@leafer-game/miniapp 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(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 g(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&g(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let n in this)"_"!==n[0]&&(i=e?e[n]:void 0,t[n]=s(i)?this[n]: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(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:n}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!s(t))){if("path"===r&&!this.__pathInputed)continue;e=n?n[r]:void 0,i[r]=s(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,this.__complexData&&this.__complexData.destroy()}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CANVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(S,t,e,i,s),toTempAB(t,e,i){v=i?a(t)?e:t:[],a(t)?(x=C(t),w=e):a(e)?(x=t,w=C(e)):(x=t,w=e),4!==x.length&&(x=T(x)),4!==w.length&&(w=T(w))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(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]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?b(t,e):(P(t,e,i),B(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(P(t,e,i),B(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,h,l]=4===t.length?t:T(t);return B(n,h*i,l*e,r*i,o*e)}},{set:B,get:T,setTemp:C,toTempAB:P}=k,{round:R,pow:E,max:L,floor:A,PI:O}=Math,D={},F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.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=s(e)?1e12:E(10,e);return-0===(t=R(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&F.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:r,scaleY:o}=t;if((s||e)&&(r<0&&(r=-r),o<0&&(o=-o)),e)if(!0===e)r=o=i?1:1/r;else{let t;a(e)?t=e:"zoom-in"===e&&(t=1),t&&(r=o=r>t||o>t?i?1:1/r:i?1:1/t)}return D.scaleX=r,D.scaleY=o,D},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(A(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const I=O/180,W=2*O,z=O/2;function N(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:U,acos:j,sqrt:V}=Math,{float:q}=F,G={};function K(){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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:K(),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:X,getWorld:K,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},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){J.toInnerPoint(t,e,G),J.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=U(e*=I),a=H(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){J.toInnerPoint(t,e,G),J.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=I,t.a=s+r*i,t.b=n+o*i),e&&(e*=I,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,G),J.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.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,n,r){const{e:o,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){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){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.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,n,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:n}=e,r=i*I,o=U(r),a=H(r);if(s||n){const e=s*I,i=n*I;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||n)&&J.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=V(n*n+r*r),c=t/d;const e=n/d;u=r>0?j(e):-j(e)}else{c=V(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?j(-e):-j(e))}const e=q(U(u)),i=H(u);d=q(d),c=q(c),_=e?q((o/c+i)/e/I,9):0,p=e?q((r/d-i)/e/I,9):0,u=q(u/I)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=V(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Q,{float:Z}=F,{toInnerPoint:$,toOuterPoint:tt}=Q,{sin:et,cos:it,abs:st,sqrt:nt,atan2:rt,min:ot,round:at}=Math,ht={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=s(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?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i,s=1,n=1){i||(i=lt.defaultPoint);const r=it(e*=I),o=et(e),a=(t.x-i.x)/s,h=(t.y-i.y)/n;t.x=i.x+(a*r-h*o)*s,t.y=i.y+(a*o+h*r)*n},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ct(t,e),ut(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},toVertical(t,e,i,s){const n=e*I;t.x+=-Math.sin(n)*i,t.y+=Math.cos(n)*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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=st(i-t),r=st(s-e);return nt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>ot(dt(t,e,i,s),dt(i,s,n,r)),getAngle:(t,e,i,s)=>_t(t,e,i,s)/I,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,n,r,o,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e,i=1,s=1)=>rt((e.y-t.y)/s,(e.x-t.x)/i),getDistancePoint(t,e,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+it(r)*i,e.y=t.y+et(r)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){t.x=t.y=0}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:_t}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e,i,s){return ht.rotate(this,t,e,i,s),this}rotateOf(t,e,i,s){return ht.rotate(this,e,t,i,s),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(ht.getDistancePoint(this,t,e,i,s))}getAngle(t,e,i){return ht.getAngle(this,t,e,i)}getAtan2(t,e,i){return ht.getAtan2(this,t,e,i)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const gt=new pt;class ft{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),this}setWith(t){return Q.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 ft(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){return Q.reset(this),this}}const yt=new ft,mt={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){xt(t,e,i),xt(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:xt}=mt;var wt,vt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(vt||(vt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const St={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,i,s,n,r){const o=kt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),St.toPoint(t,e,i,s),i)};function kt(t){return r(t)?bt[vt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,r){Bt(t,i,s,n,e,r)}},{tempPointBounds:Ct,setPoint:Pt,addPoint:Rt,toBounds:Et}=mt,{toOuterPoint:Lt}=Q,{float:At,fourNumber:Ot}=F,{floor:Dt,ceil:Ft}=Math;let Mt,It,Wt,zt;const Nt={},Yt={},Xt={},Ht={tempBounds:Xt,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(d(i)){const e=Ot(i);s?Ut.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ut.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},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ut.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=Ut.maxX(i),e.offsetY=Ut.maxY(i),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ut.copy(Xt,t),Ut.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Nt.x=t.x,Nt.y=t.y,Lt(e,Nt,Yt),Pt(Ct,Yt.x,Yt.y),Nt.x=t.x+t.width,Lt(e,Nt,Yt),Rt(Ct,Yt.x,Yt.y),Nt.y=t.y+t.height,Lt(e,Nt,Yt),Rt(Ct,Yt.x,Yt.y),Nt.x=t.x,Lt(e,Nt,Yt),Rt(Ct,Yt.x,Yt.y),Et(Ct,i)},toInnerOf(t,e,i){i||(i=t),Ut.move(i,-e.e,-e.f),Ut.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ut.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),r(s)&&(s=Ut.getFitScale(t,e,"cover"===s)),Xt.width=n?e.width*=s:e.width*s,Xt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Xt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ut.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ut.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ut.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Mt=t.x+t.width,It=t.y+t.height,Wt=e.x,zt=e.y,i||(Wt+=e.width,zt+=e.height),Mt=Mt>Wt?Mt:Wt,It=It>zt?It:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=It-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ut.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ut.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Vt(t,n)):jt(t,n));r&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Ct,t.x,t.y):Rt(Ct,t.x,t.y)),Et(Ct,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){jt(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}]},getPoint:(t,e,i=!1,s)=>St.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=ht.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=ht.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=Ut.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=Ut.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=Ut.tempToOuterOf(e,i)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Mt=s+r,It=n+o,Wt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Mt=Mt<Wt?Mt:Wt,It=It<zt?It:zt,r=Mt-s,o=It-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Ut.copy(t,Ut.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,hasSize:t=>t.width&&t.height,reset(t){Ut.set(t)}},Ut=Ht,{add:jt,copy:Vt}=Ut;class qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Ht.copy(this,t):Ht.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 qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Gt=new qt;class Kt{constructor(t,e,i,s,n,r){c(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 qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Jt={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},{floor:Zt,max:$t}=Math,te={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",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ee.maxCacheSize),isSuperLarge:(t,e,i)=>ee.isLarge(t,e,i,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ee;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=$t(Zt(e+(s||0)),1),c=$t(Zt(i+(n||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=te.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ee.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:ee}=te,{randColor:ie}=F;class se{constructor(t){this.repeatMap={},this.name=t}static get(t){return new se(t)}static set filter(t){this.filterList=ne(t)}static set exclude(t){this.excludeList=ne(t)}static drawRepaint(t,e){const i=ie();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===se.showBounds,n=t.__nowWorld,r=ie();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(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.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 ne(t){return t?r(t)&&(t=[t]):t=[],t}se.filterList=[],se.excludeList=[],se.showWarn=!0;const re=se,oe=se.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=y.create(y.RUNTIME);return he.currentId=he.idMap[i]=e?performance.now():Date.now(),he.currentName=he.nameMap[i]=t,he.nameToIdMap[t]=i,i},end(t,e){const i=he.idMap[t],s=he.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[s]=void 0,oe.log(s,n,"ms")},endOfName(t,e){const i=he.nameToIdMap[t];s(i)||he.end(i,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=se.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,i,n,r,o){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:pe}=_e,ge=se.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(ye[e]&&ge.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=fe;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ce.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(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 we(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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Be=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;be.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){c(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}};xe([ve("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),xe([ve("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),xe([ve("globalAlpha")],Be.prototype,"opacity",void 0),xe([ve()],Be.prototype,"fillStyle",void 0),xe([ve()],Be.prototype,"strokeStyle",void 0),xe([ve("lineWidth")],Be.prototype,"strokeWidth",void 0),xe([ve("lineCap")],Be.prototype,"strokeCap",void 0),xe([ve("lineJoin")],Be.prototype,"strokeJoin",void 0),xe([ve("lineDashOffset")],Be.prototype,"dashOffset",void 0),xe([ve()],Be.prototype,"miterLimit",void 0),xe([ve()],Be.prototype,"shadowBlur",void 0),xe([ve()],Be.prototype,"shadowColor",void 0),xe([ve()],Be.prototype,"shadowOffsetX",void 0),xe([ve()],Be.prototype,"shadowOffsetY",void 0),xe([ve()],Be.prototype,"filter",void 0),xe([ve()],Be.prototype,"font",void 0),xe([ve()],Be.prototype,"fontKerning",void 0),xe([ve()],Be.prototype,"fontStretch",void 0),xe([ve()],Be.prototype,"fontVariantCaps",void 0),xe([ve()],Be.prototype,"textAlign",void 0),xe([ve()],Be.prototype,"textBaseline",void 0),xe([ve()],Be.prototype,"textRendering",void 0),xe([ve()],Be.prototype,"wordSpacing",void 0),xe([ve()],Be.prototype,"letterSpacing",void 0),xe([ve()],Be.prototype,"direction",void 0),xe([Se()],Be.prototype,"setTransform",null),xe([Se()],Be.prototype,"resetTransform",null),xe([Se()],Be.prototype,"getTransform",null),xe([Se()],Be.prototype,"save",null),xe([Se()],Be.prototype,"restore",null),xe([Se()],Be.prototype,"translate",null),xe([Se()],Be.prototype,"scale",null),xe([Se()],Be.prototype,"rotate",null),xe([Se()],Be.prototype,"fill",null),xe([Se()],Be.prototype,"stroke",null),xe([Se()],Be.prototype,"clip",null),xe([Se()],Be.prototype,"fillRect",null),xe([Se()],Be.prototype,"strokeRect",null),xe([Se()],Be.prototype,"clearRect",null),xe([Se()],Be.prototype,"beginPath",null),xe([Se()],Be.prototype,"moveTo",null),xe([Se()],Be.prototype,"lineTo",null),xe([Se()],Be.prototype,"bezierCurveTo",null),xe([Se()],Be.prototype,"quadraticCurveTo",null),xe([Se()],Be.prototype,"closePath",null),xe([Se()],Be.prototype,"arc",null),xe([Se()],Be.prototype,"arcTo",null),xe([Se()],Be.prototype,"ellipse",null),xe([Se()],Be.prototype,"rect",null),xe([Se()],Be.prototype,"roundRect",null),xe([Se()],Be.prototype,"createConicGradient",null),xe([Se()],Be.prototype,"createLinearGradient",null),xe([Se()],Be.prototype,"createPattern",null),xe([Se()],Be.prototype,"createRadialGradient",null),xe([Se()],Be.prototype,"fillText",null),xe([Se()],Be.prototype,"measureText",null),xe([Se()],Be.prototype,"strokeText",null);const{copy:Te,multiplyParent:Ce,pixelScale:Pe}=Q,{round:Re}=Math,Ee=new qt,Le=new qt,Ae={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class De extends Be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ae),this.manager=e,this.innerId=y.create(y.CANVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||te.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;p.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!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&&Ce(t,e,n),Pe(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Re(n.e-.5)+.5,n.f=Re(n.f-.5)+.5):(n.e=Re(n.e),n.f=Re(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:n,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(r=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Le):i=Ee,this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){if(this.setTempPixelBounds(t,!0,!0),!Ee.width||!Ee.height)return;let e,i;const{context:s}=this,n=s.getImageData(Ee.x,Ee.y,Ee.width,Ee.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,Ee.x,Ee.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,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ee.x,Ee.y,Ee.width,Ee.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ee.x,Ee.y,Ee.width,Ee.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ee,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Le,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ce.canvas(Object.assign({},i));return n.save(),t&&(Te(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Fe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Me),We={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},ze={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},Ne=Object.assign(Object.assign({},ze),Me),Ye=Ie,Xe={};for(let t in Ye)Xe[Ye[t]]=t;const He={};for(let t in Ye)He[Ye[t]]=We[t];const Ue={drawRoundRect(t,e,i,s,n,r){const o=F.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:je,cos:Ve,hypot:qe,atan2:Ge,ceil:Ke,abs:Qe,PI:Je,sqrt:Ze,pow:$e}=Math,{setPoint:ti,addPoint:ei}=mt,{set:ii,toNumberPoints:si}=ht,{M:ni,L:ri,C:oi,Q:ai,Z:hi}=Ie,li={},di={points(t,e,i,s){let n=si(e);if(t.push(ni,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y,m,x=n.length;const w=!0===i?.5:i;s&&(n=[n[x-2],n[x-1],...n,n[0],n[1],n[2],n[3]],x=n.length);for(let i=2;i<x-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=o-e,g=a-r,f=Ze($e(p,2)+$e(g,2)),y=Ze($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(ai,d,c,o,a):(p||g)&&t.push(oi,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(ai,u,_,n[x-2],n[x-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ri,n[e],n[e+1]);s&&t.push(hi)},rect(t,e,i,s,n){Fe.creator.path=t,Fe.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){Fe.creator.path=[],Ue.drawRoundRect(Fe.creator,e,i,s,n,r),t.push(...Fe.convertToCanvasData(Fe.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,p=o-n;let g=Ge(u,c),f=Ge(p,_);const y=qe(c,u),m=qe(_,p);let x=f-g;if(x<0&&(x+=W),y<1e-12||m<1e-12||x<1e-12||Qe(x-Je)<1e-12)return t&&t.push(ri,s,n),h&&(ti(h,e,i),ei(h,s,n)),d&&ii(d,e,i),void(l&&ii(l,s,n));const w=c*p-_*u<0,v=w?-1:1,b=a/Ve(x/2),S=s+b*Ve(g+x/2+z*v),k=n+b*je(g+x/2+z*v);return g-=z*v,f-=z*v,_i(t,S,k,a,a,0,g/I,f/I,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>_i(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*I,_=je(u),p=Ve(u);let g=o*I,f=a*I;g>Je&&(g-=W),f<0&&(f+=W);let y=f-g;if(y<0?y+=W:y>W&&(y-=W),h){360===Qe(a-o)?y=-W:y-=W}const m=Ke(Qe(y/z)),x=y/m,w=je(x/4),v=8/3*w*w/je(x/2);f=g+x;let b,S,k,B,T,C,P,R,E=Ve(g),L=je(g),A=k=p*s*E-_*n*L,O=B=_*s*E+p*n*L,D=e+k,F=i+B;t&&t.push(t.length?ri:ni,D,F),l&&ti(l,D,F),c&&ii(c,D,F);for(let r=0;r<m;r++)b=Ve(f),S=je(f),k=p*s*b-_*n*S,B=_*s*b+p*n*S,T=e+A-v*(p*s*L+_*n*E),C=i+O-v*(_*s*L-p*n*E),P=e+k+v*(p*s*S+_*n*b),R=i+B+v*(_*s*S-p*n*b),t&&t.push(oi,T,C,P,R,e+k,i+B),l&&ui(e+A,i+O,T,C,P,R,e+k,i+B,l,!0),A=k,O=B,E=b,L=S,g=f,f+=x;d&&ii(d,e+k,i+B)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(oi,(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){ui(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,x=t,w=i,v=n,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=s,v=r,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ei(h,t,e):ti(h,t,e),ei(h,o,a);for(let l=0,c=d.length;l<c;l++)ci(d[l],t,e,i,s,n,r,o,a,li),ei(h,li.x,li.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 ci(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},cut(t,e,i,s,n,r,o,a,h){if(t<=0)return{left:null,right:[s,n,r,o,a,h]};if(t>=1)return{left:[s,n,r,o,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+n*t,u=s*l+r*t,_=n*l+o*t,p=r*l+a*t,g=o*l+h*t,f=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+x*t],right:[m,x,p,g,a,h]}}},{getPointAndSet:ci,toTwoPointBounds:ui,ellipse:_i}=di,{sin:pi,cos:gi,sqrt:fi,atan2:yi}=Math,{ellipse:mi}=di,xi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=r*I,p=pi(_),g=gi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,x=n*n,w=y*y,v=f*f,b=m*x-m*w-x*v;let S=0;if(b<0){const t=fi(1-b/(m*x));s*=t,n*=t}else S=(o===a?-1:1)*fi(b/(m*w+x*v));const k=S*s*y/n,B=-S*n*f/s,T=yi((y-B)/n,(f-k)/s),C=yi((-y-B)/n,(-f-k)/s);let P=C-T;0===a&&P>0?P-=W:1===a&&P<0&&(P+=W);const R=e+c+g*k-p*B,E=i+u+p*k+g*B,L=P<0?1:0;d||te.ellipseToCurve?mi(t,R,E,s,n,r,T/I,C/I,L):s!==n||r?t.push(Ie.G,R,E,s,n,r,T/I,C/I,L):t.push(Ie.O,R,E,s,T/I,C/I,L)}},wi={toCommand:t=>[],toNode:(t,e)=>[]},{M:vi,m:bi,L:Si,l:ki,H:Bi,h:Ti,V:Ci,v:Pi,C:Ri,c:Ei,S:Li,s:Ai,Q:Oi,q:Di,T:Fi,t:Mi,A:Ii,a:Wi,Z:zi,z:Ni,N:Yi,D:Xi,X:Hi,G:Ui,F:ji,O:Vi,P:qi,U:Gi}=Ie,{rect:Ki,roundRect:Qi,arcTo:Ji,arc:Zi,ellipse:$i,quadraticCurveTo:ts}=di,{ellipticalArc:es}=xi,is=se.get("PathConvert"),ss={},ns={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=He[s],a+=s===n?" ":Xe[s];for(let s=1;s<i;s++)a+=F.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?Ne:ze;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(rs.dot&&(os(o,r),r=""),rs.dot++),"0"===r&&"."!==s&&(os(o,r),r=""),r+=s):Ie[s]?(r&&(os(o,r),r=""),rs.name=Ie[s],rs.length=We[s],rs.index=0,os(o,rs.name),"m"===s?rs.name=Ie.l:"M"===s&&(rs.name=Ie.L),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&os(o,r),r=s):r&&(os(o,r),r=""),n=s;return r&&os(o,r),i?ns.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const g=[];for(;_<p;){switch(n=t[_],n){case bi:t[_+1]+=a,t[_+2]+=h;case vi:a=c=t[_+1],h=u=t[_+2],g.push(vi,a,h),_+=3;break;case Ti:t[_+1]+=a;case Bi:a=t[_+1],g.push(Si,a,h),_+=2;break;case Pi:t[_+1]+=h;case Ci:h=t[_+1],g.push(Si,a,h),_+=2;break;case ki:t[_+1]+=a,t[_+2]+=h;case Si:a=t[_+1],h=t[_+2],g.push(Si,a,h),_+=3;break;case Ai:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,n=Li;case Li:o=r===Ri||r===Li,l=o?2*a-i:a,d=o?2*h-s:h,i=t[_+1],s=t[_+2],a=t[_+3],h=t[_+4],g.push(Ri,l,d,i,s,a,h),_+=5;break;case Ei:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,t[_+5]+=a,t[_+6]+=h,n=Ri;case Ri:i=t[_+3],s=t[_+4],a=t[_+5],h=t[_+6],g.push(Ri,t[_+1],t[_+2],i,s,a,h),_+=7;break;case Mi:t[_+1]+=a,t[_+2]+=h,n=Fi;case Fi:o=r===Oi||r===Fi,i=o?2*a-i:a,s=o?2*h-s:h,e?ts(g,a,h,i,s,t[_+1],t[_+2]):g.push(Oi,i,s,t[_+1],t[_+2]),a=t[_+1],h=t[_+2],_+=3;break;case Di:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,n=Oi;case Oi:i=t[_+1],s=t[_+2],e?ts(g,a,h,i,s,t[_+3],t[_+4]):g.push(Oi,i,s,t[_+3],t[_+4]),a=t[_+3],h=t[_+4],_+=5;break;case Wi:t[_+6]+=a,t[_+7]+=h;case Ii:es(g,a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],e),a=t[_+6],h=t[_+7],_+=8;break;case Ni:case zi:g.push(zi),a=c,h=u,_++;break;case Yi:a=t[_+1],h=t[_+2],e?Ki(g,a,h,t[_+3],t[_+4]):as(g,t,_,5),_+=5;break;case Xi:a=t[_+1],h=t[_+2],e?Qi(g,a,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):as(g,t,_,9),_+=9;break;case Hi:a=t[_+1],h=t[_+2],e?Qi(g,a,h,t[_+3],t[_+4],t[_+5]):as(g,t,_,6),_+=6;break;case Ui:$i(e?g:as(g,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,ss),a=ss.x,h=ss.y,_+=9;break;case ji:e?$i(g,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):as(g,t,_,5),a=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case Vi:Zi(e?g:as(g,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,ss),a=ss.x,h=ss.y,_+=7;break;case qi:e?Zi(g,t[_+1],t[_+2],t[_+3],0,360,!1):as(g,t,_,4),a=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case Gi:Ji(e?g:as(g,t,_,6),a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,ss),a=ss.x,h=ss.y,_+=6;break;default:return is.error(`command: ${n} [index:${_}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return wi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(Si,t.x,t.y);break;case"C":e.push(Ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(zi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:os,copyData:as}=ns,{M:hs,L:ls,C:ds,Q:cs,Z:us,N:_s,D:ps,X:gs,G:fs,F:ys,O:ms,P:xs,U:ws}=Ie,{getMinDistanceFrom:vs,getRadianFrom:bs}=ht,{tan:Ss,min:ks,abs:Bs}=Math,Ts={},Cs=se.get("PointsCurve"),Ps={pointsCurveList:{},beginPath(t){t.length=0},moveTo(t,e,i){t.push(hs,e,i)},lineTo(t,e,i){t.push(ls,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ds,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(cs,e,i,s,n)},closePath(t){t.push(us)},rect(t,e,i,s,n){t.push(_s,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(gs,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(_s,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){if(s===r)return Es(t,e,i,s,a,h,l);n(o)?t.push(ys,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(fs,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(xs,e,i,s):(n(r)&&(r=0),n(o)&&(o=360),t.push(ms,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h,l){if(!s(a)){const t=vs(a,h,e,i,n,r)/(l?1:2);o=ks(o,ks(t,t*Bs(Ss(bs(a,h,e,i,n,r)/2))))}t.push(ws,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){di.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Ts),t.push(hs,Ts.x,Ts.y),Rs(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){di.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,Ts),t.push(hs,Ts.x,Ts.y),Es(t,e,i,s,r,o,a)},drawPoints(t,e,i,s,n){let r="Q";c(i)&&(r=i.type,i=i.value),Ls[r]||(Cs.warn("not found:",r),r="Q"),Ls[r](t,e,i,s,n)}},{ellipse:Rs,arc:Es,pointsCurveList:Ls}=Ps;function As(t,e){Ls[t]&&Cs.repeat(t),Ls[t]=e}As("Q",di.points);const{moveTo:Os,lineTo:Ds,quadraticCurveTo:Fs,bezierCurveTo:Ms,closePath:Is,beginPath:Ws,rect:zs,roundRect:Ns,ellipse:Ys,arc:Xs,arcTo:Hs,drawEllipse:Us,drawArc:js,drawPoints:Vs}=Ps;class qs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Fe.parse(t):t:[],this}beginPath(){return Ws(this.__path),this.paint(),this}moveTo(t,e){return Os(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ds(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ms(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Fs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Is(this.__path),this.paint(),this}rect(t,e,i,s){return zs(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 Ys(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Xs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Hs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Us(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return js(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Vs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Gs,L:Ks,C:Qs,Q:Js,Z:Zs,N:$s,D:tn,X:en,G:sn,F:nn,O:rn,P:on,U:an}=Ie,hn=se.get("PathDrawer"),ln={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Gs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ks:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Qs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.closePath(),s+=1;break;case $s:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case tn: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 en:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case sn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case nn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case rn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case on:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case an:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void hn.error(`command: ${i} [index:${s}]`,e)}},drawPathByPoints(t,e,i){}},{M:dn,L:cn,C:un,Q:_n,Z:pn,N:gn,D:fn,X:yn,G:mn,F:xn,O:wn,P:vn,U:bn}=Ie,{toTwoPointBounds:Sn,toTwoPointBoundsByQuadraticCurve:kn,arcTo:Bn,arc:Tn,ellipse:Cn}=di,{addPointBounds:Pn,copy:Rn,addPoint:En,setPoint:Ln,addBounds:An,toBounds:On}=mt,Dn=se.get("PathBounds");let Fn,Mn,In;const Wn={},zn={},Nn={},Yn={toBounds(t,e){Yn.toTwoPointBounds(t,zn),On(zn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ln(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===pn||o===un||o===_n?Ln(e,h,l):Ln(e,t[a+1],t[a+2])),o){case dn:case cn:h=t[a+1],l=t[a+2],En(e,h,l),a+=3;break;case un:n=t[a+5],r=t[a+6],Sn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Wn),Pn(e,Wn),h=n,l=r,a+=7;break;case _n:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],kn(h,l,i,s,n,r,Wn),Pn(e,Wn),h=n,l=r,a+=5;break;case pn:a+=1;break;case gn:h=t[a+1],l=t[a+2],An(e,h,l,t[a+3],t[a+4]),a+=5;break;case fn:case yn:h=t[a+1],l=t[a+2],An(e,h,l,t[a+3],t[a+4]),a+=o===fn?9:6;break;case mn:Cn(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],Wn,Nn),0===a?Rn(e,Wn):Pn(e,Wn),h=Nn.x,l=Nn.y,a+=9;break;case xn:h=t[a+1],l=t[a+2],Mn=t[a+3],In=t[a+4],An(e,h-Mn,l-In,2*Mn,2*In),h+=Mn,a+=5;break;case wn:Tn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Wn,Nn),0===a?Rn(e,Wn):Pn(e,Wn),h=Nn.x,l=Nn.y,a+=7;break;case vn:h=t[a+1],l=t[a+2],Fn=t[a+3],An(e,h-Fn,l-Fn,2*Fn,2*Fn),h+=Fn,a+=4;break;case bn:Bn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Wn,Nn),0===a?Rn(e,Wn):Pn(e,Wn),h=Nn.x,l=Nn.y,a+=6;break;default:return void Dn.error(`command: ${o} [index:${a}]`,t)}}},{M:Xn,L:Hn,Z:Un}=Ie,{getCenterX:jn,getCenterY:Vn}=ht,{arcTo:qn}=Ps,{float:Gn}=F,Kn={smooth(t,e,i){let s,n,r,o,a,h,l=0,c=0,u=0,_=0,p=0,g=0,f=0,y=0,m=0;d(e)&&(e=e[0]||0);const x=t.length,w=9===x,v=[];for(;l<x;){switch(s=t[l],s){case Xn:h=v.length,h&&n!==Un&&(v[o]=_,v[a]=p),_=y=t[l+1],p=m=t[l+2],l+=3,t[l]===Hn?(g=t[l+1],f=t[l+2],w?v.push(Xn,_,p):v.push(Xn,jn(_,g),Vn(p,f))):v.push(Xn,_,p),o=h+1,a=h+2;break;case Hn:switch(c=t[l+1],u=t[l+2],l+=3,t[l]){case Hn:qn(v,c,u,t[l+1],t[l+2],e,y,m,w);break;case Un:Gn(c)===Gn(_)&&Gn(u)===Gn(p)?(c=y,u=m):qn(v,c,u,_,p,e,y,m,w);break;default:v.push(Hn,c,u)}y=c,m=u;break;case Un:n!==Un&&(qn(v,_,p,g,f,e,y,m,w),v.push(Un)),l+=1;break;default:r=He[s];for(let e=0;e<r;e++)v.push(t[l+e]);l+=r}n=s}return s!==Un&&(v[o]=_,v[a]=p),v}};function Qn(t){return new qs(t)}const Jn=Qn();Fe.creator=Qn(),Fe.parse=ns.parse,Fe.convertToCanvasData=ns.toCanvasData;const{drawRoundRect:Zn}=Ue;function $n(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Zn(this,t,e,i,s,n)})}(t)}const tr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=er.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{}}}},er=tr;er.mineType=er.mimeType,er.alphaPixelTypes.forEach(t=>er.upperCaseTypeMap[t]=t.toUpperCase());const ir=se.get("TaskProcessor");class sr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return we(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){ir.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class nr{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&&p.assign(this.config,t),this.empty()}add(t,e,i){let n,r,o,h;const l=new sr(t);return l.parent=this,a(e)?h=e:e&&(r=e.parallel,n=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}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.run()}),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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)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 rr=se.get("Resource"),or={tasker:new nr,queue:new nr({parallel:1}),map:{},get isComplete(){return ar.tasker.isComplete},set(t,e){ar.map[t]&&rr.repeat(t),ar.map[t]=e},get:t=>ar.map[t],remove(t){const e=ar.map[t];e&&(e.destroy&&e.destroy(),delete ar.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ce.image(s)),ar.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){ar.map={}}},ar=or,hr={maxRecycled:10,recycledList:[],patternTasker:or.queue,get(t,e){let i=or.get(t.url);return i||or.set(t.url,i=ce[e||"image"](t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(te.image.isLarge(t)?t.url&&or.remove(t.url):(t.clearLevels(),lr.recycledList.push(t)))})},recyclePaint(t){lr.recycle(t.image)},clearRecycled(t){const e=lr.recycledList;(e.length>lr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&or.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>tr.alphaPixelTypes.some(e=>lr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+tr.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+tr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},lr=hr,{IMAGE:dr,create:cr}=y;class ur{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?te.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=cr(dr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}hr.isFormat("svg",t)&&(this.isSVG=!0),hr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,or.tasker.add(()=>we(this,void 0,void 0,function*(){return yield te.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),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||(this.width=t.width,this.height=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,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=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 h=te.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=te.canvas.createPattern(t,e);return te.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class _r extends ur{get tag(){return"Film"}}class pr extends ur{get tag(){return"Video"}}function gr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function fr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function yr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function mr(t,e){return(i,s)=>wr(i,s,t,e&&e(s))}function xr(t){return t}function wr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};gr(t,e,Object.assign(n,s||{})),$r(t,e,i)}function vr(t){return mr(t)}function br(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Sr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function kr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Rr(this))}}))}function Br(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Tr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Cr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&Rr(this)}}))}function Pr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(Rr(this),this.__.__removeNaturalSize())}}))}function Rr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Er(t){return mr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Rr(this)}}))}const Lr=Cr;function Ar(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i)&&(Or(this),e&&(this.__.__useStroke=!0))}}))}function Or(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Rr(t)}const Dr=Ar;function Fr(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Mr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&Ir(this)}}))}function Ir(t){t.__layout.surfaceChanged||t.__layout.surfaceChange()}function Wr(t){return mr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function zr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Yr(this)}}))}function Nr(t){return mr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Xr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Xr(this,t,e,i),this.mask&&Yr(this)}}))}function Yr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Xr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Rr(t))}function Hr(t){t.__layout.childrenSortChange(),t.__.flow&&t.__layout.boxChange()}function Ur(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParentChange(Hr)}}))}function jr(t){t.__updateMask()}function Vr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i)&&(this.__layout.boxChanged||this.__layout.boxChange(),e?this.__updateMask():this.waitParentChange(jr))}}))}function qr(t){t.__updateEraser()}function Gr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParentChange(qr)}}))}function Kr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Qr(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Jr(t){return(e,i)=>{gr(e,"__DataProcessor",{get:()=>t})}}function Zr(t){return(e,i)=>{gr(e,"__LayoutProcessor",{get:()=>t})}}function $r(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=yr(e,i);if(s(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(c(i)){const t=_(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=fr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),gr(n,e,a)}const to=new se("rewrite"),eo=[],io=["destroy","constructor"];function so(t){return(e,i)=>{eo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function no(){return t=>{ro()}}function ro(t){eo.length&&(eo.forEach(e=>{t&&to.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),eo.length=0)}function oo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(io.includes(s)||e&&e.includes(s)))if(t.prototype){const e=fr(t.prototype,s);e&&Object.defineProperty(i.prototype,s,e)}else i.prototype[s]=t[s]})}}function ao(){return t=>{_e.register(t)}}function ho(){return t=>{fe.register(t)}}setTimeout(()=>ro(!0));const{copy:lo,toInnerPoint:co,toOuterPoint:uo,scaleOfOuter:_o,rotateOfOuter:po,skewOfOuter:go,multiplyParent:fo,divideParent:yo,getLayout:mo}=Q,xo={},{round:wo}=Math,vo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Bo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)ko(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,e){const i=t.__layout;i.boundsChanged&&t.__updateLocalBounds(),e&&(i.resized=void 0),i.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)To(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&To(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&So.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(Po(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Co(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||te.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},clip(t,e,i){t.__worldOpacity&&(e.setWorld(t.__nowWorld=t.__getNowWorld(i)),t.__drawRenderPath(e),e.clipUI(t))},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},updateFlowLayout(t){},updatePositionLayout(t){},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?uo(t.localTransform,r,r,!0):t.parent&&co(t.parent.scrollWorldTransform,r,r,!0),So.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=wo(e),i=wo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r,o){So.zoomOfLocal(t,Ro(t,e),i,s,n,r,o)},zoomOfLocal(t,e,i,s=i,n,r,o){const h=t.__localMatrix;if(a(s)||(s&&(r=s),s=i),lo(xo,h),_o(xo,e,i,s),So.hasHighPosition(t))So.setTransform(t,xo,n,r,o);else{const e=t.x+xo.e-h.e,a=t.y+xo.f-h.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,o))}},rotateOfWorld(t,e,i,s){So.rotateOfLocal(t,Ro(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;lo(xo,n),po(xo,e,i),So.hasHighPosition(t)?So.setTransform(t,xo,!1,s):t.set({x:t.x+xo.e-n.e,y:t.y+xo.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){So.skewOfLocal(t,Ro(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){lo(xo,t.__localMatrix),go(xo,e,i,s),So.setTransform(t,xo,n,r)},transformWorld(t,e,i,s,n){lo(xo,t.worldTransform),fo(xo,e),t.parent&&yo(xo,t.parent.scrollWorldTransform),So.setTransform(t,xo,i,s,n)},transform(t,e,i,s,n){lo(xo,t.localTransform),fo(xo,e),So.setTransform(t,xo,i,s,n)},setTransform(t,e,i,s,n){const r=t.__,o=r.origin&&So.getInnerOrigin(t,r.origin),a=mo(e,o,r.around&&So.getInnerOrigin(t,r.around));if(So.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,o){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=So.getInnerOrigin(t,r.origin);ht.move(a,o.x-s.x,o.y-s.y)}t.set(a),t.scaleResize(e,i,!1,n)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return _o(i,So.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(So.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(lo(xo,t.worldTransform),yo(xo,e.scrollWorldTransform),i?xo:Object.assign({},xo)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(So.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||So.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e,i){if(!e)return!1;for(;t;){if(e===t)return!0;if(i&&t.__level===i)return;t=t.parent}},animateMove(t,e,i=.3,s){if(e.x||e.y){if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const n=e.x*i,r=e.y*i;e.x-=n,e.y-=r,t.move(n,r),te.requestRender(()=>So.animateMove(t,e,i,s))}s&&s()}}};function bo(t){return t&&t.config.trackChanges}const So=vo,{updateAllMatrix:ko,updateMatrix:Bo,updateAllWorldOpacity:To,updateAllChange:Co,updateChange:Po}=So;function Ro(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Eo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>Ao(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Ao(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return Ao(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Lo;function Ao(t,e){return e||(Lo=0),t.__.mask&&(Lo=1),Lo<0?null:(Lo&&(Lo=-1),!0)}const{updateBounds:Oo}=vo,Do={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,zIndex(t,e,i){const{children:s}=t,n=s[i-1],r=s[i];n&&r?(e.zIndex<n.zIndex||e.zIndex>r.zIndex)&&(e.zIndex=(n.zIndex+r.zIndex)/2):n?e.zIndex<n.zIndex&&(e.zIndex=n.zIndex+1):r&&e.zIndex>r.zIndex&&(e.zIndex=r.zIndex-1)},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),Fo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(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++)Mo(e[t],e)},updateBounds(t,e){const i=[t];Mo(t,i),Io(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++)Oo(s[t]);e&&e===i||Oo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Wo(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&zo(t,e,i,s,n,r,o)}},{pushAllChildBranch:Fo,pushAllBranchStack:Mo,updateBoundsByBranchStack:Io,move:Wo,scale:zo}=Do,No={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Yo,updateBounds:Xo}=vo,{toOuterOf:Ho,getPoints:Uo,copy:jo}=Ht,Vo="_localContentBounds",qo="_worldContentBounds",Go="_worldBoxBounds",Ko="_worldStrokeBounds";class Qo{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 Ho(this.contentBounds,this.leaf.__localMatrix,this[Vo]||(this[Vo]={})),this[Vo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ho(this.contentBounds,this.leaf.__world,this[qo]||(this[qo]={})),this[qo]}get worldBoxBounds(){return Ho(this.boxBounds,this.leaf.__world,this[Go]||(this[Go]={})),this[Go]}get worldStrokeBounds(){return Ho(this.strokeBounds,this.leaf.__world,this[Ko]||(this[Ko]={})),this[Ko]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Xo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,te.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 Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Yo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(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=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Yo(s,e,!0)}if(o||(o=Q.getLayout(r)),jo(o,a),ht.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,n=Uo(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 s(r)||n.forEach(t=>i.innerToWorld(t,null,!1,r)),n}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.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Jo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&te.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&te.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&te.event.stop(this.origin)}}class Zo extends Jo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Zo.ADD="child.add",Zo.REMOVE="child.remove",Zo.CREATED="created",Zo.MOUNTED="mounted",Zo.UNMOUNTED="unmounted",Zo.DESTROY="destroy";const $o="property.scroll";class ta extends Jo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}ta.CHANGE="property.change",ta.LEAFER_CHANGE="property.leafer_change",ta.SCROLL=$o;const ea={scrollX:$o,scrollY:$o};class ia extends Jo{constructor(t,e){super(t),Object.assign(this,e)}}ia.LOAD="image.load",ia.LOADED="image.loaded",ia.ERROR="image.error";class sa extends Jo{static checkHas(t,e,i){"on"===i?e===aa?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(na)||t.hasEvent(ra)||t.hasEvent(oa),t.__hasWorldEvent=t.hasEvent(aa))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(na,t),"inner"===e&&t.emit(ra,t)),t.emit(oa,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(aa,t)}}sa.RESIZE="bounds.resize",sa.INNER="bounds.inner",sa.LOCAL="bounds.local",sa.WORLD="bounds.world";const{RESIZE:na,INNER:ra,LOCAL:oa,WORLD:aa}=sa,ha={};[na,ra,oa,aa].forEach(t=>ha[t]=1);class la extends Jo{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){c(t)?(super(la.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}la.RESIZE="resize";class da extends Jo{constructor(t,e){super(t),this.data=e}}da.REQUEST="watch.request",da.DATA="watch.data";class ca extends Jo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ca.REQUEST="layout.request",ca.START="layout.start",ca.BEFORE="layout.before",ca.LAYOUT="layout",ca.AFTER="layout.after",ca.AGAIN="layout.again",ca.END="layout.end";class ua extends Jo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ua.REQUEST="render.request",ua.CHILD_START="render.child_start",ua.CHILD_END="render.child_end",ua.START="render.start",ua.BEFORE="render.before",ua.RENDER="render",ua.AFTER="render.after",ua.AGAIN="render.again",ua.END="render.end",ua.NEXT="render.next";class _a extends Jo{}_a.START="leafer.start",_a.BEFORE_READY="leafer.before_ready",_a.READY="leafer.ready",_a.AFTER_READY="leafer.after_ready",_a.VIEW_READY="leafer.view_ready",_a.VIEW_COMPLETED="leafer.view_completed",_a.STOP="leafer.stop",_a.RESTART="leafer.restart",_a.END="leafer.end",_a.UPDATE_MODE="leafer.update_mode",_a.TRANSFORM="leafer.transform",_a.MOVE="leafer.move",_a.SCALE="leafer.scale",_a.ROTATE="leafer.rotate",_a.SKEW="leafer.skew";const{MOVE:pa,SCALE:ga,ROTATE:fa,SKEW:ya}=_a,ma={x:pa,y:pa,scaleX:ga,scaleY:ga,rotation:fa,skewX:ya,skewY:ya},xa={};class wa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=va(this,s,!0),h=r(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):a[t]=[l],ha[t]&&sa.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=r(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=va(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],ha[t]&&sa.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&fe.has(t)&&(e=fe.get(t,{type:t,target:this,current:this}));const s=va(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:n}=this,r=i&&i[t],o=n&&n[t];return!!(s(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function va(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:xa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:xa)}}const{on:ba,on_:Sa,off:ka,off_:Ba,once:Ta,emit:Ca,emitEvent:Pa,hasEvent:Ra,destroy:Ea}=wa.prototype,La={on:ba,on_:Sa,off:ka,off_:Ba,once:Ta,emit:Ca,emitEvent:Pa,hasEvent:Ra,destroyEventer:Ea},Aa=se.get("setAttr"),Oa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(Aa.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new ta(ta.LEAFER_CHANGE,this,t,n,e));const i=ma[t];i&&(this.emitEvent(new _a(i,this)),this.emitEvent(new _a(_a.TRANSFORM,this)))}this.emitPropertyEvent(ta.CHANGE,t,n,e);const i=ea[t];return i&&this.emitPropertyEvent(i,t,n,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const{leafer:n}=this;if(bo(n)||n.zoomLayer===this){const r=new ta(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),n.emitEvent(r)}else n.watcher.add(this)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Da,multiplyParent:Fa,translateInner:Ma,defaultWorld:Ia}=Q,{toPoint:Wa,tempPoint:za}=St,Na={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Fa(this.__local||e,t?t.__scrollWorld||t.__world:Ia,i,!!e.affectScaleOrRotation,n),s&&Ma(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&vo.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Da(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Wa(i.around||i.origin,t.boxBounds,za),Ma(e,-za.x,-za.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ya,updateAllMatrix:Xa}=vo,{updateBounds:Ha}=Do,{toOuterOf:Ua,copyAndSpread:ja,copy:Va}=Ht,{toBounds:qa}=Yn,Ga={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ua(t.renderBounds,e,e),this.__hasComplex&&vo.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&sa.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&sa.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&!t.strokeChanged&&(t.strokeChanged=!!t.boxChanged||2),t.renderSpread&&!t.renderChanged&&(t.renderChanged=!!t.boxChanged||2),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(2===t.strokeChanged?this.__updateLocalStrokeBounds():(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.resized="inner",(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0)),t.strokeChanged=void 0,this.parent&&this.parent.__layout.strokeChange()),t.renderChanged&&(2===t.renderChanged?this.__updateLocalRenderBounds():(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel()),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.outerScale&&vo.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasPosition&&vo.updatePositionLayout(this),this.__hasAutoLayout&&this.__updateAutoLayout(),Ua(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ua(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ua(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?qa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?vo.updateFlowLayout(this):(Xa(this),Ha(this,this))):Ya(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ja(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Va(e.renderBounds,e.strokeBounds):ja(e.renderBounds,e.boxBounds,i)}},Ka={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1: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),vo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);se.showBounds&&se.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){vo.clip(this,t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Qa}=Eo,{hasSize:Ja}=Ht,Za={__updateChange(){this.__layout.childrenSortChanged&&this.__updateSortChildren(),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ja(i)){const s=this.__;if(s.__useDim){if(s.bright&&!e.topRendering)return e.topList.add(this);s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],Qa(i,e)||(i.__hasComplex?vo.renderComplex(i,t,e):i.__render(t,e));0===this.__hasMask&&this.__rerenderMask(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Qa(i[s],e)||i[s].__clip(t,e)}}},{LEAF:$a,create:th}=y,{stintSet:eh}=p,{toInnerPoint:ih,toOuterPoint:sh,multiplyParent:nh}=Q,{toOuterOf:rh}=Ht,{copy:oh,move:ah}=ht,{getScaleFixedData:hh}=F,{moveLocal:lh,zoomOfLocal:dh,rotateOfLocal:ch,skewOfLocal:uh,moveWorld:_h,zoomOfWorld:ph,rotateOfWorld:gh,skewOfWorld:fh,transform:yh,transformWorld:mh,setTransform:xh,getFlipTransform:wh,getLocalOrigin:vh,getRelativeWorld:bh,drop:Sh}=vo;let kh=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 f}get __LayoutProcessor(){return Qo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isFrame(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=th($a),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Zo.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()}waitParentChange(t){this.__parentChange||(this.__parentChange=[]),this.__parentChange.includes(t)||this.__parentChange.push(t),this.parent&&t(this.parent,this)}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Zo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Zo.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(Zo.MOUNTED),t.cacheId&&vo.cacheId(this)):this.__emitLifeEvent(Zo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}__bindFrame(t){if(this.frame=t,this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindFrame(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))}scaleResize(t,e=t,i,s){this.scaleX*=t,this.scaleY*=e}updateLayout(){this.__layout.update()}forceUpdate(t){let e;if(this.__hasComplex&&vo.updateComplex(this),t&&"bounds"!==t?"surface"===t?(Ir(this),e=!0):"stroke"===t&&(Or(this),e=!0):(Rr(this),e=!0),e){const{leafer:t}=this;return t&&t.watcher&&t.watcher.__onAttrChange({target:this})}const i=this.__.__getInput(t);this.__[t]=s(i)?null:void 0,this[t]=i}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateEraser(){this.__hasEraser=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(){const t=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity);this.__hasMask=this.__.maskskip?t&&0:t}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return nh(i,t.matrix,e,void 0,i),rh(this.__layout.renderBounds,e,e),eh(e,"half",i.half),eh(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,i=!0){return hh(hr.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}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?bh(this,e):this.worldTransform,n=i?t:{};return rh(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&oh(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&oh(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),ih(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){sh(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const n=this.getInnerPoint(t,e,i,s);return i?n:this.getBoxPointByInner(n,null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return ah(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 ah(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,s){xh(this,t,e,i,s)}transform(t,e,i,s){yh(this,t,e,i,s)}move(t,e,i){lh(this,t,e,i)}moveInner(t,e,i){_h(this,t,e,!0,i)}scaleOf(t,e,i,s,n,r){dh(this,vh(this,t),e,i,s,n,r)}rotateOf(t,e,i){ch(this,vh(this,t),e,i)}skewOf(t,e,i,s,n){uh(this,vh(this,t),e,i,s,n)}transformWorld(t,e,i,s){mh(this,t,e,i,s)}moveWorld(t,e,i){_h(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n,r){ph(this,t,e,i,s,n,r)}rotateOfWorld(t,e){gh(this,t,e)}skewOfWorld(t,e,i,s,n){fh(this,t,e,i,s,n)}flip(t,e){yh(this,wh(this,t),!1,e)}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){Sh(this,t,e,i)}static changeAttr(t,e,i){i?this.addAttr(t,e,i):$r(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Cr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Zo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Zo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};kh=xe([oo(Oa),oo(Na),oo(Ga),oo(La),oo(Ka)],kh);const{setListWithFn:Bh}=Ht,{sort:Th}=Do,{localBoxBounds:Ch,localStrokeBounds:Ph,localRenderBounds:Rh,maskLocalBoxBounds:Eh,maskLocalStrokeBounds:Lh,maskLocalRenderBounds:Ah}=Eo,Oh=new se("Branch");let Dh=class extends kh{__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(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){Bh(e||this.__layout.boxBounds,this.children,this.__hasMask?Eh:Ch)}__updateStrokeBounds(t){Bh(t||this.__layout.strokeBounds,this.children,this.__hasMask?Lh:Ph)}__updateRenderBounds(t){Bh(t||this.__layout.renderBounds,this.children,this.__hasMask?Ah:Rh)}__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(Th),this.__layout.affectChildrenSort=t}this.__layout.childrenSortChanged=!1}add(t,e){if(t===this||t.destroyed)return Oh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):(Do.zIndex(this,t,e),this.children.splice(e,0,t)),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__parentChange&&t.__parentChange.forEach(e=>e(this,t)),t.__bubbleMap&&t.__emitLifeEvent(Zo.ADD),this.frame&&t.__bindFrame(this.frame),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Zo.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)):s(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(Zo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Zo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear())),t.frame&&!t.isFrame&&t.__bindFrame(null)}__emitChildEvent(t,e){const{leafer:i}=this;if(bo(i)||i.zoomLayer===this){const s=new Zo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),i.emitEvent(s)}else i.watcher.addChild(e,this,t)}};Dh=xe([oo(Za)],Dh);class Fh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(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 n=0,r=e.length;n<r;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(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 Fh;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 Mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Ih="2.3.2";if("undefined"!=typeof globalThis){const t=globalThis.Leafer||(globalThis.Leafer={});t.version=Ih,t.Plugin=de}class Wh extends De{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(r(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=te.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&te.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,n={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(n),this.context&&(this.viewSelect&&(te.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,a(n)?[n]:n)}),$n(this.context.__proto__))}__createView(){this.view=te.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&te.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,this.updateViewSize(),t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),te.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,te.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};p.copyAttrs(e,this,Oe),this.resize(t),s(this.width)||this.resizeListener(new la(t,e))}}function zh(t,e){te.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(tr.mimeType(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(tr.mimeType(tr.fileType(e)),i);return s=s.substring(s.indexOf("64,")+3),te.origin.download(s,e)},download:(t,i)=>new Promise((s,n)=>{let r;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,r=!0);const o=e.getFileSystemManager();o.writeFile({filePath:i,data:t,encoding:"base64",success(){r?te.miniapp.saveToAlbum(i).then(()=>{o.unlink({filePath:i}),s()}):s()},fail(t){n(t)}})}),loadImage:(t,e,i)=>new Promise((e,i)=>{const s=te.getCanvas().view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=te.image.getRealURL(t)}),loadContent:(t,i="text")=>new Promise((s,n)=>e.request({url:t,responseType:"arrayBuffer"===i?"arraybuffer":"text",success:t=>s("json"===i&&"string"==typeof t.data?JSON.parse(t.data):t.data),fail:n})),noRepeat:"repeat-x"},te.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},te.event={stopDefault(t){},stopNow(t){},stop(t){}},te.canvas=ce.canvas(),te.conicGradientSupport=!!te.canvas.context.createConicGradient,gr(te,"devicePixelRatio",{get:()=>Math.max(1,e.getWindowInfo?e.getWindowInfo().pixelRatio:e.getSystemInfoSync().pixelRatio)})}Object.assign(ce,{canvas:(t,e)=>new Wh(t,e),image:t=>new ur(t)}),te.name="miniapp",te.getCanvas=function(){const{renderCanvas:t}=te;return t&&t.view?t:te.canvas},te.requestRender=function(t){const{view:e}=te.getCanvas();e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)};class Nh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Fh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.changed=0,this.config={},this.__updatedList=new Fh,this.target=t,e&&(this.config=p.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<100&&(this.changed++,this.running&&this.target.emit(ua.REQUEST))}__onAttrChange(t){this.add(t.target)}add(t){this.config.usePartLayout&&this.__updatedList.add(t),this.update()}addChild(t,e,i){this.config.usePartLayout&&(i===Zo.ADD?(this.hasAdd=!0,this.__pushChild(t)):(this.hasRemove=!0,this.__updatedList.add(e))),this.update()}__onChildEvent(t){this.addChild(t.child,t.parent,t.type)}__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 da(da.DATA,{updatedList:this.updatedList})),this.__updatedList=new Fh,this.totalTimes++,this.hasVisible=this.hasRemove=this.hasAdd=!1,this.changed=0}__listenEvents(){this.__eventIds=[this.target.on_([[ta.CHANGE,this.__onAttrChange,this],[[Zo.ADD,Zo.REMOVE],this.__onChildEvent,this],[da.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Yh,updateBounds:Xh,updateChange:Hh}=vo,{pushAllChildBranch:Uh,pushAllParent:jh}=Do,Vh={updateMatrix(t,e){let i,s,n=0;const{list:r}=t;for(;n<r.length;)i=r[n],s=i.__layout,e.without(i)&&!s.proxyZoom&&(s.matrixChanged?(Yh(i,!0),i.isBranch&&Uh(i,e),qh(i,e)):s.boundsChanged&&(i.isBranch&&(i.__tempNumber=0),qh(i,e))),n++},updateBounds(t){let e,i,s,n,r=0;const{levels:o,levelMap:a}=t;for(t.sort(!0);r<o.length;){e=o[r],i=a[e];for(let t=0,e=i.length;t<e;t++){if(s=i[t],s.isBranch&&s.__tempNumber){n=s.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||Xh(n[t])}Xh(s)}r++}},updateChange(t){t.list.forEach(Hh)},push:qh};function qh(t,e){e.add(t),jh(t,e)}const{worldBounds:Gh}=Eo;class Kh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new Fh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Gh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Gh),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:Qh,updateAllChange:Jh}=vo,Zh=se.get("Layouter");class $h{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Mh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(ca.START),this.layoutOnce(),t.emitEvent(new ca(ca.END,this.layoutedBlocks,this.times))}catch(t){Zh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Zh.warn("layouting"):this.times>3?Zh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(da.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=ae.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=ca,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ca(n,a,this.times)),this.extraBlock=null,s.sort(),Vh.updateMatrix(s,this.__levelList),Vh.updateBounds(this.__levelList),Vh.updateChange(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ca(r,a,this.times)),i.emitEvent(new ca(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ca,r=this.getBlocks(new Fh(e));e.emitEvent(new ca(i,r,this.times)),$h.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new ca(s,r,this.times)),e.emitEvent(new ca(n,r,this.times)),this.addBlocks(r),ae.end(t)}static fullLayout(t){Qh(t,!0),t.isBranch?Do.updateBounds(t):vo.updateBounds(t),Jh(t)}addExtra(t,e){if(!this.__updatedList.has(t)){const{updatedList:i,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Kh([]));if(i.length?s.add(t.__world):s.set(t.__world),i.add(t),e){const e=this.__levelList;Vh.push(t,e),e.sort(!0)}}}createBlock(t){return new Kh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[ca.REQUEST,this.layout,this],[ca.AGAIN,this.layoutAgain,this],[da.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const tl=se.get("Renderer");class el{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,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ca.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ua.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ua.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ua.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,tl.log(e.innerName,"---\x3e");try{this.emitRender(ua.START),this.renderOnce(t),this.emitRender(ua.END,this.totalBounds),hr.clearRecycled()}catch(t){this.rendering=!1,tl.error(t)}tl.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return tl.warn("rendering");if(this.times>3)return tl.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(ua.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ua.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ua.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ua.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=ae.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(el.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),se.showRepaint&&se.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),te.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return te.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};te.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(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 qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||tl.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new ua(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ua.REQUEST,this.update,this],[ca.END,this.__onLayoutEnd,this],[ua.AGAIN,this.renderAgain,this],[la.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}el.clipSpread=10;const il={},{copyRadiusPoint:sl}=ht,{hitRadiusPoint:nl}=Ht;class rl{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 Fh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new Fh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||vo.worldHittable(e))&&(this.hitChild(e,e.hitThrough?this.point:o,e.mask&&e.parent&&e.parent.__onlyHitMask),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&vo.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,void 0,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>vo.worldHittable(t))}getPath(t){const e=new Fh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Fh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new Fh,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,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=nl(i.__world,n.hitRadius?sl(il,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r,e)}}else s&&this.hitChild(i,r,e)}hitChild(t,e,i,s){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e,!(!i||"path"!==t.mask)||void 0)){const{parent:i,mask:n}=t;if(i&&i.__hasMask&&n&&"clipping"!==n&&"clipping-path"!==n&&!i.children.some(t=>!t.mask&&this.isHitLeaf(t,e)))return;const r=s||t,{hitThrough:o}=t,{findList:a}=this;if(o){const e=a.list.findIndex(e=>"parent"===o?vo.hasParent(e.parent,t.parent):e[o]===t[o]);if(e>0)return a.addAt(r,e)}a.add(r)}}isHitLeaf(t,e){if(t.isBranch){const{findList:e}=this,i=e.length;this.eachFind([t],!1);const s=e.length-i;for(let t=0;t<s;t++)e.remove(e.indexAt(e.length-1));return!!s}return t.__hitWorld(e)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class ol{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new rl(this.target=t,this),this.finder=ce.finder&&ce.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return te.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):de.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function al(t){return mr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function hl(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function ll(){return(t,e)=>{const i="_"+e;gr(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function dl(){return(t,e)=>{gr(t,e,{set(t){},get(){return this}})}}function cl(t){return(e,i)=>{gr(e,i,yr(i,t))}}Object.assign(ce,{watcher:(t,e)=>new Nh(t,e),layouter:(t,e)=>new $h(t,e),renderer:(t,e,i)=>new el(t,e,i),selector:(t,e)=>new ol(t,e)}),te.layout=$h.fullLayout,te.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Fh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>{const{parent:i}=t;i&&i.isBranchLeaf&&"show"!==i.overflow?(e.save(),vo.clip(i,e,s),t.__render(e,s),e.restore()):t.__render(e,s)})};const ul={},_l={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},pl=Qt,gl={},fl={},yl={},ml={},xl={},wl={apply(){de.need("filter")}},vl={},bl={setStyleName:()=>de.need("state"),set:()=>de.need("state")},Sl={list:{},register(t,e){Sl.list[t]=e},get:t=>Sl.list[t]},{parse:kl,objectToCanvasData:Bl}=ns,{stintSet:Tl}=p,{hasTransparent:Cl}=_l,Pl={originPaint:{}},Rl=se.get("UIData");class El extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,Rl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Rl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(Tl(this,"__isTransparentFill",Cl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(Tl(this,"__isTransparentStroke",Cl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?kl(t,this.__useArrow):Bl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ll(this,"shadow",t)}setInnerShadow(t){Ll(this,"innerShadow",t)}setFilter(t){Ll(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&fl.compute("fill",this.__leaf),e&&fl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;Tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Pl)):(this.__isStrokes=!0,this._stroke||(this._stroke=Pl))}__removePaint(t,e){e&&this.__removeInput(t),yl.recycleImage(t,this),"fill"===t?(Tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Tl(this,"__isAlphaPixelStroke",void 0),Tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ll(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Al extends El{}class Ol extends Al{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Dl extends Al{__getInputData(t,e){const i=super.__getInputData(t,e);return Oe.forEach(t=>delete i[t]),i}}class Fl extends Ol{}class Ml extends El{get __usePathBox(){return this.points||this.__pathInputed}}class Il extends El{get __boxStroke(){return!this.__pathInputed}}class Wl extends El{get __boxStroke(){return!this.__pathInputed}}class zl extends El{get __usePathBox(){return this.points||this.__pathInputed}}class Nl extends El{}class Yl extends El{get __pathInputed(){return 2}}class Xl extends Al{}const Hl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ul extends El{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=Hl[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=_e.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class jl extends Il{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Vl extends Il{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{max:ql,add:Gl}=k,Kl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=ql(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=xl.getShadowRenderSpread(this,e)),s&&(t=ql(t,s)),r&&(t=Gl(t,wl.getSpread(r))),o&&(t=Gl(t,o)),a&&(t=Gl(t,a));let l=t;return i&&(l=ql(l,xl.getInnerShadowSpread(this,i))),n&&(l=ql(l,n)),this.__layout.renderShapeSpread=l,h?ql(h.__updateRenderSpread(),t):t}},{stintSet:Ql}=p,Jl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ql(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ql(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ql(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!xl.isTransformShadow(e[0])&&!(e[0].blendMode&&"pass-through"!==e[0].blendMode)&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Zl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=fl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&xl.shadow(this,t,h),a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),n&&(s.__isFills?fl.fills(n,this,t,e):fl.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&xl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),c&&wl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,_l.string(e.color))}n&&(s.__isFills?fl.fills(n,this,t,e):fl.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e))}}else s.__pathForRender?Zl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?fl.fills(s,this,t,e):fl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?fl.strokes(n,this,t,e):fl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Zl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&fl.stroke(n,t,e,i),s&&fl.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&fl.stroke(n,t,e,i)}const $l={__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 td;let ed=td=class extends kh{get app(){return this.leafer&&this.leafer.app}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){F.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Jn.set(this.path=t||[]),t||this.__drawPathByBox(Jn),Jn}set(t,e){t&&Object.assign(this,t)}get(t){return r(t)?this.__.__getInput(t):this.__.__getInputData(t)}find(t,e){return de.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return de.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Jn.set(i=[]),this.__drawPathByBox(Jn,"box",!e)),t?ns.toCanvasData(i,!0):i}getPathString(t,e,i){return ns.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||vl.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?Kn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&gl.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&gl.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){const e=this.__;t.beginPath(),e.__usePointsMode?ln.drawPathByPoints(t,e.points,e.closed):this.__drawPathByData(t,e.path,!0)}__drawPathByData(t,e,i){e?ln.drawPathByData(t,e):this.__drawPathByBox(t,"box",i)}__drawPathByBox(t,e="box",i){const{x:s,y:n,width:r,height:o}=this.__layout[e+"Bounds"];if(this.__.cornerRadius&&!i){const{cornerRadius:e}=this.__;t.roundRect(s,n,r,o,a(e)?[e]:e)}else t.rect(s,n,r,o);t.closePath()}drawImagePlaceholder(t,e,i){fl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),de.need("animate")}killAnimate(t,e){}export(t,e){return de.need("export")}syncExport(t,e){return de.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),td.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){ao()(this)}static registerData(t){Jr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xe([Jr(El)],ed.prototype,"__",void 0),xe([ll()],ed.prototype,"zoomLayer",void 0),xe([vr("")],ed.prototype,"id",void 0),xe([vr("")],ed.prototype,"name",void 0),xe([vr("")],ed.prototype,"className",void 0),xe([Mr("pass-through")],ed.prototype,"blendMode",void 0),xe([zr(1)],ed.prototype,"opacity",void 0),xe([Nr(!0)],ed.prototype,"visible",void 0),xe([Mr(!1)],ed.prototype,"locked",void 0),xe([Wr(!1)],ed.prototype,"dim",void 0),xe([Wr(!1)],ed.prototype,"dimskip",void 0),xe([Ur(0)],ed.prototype,"zIndex",void 0),xe([Vr(!1)],ed.prototype,"mask",void 0),xe([Gr(!1)],ed.prototype,"eraser",void 0),xe([br(0,!0)],ed.prototype,"x",void 0),xe([br(0,!0)],ed.prototype,"y",void 0),xe([Cr(100,!0)],ed.prototype,"width",void 0),xe([Cr(100,!0)],ed.prototype,"height",void 0),xe([Br(1,!0)],ed.prototype,"scaleX",void 0),xe([Br(1,!0)],ed.prototype,"scaleY",void 0),xe([Tr(0,!0)],ed.prototype,"rotation",void 0),xe([Tr(0,!0)],ed.prototype,"skewX",void 0),xe([Tr(0,!0)],ed.prototype,"skewY",void 0),xe([br(0,!0)],ed.prototype,"offsetX",void 0),xe([br(0,!0)],ed.prototype,"offsetY",void 0),xe([Sr(0,!0)],ed.prototype,"scrollX",void 0),xe([Sr(0,!0)],ed.prototype,"scrollY",void 0),xe([kr()],ed.prototype,"origin",void 0),xe([kr()],ed.prototype,"around",void 0),xe([vr(!1)],ed.prototype,"lazy",void 0),xe([Pr(1)],ed.prototype,"pixelRatio",void 0),xe([Fr(0)],ed.prototype,"renderSpread",void 0),xe([Er()],ed.prototype,"path",void 0),xe([Lr()],ed.prototype,"windingRule",void 0),xe([Lr(!0)],ed.prototype,"closed",void 0),xe([Cr(0)],ed.prototype,"padding",void 0),xe([Cr(!1)],ed.prototype,"lockRatio",void 0),xe([Cr()],ed.prototype,"widthRange",void 0),xe([Cr()],ed.prototype,"heightRange",void 0),xe([vr(!1)],ed.prototype,"draggable",void 0),xe([vr()],ed.prototype,"dragBounds",void 0),xe([vr("auto")],ed.prototype,"dragBoundsType",void 0),xe([vr(!1)],ed.prototype,"editable",void 0),xe([Kr(!0)],ed.prototype,"hittable",void 0),xe([Kr()],ed.prototype,"hitThrough",void 0),xe([Kr("path")],ed.prototype,"hitFill",void 0),xe([Dr("path")],ed.prototype,"hitStroke",void 0),xe([Kr(!1)],ed.prototype,"hitBox",void 0),xe([Kr(!0)],ed.prototype,"hitChildren",void 0),xe([Kr(!0)],ed.prototype,"hitSelf",void 0),xe([Kr()],ed.prototype,"hitRadius",void 0),xe([Qr("")],ed.prototype,"cursor",void 0),xe([Mr()],ed.prototype,"fill",void 0),xe([Dr(void 0,!0)],ed.prototype,"stroke",void 0),xe([Dr("inside")],ed.prototype,"strokeAlign",void 0),xe([Dr(1,!0)],ed.prototype,"strokeWidth",void 0),xe([Dr(!1)],ed.prototype,"strokeScaleFixed",void 0),xe([Dr("none")],ed.prototype,"strokeCap",void 0),xe([Dr("miter")],ed.prototype,"strokeJoin",void 0),xe([Dr()],ed.prototype,"dashPattern",void 0),xe([Dr(0)],ed.prototype,"dashOffset",void 0),xe([Dr(10)],ed.prototype,"miterLimit",void 0),xe([Lr(0)],ed.prototype,"cornerRadius",void 0),xe([Lr()],ed.prototype,"cornerSmoothing",void 0),xe([al()],ed.prototype,"shadow",void 0),xe([al()],ed.prototype,"innerShadow",void 0),xe([al()],ed.prototype,"blur",void 0),xe([al()],ed.prototype,"backgroundBlur",void 0),xe([al()],ed.prototype,"grayscale",void 0),xe([al()],ed.prototype,"filter",void 0),xe([Mr()],ed.prototype,"placeholderColor",void 0),xe([vr(100)],ed.prototype,"placeholderDelay",void 0),xe([vr({})],ed.prototype,"data",void 0),ed=td=xe([oo(Kl),oo(Jl),no()],ed);let id=class extends ed{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children: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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}};var sd;xe([Jr(Al)],id.prototype,"__",void 0),xe([Cr(0)],id.prototype,"width",void 0),xe([Cr(0)],id.prototype,"height",void 0),id=xe([oo(Dh),ao()],id);const nd=se.get("Leafer");let rd=sd=class extends id{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&or.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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,trackChanges:!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),sd.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const n=this.canvas=ce.canvas(s);this.__controllers.push(this.renderer=ce.renderer(this,n,s),this.watcher=ce.watcher(this,s),this.layouter=ce.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ce.selector(this),this.interaction=ce.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ce.hitCanvasManager()),this.canvasManager=new me,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),No.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(_a.RESTART):this.emitLeafer(_a.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(_a.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Oe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(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=p.copyAttrs({},this.canvas,Oe);e.resize(t),this.updateLazyBounds(),this.__onResize(new la(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Oe),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Oe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(_a.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Oe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=p.copyAttrs({},s,Oe);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(_a.BEFORE_READY),this.emitLeafer(_a.READY),this.emitLeafer(_a.AFTER_READY),No.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(_a.VIEW_READY),No.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){No.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(_a.VIEW_COMPLETED),No.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return de.need("view")}getValidMove(t,e,i){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 _a(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[_a.START,()=>ae.end(t)],[ca.START,this.updateLazyBounds,this],[ua.START,this.__onCreated,this],[ua.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[da.DATA,this.__onWatchData,this],[ca.END,this.__onLayoutEnd,this],[ua.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){sd.list.remove(this);try{this.stop(),this.emitLeafer(_a.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{hr.clearRecycled()},100)}catch(t){nd.error(t)}}};t?e():setTimeout(e)}};rd.list=new Fh,xe([Jr(Dl)],rd.prototype,"__",void 0),xe([Cr()],rd.prototype,"pixelRatio",void 0),xe([vr("normal")],rd.prototype,"mode",void 0),rd=sd=xe([ao()],rd);let od=class extends ed{get __tag(){return"Rect"}};xe([Jr(Il)],od.prototype,"__",void 0),od=xe([oo($l),no(),ao()],od);const{add:ad,includes:hd,scroll:ld}=Ht,dd=od.prototype,cd=id.prototype;let ud=class extends id{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(ad(a,r),ld(a,i)),this.__updateRectRenderBounds(),t=!hd(r,a),t&&"show"===o&&ad(n,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xe([Jr(Ol)],ud.prototype,"__",void 0),xe([Cr(100)],ud.prototype,"width",void 0),xe([Cr(100)],ud.prototype,"height",void 0),xe([vr(!1)],ud.prototype,"resizeChildren",void 0),xe([Fr("show")],ud.prototype,"overflow",void 0),xe([so(dd.__updateStrokeSpread)],ud.prototype,"__updateStrokeSpread",null),xe([so(dd.__updateRenderSpread)],ud.prototype,"__updateRectRenderSpread",null),xe([so(dd.__updateBoxBounds)],ud.prototype,"__updateRectBoxBounds",null),xe([so(dd.__updateStrokeBounds)],ud.prototype,"__updateStrokeBounds",null),xe([so(dd.__updateRenderBounds)],ud.prototype,"__updateRectRenderBounds",null),xe([so(dd.__updateChange)],ud.prototype,"__updateRectChange",null),xe([so(dd.__render)],ud.prototype,"__renderRect",null),xe([so(cd.__render)],ud.prototype,"__renderGroup",null),ud=xe([no(),ao()],ud);let _d=class extends ud{get __tag(){return"Frame"}get isFrame(){return!0}};xe([dl()],_d.prototype,"frame",void 0),xe([Jr(Fl)],_d.prototype,"__",void 0),xe([Mr("#FFFFFF")],_d.prototype,"fill",void 0),xe([Fr("hide")],_d.prototype,"overflow",void 0),_d=xe([ao()],_d);const{moveTo:pd,closePath:gd,ellipse:fd}=Ps,{tempPoint:yd,set:md,rotate:xd}=ht,{abs:wd}=Math,vd={};let bd=class extends ed{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r,closed:o}=t,a=e/2,h=i/2,l=t.path=[];let d,c,u;if((n||r)&&(c=!0),c&&(u=360===wd(r-n)),s){const t=s<1||o,e=a*s,i=h*s;c?(fd(l,a,h,a,h,0,n,r),t?(u&&(gd(l),md(yd,a+e,h),md(vd,a,h),xd(yd,r,vd,a,h),pd(l,yd.x,yd.y)),fd(l,a,h,e,i,0,r,n,!0)):u||(d=!0)):(fd(l,a,h,a,h),t&&(gd(l),pd(l,a+e,h),fd(l,a,h,e,i,0,360,0,!0)))}else c?(u||(o||(d=!0),d||pd(l,a,h)),fd(l,a,h,a,h,0,n,r)):fd(l,a,h,a,h);d||gd(l),(te.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};xe([Jr(Wl)],bd.prototype,"__",void 0),xe([Lr(0)],bd.prototype,"innerRadius",void 0),xe([Lr(0)],bd.prototype,"startAngle",void 0),xe([Lr(0)],bd.prototype,"endAngle",void 0),bd=xe([ao()],bd);const{sin:Sd,cos:kd,PI:Bd}=Math,{moveTo:Td,lineTo:Cd,closePath:Pd,drawPoints:Rd}=Ps;let Ed=class extends ed{get __tag(){return"Polygon"}get isPointsMode(){return this.points&&!this.pathInputed}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Rd(e,t.points,t.curve,t.closed,t);else{const{width:i,height:s,sides:n,startAngle:r}=t,o=i/2,a=s/2;let h,l=0;r?(l=r*I,Td(e,o+o*Sd(l),a-a*kd(l))):Td(e,o,0);for(let t=1;t<n;t++)h=2*t*Bd/n+l,Cd(e,o+o*Sd(h),a-a*kd(h));Pd(e)}}};xe([Jr(zl)],Ed.prototype,"__",void 0),xe([Lr(3)],Ed.prototype,"sides",void 0),xe([Lr(0)],Ed.prototype,"startAngle",void 0),xe([Lr()],Ed.prototype,"points",void 0),xe([Lr(0)],Ed.prototype,"curve",void 0),Ed=xe([no(),ao()],Ed);const{sin:Ld,cos:Ad,PI:Od}=Math,{moveTo:Dd,lineTo:Fd,closePath:Md}=Ps;let Id=class extends ed{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h,l=0;n?(l=n*I,Dd(a,r+r*Ld(l),o-o*Ad(l))):Dd(a,r,0);for(let t=1;t<2*i;t++)h=t*Od/i+l,Fd(a,r+(t%2==0?r:r*s)*Ld(h),o-(t%2==0?o:o*s)*Ad(h));Md(a)}};xe([Jr(Nl)],Id.prototype,"__",void 0),xe([Lr(5)],Id.prototype,"corners",void 0),xe([Lr(.382)],Id.prototype,"innerRadius",void 0),xe([Lr(0)],Id.prototype,"startAngle",void 0),Id=xe([ao()],Id);const{moveTo:Wd,lineTo:zd,drawPoints:Nd}=Ps,{rotate:Yd,getAngle:Xd,getDistance:Hd,defaultPoint:Ud}=ht;let jd=class extends ed{get __tag(){return"Line"}get isPointsMode(){return this.points&&!this.pathInputed}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Yd(i,e),i}set toPoint(t){this.width=Hd(Ud,t),this.rotation=Xd(Ud,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Nd(e,t.points,t.curve,t.closed,t):(Wd(e,0,0),zd(e,this.width,0))}};xe([Jr(Ml)],jd.prototype,"__",void 0),xe([Ar("center")],jd.prototype,"strokeAlign",void 0),xe([Cr(0)],jd.prototype,"height",void 0),xe([Lr()],jd.prototype,"points",void 0),xe([Lr(0)],jd.prototype,"curve",void 0),xe([Lr(!1)],jd.prototype,"closed",void 0),jd=xe([ao()],jd);let Vd=class extends od{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};xe([Jr(jl)],Vd.prototype,"__",void 0),xe([Cr("")],Vd.prototype,"url",void 0),Vd=xe([ao()],Vd);const qd=Vd;let Gd=class extends od{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ce.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ur({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ia(ia.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(a(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xe([Jr(Vl)],Gd.prototype,"__",void 0),xe([hl(100)],Gd.prototype,"width",void 0),xe([hl(100)],Gd.prototype,"height",void 0),xe([hl(1)],Gd.prototype,"pixelRatio",void 0),xe([hl(!0)],Gd.prototype,"smooth",void 0),xe([vr(!1)],Gd.prototype,"safeResize",void 0),xe([hl()],Gd.prototype,"contextSettings",void 0),Gd=xe([ao()],Gd);const{copyAndSpread:Kd,includes:Qd,setList:Jd}=Ht,{stintSet:Zd}=p;let $d=class extends ed{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,wordSpacing:s,fontFamily:n,fontSize:r,fontWeight:o,italic:a,textCase:h,textOverflow:l,padding:d,width:c,height:u}=t;t.__lineHeight=pl.number(e,r),t.__letterSpacing=pl.number(i,r),t.__wordSpacing=pl.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${n||"caption"}`,Zd(t,"__padding",d&&F.fourNumber(d)),Zd(t,"__clipText","show"!==l&&!t.__autoSize),Zd(t,"__isCharMode",c||u||t.__letterSpacing||t.__wordSpacing||t.motionText||"none"!==h),t.__textDrawData=ul.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&(e.renderChanged=!0),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),p.stintSet(this,"isOverflow",!Qd(h,a)&&!t.motionText),this.isOverflow?(Jd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=k.max(t,(i-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Kd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xe([Jr(Ul)],$d.prototype,"__",void 0),xe([Cr(0)],$d.prototype,"width",void 0),xe([Cr(0)],$d.prototype,"height",void 0),xe([Mr()],$d.prototype,"boxStyle",void 0),xe([vr(!1)],$d.prototype,"resizeFontSize",void 0),xe([Mr("#000000")],$d.prototype,"fill",void 0),xe([Ar("outside")],$d.prototype,"strokeAlign",void 0),xe([Kr("all")],$d.prototype,"hitFill",void 0),xe([Cr("")],$d.prototype,"text",void 0),xe([Cr("")],$d.prototype,"placeholder",void 0),xe([Cr("caption")],$d.prototype,"fontFamily",void 0),xe([Cr(12)],$d.prototype,"fontSize",void 0),xe([Cr("normal")],$d.prototype,"fontWeight",void 0),xe([Cr(!1)],$d.prototype,"italic",void 0),xe([Cr("none")],$d.prototype,"textCase",void 0),xe([Cr("none")],$d.prototype,"textDecoration",void 0),xe([Cr(0)],$d.prototype,"letterSpacing",void 0),xe([Cr(0)],$d.prototype,"wordSpacing",void 0),xe([Cr({type:"percent",value:1.5})],$d.prototype,"lineHeight",void 0),xe([Cr(0)],$d.prototype,"paraIndent",void 0),xe([Cr(0)],$d.prototype,"paraSpacing",void 0),xe([Cr("x")],$d.prototype,"writingMode",void 0),xe([Cr("left")],$d.prototype,"textAlign",void 0),xe([Cr("top")],$d.prototype,"verticalAlign",void 0),xe([Cr(!0)],$d.prototype,"autoSizeAlign",void 0),xe([Cr("normal")],$d.prototype,"textWrap",void 0),xe([Cr("show")],$d.prototype,"textOverflow",void 0),xe([Mr(!1)],$d.prototype,"textEditing",void 0),$d=xe([ao()],$d);let tc=class extends ed{get __tag(){return"Path"}};xe([Jr(Yl)],tc.prototype,"__",void 0),xe([Ar("center")],tc.prototype,"strokeAlign",void 0),tc=xe([ao()],tc);let ec=class extends id{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new tc(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};xe([Jr(Xl)],ec.prototype,"__",void 0),xe([(t,e)=>{gr(t,e,{get(){return this.__path}})}],ec.prototype,"path",void 0),ec=xe([oo(qs,["set","path","paint"]),ao()],ec);let ic=class extends rd{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ce.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new rd(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds,void 0,void 0,!0))}__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&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Oe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ca.END,this.__onReady,this],[ua.START,this.__onCreated,this],[ua.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ua.END,this.__onChildRenderEnd,this))}};ic=xe([ao()],ic);const sc={},nc={isHoldSpaceKey:()=>nc.isHold("Space"),isHold:t=>sc[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){sc[t]||(sc[t]=!0)},setUpCode(t){sc[t]=!1}},rc={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 oc extends Jo{get spaceKey(){return nc.isHoldSpaceKey()}get left(){return rc.left(this)}get right(){return rc.right(this)}get middle(){return rc.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return nc.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){fe.changeName(t,e)}}const{min:ac,max:hc,abs:lc}=Math,{float:dc,sign:cc}=F,{minX:uc,maxX:_c,minY:pc,maxY:gc}=Ht,fc=new qt,yc=new qt,mc={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&xc.getValidMove(t.__localBoxBounds,xc.getDragBounds(t),s,e,!0),xc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&xc.getValidScaleOf(t.__localBoxBounds,xc.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&dc(t[s])>dc(e[s]),getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),xc.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),xc.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=dc(s.x),s.y=dc(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),yc.set(e),fc.set(t).scaleOf(s,n.x,n.y);const h=dc((s.x-t.x)/t.width),l=dc(1-h),d=dc((s.y-t.y)/t.height),c=dc(1-d);let u,_,p,g,f=1,y=1;return xc.isInnerMode(t,e,i,"width")?(n.x<0&&fc.scaleOf(s,f=1/n.x,1),p=dc(fc.minX-yc.minX),g=dc(yc.maxX-fc.maxX),u=h&&p>0?1+p/(h*fc.width):1,_=l&&g>0?1+g/(l*fc.width):1,f*=hc(u,_)):(n.x<0&&((dc(uc(t)-uc(e),2)<=0||dc(_c(e)-_c(t),2)<=0)&&(fc.scaleOf(s,f=1/n.x,1),fc.width>1&&(f*=1/fc.width,fc.width=1)),fc.unsign()),p=dc(yc.minX-fc.minX),g=dc(fc.maxX-yc.maxX),u=h&&p>0?1-p/(h*fc.width):1,_=l&&g>0?1-g/(l*fc.width):1,f*=ac(u,_)),xc.isInnerMode(t,e,i,"height")?(n.y<0&&fc.scaleOf(s,1,y=1/n.y),p=dc(fc.minY-yc.minY),g=dc(yc.maxY-fc.maxY),u=d&&p>0?1+p/(d*fc.height):1,_=c&&g>0?1+g/(c*fc.height):1,y*=hc(u,_),r&&(u=hc(lc(f),lc(y)),f=cc(f)*u,y=cc(y)*u)):(n.y<0&&((dc(pc(t)-pc(e),2)<=0||dc(gc(e)-gc(t),2)<=0)&&(fc.scaleOf(s,1,y=1/n.y),fc.height>1&&(y*=1/fc.height,fc.height=1)),fc.unsign()),p=dc(yc.minY-fc.minY),g=dc(fc.maxY-yc.maxY),u=d&&p>0?1-p/(d*fc.height):1,_=c&&g>0?1-g/(c*fc.height):1,y*=ac(u,_)),n.x*=o(f)?f:1,n.y*=o(y)?y:1,n}},xc=mc;let wc=class extends oc{};wc.POINTER="pointer",wc.BEFORE_DOWN="pointer.before_down",wc.BEFORE_MOVE="pointer.before_move",wc.BEFORE_UP="pointer.before_up",wc.DOWN="pointer.down",wc.MOVE="pointer.move",wc.UP="pointer.up",wc.OVER="pointer.over",wc.OUT="pointer.out",wc.ENTER="pointer.enter",wc.LEAVE="pointer.leave",wc.TAP="tap",wc.DOUBLE_TAP="double_tap",wc.CLICK="click",wc.DOUBLE_CLICK="double_click",wc.LONG_PRESS="long_press",wc.LONG_TAP="long_tap",wc.MENU="pointer.menu",wc.MENU_TAP="pointer.menu_tap",wc=xe([ho()],wc);const vc=wc,bc={};let Sc=class extends wc{static setList(t){this.list=t instanceof Fh?t:new Fh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ht.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),mc.axisMove(t,n),n}static limitMove(t,e){mc.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(bc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(bc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(bc,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){bc.x=t?this.totalX:this.moveX,bc.y=t?this.totalY:this.moveY}};Sc.BEFORE_DRAG="drag.before_drag",Sc.START="drag.start",Sc.DRAG="drag",Sc.END="drag.end",Sc.OVER="drag.over",Sc.OUT="drag.out",Sc.ENTER="drag.enter",Sc.LEAVE="drag.leave",Sc.ANIMATE="drag.animate",Sc=xe([ho()],Sc);const kc=Sc;let Bc=class extends wc{static setList(t){Sc.setList(t)}static setData(t){Sc.setData(t)}};Bc.DROP="drop",Bc=xe([ho()],Bc);let Tc=class extends Sc{};Tc.BEFORE_MOVE="move.before_move",Tc.START="move.start",Tc.MOVE="move",Tc.DRAG_ANIMATE="move.drag_animate",Tc.END="move.end",Tc.PULL_DOWN="move.pull_down",Tc.REACH_BOTTOM="move.reach_bottom",Tc=xe([ho()],Tc);let Cc=class extends oc{};Cc=xe([ho()],Cc);const Pc=Cc;let Rc=class extends wc{};Rc.BEFORE_ROTATE="rotate.before_rotate",Rc.START="rotate.start",Rc.ROTATE="rotate",Rc.END="rotate.end",Rc=xe([ho()],Rc);let Ec=class extends Sc{};Ec.SWIPE="swipe",Ec.LEFT="swipe.left",Ec.RIGHT="swipe.right",Ec.UP="swipe.up",Ec.DOWN="swipe.down",Ec=xe([ho()],Ec);let Lc=class extends wc{};Lc.BEFORE_ZOOM="zoom.before_zoom",Lc.START="zoom.start",Lc.ZOOM="zoom",Lc.END="zoom.end",Lc=xe([ho()],Lc);let Ac=class extends oc{};Ac.BEFORE_DOWN="key.before_down",Ac.BEFORE_UP="key.before_up",Ac.DOWN="key.down",Ac.HOLD="key.hold",Ac.UP="key.up",Ac=xe([ho()],Ac);const Oc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Ec.UP:t>45&&t<135?Ec.DOWN:t<=45&&t>=-45?Ec.RIGHT:Ec.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:Dc.getSwipeDirection(ht.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,time:Date.now(),buttons:s(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 Fh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>vo.draggable(t)||!t.isLeafer&&t.hasEvent(Sc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Dc=Oc,Fc=new Fh,{getDragEventData:Mc,getDropEventData:Ic,getSwipeEventData:Wc}=Oc;class zc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Mc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Sc.list||this.draggableList||Fc;return this.dragging&&(s?t?Fc:new Fh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Tc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&rc.left(t),this.dragging&&(this.interaction.emit(Sc.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],vo.draggable(e)){this.draggableList=new Fh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=Mc(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(Tc.BEFORE_MOVE,this.dragData),e.emit(Tc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(Sc.BEFORE_DRAG,this.dragData),e.emit(Sc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=r(e.draggable),l=Sc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);o&&!s&&t?vo.animateMove(e,l,a(o)?o:.3,()=>e.emit(Sc.ANIMATE)):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Sc.OUT,t,i),e.emit(Sc.OVER,t,s)):e.emit(Sc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Sc.LEAVE,t,i,s),e.emit(Sc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(setTimeout(()=>this.interaction.pointerMove(t)),this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=Mc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(Tc.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Sc.END,o),this.swipe(t,i,s,o),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(ht.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Wc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Ic(t,e,Sc.data);s.path=i,this.interaction.emit(Bc.DROP,s),this.interaction.emit(Sc.LEAVE,t,i)}dragReset(){Sc.list=Sc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Nc=se.get("emit");const Yc=["move","zoom","rotate","key"];function Xc(t,e,i,s,n){if(Yc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Uc(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&&Hc(r,e,i,s,n)}}function Hc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Uc(t,n)&&(bl.updateEventStyle&&!s&&bl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=fe.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Uc(t,e){return e&&e.has(t)}const jc={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Vc,pathCanDrag:qc,pathHasOutside:Gc}=Oc;class Kc{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&&rc.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&rc.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&nc.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=p.clone(jc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Fh(t),this.createTransformer(),this.dragger=new zc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(rc.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(wc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(wc.DOWN,t),rc.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=rc.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&rc.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(wc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ht.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(wc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;rc.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(wc.BEFORE_UP,t),this.emit(wc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(wc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(wc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Ac.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,nc.setDownCode(e),this.emit(Ac.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Ac.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Ac.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,nc.setUpCode(e),this.emit(Ac.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Fh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(wc.OUT,t,i),this.emit(wc.OVER,t,e)):this.emit(wc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(wc.LEAVE,t,i,e),this.emit(wc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(wc.LEAVE,t),this.dragger.dragging&&this.emit(Bc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[wc.DOUBLE_TAP,wc.DOUBLE_CLICK].some(e=>Vc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;te.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.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&&!Gc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!qc(t.path))&&!Gc(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))}stopDragAnimate(){this.dragger.stopAnimate()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:wc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ht.round(s),s}emitTap(t){this.emit(wc.TAP,t),this.emit(wc.CLICK,t)}emitDoubleTap(t){this.emit(wc.DOUBLE_TAP,t),this.emit(wc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(wc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(wc.LONG_TAP,t),(Vc(t.path,wc.LONG_TAP)||Vc(t.path,wc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(la.RESIZE,this.__onResize,this)],t.once(_a.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],Hc(n,t,e,!0,s))return;n.isApp&&Xc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Xc(n,t,e,!1,s),Hc(n,t,e,!1,s))return}catch(t){Nc.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 Qc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Qc.custom={};class Jc extends me{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Fh,this.pixelList=new Fh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ce.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ce.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()}}te.getSelector=function(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())};const{toInnerRadiusPointOf:Zc,copyRadiusPoint:$c}=ht,{hitRadiusPoint:tu,hitPoint:eu}=Ht,iu={},su={},nu=kh.prototype;nu.hit=function(t,e=0){this.updateLayout(),$c(su,t,e);const i=this.__world;return!!(e?tu(i,su):eu(i,su))&&(this.isBranch?te.getSelector(this).hitPoint(Object.assign({},su),e,{target:this}):this.__hitWorld(su))},nu.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&($c(iu,t,i.hitRadius),t=iu),Zc(t,s,iu),i.hitBox||r){if(Ht.hitRadiusPoint(n.boxBounds,iu))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(iu,e)},nu.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},nu.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},nu.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},nu.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ru=new ft,ou=ed.prototype;ou.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=te.image.hitCanvasSize,o=r.hitScale=Gt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Gt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),hr.patternLocked=!0,this.__renderShape(r,{matrix:ru.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),hr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},ou.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,strokeScaleFixed:o}=i,a=i.__maxStrokeWidth*(o?this.getRenderScaleData(!0,o,!1).scaleX:1),h=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!h)return!1;const l=2*t.radiusX;let d=l,{strokeAlign:c}=i;if(i.motionText&&(d+=i.fontSize/2,c="center"),h)switch(c){case"inside":if(d+=2*a,!n&&this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l;break;case"center":d+=a;break;case"outside":if(d+=2*a,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l}}return!!d&&this.__hitStroke(t,d)};const au=ed.prototype,hu=od.prototype,lu=ud.prototype;hu.__updateHitCanvas=lu.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?au.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},hu.__hitFill=lu.__hitFill=function(t){return this.__hitCanvas?au.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},$d.prototype.__drawHitPath=function(t){const e=this.__,{__lineHeight:i,fontSize:s,__baseLine:n,__letterSpacing:r,__textDrawData:o}=e;t.beginPath(),e.motionText?this.__drawPathByData(t,e.__pathForMotionText):r<0?this.__drawPathByBox(t):o.rows.forEach(e=>t.rect(e.x,e.y-n,e.width,i<s?s:i))},id.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),te.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const du=De.prototype;du.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},du.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},du.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Gt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.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 cu={convertTouch(t,e){const i=cu.getTouch(t),s=Oc.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class uu extends Kc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return s(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=cu.getTouch(t);this.pointerDown(cu.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=cu.getTouch(t);this.pointerMove(cu.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=cu.getTouch(t);this.pointerUp(cu.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Oc.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function _u(t,e,i,s){t.__.__font?fl.fillText(t,e,i,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function pu(t,e,i,s,n){const r=i.__;c(t)?fl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&fl.strokeArrow(t,i,s,n)}function gu(t,e,i,s,n){const r=i.__;c(t)?fl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),fl.drawTextStroke(i,s,n))}function fu(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,gu(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",fl.fillText(i,r,n),r.blendMode="normal",vo.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:yu,copyAndSpread:mu,toOuterOf:xu,getOuterOf:wu,getByMove:vu,move:bu,getIntersectData:Su}=Ht,ku={};let Bu;const{stintSet:Tu}=p,{hasTransparent:Cu}=_l;function Pu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n,o;const{boxBounds:a}=i.__layout,{type:h}=e;switch(h){case"image":case"film":case"video":if(!e.url)return;o=Bu&&Bu[e.url],n=yl.image(i,t,e,a,o),"image"!==h&&yl[h](n,o);break;case"linear":n=ml.linearGradient(e,a);break;case"radial":n=ml.radialGradient(e,a);break;case"angular":n=ml.conicGradient(e,a);break;case"solid":const{color:r,opacity:l}=e;n={type:h,style:_l.string(r,l)};break;default:s(e.r)||(n={type:"solid",style:_l.string(e)})}if(n&&(n.originPaint=e,r(n.style)&&Cu(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const Ru={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),Bu=yl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Pu(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));s.length?(i["_"+t]=s,s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Tu(i,"__isAlphaPixelFill",n),Tu(i,"__isTransparentFill",r)):(Tu(i,"__isAlphaPixelStroke",n),Tu(i,"__isTransparentStroke",r),Tu(i,"__hasMultiStrokeStyle",o))):(i.__removePaint(t,!1),i["_"+t]=""),Bu=void 0},fill:function(t,e,i,s){i.fillStyle=t,_u(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,yl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,r.scaleFixed,!1);1!==t&&i.scale(t,s)}r.blendMode&&(i.blendMode=r.blendMode),_u(e,i,s,!0),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),_u(e,i,s),i.restoreBlendMode()):_u(e,i,s)}},fillPathOrText:_u,fillText:function(t,e,i,s){const n=t.__;let r;if(n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor),s&&(r=e,(e=e.getSameCanvas(!0,!0)).font=t.__.__font,e.fillStyle="#000"),t.motionText)fl.fillMotionText(t,e,i);else{let t;const{rows:i,decorationY:s}=n.__textDrawData;for(let s=0,n=i.length;s<n;s++)t=i[s],t.text?e.fillText(t.text,t.x,t.y):t.data&&t.data.forEach(i=>{e.fillText(i.char,i.x,t.y)});if(s){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,r)))}}s&&(e.beginPath(),t.__drawPathByBox(e,"render"),e.fillStyle=r.fillStyle,e.setTransform(r.getTransform()),e.blendMode="source-in",e.fill(),r.copyWorldByReset(e,t.__nowWorld),e.recycle(t.__nowWorld))},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)fl.strokeText(t,e,i,s);else if(n.__pathForStroke)fl.fillStroke(t,e,i,s);else switch(n.strokeAlign){case"center":pu(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),pu(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)pu(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),pu(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),vo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){fl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":gu(t,1,e,i,s);break;case"inside":fu(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?gu(t,2,e,i,s):fu(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!yl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?fl.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?fl.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;xu(o.strokeSpread?(mu(ku,o.boxBounds,o.strokeSpread),ku):o.boxBounds,r,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))_=s,h=u=a,l=r;else{let s;if(te.fullImageShadow)s=a;else{const t=o.renderShapeSpread?yu(n,k.swapAndScale(o.renderShapeSpread,p,g)):n;s=Su(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=wu(a,c),h=vu(u,-c.e,-c.f),l=wu(r,c),bu(l,-c.e,-c.f);const m=i.matrix;m?(d=new ft(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Eu,Lu=new qt;const{isSame:Au}=Ht;function Ou(t,e,i,s,n,r){let o=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate(),vo.updateBounds(t,!0),t.__layout.boundsChanged=!0,t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),o=!1)),"brush"===i.mode&&yl.brush(t,e,n),!n.data){yl.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e}=i,o=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!n.brush;(o||e&&e<1||i.blendMode)&&(n.complex=!o||2)}return i.filter&&yl.applyFilter(n,s,i.filter,t),o}function Du(t,e){Iu(t,ia.LOAD,e)}function Fu(t,e){Iu(t,ia.LOADED,e)}function Mu(t,e,i){e.error=i,t.forceUpdate("surface"),Iu(t,ia.ERROR,e)}function Iu(t,e,i){t.hasEvent(e)&&t.emitEvent(new ia(e,i))}function Wu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:zu,translate:Nu}=Q,Yu=new qt,Xu={},Hu={};function Uu(t,e,i,s){const n=r(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let ju={},Vu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:qu,set:Gu,rotateOfOuter:Ku,translate:Qu,scaleOfOuter:Ju,multiplyParent:Zu,scale:$u,rotate:t_,skew:e_}=Q;function i_(t,e,i,s,n,r,o,a){o&&t_(t,o),a&&e_(t,a.x,a.y),n&&$u(t,n,r),Qu(t,e.x+i,e.y+s)}const{get:s_,scale:n_,copy:r_}=Q,{getFloorScale:o_}=F,{abs:a_}=Math;const h_={image:function(t,e,i,s,n){let r,o;const a=hr.get(i,i.type),h=!n;return Eu&&i===Eu.paint&&Au(s,Eu.boxBounds)?r=Eu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Eu=a.use>1?{leafPaint:r,paint:i,boxBounds:Lu.set(s)}:null),(h||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ou(t,e,i,a,r,s),h&&(Du(t,o),Fu(t,o))):a.error?h&&Mu(t,o,a.error):(h&&(Wu(t,!0),Du(t,o)),r.loadId=a.load(()=>{Wu(t,!1),t.destroyed||(Ou(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Fu(t,o)),r.loadId=void 0},e=>{Wu(t,!1),Mu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=yl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:_}=n;if(!d||t.patternId===a&&!u||_){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===te.name||u||(e=te.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e)i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill());else if(!t.style||c.sync||u?yl.createPattern(t,i,s,n):yl.createPatternTask(t,i,s,n),!l||!t.style)return!1;return yl.drawImage(t,r,o,i,s,n),!0},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:r,opacity:a}=t.originPaint,{transform:h}=o;n.save(),2===l&&n.clipUI(s),r&&(n.blendMode=r),a&&(n.opacity*=a),h&&n.transform(h),u.render(n,0,0,d,c,s,t,e,i),n.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),u.render(n,0,0,d,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(t.brush&&yl.addBrushScale(n,t,e),i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,r,o,a;const h=e.__leaf;for(let l=0,c=i.length;l<c;l++)s=i[l],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=s,hr.recyclePaint(s),s.brush&&yl.recycleBrush(s,h),e.__willDestroy&&n.parent&&yl.recycleFilter(n,h),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=hr.patternTasker.add(()=>we(this,void 0,void 0,function*(){yl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=yl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!te.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:a,brush:h,data:l}=t,{transform:d,gap:c}=l,u=yl.getPatternFixScale(t,n,r);let _,p,g,{width:f,height:y}=a,{opacity:m}=t.originPaint;(h||1===m)&&(m=void 0),u&&(n*=u,r*=u),f*=n,y*=r,c&&!h&&(p=c.x*n/a_(l.scaleX||1),g=c.y*r/a_(l.scaleY||1)),(d||1!==n||1!==r)&&(n*=o_(f+(p||0)),r*=o_(y+(g||0)),_=s_(),d&&r_(_,d),n_(_,1/n,1/r));const x=a.getCanvas(f,y,m,void 0,p,g,e.leafer&&e.leafer.config.smooth,l.interlace);h?(t.style=x,yl.cacheBrush(t,e,i,s)):t.style=a.getPattern(x,l.repeat||te.origin.noRepeat||"no-repeat",_,t),t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=te.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=yl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Yu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,interlace:m}=t,x=e.width===s&&e.height===n,w={mode:o},v="center"!==h&&(_||0)%180==90;let b,S;switch(Ht.set(Hu,0,0,v?n:s,v?s:n),o&&"cover"!==o&&"fit"!==o?((d||u)&&(F.getScaleData(d,u,i,Xu),b=Xu.scaleX,S=Xu.scaleY),(h||y||f)&&(b&&Ht.scale(Hu,b,S,!0),h&&Tt.toPoint(h,Hu,e,Hu,!0,!0))):x&&!_||(b=S=Ht.getFitScale(e,Hu,"fit"!==o),Ht.put(e,i,h,b,!1,Hu),Ht.scale(Hu,b,S,!0)),l&&ht.move(Hu,l),o){case"stretch":x?b&&(b=S=void 0):(b=e.width/s,S=e.height/n,yl.stretchMode(w,e,b,S));break;case"normal":case"clip":if(Hu.x||Hu.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),yl.clipMode(w,e,Hu.x,Hu.y,b,S,_,p,t,i),t&&(b=b?b*t:t,S=S?S*i:i)}break;case"repeat":(!x||b||_||p)&&yl.repeatMode(w,e,s,n,Hu.x,Hu.y,b,S,_,p,h,t.freeTransform);case"brush":f||(w.repeat="repeat");const i=c(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:Uu(r,i,n.width,e&&e.x),y:Uu(o,s,n.height,e&&e.y)}}(y,i&&f,Hu.width,Hu.height,e));break;default:b&&yl.fillOrFitMode(w,e,Hu.x,Hu.y,b,S,_)}return w.transform||"brush"===o||(e.x||e.y)&&Nu(w.transform=zu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=S),f&&(w.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=a(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=qu(),{x:r,y:o}=e;r||o?Qu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),$u(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=qu();Qu(a,e.x+i,e.y+s),$u(a,n,r),o&&Ku(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=qu();i_(d,e,i,s,n,r,o,a),h&&(o||a?(Gu(Vu),Ju(Vu,e,h,l),Zu(d,Vu)):Ju(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=qu();if(c)i_(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Ku(u,{x:i/2,y:s/2},h);else switch(t_(u,h),h){case 90:Qu(u,s,0);break;case 180:Qu(u,i,s);break;case 270:Qu(u,0,i)}ju.x=e.x+n,ju.y=e.y+r,Qu(u,ju.x,ju.y),o&&Ju(u,ju,o,a)}t.transform=u}},{toPoint:l_}=St,{hasTransparent:d_}=_l,c_={},u_={};function __(t,e,i,s){if(i){let n,o,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],r(n)?(a=t/(l-1),o=_l.string(n,s)):(a=n.offset,o=_l.string(n.color,s)),e.addColorStop(a,o),!h&&d_(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:p_,getDistance:g_}=ht,{get:f_,rotateOfOuter:y_,scaleOfOuter:m_}=Q,{toPoint:x_}=St,w_={},v_={};function b_(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=p_(e,i);r=f_(),n?(m_(r,e,o/a*(s||1),1),y_(r,e,t+90)):(m_(r,e,1,o/a*(s||1)),y_(r,e,t))}return r}const{getDistance:S_}=ht,{toPoint:k_}=St,B_={},T_={};const C_={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;l_(i||"top",e,c_),l_(s||"bottom",e,u_);const o=te.canvas.createLinearGradient(c_.x,c_.y,u_.x,u_.y),a={type:n,style:o};return __(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;x_(i||"center",e,w_),x_(s||"bottom",e,v_);const a=te.canvas.createRadialGradient(w_.x,w_.y,0,w_.x,w_.y,g_(w_,v_)),h={type:n,style:a};__(h,a,t.stops,r);const l=b_(e,w_,v_,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,rotation:o,stretch:a}=t;k_(i||"center",e,B_),k_(s||"bottom",e,T_);const h=te.conicGradientSupport?te.canvas.createConicGradient(o?o*I:0,B_.x,B_.y):te.canvas.createRadialGradient(B_.x,B_.y,0,B_.x,B_.y,S_(B_,T_)),l={type:n,style:h};__(l,h,t.stops,r);const d=b_(e,B_,T_,a||1,te.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:b_},{copy:P_,move:R_,toOffsetOutBounds:E_}=Ht,{max:L_,abs:A_}=Math,O_={},D_=new ft,F_={};function M_(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=A_(t.spread||0),o=L_(o,n+r-s),a=L_(a,n+r+i),h=L_(h,n+r+s),l=L_(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function I_(t,e,i){const{shapeBounds:s}=i;let n,r;te.fullImageShadow?(P_(O_,t.bounds),R_(O_,e.x-s.x,e.y-s.y),n=t.bounds,r=O_):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:W_}=Ht,z_={};const N_=M_;const Y_={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;E_(h,F_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(F_.offsetX+(o.x||0)*c*f,F_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,_l.string(o.color)),n=xl.getShadowTransform(t,_,i,o,F_,f),n&&_.setTransform(n),I_(_,F_,i),n&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,r,"copy"),s=r),a?_.copyWorld(a,r,r,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),vo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;W_(h,z_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(z_.offsetX+(o.x||0)*c*f,z_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=xl.getShadowTransform(t,_,i,o,z_,f,!0),n&&_.setTransform(n),I_(_,z_,i),_.restore(),a?(_.copyWorld(_,l,r,"copy"),_.copyWorld(a,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,_l.string(o.color),"source-in"),vo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.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){},getShadowRenderSpread:M_,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return D_.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),D_}},isTransformShadow(t){},getInnerShadowSpread:N_},{excludeRenderBounds:X_}=Eo;let H_;function U_(t,e,i,s,n,r,o,a){switch(e){case"grayscale":H_||(H_=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);V_(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":V_(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function j_(t){return t.getSameCanvas(!1,!0)}function V_(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}id.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(U_(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||X_(i,e)||i.__render(t,e),r=i.__.opacity,H_=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=j_(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=j_(t)),n||(n=j_(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&U_(this,o,t,n,s,r,void 0,!1),X_(i,e)||i.__render(n||t,e),d&&U_(this,o,t,n,s,r,d,!1)}U_(this,o,t,n,s,r,void 0,!0)};const q_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",G_=q_+"_#~&*+\\=|≮≯≈≠=…",K_=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],[4352,4607],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12784,12799],[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("|"),"u");function Q_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const J_=Q_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Z_=Q_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),$_=Q_(q_),tp=Q_(G_),ep=Q_("- —/~|┆·");var ip;!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"}(ip||(ip={}));const{Letter:sp,Single:np,Before:rp,After:op,Symbol:ap,Break:hp}=ip;function lp(t){return J_[t]?sp:ep[t]?hp:Z_[t]?rp:$_[t]?op:tp[t]?ap:K_.test(t)?np:sp}const dp={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 cp(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:up}=dp,{Letter:_p,Single:pp,Before:gp,After:fp,Symbol:yp,Break:mp}=ip;let xp,wp,vp,bp,Sp,kp,Bp,Tp,Cp,Pp,Rp,Ep,Lp,Ap,Op,Dp,Fp,Mp=[];function Ip(t,e){Cp&&!Tp&&(Tp=Cp),xp.data.push({char:t,width:e}),vp+=e}function Wp(t){t&&(bp+=t,xp.addWidth=t),bp+=vp,xp.width=vp,wp.words.push(xp),xp={data:[]},vp=0}function zp(){Ap&&(Op.paraNumber++,wp.paraStart=!0,Ap=!1),Cp&&(wp.startCharSize=Tp,wp.endCharSize=Cp,Tp=0),wp.width=bp,Dp.width?up(wp):Fp&&Np(),Mp.push(wp),wp={words:[]},bp=0}function Np(){bp>(Op.maxWidth||0)&&(Op.maxWidth=bp)}const{top:Yp,right:Xp,bottom:Hp,left:Up}=wt;function jp(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 Vp={getDrawData:function(t,e){r(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;e.motionText&&(n=o=0),a&&(n?(i=a[Up],n-=a[Xp]+a[Up],!n&&(n=.01)):e.autoSizeAlign||(i=a[Up]),o?(s=a[Yp],o-=a[Yp]+a[Hp],!o&&(o=.01)):e.autoSizeAlign||(s=a[Yp]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:te.canvas.font=e.__font};return function(t,e,i){Op=t,Mp=t.rows,Dp=t.bounds,Fp=!Dp.width&&!i.autoSizeAlign;const{paraIndent:s,textCase:n}=i,{canvas:r}=te,{width:o}=Dp;if(i.__isCharMode){const t="none"!==i.textWrap,a="break"===i.textWrap,h=i.__letterSpacing,l=i.__wordSpacing;Ap=!0,Rp=null,Tp=Bp=Cp=vp=bp=0,xp={data:[]},wp={words:[]};for(let i=0,d=(e=[...e]).length;i<d;i++)kp=e[i],"\n"===kp?(vp&&Wp(),wp.paraEnd=!0,zp(),Ap=!0):(Pp=lp(kp),Pp===_p&&"none"!==n&&(kp=cp(kp,n,!vp)),Bp=r.measureText(kp).width,h&&(h<0&&(Cp=Bp),Bp+=h),Ep=Pp===pp&&(Rp===pp||Rp===_p)||Rp===pp&&Pp!==fp,Lp=!(Pp!==gp&&Pp!==pp||Rp!==yp&&Rp!==fp),Sp=Ap&&s?o-s:o,t&&o&&bp+vp+Bp>Sp&&(a?(vp&&Wp(),bp&&zp()):(Lp||(Lp=Pp===_p&&Rp==fp),Ep||Lp||Pp===mp||Pp===gp||Pp===pp||vp+Bp>Sp?(vp&&Wp(),bp&&zp()):bp&&zp()))," "===kp&&!0!==Ap&&bp+vp===0||(Pp===mp?(" "===kp&&vp&&Wp(l),Ip(kp,Bp),Wp()):Ep||Lp?(vp&&Wp(l),Ip(kp,Bp)):Ip(kp,Bp)),Rp=Pp);vp&&Wp(),bp&&zp(),Mp.length>0&&(Mp[Mp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Op.paraNumber++,bp=r.measureText(t).width,Mp.push({x:s||0,text:t,width:bp,paraStart:!0}),Fp&&Np()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":jp(e,"x",t[Up]);break;case"right":jp(e,"x",-t[Xp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":jp(e,"y",t[Yp]);break;case"bottom":jp(e,"y",-t[Hp])}}(a,h,e,n,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(e.__autoHeight?y: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 x,w,v,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(x=i[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=r,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<s.x&&(s.x=w),v>s.width&&(s.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r}=e,o=e.__letterSpacing||e.motionText,a=e.__wordSpacing,h=i&&n.includes("both"),l=h||i&&n.includes("justify"),d=l&&n.includes("letter");let c,u,_,p,g,f,y,m,x,w;s.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||h,u=i-t.width-g,d?p=u/(t.words.reduce((t,e)=>t+e.data.length,0)-1):_=m>1?u/(m-1):0),f=o||t.isOverflow||d?0:_||a?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===f?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,c=t.x,t.data=[],t.words.forEach((e,i)=>{1===f?(y={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,y),(t.isOverflow||" "!==y.char)&&t.data.push(y)):c=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,c,t.data,t.isOverflow,w&&p),e.addWidth&&(c+=e.addWidth),w&&(x=i===m-1,_?x||(c+=_,t.width+=_):p&&(t.width+=p*(e.data.length-(x?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?te.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=_l.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const qp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!_l.object)return t;t=_l.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};Object.assign(ul,Vp),Object.assign(_l,qp),Object.assign(fl,Ru),Object.assign(yl,h_),Object.assign(ml,C_),Object.assign(xl,Y_),Object.assign(ce,{interaction:(t,e,i,s)=>new uu(t,e,i,s),hitCanvas:(t,e)=>new Wh(t,e),hitCanvasManager:()=>new Jc}),rd.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&zh(0,wx)}catch(t){}class Gp extends El{get __isCanvas(){return!0}get __drawAfterFill(){return!0}get __boxStroke(){return!this.__pathInputed}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Kp=class extends ed{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?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),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),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=hr.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:h,height:l}=r&&(a(r)?{width:r,height:r}:r)||(o>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new ia(ia.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:n,__action:r}=this;r&&(r.FPS&&(i=r.FPS),s(r.loop)||(n=r.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!n)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(),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()}};function Qp(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?bl.setStyleName(this,e,i):bl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Jp(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Zp(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 $p(t,e){c(e)||(e=void 0),ig(t,e,"in")}function tg(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),ig(t,e,"out"))}xe([Jr(Gp)],Kp.prototype,"__",void 0),xe([Cr()],Kp.prototype,"robot",void 0),xe([vr()],Kp.prototype,"actions",void 0),xe([vr("")],Kp.prototype,"action",void 0),xe([Mr(0)],Kp.prototype,"now",void 0),xe([vr(12)],Kp.prototype,"FPS",void 0),xe([vr(!0)],Kp.prototype,"loop",void 0),Kp=xe([ao()],Kp),de.add("robot");const eg={};function ig(t,e,i){const{normalStyle:s}=t;e||(e=eg),e.scale&&(F.assignScale(e,e.scale),delete e.scale),e!==eg&&bl.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const o=r?function(t,e){const i=rg(e,t),s=t.animate();s&&rg(i,t,s.fromStyle);return i}(t,e):void 0;bl.canAnimate&&sg(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=sg(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete a.animation}t.normalStyle=ng(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(r){const e=ng(o,t);t.set(o,"temp"),t.animate([o,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function sg(t){let e;const i={},s=Zp(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&bl.isState(n,t,s)&&(e=og(i,r));const o=i.selectedStyle||t.selectedStyle;o&&bl.isSelected(t,s)&&(e=og(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&bl.isPlacehold(t,s)&&(e=og(i,a)),bl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=og(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&bl.isFocus(t,s)&&(e=og(i,n));const r=i.hoverStyle||t.hoverStyle;r&&bl.isHover(t,s)&&(e=og(i,r));const o=i.pressStyle||t.pressStyle;o&&bl.isPress(t,s)&&(e=og(i,o))}return e?i:void 0}function ng(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&bl.animateExcludes[t]||(n[t]=e[t]);return n}function rg(t,e,i){return ng(t,e,i,!0)}function og(t,e){return Object.assign(t,e),!0}function ag(t,e){const i=t[e];i&&$p(t,i),t.button&&lg(t.children,e)}function hg(t,e,i){i||(i=t.states[e]),$p(t,i),t.button&&lg(t.children,null,e)}function lg(t,e,i){if(!t)return;let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],e){switch(r=!0,e){case"hoverStyle":bl.isHover(n)&&(r=!1);break;case"pressStyle":bl.isPress(n)&&(r=!1);break;case"focusStyle":bl.isFocus(n)&&(r=!1)}r&&ag(n,e)}else s(i)||hg(n,i);n.isBranch&&lg(n.children,e,i)}}function dg(t,e){const i=t[e];i&&tg(t,i),t.button&&ug(t.children,e)}function cg(t,e,i){tg(t,i),t.button&&ug(t.children,null,e)}function ug(t,e,i){if(!t)return;let n;for(let r=0,o=t.length;r<o;r++)n=t[r],e?dg(n,e):s(i)||cg(n,i),n.isBranch&&ug(n.children,e,i)}function _g(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=Zp(e,i);r&&(s=n[t](r))}return s}function pg(t,e,i){let s=e[t];if(!s&&i){const n=Zp(e,i);n&&(s=n[t])}return s}de.add("state"),bl.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},bl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Zp(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},bl.isSelected=function(t,e){return pg("selected",t,e)},bl.isDisabled=function(t,e){return pg("disabled",t,e)},bl.isFocus=function(t,e){return _g("isFocus",t,e)},bl.isHover=function(t,e){return _g("isHover",t,e)},bl.isPress=function(t,e){return _g("isPress",t,e)},bl.isPlacehold=function(t,e){return t.__.__isPlacehold},bl.isDrag=function(t,e){return _g("isDrag",t,e)},bl.setStyleName=function(t,e,i){i?hg(t,e,t[e]):cg(t,e,t[e])},bl.set=function(t,e){const i=t.states[e];i?hg(t,e,i):cg(t,e,i)},bl.getStyle=sg,bl.updateStyle=ig,bl.updateEventStyle=function(t,e){switch(e){case wc.ENTER:ag(t,"hoverStyle");break;case wc.LEAVE:dg(t,"hoverStyle");break;case wc.DOWN:ag(t,"pressStyle");break;case wc.UP:dg(t,"pressStyle")}};const gg=ed.prototype;ed.addAttr("selected",!1,Qp,"selectedStyle"),ed.addAttr("disabled",!1,Qp,"disabledStyle"),ed.addAttr("states",{},Jp),ed.addAttr("state","",Qp),ed.addAttr("normalStyle",void 0,vr),ed.addAttr("hoverStyle",void 0,Jp),ed.addAttr("pressStyle",void 0,Jp),ed.addAttr("focusStyle",void 0,Jp),ed.addAttr("selectedStyle",void 0,Jp),ed.addAttr("disabledStyle",void 0,Jp),ed.addAttr("placeholderStyle",void 0,Jp),ed.addAttr("button",!1,vr),gg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},gg.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?ag(this,"focusStyle"):dg(this,"focusStyle")})},gg.updateState=function(){bl.updateStyle(this,void 0,"in")};const fg=$d.prototype,yg="text";gr(fg,yg,Object.assign(Object.assign({},fr(fg,yg)),{set(t){const e=this,i=e.text;e.__setAttr(yg,t)&&(Rr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:mg,sin:xg,pow:wg,sqrt:vg,abs:bg,ceil:Sg,floor:kg,round:Bg,PI:Tg}=Math,Cg=5*Tg,Pg=1.70158,Rg=2.5949095,Eg=7.5625,Lg=2.75;function Ag(t){return e=>wg(e,t)}function Og(t){return e=>1-wg(1-e,t)}function Dg(t){return e=>e<.5?.5*wg(2*e,t):1-.5*wg(2-2*e,t)}function Fg(t){return t<1/Lg?Eg*t*t:t<2/Lg?Eg*(t-=1.5/Lg)*t+.75:t<2.5/Lg?Eg*(t-=2.25/Lg)*t+.9375:Eg*(t-=2.625/Lg)*t+.984375}function Mg(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=Ig(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(bg(l)<1e-6));e++)c-=d/l;return n[o]=Ig(c,e,s)}}function Ig(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Wg={get(t){const{list:e}=Wg;return r(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Wg.list[t]=e},list:{linear:t=>t,ease:Mg(.25,.1,.25,1),"ease-in":Mg(.42,0,1,1),"ease-out":Mg(0,0,.58,1),"ease-in-out":Mg(.42,0,.58,1),"sine-in":t=>1-mg(t*Tg*.5),"sine-out":t=>xg(t*Tg*.5),"sine-in-out":t=>.5*(1-mg(t*Tg)),"quad-in":Ag(2),"quad-out":Og(2),"quad-in-out":Dg(2),"cubic-in":Ag(3),"cubic-out":Og(3),"cubic-in-out":Dg(3),"quart-in":Ag(4),"quart-out":Og(4),"quart-in-out":Dg(4),"quint-in":Ag(5),"quint-out":Og(5),"quint-in-out":Dg(5),"expo-in":t=>t?wg(2,10*t-10):0,"expo-out":t=>1===t?1:1-wg(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*wg(2,2*t*10-10):.5*(2-wg(2,10-2*t*10)),"circ-in":t=>1-vg(1-wg(t,2)),"circ-out":t=>vg(1-wg(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-vg(1-wg(2*t,2))):.5*(vg(1-wg(2-2*t,2))+1),"back-in":t=>((Pg+1)*t-Pg)*t*t,"back-out":t=>(t-=1)*t*((Pg+1)*t+Pg)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Rg+1)*t-Rg)*.5:.5*((t=2*t-2)*t*((Rg+1)*t+Rg)+2),"elastic-in":t=>0===t||1===t?t:-wg(2,10*(t-1))*xg((t-1.1)*Cg),"elastic-out":t=>0===t||1===t?t:wg(2,-10*t)*xg((t-.1)*Cg)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-wg(2,10*((t*=2)-1))*xg((t-1.1)*Cg)*.5:wg(2,10*(1-(t*=2)))*xg((t-1.1)*Cg)*.5+1,"bounce-in":t=>1-Fg(1-t),"bounce-out":Fg,"bounce-in-out":t=>t<.5?.5*(1-Fg(1-2*t)):.5*(1+Fg(2*t-1)),"cubic-bezier":Mg,steps:function(t,e="floor"){return i=>("floor"===e?kg(i*t):"ceil"===e?Sg(i*t):Bg(i*t))/t}}};function zg(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 Ng{}Ng.CREATED="created",Ng.PLAY="play",Ng.PAUSE="pause",Ng.STOP="stop",Ng.SEEK="seek",Ng.UPDATE="update",Ng.COMPLETED="completed";let Yg=class extends wa{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&&a(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,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=d(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=Wg.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))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(Ng.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Ng.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Ng.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=pl.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(Ng.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:n}=this,{length:r}=i,o=!(r>1)||this.join;let h,l,d,c,u,_=0,p=0;r>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<r;n++){if(l=i[n],c=l.style||l,h||(h=o?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=l;r&&(d.swing=a(r)?r:2,u=2*d.swing-1),o&&(d.loop=u=a(o)?o:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=Wg.get(n))}if(!d.autoDuration&&s(d.duration)&&(r>1?n>0||o?p+=u:d.duration=0:d.duration=this.duration),r>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=_||!n||!n.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(Ng.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:n,toStyle:r,target:o}=this;for(let a in e)s(n[a])&&(n[a]=r[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=s(i[a])?r[a]:i[a],r[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:n}=i;for(let r=0;r<n;r++)e=i[r],s(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))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,te.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}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,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),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.startRequestAnimate()}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.emitType(Ng.COMPLETED)}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={}),Sl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(Ng.UPDATE)}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 a(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.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};xe([zg("ease")],Yg.prototype,"easing",void 0),xe([zg(0)],Yg.prototype,"delay",void 0),xe([zg(.2)],Yg.prototype,"duration",void 0),xe([zg("auto")],Yg.prototype,"ending",void 0),xe([zg(!1)],Yg.prototype,"reverse",void 0),xe([zg(!1)],Yg.prototype,"swing",void 0),xe([zg(!1)],Yg.prototype,"loop",void 0),xe([zg(0)],Yg.prototype,"loopDelay",void 0),xe([zg(1)],Yg.prototype,"speed",void 0),xe([zg(!0)],Yg.prototype,"autoplay",void 0),xe([zg()],Yg.prototype,"join",void 0),xe([zg()],Yg.prototype,"jump",void 0),xe([zg()],Yg.prototype,"attrs",void 0),Yg=xe([oo(La)],Yg);let Xg=class extends Yg{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Yg(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Ng.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Ng.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Ng.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(Ng.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Ng.COMPLETED:this.completed&&this.emitType(t);break;case Ng.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};Xg=xe([oo(La)],Xg);const Hg={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"},Ug=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,jg=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Vg=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,qg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Gg=parseInt,Kg=parseFloat,{round:Qg}=Math;let Jg={},Zg=0;function $g(t){let e,i,s,n=1;switch(t.length){case 9:e=Gg(t.slice(1,3),16),i=Gg(t.slice(3,5),16),s=Gg(t.slice(5,7),16),n=Gg(t.slice(7,9),16)/255;break;case 7:e=Gg(t.slice(1,3),16),i=Gg(t.slice(3,5),16),s=Gg(t.slice(5,7),16);break;case 5:e=Gg(t[1]+t[1],16),i=Gg(t[2]+t[2],16),s=Gg(t[3]+t[3],16),n=Gg(t[4]+t[4],16)/255;break;case 4:e=Gg(t[1]+t[1],16),i=Gg(t[2]+t[2],16),s=Gg(t[3]+t[3],16);break;case 3:e=i=s=Gg(t[1]+t[2],16);break;case 2:e=i=s=Gg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const tf=1/6,ef=.5,sf=2/3,nf=1/3;function rf(t,e,i){return i<0?i++:i>1&&i--,i<tf?t+6*(e-t)*i:i<ef?e:i<sf?t+(e-t)*(sf-i)*6:t}function of(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=rf(a,s,t+nf),r=rf(a,s,t),o=rf(a,s,t-nf)}return{r:Qg(255*n),g:Qg(255*r),b:Qg(255*o),a:s}}de.add("color"),_l.object=function(t,e){let i,n=!s(e)&&e<1;if(r(t)){const e=Jg[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=$g(t);break;case"R":case"r":"("===t[4]&&jg.test(t)?i=function(t){const e=jg.exec(t);return{r:Gg(e[1]),g:Gg(e[2]),b:Gg(e[3]),a:Kg(e[4])}}(t):"("===t[3]&&Ug.test(t)&&(i=function(t){const e=Ug.exec(t);return{r:Gg(e[1]),g:Gg(e[2]),b:Gg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&qg.test(t)?i=function(t){const e=qg.exec(t);return of(Kg(e[1]),Kg(e[2]),Kg(e[3]),Kg(e[4]))}(t):"("===t[3]&&Vg.test(t)&&(i=function(t){const e=Vg.exec(t);return of(Kg(e[1]),Kg(e[2]),Kg(e[3]),1)}(t))}if(!i){const e=Hg[t.toLowerCase()];e&&(i=$g("#"+e))}i&&(Zg++,Zg>1e4&&(Jg={},Zg=0),Jg[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),n&&(i.a*=e),i};const{round:af}=Math,{fourNumber:hf}=F,lf={fill:pf,stroke:pf,cornerRadius:(t,e,i)=>a(t)&&a(e)?uf(t,e,i):(t=hf(t),e=hf(e),t.map((t,s)=>uf(t,e[s],i))),text(t,e,i){if(r(t)&&r(e)){const s=t.length,n=e.length,r=uf(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return a(t)||a(e)?F.float(uf(t,e,i),Math.max(cf(t),cf(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Sl.setBetweenStyle(n,t,e,n,i,s),n},shadow:gf,innerShadow:gf},df={value:function(t,e,i){const s=a(t),n=a(e);return s&&n?t+(e-t)*i:n||s?uf(t,e,i):t},number:uf,color:_f,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=Sl;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 cf(t){const e=String(t).split(".")[1];return e?e.length:0}function uf(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?af(n):n}function _f(t,e,i){let s=_l.object(t),n=_l.object(e);t||(s=Object.assign(Object.assign({},n),{a:0})),e||(n=Object.assign(Object.assign({},s),{a:0}));const r=uf(s.r,n.r,i,1)+","+uf(s.g,n.g,i,1)+","+uf(s.b,n.b,i,1),o=uf(s.a,n.a,i);return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}function pf(t,e,i){return!r(t)&&t||!r(e)&&e?e:_f(t,e,i)}function gf(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:uf((t=t||{}).x,e.x,i),y:uf(t.y,e.y,i),blur:uf(t.blur,e.blur,i),spread:uf(t.spread,e.spread,i),color:_f(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}de.add("animate","color"),bl.canAnimate=!0,Object.assign(Sl.list,lf),Object.assign(Sl,df);const ff=ed.prototype;ed.addAttr("animation",void 0,function(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),ed.addAttr("animationOut",void 0,vr),ed.addAttr("transition",!0,vr),ed.addAttr("transitionOut",void 0,vr),ff.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},ff.animate=function(t,e,i,n){if(s(t))return this.__animate;let r=d(t)&&!e&&i?new Xg(this,t,n):new Yg(this,t,e,n);this.killAnimate(i,r.toStyle);const o=this.__animate;return o&&(r instanceof Xg?r.list.unshift(o):r=new Xg(this,[o,r])),this.__animate=r},ff.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Xg&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},ff.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Ng.COMPLETED,e)};const yf=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],mf=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:xf}=Math,{getDerivative:wf}=di,vf={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<yf.length;h++)l=f*(1+yf[h]),d=f*(1-yf[h]),c=wf(l,t,i,n,o),u=wf(l,e,s,r,a),_=wf(d,t,i,n,o),p=wf(d,e,s,r,a),g+=mf[h]*(xf(c*c+u*u)+xf(_*_+p*p));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=wf(t,e,s,r,a),d=wf(t,i,n,o,h);return Math.atan2(d,l)/I},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;)bf(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(Ie.C,c,u,g,f,y,m)}},{getDistance:bf}=vf,{M:Sf,L:kf,C:Bf,Z:Tf}=Ie,{float:Cf}=F,{set:Pf,getAngle:Rf,getDistanceFrom:Ef,getDistancePoint:Lf}=ht,Af={},Of={},Df={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Sf:case kf:Df.transformPoints(t,e,s,1),s+=3;break;case Bf:Df.transformPoints(t,e,s,3),s+=7;break;case Tf:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Af.x=t[n],Af.y=t[n+1],Q.toOuterPoint(e,Af),t[n]=Af.x,t[n+1]=Af.y},getMotionPathData(t){let e,i,s,n,r,o=0,a=[],h=0,l=0,d=0,c=0,u=0;const _=t.length;for(;h<_;){switch(n=t[h],n){case Sf:c=t[h+1],u=t[h+2];case kf:i=t[h+1],s=t[h+2],e=n===kf&&h>0?Ef(l,d,i,s):0,l=i,d=s,h+=3;break;case Bf:i=t[h+5],s=t[h+6],e=vf.getDistance(l,d,t[h+1],t[h+2],t[h+3],t[h+4],i,s),l=i,d=s,h+=7;break;case Tf:r=!0,e=Ef(l,d,c,u),h+=1;break;default:e=0}a.push(e),o+=e}return{total:o,segments:a,data:t,closed:r}},getDistancePoint(t,e,i,s){const{segments:n,data:r,total:o}=t;e=pl.number(e,o),s&&(e+=s),e>o&&(e%=o),e<0&&(e=o+e);let a,h,l,d,c,u,_,p,g,f=0,y={},m=0,x=0,w=0,v=0,b=0,S=0;const k=r.length;for(;m<k;){switch(d=r[m],d){case Sf:b=r[m+1],S=r[m+2];case kf:if(h=r[m+1],l=r[m+2],a=n[x],f+a>=e||!t.total){if(Pf(y,h,l),m)return Pf(Of,w,v),Lf(Of,y,e-f,!0),y.rotation=Rf(Of,y),y;{const e=Df.getDistancePoint(t,i,i,s);return y.rotation=e.rotation,y}}w=h,v=l,m+=3;break;case Bf:if(h=r[m+5],l=r[m+6],a=n[x],f+a>=e)return c=r[m+1],u=r[m+2],_=r[m+3],p=r[m+4],g=vf.getT(e-f,a,w,v,c,u,_,p,h,l,i),di.getPointAndSet(g,w,v,c,u,_,p,h,l,y),y.rotation=vf.getRotation(g,w,v,c,u,_,p,h,l),y;w=h,v=l,m+=7;break;case Tf:if(h=b,l=S,a=n[x],f+a>=e)return Pf(Of,w,v),Pf(y,h,l),Lf(Of,y,e-f,!0),y.rotation=Rf(Of,y),y;w=h,v=l,m+=1;break;default:a=0}x++,f+=a}return y},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=pl.number(e,t.total);let o,a,h,l,d,c,u,_,p,g,f=0,y={},m=0,x=0,w=0,v=0,b=0,S=0;const k=n.length;for(;m<k;){switch(d=n[m],d){case Sf:b=n[m+1],S=n[m+2];case kf:if(h=n[m+1],l=n[m+2],o=s[x],f+o>e||!t.total)return m||(w=h,v=l),Pf(Of,w,v),Pf(y,h,l),a=Cf(e-f),a&&(Lf(Of,y,a,!0),r.push(d,y.x,y.y)),r;w=h,v=l,m+=3,r.push(d,w,v);break;case Bf:if(c=n[m+1],u=n[m+2],_=n[m+3],p=n[m+4],h=n[m+5],l=n[m+6],o=s[x],f+o>e)return a=Cf(e-f),a&&(g=vf.getT(a,o,w,v,c,u,_,p,h,l,i),vf.cut(r,g,w,v,c,u,_,p,h,l)),r;w=h,v=l,m+=7,r.push(d,c,u,_,p,h,l);break;case Tf:if(h=b,l=S,o=s[x],f+o>e)return Pf(Of,w,v),Pf(y,h,l),a=Cf(e-f),a&&(Lf(Of,y,a,!0),r.push(kf,y.x,y.y)),r;w=h,v=l,m+=1,r.push(d);break;default:o=0}x++,f+=o}return r}};function Ff(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}de.add("motion-path"),Sl.register("motion",function(t,e,i,s){return c(t)&&(t=pl.number(t,s.getMotionTotal())),c(e)&&(e=pl.number(e,s.getMotionTotal())),Sl.number(t||0,e||0,i)}),Sl.register("motionRotation",function(t,e,i){return Sl.number(t,e,i)});const Mf=ed.prototype,{updateMatrix:If,updateAllMatrix:Wf}=vo,{updateBounds:zf}=Do,{toVertical:Nf}=ht,Yf={};function Xf(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Uf(t);i.total&&(t.__.__pathForRender=Df.getDistancePath(i,e,t.motionPrecision))}else{if(t.motionText)t.__updateMotionText();else{const i=t.getMotionPoint(e,t.motionAround);!1===t.motionRotation&&delete i.rotation,t.set(i)}t.__hasAutoLayout||(t.isBranch?(Wf(t),zf(t,t)):If(t))}i&&(t.leafer.created=!0)}}function Hf(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 Uf(t){const e=t.__;if(e.__pathForMotion)return e.__pathForMotion;return e.__pathForMotion=Df.getMotionPathData(t.getPath(!0,!0))}ed.addAttr("motionPath",void 0,Ff),ed.addAttr("motionPrecision",1,Ff),ed.addAttr("motion",void 0,Ff),ed.addAttr("motionAround",void 0,Ff),ed.addAttr("motionVertical","below",Ff),ed.addAttr("motionRotation",!0,Ff),Mf.getMotionPath=function(){return Hf(this)},Mf.getMotionPathData=function(){return Uf(Hf(this))},Mf.getMotionPoint=function(t,e,i=0,s=0,n){n||(n=Hf(this));const r=Uf(n);if(!r.total)return{};const o=Df.getDistancePoint(r,t,n.motionPrecision,i),{motionRotation:h}=this;return a(h)?o.rotation+=h:!1===h&&(o.rotation=0),e&&"top-left"!==e&&(St.toPoint(e,this.__layout.boxBounds,Yf),ht.set(Yf,o.x-Yf.x*this.scaleX,o.y-Yf.y*this.scaleY),o.rotation&&ht.rotate(Yf,o.rotation,o),ht.copy(o,Yf)),s&&Nf(o,o.rotation,s),Q.toOuterPoint(n.localTransform,o),o},Mf.getMotionTotal=function(){return this.getMotionPathData().total},Mf.__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],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Xf(t))}else Xf(this)};const{Yes:jf,NoAndSkip:Vf,YesAndSkip:qf}=e,Gf={},Kf={},Qf={};class Jf{constructor(t,e){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.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,n){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":Gf.id=t.substring(1),t=Gf;break;case".":Kf.className=t.substring(1),t=Kf;break;default:Qf.tag=t,t=Qf}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,n=d(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?p.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,n)}}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&&vo.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),"boolean"==typeof r&&(r=r?1:0),r===jf||r===qf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Vf&&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_(Zo.REMOVE,this.__onRemoveChild,this),this.target.on_(ta.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 Zf=ed.prototype;function $f(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())}Zf.find=function(t,e){return $f(this).getBy(t,this,!1,e)},Zf.findOne=function(t,e){return $f(this).getBy(t,this,!0,e)},de.add("find"),ce.finder=function(t,e){return new Jf(t,e)},vo.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)};export{Tt as AlignHelper,Yg as Animate,Wg as AnimateEasing,Ng as AnimateEvent,Xg as AnimateList,e as Answer,ic as App,St as AroundHelper,Kt as AutoBounds,di as BezierHelper,qt as Bounds,sa as BoundsEvent,Ht as BoundsHelper,ud as Box,Ol as BoxData,Dh as Branch,Do as BranchHelper,Za as BranchRender,Gd as Canvas,Vl as CanvasData,me as CanvasManager,Zo as ChildEvent,_l as ColorConvert,ce as Creator,Qc as Cursor,p as DataHelper,se as Debug,wt as Direction4,vt as Direction9,mc as DragBoundsHelper,Sc as DragEvent,zc as Dragger,Bc as DropEvent,xl as Effect,bd as Ellipse,Wl as EllipseData,xi as EllipseHelper,Jo as Event,fe as EventCreator,wa as Eventer,vl as Export,tr as FileHelper,wl as Filter,Jf as Finder,k as FourNumberHelper,_d as Frame,Fl as FrameData,id as Group,Al as GroupData,vf as HighBezierHelper,Df as HighCurveHelper,Jc as HitCanvasManager,Vd as Image,jl as ImageData,ia as ImageEvent,hr as ImageManager,y as IncrementId,uu as Interaction,Kc as InteractionBase,Oc as InteractionHelper,Ac as KeyEvent,nc as Keyboard,ca as LayoutEvent,$h as Layouter,Vh as LayouterHelper,kh as Leaf,Ga as LeafBounds,Eo as LeafBoundsHelper,f as LeafData,Oa as LeafDataProxy,La as LeafEventer,vo as LeafHelper,Qo as LeafLayout,Mh as LeafLevelList,Fh as LeafList,Na as LeafMatrix,Ka as LeafRender,rd as Leafer,Wh as LeaferCanvas,De as LeaferCanvasBase,Dl as LeaferData,_a as LeaferEvent,_r as LeaferFilm,ur as LeaferImage,pr as LeaferVideo,jd as Line,Ml as LineData,F as MathHelper,ft as Matrix,Q as MatrixHelper,Tc as MoveEvent,kc as MyDragEvent,qd as MyImage,vc as MyPointerEvent,Pc as MyTouchEvent,ze as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,z as PI_2,fl as Paint,ml as PaintGradient,yl as PaintImage,tc as Path,gl as PathArrow,Yn as PathBounds,Ps as PathCommandDataHelper,Ie as PathCommandMap,wi as PathCommandNodeHelper,ns as PathConvert,Kn as PathCorner,qs as PathCreator,Yl as PathData,ln as PathDrawer,Fe as PathHelper,t as PathNodeHandleType,He as PathNumberCommandLengthMap,Xe as PathNumberCommandMap,ec as Pen,Xl as PenData,rl as Picker,te as Platform,de as Plugin,pt as Point,ht as PointHelper,rc as PointerButton,wc as PointerEvent,Ed as Polygon,zl as PolygonData,ta as PropertyEvent,od as Rect,Il as RectData,Ue as RectHelper,$l as RectRender,ua as RenderEvent,el as Renderer,la as ResizeEvent,or as Resource,Kp as Robot,Gp as RobotData,Rc as RotateEvent,ae as Run,ol as Selector,Id as Star,Nl as StarData,bl as State,Jt as StringNumberMap,Ec as SwipeEvent,sr as TaskItem,nr as TaskProcessor,$d as Text,ul as TextConvert,Ul as TextData,Cc as TouchEvent,Sl as Transition,mt as TwoPointBoundsHelper,ed as UI,Kl as UIBounds,_e as UICreator,El as UIData,oc as UIEvent,Jl as UIRender,pl as UnitConvert,Qt as UnitConvertHelper,No as WaitHelper,da as WatchEvent,Nh as Watcher,Lc as ZoomEvent,Fr as affectRenderBoundsType,Ar as affectStrokeBoundsType,xr as attr,kr as autoLayoutType,Cr as boundsType,$n as canvasPatch,Oe as canvasSizeAttrs,cl as createAttr,yr as createDescriptor,Qr as cursorType,Jr as dataProcessor,vr as dataType,mr as decorateLeafAttr,$r as defineDataProcessor,gr as defineKey,wr as defineLeafAttr,Wr as dimType,Rr as doBoundsType,Or as doStrokeType,Ir as doSurfaceType,al as effectType,i as emptyData,Gr as eraserType,ea as extraPropertyEventMap,dl as frameType,Y as getBoundsData,fr as getDescriptor,X as getMatrixData,N as getPointData,Kr as hitType,d as isArray,u as isData,_ as isEmptyData,o as isFinite,n as isNull,a as isNumber,c as isObject,r as isString,bo as isTrackChanges,s as isUndefined,Zr as layoutProcessor,ma as leaferTransformAttrMap,Vr as maskType,Ff as motionPathType,Pr as naturalBoundsType,zr as opacityType,Qn as path,Er as pathInputType,Lr as pathType,Jn as pen,br as positionType,As as registerPointsCurve,ao as registerUI,ho as registerUIEvent,hl as resizeType,so as rewrite,no as rewriteAble,Tr as rotationType,Br as scaleType,Sr as scrollType,Ur as sortType,Jp as stateStyleType,Qp as stateType,Dr as strokeType,Mr as surfaceType,Gt as tempBounds,yt as tempMatrix,gt as tempPoint,l as tryToNumber,zh as useCanvas,oo as useModule,Ih as version,Nr as visibleType,ll as zoomLayerType};
|
|
1
|
+
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(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 g(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&g(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let n in this)"_"!==n[0]&&(i=e?e[n]:void 0,t[n]=s(i)?this[n]: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(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:n}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!s(t))){if("path"===r&&!this.__pathInputed)continue;e=n?n[r]:void 0,i[r]=s(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,this.__complexData&&this.__complexData.destroy()}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CANVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(S,t,e,i,s),toTempAB(t,e,i){v=i?a(t)?e:t:[],a(t)?(x=C(t),w=e):a(e)?(x=t,w=C(e)):(x=t,w=e),4!==x.length&&(x=T(x)),4!==w.length&&(w=T(w))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(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]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?b(t,e):(P(t,e,i),B(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(P(t,e,i),B(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,h,l]=4===t.length?t:T(t);return B(n,h*i,l*e,r*i,o*e)}},{set:B,get:T,setTemp:C,toTempAB:P}=k,{round:R,pow:E,max:L,floor:A,PI:O}=Math,D={},F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.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=s(e)?1e12:E(10,e);return-0===(t=R(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&F.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:r,scaleY:o}=t;if((s||e)&&(r<0&&(r=-r),o<0&&(o=-o)),e)if(!0===e)r=o=i?1:1/r;else{let t;a(e)?t=e:"zoom-in"===e&&(t=1),t&&(r=o=r>t||o>t?i?1:1/r:i?1:1/t)}return D.scaleX=r,D.scaleY=o,D},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(A(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const I=O/180,W=2*O,N=O/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:U,sqrt:V}=Math,{float:q}=F,G={};function K(){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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:K(),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:X,getWorld:K,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},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){J.toInnerPoint(t,e,G),J.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=j(e*=I),a=H(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){J.toInnerPoint(t,e,G),J.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=I,t.a=s+r*i,t.b=n+o*i),e&&(e*=I,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,G),J.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.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,n,r){const{e:o,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){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){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.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,n,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:n}=e,r=i*I,o=j(r),a=H(r);if(s||n){const e=s*I,i=n*I;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||n)&&J.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=V(n*n+r*r),c=t/d;const e=n/d;u=r>0?U(e):-U(e)}else{c=V(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?U(-e):-U(e))}const e=q(j(u)),i=H(u);d=q(d),c=q(c),_=e?q((o/c+i)/e/I,9):0,p=e?q((r/d-i)/e/I,9):0,u=q(u/I)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=V(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Q,{float:Z}=F,{toInnerPoint:$,toOuterPoint:tt}=Q,{sin:et,cos:it,abs:st,sqrt:nt,atan2:rt,min:ot,round:at}=Math,ht={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=s(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?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i,s=1,n=1){i||(i=lt.defaultPoint);const r=it(e*=I),o=et(e),a=(t.x-i.x)/s,h=(t.y-i.y)/n;t.x=i.x+(a*r-h*o)*s,t.y=i.y+(a*o+h*r)*n},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ct(t,e),ut(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},toVertical(t,e,i,s){const n=e*I;t.x+=-Math.sin(n)*i,t.y+=Math.cos(n)*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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=st(i-t),r=st(s-e);return nt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>ot(dt(t,e,i,s),dt(i,s,n,r)),getAngle:(t,e,i,s)=>_t(t,e,i,s)/I,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,n,r,o,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e,i=1,s=1)=>rt((e.y-t.y)/s,(e.x-t.x)/i),getDistancePoint(t,e,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+it(r)*i,e.y=t.y+et(r)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){t.x=t.y=0}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:_t}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e,i,s){return ht.rotate(this,t,e,i,s),this}rotateOf(t,e,i,s){return ht.rotate(this,e,t,i,s),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(ht.getDistancePoint(this,t,e,i,s))}getAngle(t,e,i){return ht.getAngle(this,t,e,i)}getAtan2(t,e,i){return ht.getAtan2(this,t,e,i)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const gt=new pt;class ft{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),this}setWith(t){return Q.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 ft(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){return Q.reset(this),this}}const yt=new ft,mt={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){xt(t,e,i),xt(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:xt}=mt;var wt,vt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(vt||(vt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const St={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,i,s,n,r){const o=kt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),St.toPoint(t,e,i,s),i)};function kt(t){return r(t)?bt[vt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,r){Bt(t,i,s,n,e,r)}},{tempPointBounds:Ct,setPoint:Pt,addPoint:Rt,toBounds:Et}=mt,{toOuterPoint:Lt}=Q,{float:At,fourNumber:Ot}=F,{floor:Dt,ceil:Ft}=Math;let Mt,It,Wt,Nt;const zt={},Yt={},Xt={},Ht={tempBounds:Xt,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(d(i)){const e=Ot(i);s?jt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.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},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else zt.x=t.x,zt.y=t.y,Lt(e,zt,Yt),Pt(Ct,Yt.x,Yt.y),zt.x=t.x+t.width,Lt(e,zt,Yt),Rt(Ct,Yt.x,Yt.y),zt.y=t.y+t.height,Lt(e,zt,Yt),Rt(Ct,Yt.x,Yt.y),zt.x=t.x,Lt(e,zt,Yt),Rt(Ct,Yt.x,Yt.y),Et(Ct,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),r(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Xt.width=n?e.width*=s:e.width*s,Xt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Xt,t,o,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Mt=t.x+t.width,It=t.y+t.height,Wt=e.x,Nt=e.y,i||(Wt+=e.width,Nt+=e.height),Mt=Mt>Wt?Mt:Wt,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=Mt-t.x,t.height=It-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Vt(t,n)):Ut(t,n));r&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Ct,t.x,t.y):Rt(Ct,t.x,t.y)),Et(Ct,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Ut(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}]},getPoint:(t,e,i=!1,s)=>St.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=ht.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=ht.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=jt.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=jt.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=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Mt=s+r,It=n+o,Wt=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Mt=Mt<Wt?Mt:Wt,It=It<Nt?It:Nt,r=Mt-s,o=It-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){jt.copy(t,jt.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,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Ht,{add:Ut,copy:Vt}=jt;class qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Ht.copy(this,t):Ht.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 qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Gt=new qt;class Kt{constructor(t,e,i,s,n,r){c(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 qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Jt={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},{floor:Zt,max:$t}=Math,te={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},origin:{},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ee.maxCacheSize),isSuperLarge:(t,e,i)=>ee.isLarge(t,e,i,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ee;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=$t(Zt(e+(s||0)),1),c=$t(Zt(i+(n||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=te.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ee.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:ee}=te,{randColor:ie}=F;class se{constructor(t){this.repeatMap={},this.name=t}static get(t){return new se(t)}static set filter(t){this.filterList=ne(t)}static set exclude(t){this.excludeList=ne(t)}static drawRepaint(t,e){const i=ie();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===se.showBounds,n=t.__nowWorld,r=ie();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(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.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 ne(t){return t?r(t)&&(t=[t]):t=[],t}se.filterList=[],se.excludeList=[],se.showWarn=!0;const re=se,oe=se.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=y.create(y.RUNTIME);return he.currentId=he.idMap[i]=e?performance.now():Date.now(),he.currentName=he.nameMap[i]=t,he.nameToIdMap[t]=i,i},end(t,e){const i=he.idMap[t],s=he.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[s]=void 0,oe.log(s,n,"ms")},endOfName(t,e){const i=he.nameToIdMap[t];s(i)||he.end(i,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=se.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,i,n,r,o){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:pe}=_e,ge=se.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(ye[e]&&ge.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=fe;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ce.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(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 we(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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Be=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;be.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){c(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}};xe([ve("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),xe([ve("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),xe([ve("globalAlpha")],Be.prototype,"opacity",void 0),xe([ve()],Be.prototype,"fillStyle",void 0),xe([ve()],Be.prototype,"strokeStyle",void 0),xe([ve("lineWidth")],Be.prototype,"strokeWidth",void 0),xe([ve("lineCap")],Be.prototype,"strokeCap",void 0),xe([ve("lineJoin")],Be.prototype,"strokeJoin",void 0),xe([ve("lineDashOffset")],Be.prototype,"dashOffset",void 0),xe([ve()],Be.prototype,"miterLimit",void 0),xe([ve()],Be.prototype,"shadowBlur",void 0),xe([ve()],Be.prototype,"shadowColor",void 0),xe([ve()],Be.prototype,"shadowOffsetX",void 0),xe([ve()],Be.prototype,"shadowOffsetY",void 0),xe([ve()],Be.prototype,"filter",void 0),xe([ve()],Be.prototype,"font",void 0),xe([ve()],Be.prototype,"fontKerning",void 0),xe([ve()],Be.prototype,"fontStretch",void 0),xe([ve()],Be.prototype,"fontVariantCaps",void 0),xe([ve()],Be.prototype,"textAlign",void 0),xe([ve()],Be.prototype,"textBaseline",void 0),xe([ve()],Be.prototype,"textRendering",void 0),xe([ve()],Be.prototype,"wordSpacing",void 0),xe([ve()],Be.prototype,"letterSpacing",void 0),xe([ve()],Be.prototype,"direction",void 0),xe([Se()],Be.prototype,"setTransform",null),xe([Se()],Be.prototype,"resetTransform",null),xe([Se()],Be.prototype,"getTransform",null),xe([Se()],Be.prototype,"save",null),xe([Se()],Be.prototype,"restore",null),xe([Se()],Be.prototype,"translate",null),xe([Se()],Be.prototype,"scale",null),xe([Se()],Be.prototype,"rotate",null),xe([Se()],Be.prototype,"fill",null),xe([Se()],Be.prototype,"stroke",null),xe([Se()],Be.prototype,"clip",null),xe([Se()],Be.prototype,"fillRect",null),xe([Se()],Be.prototype,"strokeRect",null),xe([Se()],Be.prototype,"clearRect",null),xe([Se()],Be.prototype,"beginPath",null),xe([Se()],Be.prototype,"moveTo",null),xe([Se()],Be.prototype,"lineTo",null),xe([Se()],Be.prototype,"bezierCurveTo",null),xe([Se()],Be.prototype,"quadraticCurveTo",null),xe([Se()],Be.prototype,"closePath",null),xe([Se()],Be.prototype,"arc",null),xe([Se()],Be.prototype,"arcTo",null),xe([Se()],Be.prototype,"ellipse",null),xe([Se()],Be.prototype,"rect",null),xe([Se()],Be.prototype,"roundRect",null),xe([Se()],Be.prototype,"createConicGradient",null),xe([Se()],Be.prototype,"createLinearGradient",null),xe([Se()],Be.prototype,"createPattern",null),xe([Se()],Be.prototype,"createRadialGradient",null),xe([Se()],Be.prototype,"fillText",null),xe([Se()],Be.prototype,"measureText",null),xe([Se()],Be.prototype,"strokeText",null);const{copy:Te,multiplyParent:Ce,pixelScale:Pe}=Q,{round:Re}=Math,Ee=new qt,Le=new qt,Ae={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class De extends Be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ae),this.manager=e,this.innerId=y.create(y.CANVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||te.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;p.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!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&&Ce(t,e,n),Pe(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Re(n.e-.5)+.5,n.f=Re(n.f-.5)+.5):(n.e=Re(n.e),n.f=Re(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:n,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(r=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Le):i=Ee,this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){if(this.setTempPixelBounds(t,!0,!0),!Ee.width||!Ee.height)return;let e,i;const{context:s}=this,n=s.getImageData(Ee.x,Ee.y,Ee.width,Ee.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,Ee.x,Ee.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,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ee.x,Ee.y,Ee.width,Ee.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ee.x,Ee.y,Ee.width,Ee.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ee,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Le,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ce.canvas(Object.assign({},i));return n.save(),t&&(Te(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Fe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Me),We={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},Ne={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},ze=Object.assign(Object.assign({},Ne),Me),Ye=Ie,Xe={};for(let t in Ye)Xe[Ye[t]]=t;const He={};for(let t in Ye)He[Ye[t]]=We[t];const je={drawRoundRect(t,e,i,s,n,r){const o=F.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ue,cos:Ve,hypot:qe,atan2:Ge,ceil:Ke,abs:Qe,PI:Je,sqrt:Ze,pow:$e}=Math,{setPoint:ti,addPoint:ei}=mt,{set:ii,toNumberPoints:si}=ht,{M:ni,L:ri,C:oi,Q:ai,Z:hi}=Ie,li={},di={points(t,e,i,s){let n=si(e);if(t.push(ni,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y,m,x=n.length;const w=!0===i?.5:i;s&&(n=[n[x-2],n[x-1],...n,n[0],n[1],n[2],n[3]],x=n.length);for(let i=2;i<x-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=o-e,g=a-r,f=Ze($e(p,2)+$e(g,2)),y=Ze($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(ai,d,c,o,a):(p||g)&&t.push(oi,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(ai,u,_,n[x-2],n[x-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ri,n[e],n[e+1]);s&&t.push(hi)},rect(t,e,i,s,n){Fe.creator.path=t,Fe.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){Fe.creator.path=[],je.drawRoundRect(Fe.creator,e,i,s,n,r),t.push(...Fe.convertToCanvasData(Fe.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,p=o-n;let g=Ge(u,c),f=Ge(p,_);const y=qe(c,u),m=qe(_,p);let x=f-g;if(x<0&&(x+=W),y<1e-12||m<1e-12||x<1e-12||Qe(x-Je)<1e-12)return t&&t.push(ri,s,n),h&&(ti(h,e,i),ei(h,s,n)),d&&ii(d,e,i),void(l&&ii(l,s,n));const w=c*p-_*u<0,v=w?-1:1,b=a/Ve(x/2),S=s+b*Ve(g+x/2+N*v),k=n+b*Ue(g+x/2+N*v);return g-=N*v,f-=N*v,_i(t,S,k,a,a,0,g/I,f/I,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>_i(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*I,_=Ue(u),p=Ve(u);let g=o*I,f=a*I;g>Je&&(g-=W),f<0&&(f+=W);let y=f-g;if(y<0?y+=W:y>W&&(y-=W),h){360===Qe(a-o)?y=-W:y-=W}const m=Ke(Qe(y/N)),x=y/m,w=Ue(x/4),v=8/3*w*w/Ue(x/2);f=g+x;let b,S,k,B,T,C,P,R,E=Ve(g),L=Ue(g),A=k=p*s*E-_*n*L,O=B=_*s*E+p*n*L,D=e+k,F=i+B;t&&t.push(t.length?ri:ni,D,F),l&&ti(l,D,F),c&&ii(c,D,F);for(let r=0;r<m;r++)b=Ve(f),S=Ue(f),k=p*s*b-_*n*S,B=_*s*b+p*n*S,T=e+A-v*(p*s*L+_*n*E),C=i+O-v*(_*s*L-p*n*E),P=e+k+v*(p*s*S+_*n*b),R=i+B+v*(_*s*S-p*n*b),t&&t.push(oi,T,C,P,R,e+k,i+B),l&&ui(e+A,i+O,T,C,P,R,e+k,i+B,l,!0),A=k,O=B,E=b,L=S,g=f,f+=x;d&&ii(d,e+k,i+B)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(oi,(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){ui(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,x=t,w=i,v=n,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=s,v=r,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ei(h,t,e):ti(h,t,e),ei(h,o,a);for(let l=0,c=d.length;l<c;l++)ci(d[l],t,e,i,s,n,r,o,a,li),ei(h,li.x,li.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 ci(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},cut(t,e,i,s,n,r,o,a,h){if(t<=0)return{left:null,right:[s,n,r,o,a,h]};if(t>=1)return{left:[s,n,r,o,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+n*t,u=s*l+r*t,_=n*l+o*t,p=r*l+a*t,g=o*l+h*t,f=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+x*t],right:[m,x,p,g,a,h]}}},{getPointAndSet:ci,toTwoPointBounds:ui,ellipse:_i}=di,{sin:pi,cos:gi,sqrt:fi,atan2:yi}=Math,{ellipse:mi}=di,xi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=r*I,p=pi(_),g=gi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,x=n*n,w=y*y,v=f*f,b=m*x-m*w-x*v;let S=0;if(b<0){const t=fi(1-b/(m*x));s*=t,n*=t}else S=(o===a?-1:1)*fi(b/(m*w+x*v));const k=S*s*y/n,B=-S*n*f/s,T=yi((y-B)/n,(f-k)/s),C=yi((-y-B)/n,(-f-k)/s);let P=C-T;0===a&&P>0?P-=W:1===a&&P<0&&(P+=W);const R=e+c+g*k-p*B,E=i+u+p*k+g*B,L=P<0?1:0;d||te.ellipseToCurve?mi(t,R,E,s,n,r,T/I,C/I,L):s!==n||r?t.push(Ie.G,R,E,s,n,r,T/I,C/I,L):t.push(Ie.O,R,E,s,T/I,C/I,L)}},wi={toCommand:t=>[],toNode:(t,e)=>[]},{M:vi,m:bi,L:Si,l:ki,H:Bi,h:Ti,V:Ci,v:Pi,C:Ri,c:Ei,S:Li,s:Ai,Q:Oi,q:Di,T:Fi,t:Mi,A:Ii,a:Wi,Z:Ni,z:zi,N:Yi,D:Xi,X:Hi,G:ji,F:Ui,O:Vi,P:qi,U:Gi}=Ie,{rect:Ki,roundRect:Qi,arcTo:Ji,arc:Zi,ellipse:$i,quadraticCurveTo:ts}=di,{ellipticalArc:es}=xi,is=se.get("PathConvert"),ss={},ns={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=He[s],a+=s===n?" ":Xe[s];for(let s=1;s<i;s++)a+=F.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?ze:Ne;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(rs.dot&&(os(o,r),r=""),rs.dot++),"0"===r&&"."!==s&&(os(o,r),r=""),r+=s):Ie[s]?(r&&(os(o,r),r=""),rs.name=Ie[s],rs.length=We[s],rs.index=0,os(o,rs.name),"m"===s?rs.name=Ie.l:"M"===s&&(rs.name=Ie.L),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&os(o,r),r=s):r&&(os(o,r),r=""),n=s;return r&&os(o,r),i?ns.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const g=[];for(;_<p;){switch(n=t[_],n){case bi:t[_+1]+=a,t[_+2]+=h;case vi:a=c=t[_+1],h=u=t[_+2],g.push(vi,a,h),_+=3;break;case Ti:t[_+1]+=a;case Bi:a=t[_+1],g.push(Si,a,h),_+=2;break;case Pi:t[_+1]+=h;case Ci:h=t[_+1],g.push(Si,a,h),_+=2;break;case ki:t[_+1]+=a,t[_+2]+=h;case Si:a=t[_+1],h=t[_+2],g.push(Si,a,h),_+=3;break;case Ai:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,n=Li;case Li:o=r===Ri||r===Li,l=o?2*a-i:a,d=o?2*h-s:h,i=t[_+1],s=t[_+2],a=t[_+3],h=t[_+4],g.push(Ri,l,d,i,s,a,h),_+=5;break;case Ei:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,t[_+5]+=a,t[_+6]+=h,n=Ri;case Ri:i=t[_+3],s=t[_+4],a=t[_+5],h=t[_+6],g.push(Ri,t[_+1],t[_+2],i,s,a,h),_+=7;break;case Mi:t[_+1]+=a,t[_+2]+=h,n=Fi;case Fi:o=r===Oi||r===Fi,i=o?2*a-i:a,s=o?2*h-s:h,e?ts(g,a,h,i,s,t[_+1],t[_+2]):g.push(Oi,i,s,t[_+1],t[_+2]),a=t[_+1],h=t[_+2],_+=3;break;case Di:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,n=Oi;case Oi:i=t[_+1],s=t[_+2],e?ts(g,a,h,i,s,t[_+3],t[_+4]):g.push(Oi,i,s,t[_+3],t[_+4]),a=t[_+3],h=t[_+4],_+=5;break;case Wi:t[_+6]+=a,t[_+7]+=h;case Ii:es(g,a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],e),a=t[_+6],h=t[_+7],_+=8;break;case zi:case Ni:g.push(Ni),a=c,h=u,_++;break;case Yi:a=t[_+1],h=t[_+2],e?Ki(g,a,h,t[_+3],t[_+4]):as(g,t,_,5),_+=5;break;case Xi:a=t[_+1],h=t[_+2],e?Qi(g,a,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):as(g,t,_,9),_+=9;break;case Hi:a=t[_+1],h=t[_+2],e?Qi(g,a,h,t[_+3],t[_+4],t[_+5]):as(g,t,_,6),_+=6;break;case ji:$i(e?g:as(g,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,ss),a=ss.x,h=ss.y,_+=9;break;case Ui:e?$i(g,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):as(g,t,_,5),a=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case Vi:Zi(e?g:as(g,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,ss),a=ss.x,h=ss.y,_+=7;break;case qi:e?Zi(g,t[_+1],t[_+2],t[_+3],0,360,!1):as(g,t,_,4),a=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case Gi:Ji(e?g:as(g,t,_,6),a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,ss),a=ss.x,h=ss.y,_+=6;break;default:return is.error(`command: ${n} [index:${_}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return wi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(Si,t.x,t.y);break;case"C":e.push(Ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ni)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:os,copyData:as}=ns,{M:hs,L:ls,C:ds,Q:cs,Z:us,N:_s,D:ps,X:gs,G:fs,F:ys,O:ms,P:xs,U:ws}=Ie,{getMinDistanceFrom:vs,getRadianFrom:bs}=ht,{tan:Ss,min:ks,abs:Bs}=Math,Ts={},Cs=se.get("PointsCurve"),Ps={pointsCurveList:{},beginPath(t){t.length=0},moveTo(t,e,i){t.push(hs,e,i)},lineTo(t,e,i){t.push(ls,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ds,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(cs,e,i,s,n)},closePath(t){t.push(us)},rect(t,e,i,s,n){t.push(_s,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(gs,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(_s,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){if(s===r)return Es(t,e,i,s,a,h,l);n(o)?t.push(ys,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(fs,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(xs,e,i,s):(n(r)&&(r=0),n(o)&&(o=360),t.push(ms,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h,l){if(!s(a)){const t=vs(a,h,e,i,n,r)/(l?1:2);o=ks(o,ks(t,t*Bs(Ss(bs(a,h,e,i,n,r)/2))))}t.push(ws,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){di.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Ts),t.push(hs,Ts.x,Ts.y),Rs(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){di.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,Ts),t.push(hs,Ts.x,Ts.y),Es(t,e,i,s,r,o,a)},drawPoints(t,e,i,s,n){let r="Q";c(i)&&(r=i.type,i=i.value),Ls[r]||(Cs.warn("not found:",r),r="Q"),Ls[r](t,e,i,s,n)}},{ellipse:Rs,arc:Es,pointsCurveList:Ls}=Ps;function As(t,e){Ls[t]&&Cs.repeat(t),Ls[t]=e}As("Q",di.points);const{moveTo:Os,lineTo:Ds,quadraticCurveTo:Fs,bezierCurveTo:Ms,closePath:Is,beginPath:Ws,rect:Ns,roundRect:zs,ellipse:Ys,arc:Xs,arcTo:Hs,drawEllipse:js,drawArc:Us,drawPoints:Vs}=Ps;class qs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Fe.parse(t):t:[],this}beginPath(){return Ws(this.__path),this.paint(),this}moveTo(t,e){return Os(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ds(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ms(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Fs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Is(this.__path),this.paint(),this}rect(t,e,i,s){return Ns(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return zs(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ys(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Xs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Hs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return js(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Us(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Vs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Gs,L:Ks,C:Qs,Q:Js,Z:Zs,N:$s,D:tn,X:en,G:sn,F:nn,O:rn,P:on,U:an}=Ie,hn=se.get("PathDrawer"),ln={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Gs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ks:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Qs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.closePath(),s+=1;break;case $s:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case tn: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 en:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case sn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case nn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case rn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case on:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case an:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void hn.error(`command: ${i} [index:${s}]`,e)}},drawPathByPoints(t,e,i){}},{M:dn,L:cn,C:un,Q:_n,Z:pn,N:gn,D:fn,X:yn,G:mn,F:xn,O:wn,P:vn,U:bn}=Ie,{toTwoPointBounds:Sn,toTwoPointBoundsByQuadraticCurve:kn,arcTo:Bn,arc:Tn,ellipse:Cn}=di,{addPointBounds:Pn,copy:Rn,addPoint:En,setPoint:Ln,addBounds:An,toBounds:On}=mt,Dn=se.get("PathBounds");let Fn,Mn,In;const Wn={},Nn={},zn={},Yn={toBounds(t,e){Yn.toTwoPointBounds(t,Nn),On(Nn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ln(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===pn||o===un||o===_n?Ln(e,h,l):Ln(e,t[a+1],t[a+2])),o){case dn:case cn:h=t[a+1],l=t[a+2],En(e,h,l),a+=3;break;case un:n=t[a+5],r=t[a+6],Sn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Wn),Pn(e,Wn),h=n,l=r,a+=7;break;case _n:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],kn(h,l,i,s,n,r,Wn),Pn(e,Wn),h=n,l=r,a+=5;break;case pn:a+=1;break;case gn:h=t[a+1],l=t[a+2],An(e,h,l,t[a+3],t[a+4]),a+=5;break;case fn:case yn:h=t[a+1],l=t[a+2],An(e,h,l,t[a+3],t[a+4]),a+=o===fn?9:6;break;case mn:Cn(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],Wn,zn),0===a?Rn(e,Wn):Pn(e,Wn),h=zn.x,l=zn.y,a+=9;break;case xn:h=t[a+1],l=t[a+2],Mn=t[a+3],In=t[a+4],An(e,h-Mn,l-In,2*Mn,2*In),h+=Mn,a+=5;break;case wn:Tn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Wn,zn),0===a?Rn(e,Wn):Pn(e,Wn),h=zn.x,l=zn.y,a+=7;break;case vn:h=t[a+1],l=t[a+2],Fn=t[a+3],An(e,h-Fn,l-Fn,2*Fn,2*Fn),h+=Fn,a+=4;break;case bn:Bn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Wn,zn),0===a?Rn(e,Wn):Pn(e,Wn),h=zn.x,l=zn.y,a+=6;break;default:return void Dn.error(`command: ${o} [index:${a}]`,t)}}},{M:Xn,L:Hn,Z:jn}=Ie,{getCenterX:Un,getCenterY:Vn}=ht,{arcTo:qn}=Ps,{float:Gn}=F,Kn={smooth(t,e,i){let s,n,r,o,a,h,l=0,c=0,u=0,_=0,p=0,g=0,f=0,y=0,m=0;d(e)&&(e=e[0]||0);const x=t.length,w=9===x,v=[];for(;l<x;){switch(s=t[l],s){case Xn:h=v.length,h&&n!==jn&&(v[o]=_,v[a]=p),_=y=t[l+1],p=m=t[l+2],l+=3,t[l]===Hn?(g=t[l+1],f=t[l+2],w?v.push(Xn,_,p):v.push(Xn,Un(_,g),Vn(p,f))):v.push(Xn,_,p),o=h+1,a=h+2;break;case Hn:switch(c=t[l+1],u=t[l+2],l+=3,t[l]){case Hn:qn(v,c,u,t[l+1],t[l+2],e,y,m,w);break;case jn:Gn(c)===Gn(_)&&Gn(u)===Gn(p)?(c=y,u=m):qn(v,c,u,_,p,e,y,m,w);break;default:v.push(Hn,c,u)}y=c,m=u;break;case jn:n!==jn&&(qn(v,_,p,g,f,e,y,m,w),v.push(jn)),l+=1;break;default:r=He[s];for(let e=0;e<r;e++)v.push(t[l+e]);l+=r}n=s}return s!==jn&&(v[o]=_,v[a]=p),v}};function Qn(t){return new qs(t)}const Jn=Qn();Fe.creator=Qn(),Fe.parse=ns.parse,Fe.convertToCanvasData=ns.toCanvasData;const{drawRoundRect:Zn}=je;function $n(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Zn(this,t,e,i,s,n)})}(t)}const tr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=er.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{}}}},er=tr;er.mineType=er.mimeType,er.alphaPixelTypes.forEach(t=>er.upperCaseTypeMap[t]=t.toUpperCase());const ir=se.get("TaskProcessor");class sr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return we(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){ir.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class nr{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&&p.assign(this.config,t),this.empty()}add(t,e,i){let n,r,o,h;const l=new sr(t);return l.parent=this,a(e)?h=e:e&&(r=e.parallel,n=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}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.run()}),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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)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 rr=se.get("Resource"),or={tasker:new nr,queue:new nr({parallel:1}),map:{},get isComplete(){return ar.tasker.isComplete},set(t,e){ar.map[t]&&rr.repeat(t),ar.map[t]=e},get:t=>ar.map[t],remove(t){const e=ar.map[t];e&&(e.destroy&&e.destroy(),delete ar.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ce.image(s)),ar.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){ar.map={}}},ar=or,hr={maxRecycled:10,recycledList:[],patternTasker:or.queue,get(t,e){let i=or.get(t.url);return i||or.set(t.url,i=ce[e||"image"](t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(te.image.isLarge(t)?t.url&&or.remove(t.url):(t.clearLevels(),lr.recycledList.push(t)))})},recyclePaint(t){lr.recycle(t.image)},clearRecycled(t){const e=lr.recycledList;(e.length>lr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&or.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>tr.alphaPixelTypes.some(e=>lr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+tr.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+tr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},lr=hr,{IMAGE:dr,create:cr}=y;class ur{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?te.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=cr(dr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}hr.isFormat("svg",t)&&(this.isSVG=!0),hr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,or.tasker.add(()=>we(this,void 0,void 0,function*(){return yield te.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),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||(this.width=t.width,this.height=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,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=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 h=te.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=te.canvas.createPattern(t,e);return te.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class _r extends ur{get tag(){return"Film"}}class pr extends ur{get tag(){return"Video"}}function gr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function fr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function yr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function mr(t,e){return(i,s)=>wr(i,s,t,e&&e(s))}function xr(t){return t}function wr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};gr(t,e,Object.assign(n,s||{})),$r(t,e,i)}function vr(t){return mr(t)}function br(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Sr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function kr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Rr(this))}}))}function Br(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Tr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Cr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i,e)&&Rr(this)}}))}function Pr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(Rr(this),this.__.__removeNaturalSize())}}))}function Rr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Er(t){return mr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Rr(this)}}))}const Lr=Cr;function Ar(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i)&&(Or(this),e&&(this.__.__useStroke=!0))}}))}function Or(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Rr(t)}const Dr=Ar;function Fr(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Mr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&Ir(this)}}))}function Ir(t){t.__layout.surfaceChanged||t.__layout.surfaceChange()}function Wr(t){return mr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Nr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Yr(this)}}))}function zr(t){return mr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Xr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Xr(this,t,e,i),this.mask&&Yr(this)}}))}function Yr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Xr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Rr(t))}function Hr(t){t.__layout.childrenSortChange(),t.__.flow&&t.__layout.boxChange()}function jr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParentChange(Hr)}}))}function Ur(t){t.__updateMask()}function Vr(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i)&&(this.__layout.boxChanged||this.__layout.boxChange(),e?this.__updateMask():this.waitParentChange(Ur))}}))}function qr(t){t.__updateEraser()}function Gr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParentChange(qr)}}))}function Kr(t){return mr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Qr(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Jr(t){return(e,i)=>{gr(e,"__DataProcessor",{get:()=>t})}}function Zr(t){return(e,i)=>{gr(e,"__LayoutProcessor",{get:()=>t})}}function $r(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=yr(e,i);if(s(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(c(i)){const t=_(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=fr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),gr(n,e,a)}const to=new se("rewrite"),eo=[],io=["destroy","constructor"];function so(t){return(e,i)=>{eo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function no(){return t=>{ro()}}function ro(t){eo.length&&(eo.forEach(e=>{t&&to.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),eo.length=0)}function oo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(io.includes(s)||e&&e.includes(s)))if(t.prototype){const e=fr(t.prototype,s);e&&Object.defineProperty(i.prototype,s,e)}else i.prototype[s]=t[s]})}}function ao(){return t=>{_e.register(t)}}function ho(){return t=>{fe.register(t)}}setTimeout(()=>ro(!0));const{copy:lo,toInnerPoint:co,toOuterPoint:uo,scaleOfOuter:_o,rotateOfOuter:po,skewOfOuter:go,multiplyParent:fo,divideParent:yo,getLayout:mo}=Q,xo={},{round:wo}=Math,vo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Bo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)ko(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,e){const i=t.__layout;i.boundsChanged&&t.__updateLocalBounds(),e&&(i.resized=void 0),i.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)To(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&To(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&So.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(Po(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Co(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||te.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},clip(t,e,i){t.__worldOpacity&&(e.setWorld(t.__nowWorld=t.__getNowWorld(i)),t.__drawRenderPath(e),e.clipUI(t))},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},updateFlowLayout(t){},listenPositionNode(t){},updatePositionLayout(t){},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?uo(t.localTransform,r,r,!0):t.parent&&co(t.parent.scrollWorldTransform,r,r,!0),So.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=wo(e),i=wo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r,o){So.zoomOfLocal(t,Ro(t,e),i,s,n,r,o)},zoomOfLocal(t,e,i,s=i,n,r,o){const h=t.__localMatrix;if(a(s)||(s&&(r=s),s=i),lo(xo,h),_o(xo,e,i,s),So.hasHighPosition(t))So.setTransform(t,xo,n,r,o);else{const e=t.x+xo.e-h.e,a=t.y+xo.f-h.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,o))}},rotateOfWorld(t,e,i,s){So.rotateOfLocal(t,Ro(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;lo(xo,n),po(xo,e,i),So.hasHighPosition(t)?So.setTransform(t,xo,!1,s):t.set({x:t.x+xo.e-n.e,y:t.y+xo.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){So.skewOfLocal(t,Ro(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){lo(xo,t.__localMatrix),go(xo,e,i,s),So.setTransform(t,xo,n,r)},transformWorld(t,e,i,s,n){lo(xo,t.worldTransform),fo(xo,e),t.parent&&yo(xo,t.parent.scrollWorldTransform),So.setTransform(t,xo,i,s,n)},transform(t,e,i,s,n){lo(xo,t.localTransform),fo(xo,e),So.setTransform(t,xo,i,s,n)},setTransform(t,e,i,s,n){const r=t.__,o=r.origin&&So.getInnerOrigin(t,r.origin),a=mo(e,o,r.around&&So.getInnerOrigin(t,r.around));if(So.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,o){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=So.getInnerOrigin(t,r.origin);ht.move(a,o.x-s.x,o.y-s.y)}t.set(a),t.scaleResize(e,i,!1,n)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return _o(i,So.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(So.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(lo(xo,t.worldTransform),yo(xo,e.scrollWorldTransform),i?xo:Object.assign({},xo)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(So.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||So.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e,i){if(!e)return!1;for(;t;){if(e===t)return!0;if(i&&t.__level===i)return;t=t.parent}},animateMove(t,e,i=.3,s){if(e.x||e.y){if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const n=e.x*i,r=e.y*i;e.x-=n,e.y-=r,t.move(n,r),te.requestRender(()=>So.animateMove(t,e,i,s))}s&&s()}}};function bo(t){return t&&t.config.trackChanges}const So=vo,{updateAllMatrix:ko,updateMatrix:Bo,updateAllWorldOpacity:To,updateAllChange:Co,updateChange:Po}=So;function Ro(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Eo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>Ao(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Ao(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return Ao(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Lo;function Ao(t,e){return e||(Lo=0),t.__.mask&&(Lo=1),Lo<0?null:(Lo&&(Lo=-1),!0)}const{updateBounds:Oo}=vo,Do={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,zIndex(t,e,i){const{children:s}=t,n=s[i-1],r=s[i];n&&r?(e.zIndex<n.zIndex||e.zIndex>r.zIndex)&&(e.zIndex=(n.zIndex+r.zIndex)/2):n?e.zIndex<n.zIndex&&(e.zIndex=n.zIndex+1):r&&e.zIndex>r.zIndex&&(e.zIndex=r.zIndex-1)},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),Fo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(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++)Mo(e[t],e)},updateBounds(t,e){const i=[t];Mo(t,i),Io(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++)Oo(s[t]);e&&e===i||Oo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Wo(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&No(t,e,i,s,n,r,o)}},{pushAllChildBranch:Fo,pushAllBranchStack:Mo,updateBoundsByBranchStack:Io,move:Wo,scale:No}=Do,zo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Yo,updateBounds:Xo}=vo,{toOuterOf:Ho,getPoints:jo,copy:Uo}=Ht,Vo="_localContentBounds",qo="_worldContentBounds",Go="_worldBoxBounds",Ko="_worldStrokeBounds";class Qo{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 Ho(this.contentBounds,this.leaf.__localMatrix,this[Vo]||(this[Vo]={})),this[Vo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ho(this.contentBounds,this.leaf.__world,this[qo]||(this[qo]={})),this[qo]}get worldBoxBounds(){return Ho(this.boxBounds,this.leaf.__world,this[Go]||(this[Go]={})),this[Go]}get worldStrokeBounds(){return Ho(this.strokeBounds,this.leaf.__world,this[Ko]||(this[Ko]={})),this[Ko]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Xo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,te.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 Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Yo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(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=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Yo(s,e,!0)}if(o||(o=Q.getLayout(r)),Uo(o,a),ht.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,n=jo(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 s(r)||n.forEach(t=>i.innerToWorld(t,null,!1,r)),n}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.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Jo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&te.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&te.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&te.event.stop(this.origin)}}class Zo extends Jo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Zo.ADD="child.add",Zo.REMOVE="child.remove",Zo.CREATED="created",Zo.MOUNTED="mounted",Zo.UNMOUNTED="unmounted",Zo.DESTROY="destroy";const $o="property.scroll";class ta extends Jo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}ta.CHANGE="property.change",ta.LEAFER_CHANGE="property.leafer_change",ta.SCROLL=$o;const ea={scrollX:$o,scrollY:$o};class ia extends Jo{constructor(t,e){super(t),Object.assign(this,e)}}ia.LOAD="image.load",ia.LOADED="image.loaded",ia.ERROR="image.error";class sa extends Jo{static checkHas(t,e,i){"on"===i?e===aa?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(na)||t.hasEvent(ra)||t.hasEvent(oa),t.__hasWorldEvent=t.hasEvent(aa))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(na,t),"inner"===e&&t.emit(ra,t)),t.emit(oa,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(aa,t)}}sa.RESIZE="bounds.resize",sa.INNER="bounds.inner",sa.LOCAL="bounds.local",sa.WORLD="bounds.world";const{RESIZE:na,INNER:ra,LOCAL:oa,WORLD:aa}=sa,ha={};[na,ra,oa,aa].forEach(t=>ha[t]=1);class la extends Jo{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){c(t)?(super(la.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}la.RESIZE="resize";class da extends Jo{constructor(t,e){super(t),this.data=e}}da.REQUEST="watch.request",da.DATA="watch.data";class ca extends Jo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ca.REQUEST="layout.request",ca.START="layout.start",ca.BEFORE="layout.before",ca.LAYOUT="layout",ca.AFTER="layout.after",ca.AGAIN="layout.again",ca.END="layout.end";class ua extends Jo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ua.REQUEST="render.request",ua.CHILD_START="render.child_start",ua.CHILD_END="render.child_end",ua.START="render.start",ua.BEFORE="render.before",ua.RENDER="render",ua.AFTER="render.after",ua.AGAIN="render.again",ua.END="render.end",ua.NEXT="render.next";class _a extends Jo{}_a.START="leafer.start",_a.BEFORE_READY="leafer.before_ready",_a.READY="leafer.ready",_a.AFTER_READY="leafer.after_ready",_a.VIEW_READY="leafer.view_ready",_a.VIEW_COMPLETED="leafer.view_completed",_a.STOP="leafer.stop",_a.RESTART="leafer.restart",_a.END="leafer.end",_a.UPDATE_MODE="leafer.update_mode",_a.TRANSFORM="leafer.transform",_a.MOVE="leafer.move",_a.SCALE="leafer.scale",_a.ROTATE="leafer.rotate",_a.SKEW="leafer.skew";const{MOVE:pa,SCALE:ga,ROTATE:fa,SKEW:ya}=_a,ma={x:pa,y:pa,scaleX:ga,scaleY:ga,rotation:fa,skewX:ya,skewY:ya},xa={};class wa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=va(this,s,!0),h=r(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):a[t]=[l],ha[t]&&sa.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=r(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=va(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],ha[t]&&sa.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&fe.has(t)&&(e=fe.get(t,{type:t,target:this,current:this}));const s=va(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:n}=this,r=i&&i[t],o=n&&n[t];return!!(s(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function va(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:xa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:xa)}}const{on:ba,on_:Sa,off:ka,off_:Ba,once:Ta,emit:Ca,emitEvent:Pa,hasEvent:Ra,destroy:Ea}=wa.prototype,La={on:ba,on_:Sa,off:ka,off_:Ba,once:Ta,emit:Ca,emitEvent:Pa,hasEvent:Ra,destroyEventer:Ea},Aa=se.get("setAttr"),Oa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(Aa.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new ta(ta.LEAFER_CHANGE,this,t,n,e));const i=ma[t];i&&(this.emitEvent(new _a(i,this)),this.emitEvent(new _a(_a.TRANSFORM,this)))}this.emitPropertyEvent(ta.CHANGE,t,n,e);const i=ea[t];return i&&this.emitPropertyEvent(i,t,n,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const{leafer:n}=this;if(bo(n)||n.zoomLayer===this){const r=new ta(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),n.emitEvent(r)}else n.watcher.add(this)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Da,multiplyParent:Fa,translateInner:Ma,defaultWorld:Ia}=Q,{toPoint:Wa,tempPoint:Na}=St,za={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Fa(this.__local||e,t?t.__scrollWorld||t.__world:Ia,i,!!e.affectScaleOrRotation,n),s&&Ma(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&vo.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Da(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Wa(i.around||i.origin,t.boxBounds,Na),Ma(e,-Na.x,-Na.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ya,updateAllMatrix:Xa}=vo,{updateBounds:Ha}=Do,{toOuterOf:ja,copyAndSpread:Ua,copy:Va}=Ht,{toBounds:qa}=Yn,Ga={__updateWorldBounds(){const{__layout:t,__world:e}=this;ja(t.renderBounds,e,e),this.__hasComplex&&vo.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&sa.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&sa.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&(this.__updateLocalBoxBounds(),e.__usePositionNode&&vo.listenPositionNode(this)),t.localBoxChanged=void 0,t.strokeSpread&&!t.strokeChanged&&(t.strokeChanged=!!t.boxChanged||2),t.renderSpread&&!t.renderChanged&&(t.renderChanged=!!t.boxChanged||2),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(2===t.strokeChanged?this.__updateLocalStrokeBounds():(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.resized="inner",(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0)),t.strokeChanged=void 0,this.parent&&this.parent.__layout.strokeChange()),t.renderChanged&&(2===t.renderChanged?this.__updateLocalRenderBounds():(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel()),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.outerScale&&vo.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasPosition&&vo.updatePositionLayout(this),this.__hasAutoLayout&&this.__updateAutoLayout(),ja(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ja(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ja(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?qa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?vo.updateFlowLayout(this):(Xa(this),Ha(this,this))):Ya(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ua(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Va(e.renderBounds,e.strokeBounds):Ua(e.renderBounds,e.boxBounds,i)}},Ka={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1: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),vo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);se.showBounds&&se.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){vo.clip(this,t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Qa}=Eo,{hasSize:Ja}=Ht,Za={__updateChange(){this.__layout.childrenSortChanged&&this.__updateSortChildren(),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ja(i)){const s=this.__;if(s.__useDim){if(s.bright&&!e.topRendering)return e.topList.add(this);s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],Qa(i,e)||(i.__hasComplex?vo.renderComplex(i,t,e):i.__render(t,e));0===this.__hasMask&&this.__rerenderMask(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Qa(i[s],e)||i[s].__clip(t,e)}}},{LEAF:$a,create:th}=y,{stintSet:eh}=p,{toInnerPoint:ih,toOuterPoint:sh,multiplyParent:nh}=Q,{toOuterOf:rh}=Ht,{copy:oh,move:ah}=ht,{getScaleFixedData:hh}=F,{moveLocal:lh,zoomOfLocal:dh,rotateOfLocal:ch,skewOfLocal:uh,moveWorld:_h,zoomOfWorld:ph,rotateOfWorld:gh,skewOfWorld:fh,transform:yh,transformWorld:mh,setTransform:xh,getFlipTransform:wh,getLocalOrigin:vh,getRelativeWorld:bh,drop:Sh}=vo;let kh=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 f}get __LayoutProcessor(){return Qo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isFrame(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=th($a),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Zo.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()}waitParentChange(t){this.__parentChange||(this.__parentChange=[]),this.__parentChange.includes(t)||this.__parentChange.push(t),this.parent&&t(this.parent,this)}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Zo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Zo.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(Zo.MOUNTED),t.cacheId&&vo.cacheId(this)):this.__emitLifeEvent(Zo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}__bindFrame(t){if(this.frame=t,this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindFrame(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))}scaleResize(t,e=t,i,s){this.scaleX*=t,this.scaleY*=e}updateLayout(){this.__layout.update()}forceUpdate(t){let e;if(this.__hasComplex&&vo.updateComplex(this),t&&"bounds"!==t?"surface"===t?(Ir(this),e=!0):"stroke"===t&&(Or(this),e=!0):(Rr(this),e=!0),e){const{leafer:t}=this;return t&&t.watcher&&t.watcher.__onAttrChange({target:this})}const i=this.__.__getInput(t);this.__[t]=s(i)?null:void 0,this[t]=i}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateEraser(){this.__hasEraser=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(){const t=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity);this.__hasMask=this.__.maskskip?t&&0:t}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return nh(i,t.matrix,e,void 0,i),rh(this.__layout.renderBounds,e,e),eh(e,"half",i.half),eh(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,i=!0){return hh(hr.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}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?bh(this,e):this.worldTransform,n=i?t:{};return rh(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&oh(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&oh(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),ih(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){sh(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const n=this.getInnerPoint(t,e,i,s);return i?n:this.getBoxPointByInner(n,null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return ah(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 ah(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,s){xh(this,t,e,i,s)}transform(t,e,i,s){yh(this,t,e,i,s)}move(t,e,i){lh(this,t,e,i)}moveInner(t,e,i){_h(this,t,e,!0,i)}scaleOf(t,e,i,s,n,r){dh(this,vh(this,t),e,i,s,n,r)}rotateOf(t,e,i){ch(this,vh(this,t),e,i)}skewOf(t,e,i,s,n){uh(this,vh(this,t),e,i,s,n)}transformWorld(t,e,i,s){mh(this,t,e,i,s)}moveWorld(t,e,i){_h(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n,r){ph(this,t,e,i,s,n,r)}rotateOfWorld(t,e){gh(this,t,e)}skewOfWorld(t,e,i,s,n){fh(this,t,e,i,s,n)}flip(t,e){yh(this,wh(this,t),!1,e)}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){Sh(this,t,e,i)}static changeAttr(t,e,i){i?this.addAttr(t,e,i):$r(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Cr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Zo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Zo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};kh=xe([oo(Oa),oo(za),oo(Ga),oo(La),oo(Ka)],kh);const{setListWithFn:Bh}=Ht,{sort:Th}=Do,{localBoxBounds:Ch,localStrokeBounds:Ph,localRenderBounds:Rh,maskLocalBoxBounds:Eh,maskLocalStrokeBounds:Lh,maskLocalRenderBounds:Ah}=Eo,Oh=new se("Branch");let Dh=class extends kh{__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(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){Bh(e||this.__layout.boxBounds,this.children,this.__hasMask?Eh:Ch)}__updateStrokeBounds(t){Bh(t||this.__layout.strokeBounds,this.children,this.__hasMask?Lh:Ph)}__updateRenderBounds(t){Bh(t||this.__layout.renderBounds,this.children,this.__hasMask?Ah:Rh)}__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(Th),this.__layout.affectChildrenSort=t}this.__layout.childrenSortChanged=!1}add(t,e){if(t===this||t.destroyed)return Oh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):(Do.zIndex(this,t,e),this.children.splice(e,0,t)),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__parentChange&&t.__parentChange.forEach(e=>e(this,t)),t.__bubbleMap&&t.__emitLifeEvent(Zo.ADD),this.frame&&t.__bindFrame(this.frame),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Zo.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)):s(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(Zo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Zo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear())),t.frame&&!t.isFrame&&t.__bindFrame(null)}__emitChildEvent(t,e){const{leafer:i}=this;if(bo(i)||i.zoomLayer===this){const s=new Zo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),i.emitEvent(s)}else i.watcher.addChild(e,this,t)}};Dh=xe([oo(Za)],Dh);class Fh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(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 n=0,r=e.length;n<r;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(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 Fh;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 Mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Ih="2.3.4";if("undefined"!=typeof globalThis){const t=globalThis.Leafer||(globalThis.Leafer={});t.version=Ih,t.Plugin=de}class Wh extends De{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(r(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=te.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&te.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,n={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(n),this.context&&(this.viewSelect&&(te.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,a(n)?[n]:n)}),$n(this.context.__proto__))}__createView(){this.view=te.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&te.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,this.updateViewSize(),t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),te.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,te.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};p.copyAttrs(e,this,Oe),this.resize(t),s(this.width)||this.resizeListener(new la(t,e))}}function Nh(t,e){Object.assign(te.origin,{createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(tr.mimeType(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(tr.mimeType(tr.fileType(e)),i);return s=s.substring(s.indexOf("64,")+3),te.origin.download(s,e)},download:(t,i)=>new Promise((s,n)=>{let r;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,r=!0);const o=e.getFileSystemManager();o.writeFile({filePath:i,data:t,encoding:"base64",success(){r?te.miniapp.saveToAlbum(i).then(()=>{o.unlink({filePath:i}),s()}):s()},fail(t){n(t)}})}),loadImage:(t,e,i)=>new Promise((e,i)=>{const s=te.getCanvas().view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=te.image.getRealURL(t)}),loadContent:(t,i="text")=>new Promise((s,n)=>e.request({url:t,responseType:"arrayBuffer"===i?"arraybuffer":"text",success:t=>s("json"===i&&"string"==typeof t.data?JSON.parse(t.data):t.data),fail:n})),noRepeat:"repeat-x"}),te.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},te.event={stopDefault(t){},stopNow(t){},stop(t){}},te.canvas=ce.canvas(),te.conicGradientSupport=!!te.canvas.context.createConicGradient,gr(te,"devicePixelRatio",{get:()=>Math.max(1,e.getWindowInfo?e.getWindowInfo().pixelRatio:e.getSystemInfoSync().pixelRatio)})}Object.assign(ce,{canvas:(t,e)=>new Wh(t,e),image:t=>new ur(t)}),te.name="miniapp",te.getCanvas=function(){const{renderCanvas:t}=te;return t&&t.view?t:te.canvas},te.requestRender=function(t){const{view:e}=te.getCanvas();e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)};class zh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Fh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.changed=0,this.config={},this.__updatedList=new Fh,this.target=t,e&&(this.config=p.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<100&&(this.changed++,this.running&&this.target.emit(ua.REQUEST))}__onAttrChange(t){this.add(t.target)}add(t){this.target&&(this.config.usePartLayout&&this.__updatedList.add(t),this.update())}addChild(t,e,i){this.config.usePartLayout&&(i===Zo.ADD?(this.hasAdd=!0,this.__pushChild(t)):(this.hasRemove=!0,this.__updatedList.add(e))),this.update()}__onChildEvent(t){this.addChild(t.child,t.parent,t.type)}__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 da(da.DATA,{updatedList:this.updatedList})),this.__updatedList=new Fh,this.totalTimes++,this.hasVisible=this.hasRemove=this.hasAdd=!1,this.changed=0}__listenEvents(){this.__eventIds=[this.target.on_([[ta.CHANGE,this.__onAttrChange,this],[[Zo.ADD,Zo.REMOVE],this.__onChildEvent,this],[da.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Yh,updateBounds:Xh,updateChange:Hh}=vo,{pushAllChildBranch:jh,pushAllParent:Uh}=Do,Vh={updateMatrix(t,e){let i,s,n=0;const{list:r}=t;for(;n<r.length;)i=r[n],s=i.__layout,e.without(i)&&!s.proxyZoom&&(s.matrixChanged?(Yh(i,!0),i.isBranch&&jh(i,e),qh(i,e)):s.boundsChanged&&(i.isBranch&&(i.__tempNumber=0),qh(i,e))),n++},updateBounds(t){let e,i,s,n,r=0;const{levels:o,levelMap:a}=t;for(t.sort(!0);r<o.length;){e=o[r],i=a[e];for(let t=0,e=i.length;t<e;t++){if(s=i[t],s.isBranch&&s.__tempNumber){n=s.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||Xh(n[t])}Xh(s)}r++}},updateChange(t){t.list.forEach(Hh)},push:qh};function qh(t,e){e.add(t),Uh(t,e)}const{worldBounds:Gh}=Eo;class Kh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new Fh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Gh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Gh),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:Qh,updateAllChange:Jh}=vo,Zh=se.get("Layouter");class $h{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Mh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(ca.START),this.layoutOnce(),t.emitEvent(new ca(ca.END,this.layoutedBlocks,this.times))}catch(t){Zh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Zh.warn("layouting"):this.times>3?Zh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(da.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=ae.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=ca,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ca(n,a,this.times)),this.extraBlock=null,s.sort(),Vh.updateMatrix(s,this.__levelList),Vh.updateBounds(this.__levelList),Vh.updateChange(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ca(r,a,this.times)),i.emitEvent(new ca(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ca,r=this.getBlocks(new Fh(e));e.emitEvent(new ca(i,r,this.times)),$h.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new ca(s,r,this.times)),e.emitEvent(new ca(n,r,this.times)),this.addBlocks(r),ae.end(t)}static fullLayout(t){Qh(t,!0),t.isBranch?Do.updateBounds(t):vo.updateBounds(t),Jh(t)}addExtra(t,e){if(!this.__updatedList.has(t)){const{updatedList:i,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Kh([]));if(i.length?s.add(t.__world):s.set(t.__world),i.add(t),e){const e=this.__levelList;Vh.push(t,e),e.sort(!0)}}}createBlock(t){return new Kh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[ca.REQUEST,this.layout,this],[ca.AGAIN,this.layoutAgain,this],[da.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const tl=se.get("Renderer");class el{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,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ca.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ua.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ua.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ua.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,tl.log(e.innerName,"---\x3e");try{this.emitRender(ua.START),this.renderOnce(t),this.emitRender(ua.END,this.totalBounds),hr.clearRecycled()}catch(t){this.rendering=!1,tl.error(t)}tl.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return tl.warn("rendering");if(this.times>3)return tl.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(ua.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ua.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ua.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ua.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=ae.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(el.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),se.showRepaint&&se.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),te.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return te.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};te.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(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 qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||tl.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new ua(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ua.REQUEST,this.update,this],[ca.END,this.__onLayoutEnd,this],[ua.AGAIN,this.renderAgain,this],[la.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}el.clipSpread=10;const il={},{copyRadiusPoint:sl}=ht,{hitRadiusPoint:nl}=Ht;class rl{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 Fh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new Fh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||vo.worldHittable(e))&&(this.hitChild(e,e.hitThrough?this.point:o,e.mask&&e.parent&&e.parent.__onlyHitMask),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&vo.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,void 0,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>vo.worldHittable(t))}getPath(t){const e=new Fh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Fh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new Fh,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,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=nl(i.__world,n.hitRadius?sl(il,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r,e)}}else s&&this.hitChild(i,r,e)}hitChild(t,e,i,s){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e,!(!i||"path"!==t.mask)||void 0)){const{parent:i,mask:n}=t;if(i&&i.__hasMask&&n&&"clipping"!==n&&"clipping-path"!==n&&!i.children.some(t=>!t.mask&&this.isHitLeaf(t,e)))return;const r=s||t,{hitThrough:o}=t,{findList:a}=this;if(o){const e=a.list.findIndex(e=>"parent"===o?vo.hasParent(e.parent,t.parent):e[o]===t[o]);if(e>0)return a.addAt(r,e)}a.add(r)}}isHitLeaf(t,e){if(t.isBranch){const{findList:e}=this,i=e.length;this.eachFind([t],!1);const s=e.length-i;for(let t=0;t<s;t++)e.remove(e.indexAt(e.length-1));return!!s}return t.__hitWorld(e)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class ol{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new rl(this.target=t,this),this.finder=ce.finder&&ce.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return te.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):de.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function al(t){return mr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function hl(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function ll(){return(t,e)=>{const i="_"+e;gr(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function dl(){return(t,e)=>{gr(t,e,{set(t){},get(){return this}})}}function cl(t){return(e,i)=>{gr(e,i,yr(i,t))}}Object.assign(ce,{watcher:(t,e)=>new zh(t,e),layouter:(t,e)=>new $h(t,e),renderer:(t,e,i)=>new el(t,e,i),selector:(t,e)=>new ol(t,e)}),te.layout=$h.fullLayout,te.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Fh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>{const{parent:i}=t;i&&i.isBranchLeaf&&"show"!==i.overflow?(e.save(),vo.clip(i,e,s),t.__render(e,s),e.restore()):t.__render(e,s)})};const ul={},_l={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},pl=Qt,gl={},fl={},yl={},ml={},xl={},wl={apply(){de.need("filter")}},vl={},bl={setStyleName:()=>de.need("state"),set:()=>de.need("state")},Sl={list:{},register(t,e){Sl.list[t]=e},get:t=>Sl.list[t]},{parse:kl,objectToCanvasData:Bl}=ns,{stintSet:Tl}=p,{hasTransparent:Cl}=_l,Pl={originPaint:{}},Rl=se.get("UIData");class El extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,Rl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Rl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(Tl(this,"__isTransparentFill",Cl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(Tl(this,"__isTransparentStroke",Cl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?kl(t,this.__useArrow):Bl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ll(this,"shadow",t)}setInnerShadow(t){Ll(this,"innerShadow",t)}setFilter(t){Ll(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&fl.compute("fill",this.__leaf),e&&fl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;Tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Pl)):(this.__isStrokes=!0,this._stroke||(this._stroke=Pl))}__removePaint(t,e){e&&this.__removeInput(t),yl.recycleImage(t,this),"fill"===t?(Tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Tl(this,"__isAlphaPixelStroke",void 0),Tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ll(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Al extends El{}class Ol extends Al{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Dl extends Al{__getInputData(t,e){const i=super.__getInputData(t,e);return Oe.forEach(t=>delete i[t]),i}}class Fl extends Ol{}class Ml extends El{get __usePathBox(){return this.points||this.__pathInputed}}class Il extends El{get __boxStroke(){return!this.__pathInputed}}class Wl extends El{get __boxStroke(){return!this.__pathInputed}}class Nl extends El{get __usePathBox(){return this.points||this.__pathInputed}}class zl extends El{}class Yl extends El{get __pathInputed(){return 2}}class Xl extends Al{}const Hl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class jl extends El{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=Hl[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=_e.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ul extends Il{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Vl extends Il{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{max:ql,add:Gl}=k,Kl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=ql(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=xl.getShadowRenderSpread(this,e)),s&&(t=ql(t,s)),r&&(t=Gl(t,wl.getSpread(r))),o&&(t=Gl(t,o)),a&&(t=Gl(t,a));let l=t;return i&&(l=ql(l,xl.getInnerShadowSpread(this,i))),n&&(l=ql(l,n)),this.__layout.renderShapeSpread=l,h?ql(h.__updateRenderSpread(),t):t}},{stintSet:Ql}=p,Jl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ql(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ql(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ql(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!xl.isTransformShadow(e[0])&&!(e[0].blendMode&&"pass-through"!==e[0].blendMode)&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Zl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=fl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&xl.shadow(this,t,h),a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),n&&(s.__isFills?fl.fills(n,this,t,e):fl.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&xl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),c&&wl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,_l.string(e.color))}n&&(s.__isFills?fl.fills(n,this,t,e):fl.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?fl.strokes(r,this,t,e):fl.stroke(r,this,t,e))}}else s.__pathForRender?Zl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?fl.fills(s,this,t,e):fl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?fl.strokes(n,this,t,e):fl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Zl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&fl.stroke(n,t,e,i),s&&fl.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&fl.stroke(n,t,e,i)}const $l={__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 td;let ed=td=class extends kh{get app(){return this.leafer&&this.leafer.app}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){F.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Jn.set(this.path=t||[]),t||this.__drawPathByBox(Jn),Jn}set(t,e){t&&Object.assign(this,t)}get(t){return r(t)?this.__.__getInput(t):this.__.__getInputData(t)}find(t,e){return de.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return de.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Jn.set(i=[]),this.__drawPathByBox(Jn,"box",!e)),t?ns.toCanvasData(i,!0):i}getPathString(t,e,i){return ns.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||vl.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?Kn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&gl.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&gl.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){const e=this.__;t.beginPath(),e.__usePointsMode?ln.drawPathByPoints(t,e.points,e.closed):this.__drawPathByData(t,e.path,!0)}__drawPathByData(t,e,i){e?ln.drawPathByData(t,e):this.__drawPathByBox(t,"box",i)}__drawPathByBox(t,e="box",i){const{x:s,y:n,width:r,height:o}=this.__layout[e+"Bounds"];if(this.__.cornerRadius&&!i){const{cornerRadius:e}=this.__;t.roundRect(s,n,r,o,a(e)?[e]:e)}else t.rect(s,n,r,o);t.closePath()}drawImagePlaceholder(t,e,i){fl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),de.need("animate")}killAnimate(t,e){}export(t,e){return de.need("export")}syncExport(t,e){return de.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),td.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){ao()(this)}static registerData(t){Jr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xe([Jr(El)],ed.prototype,"__",void 0),xe([ll()],ed.prototype,"zoomLayer",void 0),xe([vr("")],ed.prototype,"id",void 0),xe([vr("")],ed.prototype,"name",void 0),xe([vr("")],ed.prototype,"className",void 0),xe([Mr("pass-through")],ed.prototype,"blendMode",void 0),xe([Nr(1)],ed.prototype,"opacity",void 0),xe([zr(!0)],ed.prototype,"visible",void 0),xe([Mr(!1)],ed.prototype,"locked",void 0),xe([Wr(!1)],ed.prototype,"dim",void 0),xe([Wr(!1)],ed.prototype,"dimskip",void 0),xe([jr(0)],ed.prototype,"zIndex",void 0),xe([Vr(!1)],ed.prototype,"mask",void 0),xe([Gr(!1)],ed.prototype,"eraser",void 0),xe([br(0,!0)],ed.prototype,"x",void 0),xe([br(0,!0)],ed.prototype,"y",void 0),xe([Cr(100,!0)],ed.prototype,"width",void 0),xe([Cr(100,!0)],ed.prototype,"height",void 0),xe([Br(1,!0)],ed.prototype,"scaleX",void 0),xe([Br(1,!0)],ed.prototype,"scaleY",void 0),xe([Tr(0,!0)],ed.prototype,"rotation",void 0),xe([Tr(0,!0)],ed.prototype,"skewX",void 0),xe([Tr(0,!0)],ed.prototype,"skewY",void 0),xe([br(0,!0)],ed.prototype,"offsetX",void 0),xe([br(0,!0)],ed.prototype,"offsetY",void 0),xe([Sr(0,!0)],ed.prototype,"scrollX",void 0),xe([Sr(0,!0)],ed.prototype,"scrollY",void 0),xe([kr()],ed.prototype,"origin",void 0),xe([kr()],ed.prototype,"around",void 0),xe([vr(!1)],ed.prototype,"lazy",void 0),xe([Pr(1)],ed.prototype,"pixelRatio",void 0),xe([Fr(0)],ed.prototype,"renderSpread",void 0),xe([Er()],ed.prototype,"path",void 0),xe([Lr()],ed.prototype,"windingRule",void 0),xe([Lr(!0)],ed.prototype,"closed",void 0),xe([Cr(0)],ed.prototype,"padding",void 0),xe([Cr(!1)],ed.prototype,"lockRatio",void 0),xe([Cr()],ed.prototype,"widthRange",void 0),xe([Cr()],ed.prototype,"heightRange",void 0),xe([vr(!1)],ed.prototype,"draggable",void 0),xe([vr()],ed.prototype,"dragBounds",void 0),xe([vr("auto")],ed.prototype,"dragBoundsType",void 0),xe([vr(!1)],ed.prototype,"editable",void 0),xe([Kr(!0)],ed.prototype,"hittable",void 0),xe([Kr()],ed.prototype,"hitThrough",void 0),xe([Kr("path")],ed.prototype,"hitFill",void 0),xe([Dr("path")],ed.prototype,"hitStroke",void 0),xe([Kr(!1)],ed.prototype,"hitBox",void 0),xe([Kr(!0)],ed.prototype,"hitChildren",void 0),xe([Kr(!0)],ed.prototype,"hitSelf",void 0),xe([Kr()],ed.prototype,"hitRadius",void 0),xe([Qr("")],ed.prototype,"cursor",void 0),xe([Mr()],ed.prototype,"fill",void 0),xe([Dr(void 0,!0)],ed.prototype,"stroke",void 0),xe([Dr("inside")],ed.prototype,"strokeAlign",void 0),xe([Dr(1,!0)],ed.prototype,"strokeWidth",void 0),xe([Dr(!1)],ed.prototype,"strokeScaleFixed",void 0),xe([Dr("none")],ed.prototype,"strokeCap",void 0),xe([Dr("miter")],ed.prototype,"strokeJoin",void 0),xe([Dr()],ed.prototype,"dashPattern",void 0),xe([Dr(0)],ed.prototype,"dashOffset",void 0),xe([Dr(10)],ed.prototype,"miterLimit",void 0),xe([Lr(0)],ed.prototype,"cornerRadius",void 0),xe([Lr()],ed.prototype,"cornerSmoothing",void 0),xe([al()],ed.prototype,"shadow",void 0),xe([al()],ed.prototype,"innerShadow",void 0),xe([al()],ed.prototype,"blur",void 0),xe([al()],ed.prototype,"backgroundBlur",void 0),xe([al()],ed.prototype,"grayscale",void 0),xe([al()],ed.prototype,"filter",void 0),xe([Mr()],ed.prototype,"placeholderColor",void 0),xe([vr(100)],ed.prototype,"placeholderDelay",void 0),xe([vr({})],ed.prototype,"data",void 0),ed=td=xe([oo(Kl),oo(Jl),no()],ed);let id=class extends ed{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children: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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}};var sd;xe([Jr(Al)],id.prototype,"__",void 0),xe([Cr(0)],id.prototype,"width",void 0),xe([Cr(0)],id.prototype,"height",void 0),id=xe([oo(Dh),ao()],id);const nd=se.get("Leafer");let rd=sd=class extends id{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&or.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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,trackChanges:!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),sd.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const n=this.canvas=ce.canvas(s);this.__controllers.push(this.renderer=ce.renderer(this,n,s),this.watcher=ce.watcher(this,s),this.layouter=ce.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ce.selector(this),this.interaction=ce.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ce.hitCanvasManager()),this.canvasManager=new me,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),zo.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(_a.RESTART):this.emitLeafer(_a.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(_a.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Oe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(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=p.copyAttrs({},this.canvas,Oe);e.resize(t),this.updateLazyBounds(),this.__onResize(new la(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Oe),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Oe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(_a.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Oe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=p.copyAttrs({},s,Oe);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(_a.BEFORE_READY),this.emitLeafer(_a.READY),this.emitLeafer(_a.AFTER_READY),zo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(_a.VIEW_READY),zo.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){zo.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(_a.VIEW_COMPLETED),zo.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 de.need("view")}getValidMove(t,e,i){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 _a(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[_a.START,()=>ae.end(t)],[ca.START,this.updateLazyBounds,this],[ua.START,this.__onCreated,this],[ua.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[da.DATA,this.__onWatchData,this],[ca.END,this.__onLayoutEnd,this],[ua.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){sd.list.remove(this);try{this.stop(),this.emitLeafer(_a.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{hr.clearRecycled()},100)}catch(t){nd.error(t)}}};t?e():setTimeout(e)}};rd.list=new Fh,xe([Jr(Dl)],rd.prototype,"__",void 0),xe([Cr()],rd.prototype,"pixelRatio",void 0),xe([vr("normal")],rd.prototype,"mode",void 0),rd=sd=xe([ao()],rd);let od=class extends ed{get __tag(){return"Rect"}};xe([Jr(Il)],od.prototype,"__",void 0),od=xe([oo($l),no(),ao()],od);const{add:ad,includes:hd,scroll:ld}=Ht,dd=od.prototype,cd=id.prototype;let ud=class extends id{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(ad(a,r),ld(a,i)),this.__updateRectRenderBounds(),t=!hd(r,a),t&&"show"===o&&ad(n,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xe([Jr(Ol)],ud.prototype,"__",void 0),xe([Cr(100)],ud.prototype,"width",void 0),xe([Cr(100)],ud.prototype,"height",void 0),xe([vr(!1)],ud.prototype,"resizeChildren",void 0),xe([Fr("show")],ud.prototype,"overflow",void 0),xe([so(dd.__updateStrokeSpread)],ud.prototype,"__updateStrokeSpread",null),xe([so(dd.__updateRenderSpread)],ud.prototype,"__updateRectRenderSpread",null),xe([so(dd.__updateBoxBounds)],ud.prototype,"__updateRectBoxBounds",null),xe([so(dd.__updateStrokeBounds)],ud.prototype,"__updateStrokeBounds",null),xe([so(dd.__updateRenderBounds)],ud.prototype,"__updateRectRenderBounds",null),xe([so(dd.__updateChange)],ud.prototype,"__updateRectChange",null),xe([so(dd.__render)],ud.prototype,"__renderRect",null),xe([so(cd.__render)],ud.prototype,"__renderGroup",null),ud=xe([no(),ao()],ud);let _d=class extends ud{get __tag(){return"Frame"}get isFrame(){return!0}};xe([dl()],_d.prototype,"frame",void 0),xe([Jr(Fl)],_d.prototype,"__",void 0),xe([Mr("#FFFFFF")],_d.prototype,"fill",void 0),xe([Fr("hide")],_d.prototype,"overflow",void 0),_d=xe([ao()],_d);const{moveTo:pd,closePath:gd,ellipse:fd}=Ps,{tempPoint:yd,set:md,rotate:xd}=ht,{abs:wd}=Math,vd={};let bd=class extends ed{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r,closed:o}=t,a=e/2,h=i/2,l=t.path=[];let d,c,u;if((n||r)&&(c=!0),c&&(u=360===wd(r-n)),s){const t=s<1||o,e=a*s,i=h*s;c?(fd(l,a,h,a,h,0,n,r),t?(u&&(gd(l),md(yd,a+e,h),md(vd,a,h),xd(yd,r,vd,a,h),pd(l,yd.x,yd.y)),fd(l,a,h,e,i,0,r,n,!0)):u||(d=!0)):(fd(l,a,h,a,h),t&&(gd(l),pd(l,a+e,h),fd(l,a,h,e,i,0,360,0,!0)))}else c?(u||(o||(d=!0),d||pd(l,a,h)),fd(l,a,h,a,h,0,n,r)):fd(l,a,h,a,h);d||gd(l),(te.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};xe([Jr(Wl)],bd.prototype,"__",void 0),xe([Lr(0)],bd.prototype,"innerRadius",void 0),xe([Lr(0)],bd.prototype,"startAngle",void 0),xe([Lr(0)],bd.prototype,"endAngle",void 0),bd=xe([ao()],bd);const{sin:Sd,cos:kd,PI:Bd}=Math,{moveTo:Td,lineTo:Cd,closePath:Pd,drawPoints:Rd}=Ps;let Ed=class extends ed{get __tag(){return"Polygon"}get isPointsMode(){return this.points&&!this.pathInputed}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Rd(e,t.points,t.curve,t.closed,t);else{const{width:i,height:s,sides:n,startAngle:r}=t,o=i/2,a=s/2;let h,l=0;r?(l=r*I,Td(e,o+o*Sd(l),a-a*kd(l))):Td(e,o,0);for(let t=1;t<n;t++)h=2*t*Bd/n+l,Cd(e,o+o*Sd(h),a-a*kd(h));Pd(e)}}};xe([Jr(Nl)],Ed.prototype,"__",void 0),xe([Lr(3)],Ed.prototype,"sides",void 0),xe([Lr(0)],Ed.prototype,"startAngle",void 0),xe([Lr()],Ed.prototype,"points",void 0),xe([Lr(0)],Ed.prototype,"curve",void 0),Ed=xe([no(),ao()],Ed);const{sin:Ld,cos:Ad,PI:Od}=Math,{moveTo:Dd,lineTo:Fd,closePath:Md}=Ps;let Id=class extends ed{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h,l=0;n?(l=n*I,Dd(a,r+r*Ld(l),o-o*Ad(l))):Dd(a,r,0);for(let t=1;t<2*i;t++)h=t*Od/i+l,Fd(a,r+(t%2==0?r:r*s)*Ld(h),o-(t%2==0?o:o*s)*Ad(h));Md(a)}};xe([Jr(zl)],Id.prototype,"__",void 0),xe([Lr(5)],Id.prototype,"corners",void 0),xe([Lr(.382)],Id.prototype,"innerRadius",void 0),xe([Lr(0)],Id.prototype,"startAngle",void 0),Id=xe([ao()],Id);const{moveTo:Wd,lineTo:Nd,drawPoints:zd}=Ps,{rotate:Yd,getAngle:Xd,getDistance:Hd,defaultPoint:jd}=ht;let Ud=class extends ed{get __tag(){return"Line"}get isPointsMode(){return this.points&&!this.pathInputed}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Yd(i,e),i}set toPoint(t){this.width=Hd(jd,t),this.rotation=Xd(jd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?zd(e,t.points,t.curve,t.closed,t):(Wd(e,0,0),Nd(e,this.width,0))}};xe([Jr(Ml)],Ud.prototype,"__",void 0),xe([Ar("center")],Ud.prototype,"strokeAlign",void 0),xe([Cr(0)],Ud.prototype,"height",void 0),xe([Lr()],Ud.prototype,"points",void 0),xe([Lr(0)],Ud.prototype,"curve",void 0),xe([Lr(!1)],Ud.prototype,"closed",void 0),Ud=xe([ao()],Ud);let Vd=class extends od{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};xe([Jr(Ul)],Vd.prototype,"__",void 0),xe([Cr("")],Vd.prototype,"url",void 0),Vd=xe([ao()],Vd);const qd=Vd;let Gd=class extends od{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ce.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ur({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ia(ia.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(a(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xe([Jr(Vl)],Gd.prototype,"__",void 0),xe([hl(100)],Gd.prototype,"width",void 0),xe([hl(100)],Gd.prototype,"height",void 0),xe([hl(1)],Gd.prototype,"pixelRatio",void 0),xe([hl(!0)],Gd.prototype,"smooth",void 0),xe([vr(!1)],Gd.prototype,"safeResize",void 0),xe([hl()],Gd.prototype,"contextSettings",void 0),Gd=xe([ao()],Gd);const{copyAndSpread:Kd,includes:Qd,setList:Jd}=Ht,{stintSet:Zd}=p;let $d=class extends ed{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,wordSpacing:s,fontFamily:n,fontSize:r,fontWeight:o,italic:a,textCase:h,textOverflow:l,padding:d,width:c,height:u}=t;t.__lineHeight=pl.number(e,r),t.__letterSpacing=pl.number(i,r),t.__wordSpacing=pl.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${n||"caption"}`,Zd(t,"__padding",d&&F.fourNumber(d)),Zd(t,"__clipText","show"!==l&&!t.__autoSize),Zd(t,"__isCharMode",c||u||t.__letterSpacing||t.__wordSpacing||t.motionText||"none"!==h),t.__textDrawData=ul.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&(e.renderChanged=!0),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),p.stintSet(this,"isOverflow",!Qd(h,a)&&!t.motionText),this.isOverflow?(Jd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=k.max(t,(i-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Kd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xe([Jr(jl)],$d.prototype,"__",void 0),xe([Cr(0)],$d.prototype,"width",void 0),xe([Cr(0)],$d.prototype,"height",void 0),xe([Mr()],$d.prototype,"boxStyle",void 0),xe([vr(!1)],$d.prototype,"resizeFontSize",void 0),xe([Mr("#000000")],$d.prototype,"fill",void 0),xe([Ar("outside")],$d.prototype,"strokeAlign",void 0),xe([Kr("all")],$d.prototype,"hitFill",void 0),xe([Cr("")],$d.prototype,"text",void 0),xe([Cr("")],$d.prototype,"placeholder",void 0),xe([Cr("caption")],$d.prototype,"fontFamily",void 0),xe([Cr(12)],$d.prototype,"fontSize",void 0),xe([Cr("normal")],$d.prototype,"fontWeight",void 0),xe([Cr(!1)],$d.prototype,"italic",void 0),xe([Cr("none")],$d.prototype,"textCase",void 0),xe([Cr("none")],$d.prototype,"textDecoration",void 0),xe([Cr(0)],$d.prototype,"letterSpacing",void 0),xe([Cr(0)],$d.prototype,"wordSpacing",void 0),xe([Cr({type:"percent",value:1.5})],$d.prototype,"lineHeight",void 0),xe([Cr(0)],$d.prototype,"paraIndent",void 0),xe([Cr(0)],$d.prototype,"paraSpacing",void 0),xe([Cr("x")],$d.prototype,"writingMode",void 0),xe([Cr("left")],$d.prototype,"textAlign",void 0),xe([Cr("top")],$d.prototype,"verticalAlign",void 0),xe([Cr(!0)],$d.prototype,"autoSizeAlign",void 0),xe([Cr("normal")],$d.prototype,"textWrap",void 0),xe([Cr("show")],$d.prototype,"textOverflow",void 0),xe([Mr(!1)],$d.prototype,"textEditing",void 0),$d=xe([ao()],$d);let tc=class extends ed{get __tag(){return"Path"}};xe([Jr(Yl)],tc.prototype,"__",void 0),xe([Ar("center")],tc.prototype,"strokeAlign",void 0),tc=xe([ao()],tc);let ec=class extends id{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new tc(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};xe([Jr(Xl)],ec.prototype,"__",void 0),xe([(t,e)=>{gr(t,e,{get(){return this.__path}})}],ec.prototype,"path",void 0),ec=xe([oo(qs,["set","path","paint"]),ao()],ec);let ic=class extends rd{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ce.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new rd(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds,void 0,void 0,!0))}__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&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Oe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ca.END,this.__onReady,this],[ua.START,this.__onCreated,this],[ua.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ua.END,this.__onChildRenderEnd,this))}};ic=xe([ao()],ic);const sc={},nc={isHoldSpaceKey:()=>nc.isHold("Space"),isHold:t=>sc[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){sc[t]||(sc[t]=!0)},setUpCode(t){sc[t]=!1}},rc={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 oc extends Jo{get spaceKey(){return nc.isHoldSpaceKey()}get left(){return rc.left(this)}get right(){return rc.right(this)}get middle(){return rc.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return nc.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){fe.changeName(t,e)}}const{min:ac,max:hc,abs:lc}=Math,{float:dc,sign:cc}=F,{minX:uc,maxX:_c,minY:pc,maxY:gc}=Ht,fc=new qt,yc=new qt,mc={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&xc.getValidMove(t.__localBoxBounds,xc.getDragBounds(t),s,e,!0),xc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&xc.getValidScaleOf(t.__localBoxBounds,xc.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&dc(t[s])>dc(e[s]),getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),xc.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),xc.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=dc(s.x),s.y=dc(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),yc.set(e),fc.set(t).scaleOf(s,n.x,n.y);const h=dc((s.x-t.x)/t.width),l=dc(1-h),d=dc((s.y-t.y)/t.height),c=dc(1-d);let u,_,p,g,f=1,y=1;return xc.isInnerMode(t,e,i,"width")?(n.x<0&&fc.scaleOf(s,f=1/n.x,1),p=dc(fc.minX-yc.minX),g=dc(yc.maxX-fc.maxX),u=h&&p>0?1+p/(h*fc.width):1,_=l&&g>0?1+g/(l*fc.width):1,f*=hc(u,_)):(n.x<0&&((dc(uc(t)-uc(e),2)<=0||dc(_c(e)-_c(t),2)<=0)&&(fc.scaleOf(s,f=1/n.x,1),fc.width>1&&(f*=1/fc.width,fc.width=1)),fc.unsign()),p=dc(yc.minX-fc.minX),g=dc(fc.maxX-yc.maxX),u=h&&p>0?1-p/(h*fc.width):1,_=l&&g>0?1-g/(l*fc.width):1,f*=ac(u,_)),xc.isInnerMode(t,e,i,"height")?(n.y<0&&fc.scaleOf(s,1,y=1/n.y),p=dc(fc.minY-yc.minY),g=dc(yc.maxY-fc.maxY),u=d&&p>0?1+p/(d*fc.height):1,_=c&&g>0?1+g/(c*fc.height):1,y*=hc(u,_),r&&(u=hc(lc(f),lc(y)),f=cc(f)*u,y=cc(y)*u)):(n.y<0&&((dc(pc(t)-pc(e),2)<=0||dc(gc(e)-gc(t),2)<=0)&&(fc.scaleOf(s,1,y=1/n.y),fc.height>1&&(y*=1/fc.height,fc.height=1)),fc.unsign()),p=dc(yc.minY-fc.minY),g=dc(fc.maxY-yc.maxY),u=d&&p>0?1-p/(d*fc.height):1,_=c&&g>0?1-g/(c*fc.height):1,y*=ac(u,_)),n.x*=o(f)?f:1,n.y*=o(y)?y:1,n}},xc=mc;let wc=class extends oc{};wc.POINTER="pointer",wc.BEFORE_DOWN="pointer.before_down",wc.BEFORE_MOVE="pointer.before_move",wc.BEFORE_UP="pointer.before_up",wc.DOWN="pointer.down",wc.MOVE="pointer.move",wc.UP="pointer.up",wc.OVER="pointer.over",wc.OUT="pointer.out",wc.ENTER="pointer.enter",wc.LEAVE="pointer.leave",wc.TAP="tap",wc.DOUBLE_TAP="double_tap",wc.CLICK="click",wc.DOUBLE_CLICK="double_click",wc.LONG_PRESS="long_press",wc.LONG_TAP="long_tap",wc.MENU="pointer.menu",wc.MENU_TAP="pointer.menu_tap",wc=xe([ho()],wc);const vc=wc,bc={};let Sc=class extends wc{static setList(t){this.list=t instanceof Fh?t:new Fh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ht.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),mc.axisMove(t,n),n}static limitMove(t,e){mc.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(bc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(bc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(bc,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){bc.x=t?this.totalX:this.moveX,bc.y=t?this.totalY:this.moveY}};Sc.BEFORE_DRAG="drag.before_drag",Sc.START="drag.start",Sc.DRAG="drag",Sc.END="drag.end",Sc.OVER="drag.over",Sc.OUT="drag.out",Sc.ENTER="drag.enter",Sc.LEAVE="drag.leave",Sc.ANIMATE="drag.animate",Sc=xe([ho()],Sc);const kc=Sc;let Bc=class extends wc{static setList(t){Sc.setList(t)}static setData(t){Sc.setData(t)}};Bc.DROP="drop",Bc=xe([ho()],Bc);let Tc=class extends Sc{};Tc.BEFORE_MOVE="move.before_move",Tc.START="move.start",Tc.MOVE="move",Tc.DRAG_ANIMATE="move.drag_animate",Tc.END="move.end",Tc.PULL_DOWN="move.pull_down",Tc.REACH_BOTTOM="move.reach_bottom",Tc=xe([ho()],Tc);let Cc=class extends oc{};Cc=xe([ho()],Cc);const Pc=Cc;let Rc=class extends wc{};Rc.BEFORE_ROTATE="rotate.before_rotate",Rc.START="rotate.start",Rc.ROTATE="rotate",Rc.END="rotate.end",Rc=xe([ho()],Rc);let Ec=class extends Sc{};Ec.SWIPE="swipe",Ec.LEFT="swipe.left",Ec.RIGHT="swipe.right",Ec.UP="swipe.up",Ec.DOWN="swipe.down",Ec=xe([ho()],Ec);let Lc=class extends wc{};Lc.BEFORE_ZOOM="zoom.before_zoom",Lc.START="zoom.start",Lc.ZOOM="zoom",Lc.END="zoom.end",Lc=xe([ho()],Lc);let Ac=class extends oc{};Ac.BEFORE_DOWN="key.before_down",Ac.BEFORE_UP="key.before_up",Ac.DOWN="key.down",Ac.HOLD="key.hold",Ac.UP="key.up",Ac=xe([ho()],Ac);const Oc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Ec.UP:t>45&&t<135?Ec.DOWN:t<=45&&t>=-45?Ec.RIGHT:Ec.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:Dc.getSwipeDirection(ht.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,time:Date.now(),buttons:s(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 Fh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>vo.draggable(t)||!t.isLeafer&&t.hasEvent(Sc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Dc=Oc,Fc=new Fh,{getDragEventData:Mc,getDropEventData:Ic,getSwipeEventData:Wc}=Oc;class Nc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Mc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Sc.list||this.draggableList||Fc;return this.dragging&&(s?t?Fc:new Fh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Tc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&rc.left(t),this.dragging&&(this.interaction.emit(Sc.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],vo.draggable(e)){this.draggableList=new Fh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=Mc(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(Tc.BEFORE_MOVE,this.dragData),e.emit(Tc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(Sc.BEFORE_DRAG,this.dragData),e.emit(Sc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=r(e.draggable),l=Sc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);o&&!s&&t?vo.animateMove(e,l,a(o)?o:.3,()=>e.emit(Sc.ANIMATE)):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Sc.OUT,t,i),e.emit(Sc.OVER,t,s)):e.emit(Sc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Sc.LEAVE,t,i,s),e.emit(Sc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(setTimeout(()=>this.interaction.pointerMove(t)),this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=Mc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(Tc.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Sc.END,o),this.swipe(t,i,s,o),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(ht.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Wc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Ic(t,e,Sc.data);s.path=i,this.interaction.emit(Bc.DROP,s),this.interaction.emit(Sc.LEAVE,t,i)}dragReset(){Sc.list=Sc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const zc=se.get("emit");const Yc=["move","zoom","rotate","key"];function Xc(t,e,i,s,n){if(Yc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!jc(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&&Hc(r,e,i,s,n)}}function Hc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!jc(t,n)&&(bl.updateEventStyle&&!s&&bl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=fe.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function jc(t,e){return e&&e.has(t)}const Uc={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Vc,pathCanDrag:qc,pathHasOutside:Gc}=Oc;class Kc{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&&rc.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&rc.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&nc.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=p.clone(Uc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Fh(t),this.createTransformer(),this.dragger=new Nc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(rc.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(wc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(wc.DOWN,t),rc.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=rc.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&rc.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(wc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ht.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(wc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;rc.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(wc.BEFORE_UP,t),this.emit(wc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(wc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(wc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Ac.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,nc.setDownCode(e),this.emit(Ac.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Ac.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Ac.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,nc.setUpCode(e),this.emit(Ac.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Fh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(wc.OUT,t,i),this.emit(wc.OVER,t,e)):this.emit(wc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(wc.LEAVE,t,i,e),this.emit(wc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(wc.LEAVE,t),this.dragger.dragging&&this.emit(Bc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[wc.DOUBLE_TAP,wc.DOUBLE_CLICK].some(e=>Vc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;te.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.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&&!Gc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!qc(t.path))&&!Gc(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))}stopDragAnimate(){this.dragger.stopAnimate()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:wc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ht.round(s),s}emitTap(t){this.emit(wc.TAP,t),this.emit(wc.CLICK,t)}emitDoubleTap(t){this.emit(wc.DOUBLE_TAP,t),this.emit(wc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(wc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(wc.LONG_TAP,t),(Vc(t.path,wc.LONG_TAP)||Vc(t.path,wc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(la.RESIZE,this.__onResize,this)],t.once(_a.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],Hc(n,t,e,!0,s))return;n.isApp&&Xc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Xc(n,t,e,!1,s),Hc(n,t,e,!1,s))return}catch(t){zc.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 Qc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Qc.custom={};class Jc extends me{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Fh,this.pixelList=new Fh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ce.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ce.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()}}te.getSelector=function(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())};const{toInnerRadiusPointOf:Zc,copyRadiusPoint:$c}=ht,{hitRadiusPoint:tu,hitPoint:eu}=Ht,iu={},su={},nu=kh.prototype;nu.hit=function(t,e=0){this.updateLayout(),$c(su,t,e);const i=this.__world;return!!(e?tu(i,su):eu(i,su))&&(this.isBranch?te.getSelector(this).hitPoint(Object.assign({},su),e,{target:this}):this.__hitWorld(su))},nu.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&($c(iu,t,i.hitRadius),t=iu),Zc(t,s,iu),i.hitBox||r){if(Ht.hitRadiusPoint(n.boxBounds,iu))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(iu,e)},nu.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},nu.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},nu.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},nu.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ru=new ft,ou=ed.prototype;ou.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=te.image.hitCanvasSize,o=r.hitScale=Gt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Gt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),hr.patternLocked=!0,this.__renderShape(r,{matrix:ru.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),hr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},ou.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,strokeScaleFixed:o}=i,a=i.__maxStrokeWidth*(o?this.getRenderScaleData(!0,o,!1).scaleX:1),h=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!h)return!1;const l=2*t.radiusX;let d=l,{strokeAlign:c}=i;if(i.motionText&&(d+=i.fontSize/2,c="center"),h)switch(c){case"inside":if(d+=2*a,!n&&this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l;break;case"center":d+=a;break;case"outside":if(d+=2*a,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l}}return!!d&&this.__hitStroke(t,d)};const au=ed.prototype,hu=od.prototype,lu=ud.prototype;hu.__updateHitCanvas=lu.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?au.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},hu.__hitFill=lu.__hitFill=function(t){return this.__hitCanvas?au.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},$d.prototype.__drawHitPath=function(t){const e=this.__,{__lineHeight:i,fontSize:s,__baseLine:n,__letterSpacing:r,__textDrawData:o}=e;t.beginPath(),e.motionText?this.__drawPathByData(t,e.__pathForMotionText):r<0?this.__drawPathByBox(t):o.rows.forEach(e=>t.rect(e.x,e.y-n,e.width,i<s?s:i))},id.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),te.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const du=De.prototype;du.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},du.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},du.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Gt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.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 cu={convertTouch(t,e){const i=cu.getTouch(t),s=Oc.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class uu extends Kc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return s(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=cu.getTouch(t);this.pointerDown(cu.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=cu.getTouch(t);this.pointerMove(cu.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=cu.getTouch(t);this.pointerUp(cu.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Oc.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function _u(t,e,i,s){t.__.__font?fl.fillText(t,e,i,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function pu(t,e,i,s,n){const r=i.__;c(t)?fl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&fl.strokeArrow(t,i,s,n)}function gu(t,e,i,s,n){const r=i.__;c(t)?fl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),fl.drawTextStroke(i,s,n))}function fu(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,gu(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",fl.fillText(i,r,n),r.blendMode="normal",vo.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:yu,copyAndSpread:mu,toOuterOf:xu,getOuterOf:wu,getByMove:vu,move:bu,getIntersectData:Su}=Ht,ku={};let Bu;const{stintSet:Tu}=p,{hasTransparent:Cu}=_l;function Pu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n,o;const{boxBounds:a}=i.__layout,{type:h}=e;switch(h){case"image":case"film":case"video":if(!e.url)return;o=Bu&&Bu[e.url],n=yl.image(i,t,e,a,o),"image"!==h&&yl[h](n,o);break;case"linear":n=ml.linearGradient(e,a);break;case"radial":n=ml.radialGradient(e,a);break;case"angular":n=ml.conicGradient(e,a);break;case"solid":const{color:r,opacity:l}=e;n={type:h,style:_l.string(r,l)};break;default:s(e.r)||(n={type:"solid",style:_l.string(e)})}if(n&&(n.originPaint=e,r(n.style)&&Cu(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const Ru={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),Bu=yl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Pu(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));s.length?(i["_"+t]=s,s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Tu(i,"__isAlphaPixelFill",n),Tu(i,"__isTransparentFill",r)):(Tu(i,"__isAlphaPixelStroke",n),Tu(i,"__isTransparentStroke",r),Tu(i,"__hasMultiStrokeStyle",o))):(i.__removePaint(t,!1),i["_"+t]=""),Bu=void 0},fill:function(t,e,i,s){i.fillStyle=t,_u(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,yl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,r.scaleFixed,!1);1!==t&&i.scale(t,s)}r.blendMode&&(i.blendMode=r.blendMode),_u(e,i,s,!0),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),_u(e,i,s),i.restoreBlendMode()):_u(e,i,s)}},fillPathOrText:_u,fillText:function(t,e,i,s){const n=t.__;let r;if(n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor),s&&(r=e,(e=e.getSameCanvas(!0,!0)).font=t.__.__font,e.fillStyle="#000"),t.motionText)fl.fillMotionText(t,e,i);else{let t;const{rows:i,decorationY:s}=n.__textDrawData;for(let s=0,n=i.length;s<n;s++)t=i[s],t.text?e.fillText(t.text,t.x,t.y):t.data&&t.data.forEach(i=>{e.fillText(i.char,i.x,t.y)});if(s){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,r)))}}s&&(e.beginPath(),t.__drawPathByBox(e,"render"),e.fillStyle=r.fillStyle,e.setTransform(r.getTransform()),e.blendMode="source-in",e.fill(),r.copyWorldByReset(e,t.__nowWorld),e.recycle(t.__nowWorld))},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)fl.strokeText(t,e,i,s);else if(n.__pathForStroke)fl.fillStroke(t,e,i,s);else switch(n.strokeAlign){case"center":pu(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),pu(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)pu(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),pu(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),vo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){fl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":gu(t,1,e,i,s);break;case"inside":fu(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?gu(t,2,e,i,s):fu(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!yl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?fl.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?fl.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;xu(o.strokeSpread?(mu(ku,o.boxBounds,o.strokeSpread),ku):o.boxBounds,r,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))_=s,h=u=a,l=r;else{let s;if(te.fullImageShadow)s=a;else{const t=o.renderShapeSpread?yu(n,k.swapAndScale(o.renderShapeSpread,p,g)):n;s=Su(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=wu(a,c),h=vu(u,-c.e,-c.f),l=wu(r,c),bu(l,-c.e,-c.f);const m=i.matrix;m?(d=new ft(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Eu,Lu=new qt;const{isSame:Au}=Ht;function Ou(t,e,i,s,n,r){let o=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate(),vo.updateBounds(t,!0),t.__layout.boundsChanged=!0,t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),o=!1)),"brush"===i.mode&&yl.brush(t,e,n),!n.data){yl.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e}=i,o=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!n.brush;(o||e&&e<1||i.blendMode)&&(n.complex=!o||2)}return i.filter&&yl.applyFilter(n,s,i.filter,t),o}function Du(t,e){Iu(t,ia.LOAD,e)}function Fu(t,e){Iu(t,ia.LOADED,e)}function Mu(t,e,i){e.error=i,t.forceUpdate("surface"),Iu(t,ia.ERROR,e)}function Iu(t,e,i){t.hasEvent(e)&&t.emitEvent(new ia(e,i))}function Wu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Nu,translate:zu}=Q,Yu=new qt,Xu={},Hu={};function ju(t,e,i,s){const n=r(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Uu={},Vu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:qu,set:Gu,rotateOfOuter:Ku,translate:Qu,scaleOfOuter:Ju,multiplyParent:Zu,scale:$u,rotate:t_,skew:e_}=Q;function i_(t,e,i,s,n,r,o,a){o&&t_(t,o),a&&e_(t,a.x,a.y),n&&$u(t,n,r),Qu(t,e.x+i,e.y+s)}const{get:s_,scale:n_,copy:r_}=Q,{getFloorScale:o_}=F,{abs:a_}=Math;const h_={image:function(t,e,i,s,n){let r,o;const a=hr.get(i,i.type),h=!n;return Eu&&i===Eu.paint&&Au(s,Eu.boxBounds)?r=Eu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Eu=a.use>1?{leafPaint:r,paint:i,boxBounds:Lu.set(s)}:null),(h||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ou(t,e,i,a,r,s),h&&(Du(t,o),Fu(t,o))):a.error?h&&Mu(t,o,a.error):(h&&(Wu(t,!0),Du(t,o)),r.loadId=a.load(()=>{Wu(t,!1),t.destroyed||(Ou(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Fu(t,o)),r.loadId=void 0},e=>{Wu(t,!1),Mu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=yl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:_}=n;if(!d||t.patternId===a&&!u||_){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===te.name||u||(e=te.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e)i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill());else if(!t.style||c.sync||u?yl.createPattern(t,i,s,n):yl.createPatternTask(t,i,s,n),!l||!t.style)return!1;return yl.drawImage(t,r,o,i,s,n),!0},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:r,opacity:a}=t.originPaint,{transform:h}=o;n.save(),2===l&&n.clipUI(s),r&&(n.blendMode=r),a&&(n.opacity*=a),h&&n.transform(h),u.render(n,0,0,d,c,s,t,e,i),n.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),u.render(n,0,0,d,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(t.brush&&yl.addBrushScale(n,t,e),i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,r,o,a;const h=e.__leaf;for(let l=0,c=i.length;l<c;l++)s=i[l],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=s,hr.recyclePaint(s),s.brush&&yl.recycleBrush(s,h),e.__willDestroy&&n.parent&&yl.recycleFilter(n,h),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=hr.patternTasker.add(()=>we(this,void 0,void 0,function*(){yl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=yl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!te.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:a,brush:h,data:l}=t,{transform:d,gap:c}=l,u=yl.getPatternFixScale(t,n,r);let _,p,g,{width:f,height:y}=a,{opacity:m}=t.originPaint;(h||1===m)&&(m=void 0),u&&(n*=u,r*=u),f*=n,y*=r,c&&!h&&(p=c.x*n/a_(l.scaleX||1),g=c.y*r/a_(l.scaleY||1)),(d||1!==n||1!==r)&&(n*=o_(f+(p||0)),r*=o_(y+(g||0)),_=s_(),d&&r_(_,d),n_(_,1/n,1/r));const x=a.getCanvas(f,y,m,void 0,p,g,e.leafer&&e.leafer.config.smooth,l.interlace);h?(t.style=x,yl.cacheBrush(t,e,i,s)):t.style=a.getPattern(x,l.repeat||te.origin.noRepeat||"no-repeat",_,t),t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=te.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=yl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Yu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,interlace:m}=t,x=e.width===s&&e.height===n,w={mode:o},v="center"!==h&&(_||0)%180==90;let b,S;switch(Ht.set(Hu,0,0,v?n:s,v?s:n),o&&"cover"!==o&&"fit"!==o?((d||u)&&(F.getScaleData(d,u,i,Xu),b=Xu.scaleX,S=Xu.scaleY),(h||y||f)&&(b&&Ht.scale(Hu,b,S,!0),h&&Tt.toPoint(h,Hu,e,Hu,!0,!0))):x&&!_||(b=S=Ht.getFitScale(e,Hu,"fit"!==o),Ht.put(e,i,h,b,!1,Hu),Ht.scale(Hu,b,S,!0)),l&&ht.move(Hu,l),o){case"stretch":x?b&&(b=S=void 0):(b=e.width/s,S=e.height/n,yl.stretchMode(w,e,b,S));break;case"normal":case"clip":if(Hu.x||Hu.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),yl.clipMode(w,e,Hu.x,Hu.y,b,S,_,p,t,i),t&&(b=b?b*t:t,S=S?S*i:i)}break;case"repeat":(!x||b||_||p)&&yl.repeatMode(w,e,s,n,Hu.x,Hu.y,b,S,_,p,h,t.freeTransform);case"brush":f||(w.repeat="repeat");const i=c(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:ju(r,i,n.width,e&&e.x),y:ju(o,s,n.height,e&&e.y)}}(y,i&&f,Hu.width,Hu.height,e));break;default:b&&yl.fillOrFitMode(w,e,Hu.x,Hu.y,b,S,_)}return w.transform||"brush"===o||(e.x||e.y)&&zu(w.transform=Nu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=S),f&&(w.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=a(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=qu(),{x:r,y:o}=e;r||o?Qu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),$u(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=qu();Qu(a,e.x+i,e.y+s),$u(a,n,r),o&&Ku(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=qu();i_(d,e,i,s,n,r,o,a),h&&(o||a?(Gu(Vu),Ju(Vu,e,h,l),Zu(d,Vu)):Ju(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=qu();if(c)i_(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Ku(u,{x:i/2,y:s/2},h);else switch(t_(u,h),h){case 90:Qu(u,s,0);break;case 180:Qu(u,i,s);break;case 270:Qu(u,0,i)}Uu.x=e.x+n,Uu.y=e.y+r,Qu(u,Uu.x,Uu.y),o&&Ju(u,Uu,o,a)}t.transform=u}},{toPoint:l_}=St,{hasTransparent:d_}=_l,c_={},u_={};function __(t,e,i,s){if(i){let n,o,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],r(n)?(a=t/(l-1),o=_l.string(n,s)):(a=n.offset,o=_l.string(n.color,s)),e.addColorStop(a,o),!h&&d_(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:p_,getDistance:g_}=ht,{get:f_,rotateOfOuter:y_,scaleOfOuter:m_}=Q,{toPoint:x_}=St,w_={},v_={};function b_(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=p_(e,i);r=f_(),n?(m_(r,e,o/a*(s||1),1),y_(r,e,t+90)):(m_(r,e,1,o/a*(s||1)),y_(r,e,t))}return r}const{getDistance:S_}=ht,{toPoint:k_}=St,B_={},T_={};const C_={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;l_(i||"top",e,c_),l_(s||"bottom",e,u_);const o=te.canvas.createLinearGradient(c_.x,c_.y,u_.x,u_.y),a={type:n,style:o};return __(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;x_(i||"center",e,w_),x_(s||"bottom",e,v_);const a=te.canvas.createRadialGradient(w_.x,w_.y,0,w_.x,w_.y,g_(w_,v_)),h={type:n,style:a};__(h,a,t.stops,r);const l=b_(e,w_,v_,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,rotation:o,stretch:a}=t;k_(i||"center",e,B_),k_(s||"bottom",e,T_);const h=te.conicGradientSupport?te.canvas.createConicGradient(o?o*I:0,B_.x,B_.y):te.canvas.createRadialGradient(B_.x,B_.y,0,B_.x,B_.y,S_(B_,T_)),l={type:n,style:h};__(l,h,t.stops,r);const d=b_(e,B_,T_,a||1,te.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:b_},{copy:P_,move:R_,toOffsetOutBounds:E_}=Ht,{max:L_,abs:A_}=Math,O_={},D_=new ft,F_={};function M_(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=A_(t.spread||0),o=L_(o,n+r-s),a=L_(a,n+r+i),h=L_(h,n+r+s),l=L_(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function I_(t,e,i){const{shapeBounds:s}=i;let n,r;te.fullImageShadow?(P_(O_,t.bounds),R_(O_,e.x-s.x,e.y-s.y),n=t.bounds,r=O_):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:W_}=Ht,N_={};const z_=M_;const Y_={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;E_(h,F_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(F_.offsetX+(o.x||0)*c*f,F_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,_l.string(o.color)),n=xl.getShadowTransform(t,_,i,o,F_,f),n&&_.setTransform(n),I_(_,F_,i),n&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,r,"copy"),s=r),a?_.copyWorld(a,r,r,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),vo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;W_(h,N_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(N_.offsetX+(o.x||0)*c*f,N_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=xl.getShadowTransform(t,_,i,o,N_,f,!0),n&&_.setTransform(n),I_(_,N_,i),_.restore(),a?(_.copyWorld(_,l,r,"copy"),_.copyWorld(a,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,_l.string(o.color),"source-in"),vo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.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){},getShadowRenderSpread:M_,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return D_.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),D_}},isTransformShadow(t){},getInnerShadowSpread:z_},{excludeRenderBounds:X_}=Eo;let H_;function j_(t,e,i,s,n,r,o,a){switch(e){case"grayscale":H_||(H_=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);V_(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":V_(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function U_(t){return t.getSameCanvas(!1,!0)}function V_(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}id.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(j_(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||X_(i,e)||i.__render(t,e),r=i.__.opacity,H_=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=U_(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=U_(t)),n||(n=U_(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&j_(this,o,t,n,s,r,void 0,!1),X_(i,e)||i.__render(n||t,e),d&&j_(this,o,t,n,s,r,d,!1)}j_(this,o,t,n,s,r,void 0,!0)};const q_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",G_=q_+"_#~&*+\\=|≮≯≈≠=…",K_=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],[4352,4607],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12784,12799],[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("|"),"u");function Q_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const J_=Q_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Z_=Q_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),$_=Q_(q_),tp=Q_(G_),ep=Q_("- —/~|┆·");var ip;!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"}(ip||(ip={}));const{Letter:sp,Single:np,Before:rp,After:op,Symbol:ap,Break:hp}=ip;function lp(t){return J_[t]?sp:ep[t]?hp:Z_[t]?rp:$_[t]?op:tp[t]?ap:K_.test(t)?np:sp}const dp={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 cp(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:up}=dp,{Letter:_p,Single:pp,Before:gp,After:fp,Symbol:yp,Break:mp}=ip;let xp,wp,vp,bp,Sp,kp,Bp,Tp,Cp,Pp,Rp,Ep,Lp,Ap,Op,Dp,Fp,Mp=[];function Ip(t,e){Cp&&!Tp&&(Tp=Cp),xp.data.push({char:t,width:e}),vp+=e}function Wp(t){t&&(bp+=t,xp.addWidth=t),bp+=vp,xp.width=vp,wp.words.push(xp),xp={data:[]},vp=0}function Np(){Ap&&(Op.paraNumber++,wp.paraStart=!0,Ap=!1),Cp&&(wp.startCharSize=Tp,wp.endCharSize=Cp,Tp=0),wp.width=bp,Dp.width?up(wp):Fp&&zp(),Mp.push(wp),wp={words:[]},bp=0}function zp(){bp>(Op.maxWidth||0)&&(Op.maxWidth=bp)}const{top:Yp,right:Xp,bottom:Hp,left:jp}=wt;function Up(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 Vp={getDrawData:function(t,e){r(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;e.motionText&&(n=o=0),a&&(n?(i=a[jp],n-=a[Xp]+a[jp],!n&&(n=.01)):e.autoSizeAlign||(i=a[jp]),o?(s=a[Yp],o-=a[Yp]+a[Hp],!o&&(o=.01)):e.autoSizeAlign||(s=a[Yp]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:te.canvas.font=e.__font};return function(t,e,i){Op=t,Mp=t.rows,Dp=t.bounds,Fp=!Dp.width&&!i.autoSizeAlign;const{paraIndent:s,textCase:n}=i,{canvas:r}=te,{width:o}=Dp;if(i.__isCharMode){const t="none"!==i.textWrap,a="break"===i.textWrap,h=i.__letterSpacing,l=i.__wordSpacing;Ap=!0,Rp=null,Tp=Bp=Cp=vp=bp=0,xp={data:[]},wp={words:[]};for(let i=0,d=(e=[...e]).length;i<d;i++)kp=e[i],"\n"===kp?(vp&&Wp(),wp.paraEnd=!0,Np(),Ap=!0):(Pp=lp(kp),Pp===_p&&"none"!==n&&(kp=cp(kp,n,!vp)),Bp=r.measureText(kp).width,h&&(h<0&&(Cp=Bp),Bp+=h),Ep=Pp===pp&&(Rp===pp||Rp===_p)||Rp===pp&&Pp!==fp,Lp=!(Pp!==gp&&Pp!==pp||Rp!==yp&&Rp!==fp),Sp=Ap&&s?o-s:o,t&&o&&bp+vp+Bp>Sp&&(a?(vp&&Wp(),bp&&Np()):(Lp||(Lp=Pp===_p&&Rp==fp),Ep||Lp||Pp===mp||Pp===gp||Pp===pp||vp+Bp>Sp?(vp&&Wp(),bp&&Np()):bp&&Np()))," "===kp&&!0!==Ap&&bp+vp===0||(Pp===mp?(" "===kp&&vp&&Wp(l),Ip(kp,Bp),Wp()):Ep||Lp?(vp&&Wp(l),Ip(kp,Bp)):Ip(kp,Bp)),Rp=Pp);vp&&Wp(),bp&&Np(),Mp.length>0&&(Mp[Mp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Op.paraNumber++,bp=r.measureText(t).width,Mp.push({x:s||0,text:t,width:bp,paraStart:!0}),Fp&&zp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Up(e,"x",t[jp]);break;case"right":Up(e,"x",-t[Xp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Up(e,"y",t[Yp]);break;case"bottom":Up(e,"y",-t[Hp])}}(a,h,e,n,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(e.__autoHeight?y: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 x,w,v,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(x=i[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=r,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<s.x&&(s.x=w),v>s.width&&(s.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r}=e,o=e.__letterSpacing||e.motionText,a=e.__wordSpacing,h=i&&n.includes("both"),l=h||i&&n.includes("justify"),d=l&&n.includes("letter");let c,u,_,p,g,f,y,m,x,w;s.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||h,u=i-t.width-g,d?p=u/(t.words.reduce((t,e)=>t+e.data.length,0)-1):_=m>1?u/(m-1):0),f=o||t.isOverflow||d?0:_||a?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===f?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,c=t.x,t.data=[],t.words.forEach((e,i)=>{1===f?(y={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,y),(t.isOverflow||" "!==y.char)&&t.data.push(y)):c=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,c,t.data,t.isOverflow,w&&p),e.addWidth&&(c+=e.addWidth),w&&(x=i===m-1,_?x||(c+=_,t.width+=_):p&&(t.width+=p*(e.data.length-(x?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?te.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=_l.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const qp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!_l.object)return t;t=_l.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};Object.assign(ul,Vp),Object.assign(_l,qp),Object.assign(fl,Ru),Object.assign(yl,h_),Object.assign(ml,C_),Object.assign(xl,Y_),Object.assign(ce,{interaction:(t,e,i,s)=>new uu(t,e,i,s),hitCanvas:(t,e)=>new Wh(t,e),hitCanvasManager:()=>new Jc}),rd.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Nh(0,wx)}catch(t){}class Gp extends El{get __isCanvas(){return!0}get __drawAfterFill(){return!0}get __boxStroke(){return!this.__pathInputed}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Kp=class extends ed{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?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),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),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=hr.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:h,height:l}=r&&(a(r)?{width:r,height:r}:r)||(o>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new ia(ia.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:n,__action:r}=this;r&&(r.FPS&&(i=r.FPS),s(r.loop)||(n=r.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!n)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(),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()}};function Qp(t,e){return mr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?bl.setStyleName(this,e,i):bl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Jp(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Zp(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 $p(t,e){c(e)||(e=void 0),ig(t,e,"in")}function tg(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),ig(t,e,"out"))}xe([Jr(Gp)],Kp.prototype,"__",void 0),xe([Cr()],Kp.prototype,"robot",void 0),xe([vr()],Kp.prototype,"actions",void 0),xe([vr("")],Kp.prototype,"action",void 0),xe([Mr(0)],Kp.prototype,"now",void 0),xe([vr(12)],Kp.prototype,"FPS",void 0),xe([vr(!0)],Kp.prototype,"loop",void 0),Kp=xe([ao()],Kp),de.add("robot");const eg={};function ig(t,e,i){const{normalStyle:s}=t;e||(e=eg),e.scale&&(F.assignScale(e,e.scale),delete e.scale),e!==eg&&bl.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const o=r?function(t,e){const i=rg(e,t),s=t.animate();s&&rg(i,t,s.fromStyle);return i}(t,e):void 0;bl.canAnimate&&sg(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=sg(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete a.animation}t.normalStyle=ng(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(r){const e=ng(o,t);t.set(o,"temp"),t.animate([o,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function sg(t){let e;const i={},s=Zp(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&bl.isState(n,t,s)&&(e=og(i,r));const o=i.selectedStyle||t.selectedStyle;o&&bl.isSelected(t,s)&&(e=og(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&bl.isPlacehold(t,s)&&(e=og(i,a)),bl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=og(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&bl.isFocus(t,s)&&(e=og(i,n));const r=i.hoverStyle||t.hoverStyle;r&&bl.isHover(t,s)&&(e=og(i,r));const o=i.pressStyle||t.pressStyle;o&&bl.isPress(t,s)&&(e=og(i,o))}return e?i:void 0}function ng(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&bl.animateExcludes[t]||(n[t]=e[t]);return n}function rg(t,e,i){return ng(t,e,i,!0)}function og(t,e){return Object.assign(t,e),!0}function ag(t,e){const i=t[e];i&&$p(t,i),t.button&&lg(t.children,e)}function hg(t,e,i){i||(i=t.states[e]),$p(t,i),t.button&&lg(t.children,null,e)}function lg(t,e,i){if(!t)return;let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],e){switch(r=!0,e){case"hoverStyle":bl.isHover(n)&&(r=!1);break;case"pressStyle":bl.isPress(n)&&(r=!1);break;case"focusStyle":bl.isFocus(n)&&(r=!1)}r&&ag(n,e)}else s(i)||hg(n,i);n.isBranch&&lg(n.children,e,i)}}function dg(t,e){const i=t[e];i&&tg(t,i),t.button&&ug(t.children,e)}function cg(t,e,i){tg(t,i),t.button&&ug(t.children,null,e)}function ug(t,e,i){if(!t)return;let n;for(let r=0,o=t.length;r<o;r++)n=t[r],e?dg(n,e):s(i)||cg(n,i),n.isBranch&&ug(n.children,e,i)}function _g(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=Zp(e,i);r&&(s=n[t](r))}return s}function pg(t,e,i){let s=e[t];if(!s&&i){const n=Zp(e,i);n&&(s=n[t])}return s}de.add("state"),bl.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},bl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Zp(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},bl.isSelected=function(t,e){return pg("selected",t,e)},bl.isDisabled=function(t,e){return pg("disabled",t,e)},bl.isFocus=function(t,e){return _g("isFocus",t,e)},bl.isHover=function(t,e){return _g("isHover",t,e)},bl.isPress=function(t,e){return _g("isPress",t,e)},bl.isPlacehold=function(t,e){return t.__.__isPlacehold},bl.isDrag=function(t,e){return _g("isDrag",t,e)},bl.setStyleName=function(t,e,i){i?hg(t,e,t[e]):cg(t,e,t[e])},bl.set=function(t,e){const i=t.states[e];i?hg(t,e,i):cg(t,e,i)},bl.getStyle=sg,bl.updateStyle=ig,bl.updateEventStyle=function(t,e){switch(e){case wc.ENTER:ag(t,"hoverStyle");break;case wc.LEAVE:dg(t,"hoverStyle");break;case wc.DOWN:ag(t,"pressStyle");break;case wc.UP:dg(t,"pressStyle")}};const gg=ed.prototype;ed.addAttr("selected",!1,Qp,"selectedStyle"),ed.addAttr("disabled",!1,Qp,"disabledStyle"),ed.addAttr("states",{},Jp),ed.addAttr("state","",Qp),ed.addAttr("normalStyle",void 0,vr),ed.addAttr("hoverStyle",void 0,Jp),ed.addAttr("pressStyle",void 0,Jp),ed.addAttr("focusStyle",void 0,Jp),ed.addAttr("selectedStyle",void 0,Jp),ed.addAttr("disabledStyle",void 0,Jp),ed.addAttr("placeholderStyle",void 0,Jp),ed.addAttr("button",!1,vr),gg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},gg.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?ag(this,"focusStyle"):dg(this,"focusStyle")})},gg.updateState=function(){bl.updateStyle(this,void 0,"in")};const fg=$d.prototype,yg="text";gr(fg,yg,Object.assign(Object.assign({},fr(fg,yg)),{set(t){const e=this,i=e.text;e.__setAttr(yg,t)&&(Rr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:mg,sin:xg,pow:wg,sqrt:vg,abs:bg,ceil:Sg,floor:kg,round:Bg,PI:Tg}=Math,Cg=5*Tg,Pg=1.70158,Rg=2.5949095,Eg=7.5625,Lg=2.75;function Ag(t){return e=>wg(e,t)}function Og(t){return e=>1-wg(1-e,t)}function Dg(t){return e=>e<.5?.5*wg(2*e,t):1-.5*wg(2-2*e,t)}function Fg(t){return t<1/Lg?Eg*t*t:t<2/Lg?Eg*(t-=1.5/Lg)*t+.75:t<2.5/Lg?Eg*(t-=2.25/Lg)*t+.9375:Eg*(t-=2.625/Lg)*t+.984375}function Mg(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=Ig(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(bg(l)<1e-6));e++)c-=d/l;return n[o]=Ig(c,e,s)}}function Ig(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Wg={get(t){const{list:e}=Wg;return r(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Wg.list[t]=e},list:{linear:t=>t,ease:Mg(.25,.1,.25,1),"ease-in":Mg(.42,0,1,1),"ease-out":Mg(0,0,.58,1),"ease-in-out":Mg(.42,0,.58,1),"sine-in":t=>1-mg(t*Tg*.5),"sine-out":t=>xg(t*Tg*.5),"sine-in-out":t=>.5*(1-mg(t*Tg)),"quad-in":Ag(2),"quad-out":Og(2),"quad-in-out":Dg(2),"cubic-in":Ag(3),"cubic-out":Og(3),"cubic-in-out":Dg(3),"quart-in":Ag(4),"quart-out":Og(4),"quart-in-out":Dg(4),"quint-in":Ag(5),"quint-out":Og(5),"quint-in-out":Dg(5),"expo-in":t=>t?wg(2,10*t-10):0,"expo-out":t=>1===t?1:1-wg(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*wg(2,2*t*10-10):.5*(2-wg(2,10-2*t*10)),"circ-in":t=>1-vg(1-wg(t,2)),"circ-out":t=>vg(1-wg(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-vg(1-wg(2*t,2))):.5*(vg(1-wg(2-2*t,2))+1),"back-in":t=>((Pg+1)*t-Pg)*t*t,"back-out":t=>(t-=1)*t*((Pg+1)*t+Pg)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Rg+1)*t-Rg)*.5:.5*((t=2*t-2)*t*((Rg+1)*t+Rg)+2),"elastic-in":t=>0===t||1===t?t:-wg(2,10*(t-1))*xg((t-1.1)*Cg),"elastic-out":t=>0===t||1===t?t:wg(2,-10*t)*xg((t-.1)*Cg)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-wg(2,10*((t*=2)-1))*xg((t-1.1)*Cg)*.5:wg(2,10*(1-(t*=2)))*xg((t-1.1)*Cg)*.5+1,"bounce-in":t=>1-Fg(1-t),"bounce-out":Fg,"bounce-in-out":t=>t<.5?.5*(1-Fg(1-2*t)):.5*(1+Fg(2*t-1)),"cubic-bezier":Mg,steps:function(t,e="floor"){return i=>("floor"===e?kg(i*t):"ceil"===e?Sg(i*t):Bg(i*t))/t}}};function Ng(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 zg{}zg.CREATED="created",zg.PLAY="play",zg.PAUSE="pause",zg.STOP="stop",zg.SEEK="seek",zg.UPDATE="update",zg.COMPLETED="completed";let Yg=class extends wa{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&&a(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,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=d(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=Wg.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))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(zg.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(zg.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(zg.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=pl.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(zg.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:n}=this,{length:r}=i,o=!(r>1)||this.join;let h,l,d,c,u,_=0,p=0;r>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<r;n++){if(l=i[n],c=l.style||l,h||(h=o?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=l;r&&(d.swing=a(r)?r:2,u=2*d.swing-1),o&&(d.loop=u=a(o)?o:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=Wg.get(n))}if(!d.autoDuration&&s(d.duration)&&(r>1?n>0||o?p+=u:d.duration=0:d.duration=this.duration),r>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=_||!n||!n.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(zg.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:n,toStyle:r,target:o}=this;for(let a in e)s(n[a])&&(n[a]=r[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=s(i[a])?r[a]:i[a],r[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:n}=i;for(let r=0;r<n;r++)e=i[r],s(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))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,te.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}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,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),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.startRequestAnimate()}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.emitType(zg.COMPLETED)}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={}),Sl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(zg.UPDATE)}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 a(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.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};xe([Ng("ease")],Yg.prototype,"easing",void 0),xe([Ng(0)],Yg.prototype,"delay",void 0),xe([Ng(.2)],Yg.prototype,"duration",void 0),xe([Ng("auto")],Yg.prototype,"ending",void 0),xe([Ng(!1)],Yg.prototype,"reverse",void 0),xe([Ng(!1)],Yg.prototype,"swing",void 0),xe([Ng(!1)],Yg.prototype,"loop",void 0),xe([Ng(0)],Yg.prototype,"loopDelay",void 0),xe([Ng(1)],Yg.prototype,"speed",void 0),xe([Ng(!0)],Yg.prototype,"autoplay",void 0),xe([Ng()],Yg.prototype,"join",void 0),xe([Ng()],Yg.prototype,"jump",void 0),xe([Ng()],Yg.prototype,"attrs",void 0),Yg=xe([oo(La)],Yg);let Xg=class extends Yg{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Yg(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(zg.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(zg.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(zg.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(zg.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case zg.COMPLETED:this.completed&&this.emitType(t);break;case zg.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};Xg=xe([oo(La)],Xg);const Hg={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"},jg=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Ug=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Vg=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,qg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Gg=parseInt,Kg=parseFloat,{round:Qg}=Math;let Jg={},Zg=0;function $g(t){let e,i,s,n=1;switch(t.length){case 9:e=Gg(t.slice(1,3),16),i=Gg(t.slice(3,5),16),s=Gg(t.slice(5,7),16),n=Gg(t.slice(7,9),16)/255;break;case 7:e=Gg(t.slice(1,3),16),i=Gg(t.slice(3,5),16),s=Gg(t.slice(5,7),16);break;case 5:e=Gg(t[1]+t[1],16),i=Gg(t[2]+t[2],16),s=Gg(t[3]+t[3],16),n=Gg(t[4]+t[4],16)/255;break;case 4:e=Gg(t[1]+t[1],16),i=Gg(t[2]+t[2],16),s=Gg(t[3]+t[3],16);break;case 3:e=i=s=Gg(t[1]+t[2],16);break;case 2:e=i=s=Gg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const tf=1/6,ef=.5,sf=2/3,nf=1/3;function rf(t,e,i){return i<0?i++:i>1&&i--,i<tf?t+6*(e-t)*i:i<ef?e:i<sf?t+(e-t)*(sf-i)*6:t}function of(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=rf(a,s,t+nf),r=rf(a,s,t),o=rf(a,s,t-nf)}return{r:Qg(255*n),g:Qg(255*r),b:Qg(255*o),a:s}}de.add("color"),_l.object=function(t,e){let i,n=!s(e)&&e<1;if(r(t)){const e=Jg[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=$g(t);break;case"R":case"r":"("===t[4]&&Ug.test(t)?i=function(t){const e=Ug.exec(t);return{r:Gg(e[1]),g:Gg(e[2]),b:Gg(e[3]),a:Kg(e[4])}}(t):"("===t[3]&&jg.test(t)&&(i=function(t){const e=jg.exec(t);return{r:Gg(e[1]),g:Gg(e[2]),b:Gg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&qg.test(t)?i=function(t){const e=qg.exec(t);return of(Kg(e[1]),Kg(e[2]),Kg(e[3]),Kg(e[4]))}(t):"("===t[3]&&Vg.test(t)&&(i=function(t){const e=Vg.exec(t);return of(Kg(e[1]),Kg(e[2]),Kg(e[3]),1)}(t))}if(!i){const e=Hg[t.toLowerCase()];e&&(i=$g("#"+e))}i&&(Zg++,Zg>1e4&&(Jg={},Zg=0),Jg[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),n&&(i.a*=e),i};const{round:af}=Math,{fourNumber:hf}=F,lf={fill:pf,stroke:pf,cornerRadius:(t,e,i)=>a(t)&&a(e)?uf(t,e,i):(t=hf(t),e=hf(e),t.map((t,s)=>uf(t,e[s],i))),text(t,e,i){if(r(t)&&r(e)){const s=t.length,n=e.length,r=uf(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return a(t)||a(e)?F.float(uf(t,e,i),Math.max(cf(t),cf(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Sl.setBetweenStyle(n,t,e,n,i,s),n},shadow:gf,innerShadow:gf},df={value:function(t,e,i){const s=a(t),n=a(e);return s&&n?t+(e-t)*i:n||s?uf(t,e,i):t},number:uf,color:_f,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=Sl;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 cf(t){const e=String(t).split(".")[1];return e?e.length:0}function uf(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?af(n):n}function _f(t,e,i){let s=_l.object(t),n=_l.object(e);t||(s=Object.assign(Object.assign({},n),{a:0})),e||(n=Object.assign(Object.assign({},s),{a:0}));const r=uf(s.r,n.r,i,1)+","+uf(s.g,n.g,i,1)+","+uf(s.b,n.b,i,1),o=uf(s.a,n.a,i);return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}function pf(t,e,i){return!r(t)&&t||!r(e)&&e?e:_f(t,e,i)}function gf(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:uf((t=t||{}).x,e.x,i),y:uf(t.y,e.y,i),blur:uf(t.blur,e.blur,i),spread:uf(t.spread,e.spread,i),color:_f(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}de.add("animate","color"),bl.canAnimate=!0,Object.assign(Sl.list,lf),Object.assign(Sl,df);const ff=ed.prototype;ed.addAttr("animation",void 0,function(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),ed.addAttr("animationOut",void 0,vr),ed.addAttr("transition",!0,vr),ed.addAttr("transitionOut",void 0,vr),ff.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},ff.animate=function(t,e,i,n){if(s(t))return this.__animate;let r=d(t)&&!e&&i?new Xg(this,t,n):new Yg(this,t,e,n);this.killAnimate(i,r.toStyle);const o=this.__animate;return o&&(r instanceof Xg?r.list.unshift(o):r=new Xg(this,[o,r])),this.__animate=r},ff.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Xg&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},ff.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(zg.COMPLETED,e)};const yf=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],mf=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:xf}=Math,{getDerivative:wf}=di,vf={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<yf.length;h++)l=f*(1+yf[h]),d=f*(1-yf[h]),c=wf(l,t,i,n,o),u=wf(l,e,s,r,a),_=wf(d,t,i,n,o),p=wf(d,e,s,r,a),g+=mf[h]*(xf(c*c+u*u)+xf(_*_+p*p));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=wf(t,e,s,r,a),d=wf(t,i,n,o,h);return Math.atan2(d,l)/I},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;)bf(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(Ie.C,c,u,g,f,y,m)}},{getDistance:bf}=vf,{M:Sf,L:kf,C:Bf,Z:Tf}=Ie,{float:Cf}=F,{set:Pf,getAngle:Rf,getDistanceFrom:Ef,getDistancePoint:Lf}=ht,Af={},Of={},Df={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Sf:case kf:Df.transformPoints(t,e,s,1),s+=3;break;case Bf:Df.transformPoints(t,e,s,3),s+=7;break;case Tf:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Af.x=t[n],Af.y=t[n+1],Q.toOuterPoint(e,Af),t[n]=Af.x,t[n+1]=Af.y},getMotionPathData(t){let e,i,s,n,r,o=0,a=[],h=0,l=0,d=0,c=0,u=0;const _=t.length;for(;h<_;){switch(n=t[h],n){case Sf:c=t[h+1],u=t[h+2];case kf:i=t[h+1],s=t[h+2],e=n===kf&&h>0?Ef(l,d,i,s):0,l=i,d=s,h+=3;break;case Bf:i=t[h+5],s=t[h+6],e=vf.getDistance(l,d,t[h+1],t[h+2],t[h+3],t[h+4],i,s),l=i,d=s,h+=7;break;case Tf:r=!0,e=Ef(l,d,c,u),h+=1;break;default:e=0}a.push(e),o+=e}return{total:o,segments:a,data:t,closed:r}},getDistancePoint(t,e,i,s){const{segments:n,data:r,total:o}=t;e=pl.number(e,o),s&&(e+=s),e>o&&(e%=o),e<0&&(e=o+e);let a,h,l,d,c,u,_,p,g,f=0,y={},m=0,x=0,w=0,v=0,b=0,S=0;const k=r.length;for(;m<k;){switch(d=r[m],d){case Sf:b=r[m+1],S=r[m+2];case kf:if(h=r[m+1],l=r[m+2],a=n[x],f+a>=e||!t.total){if(Pf(y,h,l),m)return Pf(Of,w,v),Lf(Of,y,e-f,!0),y.rotation=Rf(Of,y),y;{const e=Df.getDistancePoint(t,i,i,s);return y.rotation=e.rotation,y}}w=h,v=l,m+=3;break;case Bf:if(h=r[m+5],l=r[m+6],a=n[x],f+a>=e)return c=r[m+1],u=r[m+2],_=r[m+3],p=r[m+4],g=vf.getT(e-f,a,w,v,c,u,_,p,h,l,i),di.getPointAndSet(g,w,v,c,u,_,p,h,l,y),y.rotation=vf.getRotation(g,w,v,c,u,_,p,h,l),y;w=h,v=l,m+=7;break;case Tf:if(h=b,l=S,a=n[x],f+a>=e)return Pf(Of,w,v),Pf(y,h,l),Lf(Of,y,e-f,!0),y.rotation=Rf(Of,y),y;w=h,v=l,m+=1;break;default:a=0}x++,f+=a}return y},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=pl.number(e,t.total);let o,a,h,l,d,c,u,_,p,g,f=0,y={},m=0,x=0,w=0,v=0,b=0,S=0;const k=n.length;for(;m<k;){switch(d=n[m],d){case Sf:b=n[m+1],S=n[m+2];case kf:if(h=n[m+1],l=n[m+2],o=s[x],f+o>e||!t.total)return m||(w=h,v=l),Pf(Of,w,v),Pf(y,h,l),a=Cf(e-f),a&&(Lf(Of,y,a,!0),r.push(d,y.x,y.y)),r;w=h,v=l,m+=3,r.push(d,w,v);break;case Bf:if(c=n[m+1],u=n[m+2],_=n[m+3],p=n[m+4],h=n[m+5],l=n[m+6],o=s[x],f+o>e)return a=Cf(e-f),a&&(g=vf.getT(a,o,w,v,c,u,_,p,h,l,i),vf.cut(r,g,w,v,c,u,_,p,h,l)),r;w=h,v=l,m+=7,r.push(d,c,u,_,p,h,l);break;case Tf:if(h=b,l=S,o=s[x],f+o>e)return Pf(Of,w,v),Pf(y,h,l),a=Cf(e-f),a&&(Lf(Of,y,a,!0),r.push(kf,y.x,y.y)),r;w=h,v=l,m+=1,r.push(d);break;default:o=0}x++,f+=o}return r}};function Ff(t){return mr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}de.add("motion-path"),Sl.register("motion",function(t,e,i,s){return c(t)&&(t=pl.number(t,s.getMotionTotal())),c(e)&&(e=pl.number(e,s.getMotionTotal())),Sl.number(t||0,e||0,i)}),Sl.register("motionRotation",function(t,e,i){return Sl.number(t,e,i)});const Mf=ed.prototype,{updateMatrix:If,updateAllMatrix:Wf}=vo,{updateBounds:Nf}=Do,{toVertical:zf}=ht,Yf={};function Xf(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=jf(t);i.total&&(t.__.__pathForRender=Df.getDistancePath(i,e,t.motionPrecision))}else{if(t.motionText)t.__updateMotionText();else{const i=t.getMotionPoint(e,t.motionAround);!1===t.motionRotation&&delete i.rotation,t.set(i)}t.__hasAutoLayout||(t.isBranch?(Wf(t),Nf(t,t)):If(t))}i&&(t.leafer.created=!0)}}function Hf(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 jf(t){const e=t.__;if(e.__pathForMotion)return e.__pathForMotion;return e.__pathForMotion=Df.getMotionPathData(t.getPath(!0,!0))}ed.addAttr("motionPath",void 0,Ff),ed.addAttr("motionPrecision",1,Ff),ed.addAttr("motion",void 0,Ff),ed.addAttr("motionAround",void 0,Ff),ed.addAttr("motionVertical","below",Ff),ed.addAttr("motionRotation",!0,Ff),Mf.getMotionPath=function(){return Hf(this)},Mf.getMotionPathData=function(){return jf(Hf(this))},Mf.getMotionPoint=function(t,e,i=0,s=0,n){n||(n=Hf(this));const r=jf(n);if(!r.total)return{};const o=Df.getDistancePoint(r,t,n.motionPrecision,i),{motionRotation:h}=this;return a(h)?o.rotation+=h:!1===h&&(o.rotation=0),e&&"top-left"!==e&&(St.toPoint(e,this.__layout.boxBounds,Yf),ht.set(Yf,o.x-Yf.x*this.scaleX,o.y-Yf.y*this.scaleY),o.rotation&&ht.rotate(Yf,o.rotation,o),ht.copy(o,Yf)),s&&zf(o,o.rotation,s),Q.toOuterPoint(n.localTransform,o),o},Mf.getMotionTotal=function(){return this.getMotionPathData().total},Mf.__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],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Xf(t))}else Xf(this)};const{Yes:Uf,NoAndSkip:Vf,YesAndSkip:qf}=e,Gf={},Kf={},Qf={};class Jf{constructor(t,e){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.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,n){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":Gf.id=t.substring(1),t=Gf;break;case".":Kf.className=t.substring(1),t=Kf;break;default:Qf.tag=t,t=Qf}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,n=d(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?p.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,n)}}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&&vo.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),"boolean"==typeof r&&(r=r?1:0),r===Uf||r===qf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Vf&&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_(Zo.REMOVE,this.__onRemoveChild,this),this.target.on_(ta.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 Zf=ed.prototype;function $f(t){return t.leafer?t.leafer.selector:te.selector||(te.selector=ce.selector())}Zf.find=function(t,e){return $f(this).getBy(t,this,!1,e)},Zf.findOne=function(t,e){return $f(this).getBy(t,this,!0,e)},de.add("find"),ce.finder=function(t,e){return new Jf(t,e)},vo.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)};export{Tt as AlignHelper,Yg as Animate,Wg as AnimateEasing,zg as AnimateEvent,Xg as AnimateList,e as Answer,ic as App,St as AroundHelper,Kt as AutoBounds,di as BezierHelper,qt as Bounds,sa as BoundsEvent,Ht as BoundsHelper,ud as Box,Ol as BoxData,Dh as Branch,Do as BranchHelper,Za as BranchRender,Gd as Canvas,Vl as CanvasData,me as CanvasManager,Zo as ChildEvent,_l as ColorConvert,ce as Creator,Qc as Cursor,p as DataHelper,se as Debug,wt as Direction4,vt as Direction9,mc as DragBoundsHelper,Sc as DragEvent,Nc as Dragger,Bc as DropEvent,xl as Effect,bd as Ellipse,Wl as EllipseData,xi as EllipseHelper,Jo as Event,fe as EventCreator,wa as Eventer,vl as Export,tr as FileHelper,wl as Filter,Jf as Finder,k as FourNumberHelper,_d as Frame,Fl as FrameData,id as Group,Al as GroupData,vf as HighBezierHelper,Df as HighCurveHelper,Jc as HitCanvasManager,Vd as Image,Ul as ImageData,ia as ImageEvent,hr as ImageManager,y as IncrementId,uu as Interaction,Kc as InteractionBase,Oc as InteractionHelper,Ac as KeyEvent,nc as Keyboard,ca as LayoutEvent,$h as Layouter,Vh as LayouterHelper,kh as Leaf,Ga as LeafBounds,Eo as LeafBoundsHelper,f as LeafData,Oa as LeafDataProxy,La as LeafEventer,vo as LeafHelper,Qo as LeafLayout,Mh as LeafLevelList,Fh as LeafList,za as LeafMatrix,Ka as LeafRender,rd as Leafer,Wh as LeaferCanvas,De as LeaferCanvasBase,Dl as LeaferData,_a as LeaferEvent,_r as LeaferFilm,ur as LeaferImage,pr as LeaferVideo,Ud as Line,Ml as LineData,F as MathHelper,ft as Matrix,Q as MatrixHelper,Tc as MoveEvent,kc as MyDragEvent,qd as MyImage,vc as MyPointerEvent,Pc as MyTouchEvent,Ne as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,N as PI_2,fl as Paint,ml as PaintGradient,yl as PaintImage,tc as Path,gl as PathArrow,Yn as PathBounds,Ps as PathCommandDataHelper,Ie as PathCommandMap,wi as PathCommandNodeHelper,ns as PathConvert,Kn as PathCorner,qs as PathCreator,Yl as PathData,ln as PathDrawer,Fe as PathHelper,t as PathNodeHandleType,He as PathNumberCommandLengthMap,Xe as PathNumberCommandMap,ec as Pen,Xl as PenData,rl as Picker,te as Platform,de as Plugin,pt as Point,ht as PointHelper,rc as PointerButton,wc as PointerEvent,Ed as Polygon,Nl as PolygonData,ta as PropertyEvent,od as Rect,Il as RectData,je as RectHelper,$l as RectRender,ua as RenderEvent,el as Renderer,la as ResizeEvent,or as Resource,Kp as Robot,Gp as RobotData,Rc as RotateEvent,ae as Run,ol as Selector,Id as Star,zl as StarData,bl as State,Jt as StringNumberMap,Ec as SwipeEvent,sr as TaskItem,nr as TaskProcessor,$d as Text,ul as TextConvert,jl as TextData,Cc as TouchEvent,Sl as Transition,mt as TwoPointBoundsHelper,ed as UI,Kl as UIBounds,_e as UICreator,El as UIData,oc as UIEvent,Jl as UIRender,pl as UnitConvert,Qt as UnitConvertHelper,zo as WaitHelper,da as WatchEvent,zh as Watcher,Lc as ZoomEvent,Fr as affectRenderBoundsType,Ar as affectStrokeBoundsType,xr as attr,kr as autoLayoutType,Cr as boundsType,$n as canvasPatch,Oe as canvasSizeAttrs,cl as createAttr,yr as createDescriptor,Qr as cursorType,Jr as dataProcessor,vr as dataType,mr as decorateLeafAttr,$r as defineDataProcessor,gr as defineKey,wr as defineLeafAttr,Wr as dimType,Rr as doBoundsType,Or as doStrokeType,Ir as doSurfaceType,al as effectType,i as emptyData,Gr as eraserType,ea as extraPropertyEventMap,dl as frameType,Y as getBoundsData,fr as getDescriptor,X as getMatrixData,z as getPointData,Kr as hitType,d as isArray,u as isData,_ as isEmptyData,o as isFinite,n as isNull,a as isNumber,c as isObject,r as isString,bo as isTrackChanges,s as isUndefined,Zr as layoutProcessor,ma as leaferTransformAttrMap,Vr as maskType,Ff as motionPathType,Pr as naturalBoundsType,Nr as opacityType,Qn as path,Er as pathInputType,Lr as pathType,Jn as pen,br as positionType,As as registerPointsCurve,ao as registerUI,ho as registerUIEvent,hl as resizeType,so as rewrite,no as rewriteAble,Tr as rotationType,Br as scaleType,Sr as scrollType,jr as sortType,Jp as stateStyleType,Qp as stateType,Dr as strokeType,Mr as surfaceType,Gt as tempBounds,yt as tempMatrix,gt as tempPoint,l as tryToNumber,Nh as useCanvas,oo as useModule,Ih as version,zr as visibleType,ll as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=miniapp.module.min.js.map
|