UNPKG

@leafer/core

Version:
1 lines 94.7 kB
"use strict";const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:o,PI:n}=Math,a={within:(t,e,s)=>("object"==typeof e&&(s=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==s&&t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=void 0===e?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),a.float(t)),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=void 0!==e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData(t,e,s,r){if(r||(r={}),e){const t=("number"==typeof e?e:e.width||0)/s.width,i=("number"==typeof e?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&a.assignScale(r,t);return r},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=n/180,d=2*n,u=n/2;function c(){return{x:0,y:0}}function p(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:g,acos:y,sqrt:x}=Math,{float:m}=a,w={};function b(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const v={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:_,getWorld:b,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.scaleOfInner(t,w,s,r)},scaleOfInner(t,e,s,r=s){B.translateInner(t,e.x,e.y),B.scale(t,s,r),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=g(e*=l),a=f(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){B.toInnerPoint(t,e,w),B.rotateOfInner(t,w,s)},rotateOfInner(t,e,s){B.translateInner(t,e.x,e.y),B.rotate(t,s),B.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=l,t.a=r+o*s,t.b=i+n*s),e&&(e*=l,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.skewOfInner(t,w,s,r)},skewOfInner(t,e,s,r=0){B.translateInner(t,e.x,e.y),B.skew(t,s,r),B.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:o,c:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r,i){const{x:o,y:n,scaleX:a,scaleY:h}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,o=s*l,n=g(o),d=f(o);if(r||i){const e=r*l,s=i*l;t.a=(n+s*-d)*a,t.b=(d+s*n)*a,t.c=(e*n-d)*h,t.d=(n+e*d)*h}else t.a=n*a,t.b=d*a,t.c=-d*h,t.d=n*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=o,t.f=n,(s=s||r)&&B.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:h,f:d}=t;let c,p,_,w,b,v=h,B=d;if(o||n){const t=i*a-o*n;if(n&&!r){c=x(i*i+o*o),p=t/c;const e=i/c;_=o>0?y(e):-y(e)}else{p=x(n*n+a*a),c=t/p;const e=n/p;_=u-(a>0?y(-e):-y(e))}const e=m(g(_)),s=f(_);c=m(c),p=m(p),w=e?m((n/p+s)/e/l,9):0,b=e?m((o/c-s)/e/l,9):0,_=m(_/l)}else c=i,p=a,_=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*n,B+=e.x*o+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:p,rotation:_,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=x(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){B.set(t)}},B=v,{toInnerPoint:k,toOuterPoint:C}=v,{sin:T,cos:O,abs:P,sqrt:L,atan2:R,min:S,round:I,PI:M}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?I(t.x-.5)+.5:I(t.x),t.y=e?I(t.y-.5)+.5:I(t.y)},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=A.defaultPoint);const r=O(e*=l),i=T(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=A;return D(s,t),k(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=A;return D(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=A;return D(s,t),A.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),k(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){k(e,t,s)},toOuterOf(t,e,s){C(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>W(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=P(s-t),o=P(r-e);return L(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>S(W(t,e,s,r),W(s,r,i,o)),getAngle:(t,e)=>N(t,e)/l,getRotation:(t,e,s,r)=>(r||(r=e),A.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/l),getRadianFrom(t,e,s,r,i,o,n,a){void 0===n&&(n=s,a=r);let h=R(e-r,t-s);const l=R(o-a,i-n)-h;return l<-M?l+d:l},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=N(t,e);return(e=r?e:{}).x=t.x+O(i)*s,e.y=t.y+T(i)*s,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){A.reset(t)}},A=E,{getDistanceFrom:W,copy:D,getAtan2:N}=A;class Y{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Y(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new Y(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new Y(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const X=new Y;class z{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return"object"==typeof t?v.copy(this,t):v.set(this,t,e,s,r,i,o),this}setWith(t){return v.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new z(this)}translate(t,e){return v.translate(this,t,e),this}translateInner(t,e){return v.translateInner(this,t,e),this}scale(t,e){return v.scale(this,t,e),this}scaleWith(t,e){return v.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return v.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return v.scaleOfInner(this,t,e,s),this}rotate(t){return v.rotate(this,t),this}rotateOfOuter(t,e){return v.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return v.rotateOfInner(this,t,e),this}skew(t,e){return v.skew(this,t,e),this}skewOfOuter(t,e,s){return v.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return v.skewOfInner(this,t,e,s),this}multiply(t){return v.multiply(this,t),this}multiplyParent(t){return v.multiplyParent(this,t),this}divide(t){return v.divide(this,t),this}divideParent(t){return v.divideParent(this,t),this}invert(){return v.invert(this),this}invertWith(){return v.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){v.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){v.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return v.setLayout(this,t,e,s),this}getLayout(t,e,s){return v.getLayout(this,t,e,s)}withScale(t,e){return v.withScale(this,t,e)}reset(){v.reset(this)}}const F=new z,j={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){H(t,e,s),H(t,e+r,s+i)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:H}=j,{tempPointBounds:U,setPoint:G,addPoint:V,toBounds:q}=j,{toOuterPoint:Q}=v,{float:J,fourNumber:Z}=a,{floor:$,ceil:K}=Math;let tt,et,st,rt;const it={},ot={},nt={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r,i){const{x:o,y:n,width:a,height:h}=e;if(s instanceof Array){const e=Z(s);r?at.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),at.set(t,o-s,n-s,a+2*s,h+2*s);i&&("width"===i?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),at.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?lt(e,t):e=t,s?(e.offsetX=-(at.maxX(s)-t.x),e.offsetY=-(at.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else it.x=t.x,it.y=t.y,Q(e,it,ot),G(U,ot.x,ot.y),it.x=t.x+t.width,Q(e,it,ot),V(U,ot.x,ot.y),it.y=t.y+t.height,Q(e,it,ot),V(U,ot.x,ot.y),it.x=t.x,Q(e,it,ot),V(U,ot.x,ot.y),q(U,s)},toInnerOf(t,e,s){s||(s=t),at.move(s,-e.e,-e.f),at.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new z(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return at.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){at.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){at.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=$(t.x),t.y=$(t.y),t.width=e>t.x?K(t.width+e-t.x):K(t.width),t.height=s>t.y?K(t.height+s-t.y):K(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=J(t.x,e),t.y=J(t.y,e),t.width=J(t.width,e),t.height=J(t.height,e)},add(t,e,s){tt=t.x+t.width,et=t.y+t.height,st=e.x,rt=e.y,s||(st+=e.width,rt+=e.height),tt=tt>st?tt:st,et=et>rt?et:rt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){at.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){at.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||lt(t,i)):ht(t,i));o&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?G(U,t.x,t.y):V(U,t.x,t.y))),q(U,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=E.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=at.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=at.tempToOuterOf(e,s)),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,s){if(s&&(e=at.tempToOuterOf(e,s)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return tt=r+o,et=i+n,st=t.x+t.width,rt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,tt=tt<st?tt:st,et=et<rt?et:rt,o=tt-r,n=et-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){at.copy(t,at.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){at.set(t)}},at=nt,{add:ht,copy:lt}=at;class dt{get minX(){return nt.minX(this)}get minY(){return nt.minY(this)}get maxX(){return nt.maxX(this)}get maxY(){return nt.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?nt.copy(this,t):nt.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new dt(this)}move(t,e){return nt.move(this,t,e),this}scale(t,e){return nt.scale(this,t,e),this}scaleOf(t,e,s){return nt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return nt.toOuterOf(this,t,e),this}toInnerOf(t,e){return nt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return nt.getFitMatrix(this,t,e)}spread(t,e){return nt.spread(this,t,e),this}shrink(t,e){return nt.shrink(this,t,e),this}ceil(){return nt.ceil(this),this}unsign(){return nt.unsign(this),this}float(t){return nt.float(this,t),this}add(t){return nt.add(this,t),this}addList(t){return nt.setList(this,t,!0),this}setList(t){return nt.setList(this,t),this}addListWithFn(t,e){return nt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return nt.setListWithFn(this,t,e),this}setPoint(t){return nt.setPoint(this,t),this}setPoints(t){return nt.setPoints(this,t),this}addPoint(t){return nt.addPoint(this,t),this}getPoints(){return nt.getPoints(this)}hitPoint(t,e){return nt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return nt.hitRadiusPoint(this,t,e)}hit(t,e){return nt.hit(this,t,e)}includes(t,e){return nt.includes(this,t,e)}intersect(t,e){return nt.intersect(this,t,e),this}getIntersect(t,e){return new dt(nt.getIntersectData(this,t,e))}isSame(t){return nt.isSame(this,t)}isEmpty(){return nt.isEmpty(this)}reset(){nt.reset(this)}}const ut=new dt;var ct,pt;exports.Direction4=void 0,(ct=exports.Direction4||(exports.Direction4={}))[ct.top=0]="top",ct[ct.right=1]="right",ct[ct.bottom=2]="bottom",ct[ct.left=3]="left",exports.Direction9=void 0,(pt=exports.Direction9||(exports.Direction9={}))[pt.topLeft=0]="topLeft",pt[pt.top=1]="top",pt[pt.topRight=2]="topRight",pt[pt.right=3]="right",pt[pt.bottomRight=4]="bottomRight",pt[pt.bottom=5]="bottom",pt[pt.bottomLeft=6]="bottomLeft",pt[pt.left=7]="left",pt[pt.center=8]="center",pt[pt["top-left"]=0]="top-left",pt[pt["top-right"]=2]="top-right",pt[pt["bottom-right"]=4]="bottom-right",pt[pt["bottom-left"]=6]="bottom-left";const _t=[{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}];_t.forEach((t=>t.type="percent"));const ft={directionData:_t,tempPoint:{},get:gt,toPoint(t,e,s,r,i){const o=gt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function gt(t){return"string"==typeof t?_t[exports.Direction9[t]]:t}const{toPoint:yt}=ft,xt={toPoint(t,e,s,r,i){yt(t,s,r,i,e)}},mt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:wt}=a;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=vt(t)}static set exclude(t){this.excludeList=vt(t)}static drawRepaint(t,e){const s=wt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===bt.showBounds,i=t.__nowWorld,o=wt();r&&(e.setWorld(i),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),r?e.stroke():e.strokeWorld(i,o)}log(...t){if(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function vt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Bt=bt,kt=bt.get("RunTime"),Ct={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Tt.currentId=Tt.idMap[r]=e?performance.now():Date.now(),Tt.currentName=Tt.nameMap[r]=t,Tt.nameToIdMap[t]=r,r},end(t,e){const s=Tt.idMap[t],r=Tt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Tt.idMap[t]=Tt.nameMap[t]=Tt.nameToIdMap[r]=void 0,kt.log(r,i,"ms")},endOfName(t,e){const s=Tt.nameToIdMap[t];void 0!==s&&Tt.end(s,e)}},Tt=Ct,Ot=[],Pt={list:{},add(t,...e){this.list[t]=!0,Ot.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ot.forEach((t=>Pt.has(t,!0)))));const Lt=bt.get("UICreator"),Rt={list:{},register(t){const{__tag:e}=t.prototype;St[e]&&Lt.repeat(e),St[e]=t},get(t,e,s,r,i,o){St[t]||Lt.error("not register "+t);const n=new St[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:St}=Rt,It=bt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Et[e]&&It.repeat(e),Et[e]=t)}))},changeName(t,e){const s=Et[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Et[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Et[t](...e)},{nameList:Et}=Mt;const At={default:(t,e)=>(Wt(e,t),Wt(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach((i=>{var o,n;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object)return Wt(t[i],e[i],s&&s[i]);s&&i in s?(null===(n=s[i])||void 0===n?void 0:n.constructor)===Object&&Wt(t[i]={},e[i],s[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Wt}=At;class Dt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var Nt;exports.Answer=void 0,(Nt=exports.Answer||(exports.Answer={}))[Nt.No=0]="No",Nt[Nt.Yes=1]="Yes",Nt[Nt.NoAndSkip=2]="NoAndSkip",Nt[Nt.YesAndSkip=3]="YesAndSkip";function Yt(t){return"{}"===JSON.stringify(t)}function Xt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function zt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function Ft(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const jt=[];function Ht(){return(t,e)=>{jt.push(e)}}const Ut=[];class Gt{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||Ut)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;jt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}Xt([Ft("imageSmoothingEnabled")],Gt.prototype,"smooth",void 0),Xt([Ft("imageSmoothingQuality")],Gt.prototype,"smoothLevel",void 0),Xt([Ft("globalAlpha")],Gt.prototype,"opacity",void 0),Xt([Ft()],Gt.prototype,"fillStyle",void 0),Xt([Ft()],Gt.prototype,"strokeStyle",void 0),Xt([Ft("lineWidth")],Gt.prototype,"strokeWidth",void 0),Xt([Ft("lineCap")],Gt.prototype,"strokeCap",void 0),Xt([Ft("lineJoin")],Gt.prototype,"strokeJoin",void 0),Xt([Ft("lineDashOffset")],Gt.prototype,"dashOffset",void 0),Xt([Ft()],Gt.prototype,"miterLimit",void 0),Xt([Ft()],Gt.prototype,"shadowBlur",void 0),Xt([Ft()],Gt.prototype,"shadowColor",void 0),Xt([Ft()],Gt.prototype,"shadowOffsetX",void 0),Xt([Ft()],Gt.prototype,"shadowOffsetY",void 0),Xt([Ft()],Gt.prototype,"filter",void 0),Xt([Ft()],Gt.prototype,"font",void 0),Xt([Ft()],Gt.prototype,"fontKerning",void 0),Xt([Ft()],Gt.prototype,"fontStretch",void 0),Xt([Ft()],Gt.prototype,"fontVariantCaps",void 0),Xt([Ft()],Gt.prototype,"textAlign",void 0),Xt([Ft()],Gt.prototype,"textBaseline",void 0),Xt([Ft()],Gt.prototype,"textRendering",void 0),Xt([Ft()],Gt.prototype,"wordSpacing",void 0),Xt([Ft()],Gt.prototype,"letterSpacing",void 0),Xt([Ft()],Gt.prototype,"direction",void 0),Xt([Ht()],Gt.prototype,"setTransform",null),Xt([Ht()],Gt.prototype,"resetTransform",null),Xt([Ht()],Gt.prototype,"getTransform",null),Xt([Ht()],Gt.prototype,"save",null),Xt([Ht()],Gt.prototype,"restore",null),Xt([Ht()],Gt.prototype,"translate",null),Xt([Ht()],Gt.prototype,"scale",null),Xt([Ht()],Gt.prototype,"rotate",null),Xt([Ht()],Gt.prototype,"fill",null),Xt([Ht()],Gt.prototype,"stroke",null),Xt([Ht()],Gt.prototype,"clip",null),Xt([Ht()],Gt.prototype,"fillRect",null),Xt([Ht()],Gt.prototype,"strokeRect",null),Xt([Ht()],Gt.prototype,"clearRect",null),Xt([Ht()],Gt.prototype,"beginPath",null),Xt([Ht()],Gt.prototype,"moveTo",null),Xt([Ht()],Gt.prototype,"lineTo",null),Xt([Ht()],Gt.prototype,"bezierCurveTo",null),Xt([Ht()],Gt.prototype,"quadraticCurveTo",null),Xt([Ht()],Gt.prototype,"closePath",null),Xt([Ht()],Gt.prototype,"arc",null),Xt([Ht()],Gt.prototype,"arcTo",null),Xt([Ht()],Gt.prototype,"ellipse",null),Xt([Ht()],Gt.prototype,"rect",null),Xt([Ht()],Gt.prototype,"roundRect",null),Xt([Ht()],Gt.prototype,"createConicGradient",null),Xt([Ht()],Gt.prototype,"createLinearGradient",null),Xt([Ht()],Gt.prototype,"createPattern",null),Xt([Ht()],Gt.prototype,"createRadialGradient",null),Xt([Ht()],Gt.prototype,"fillText",null),Xt([Ht()],Gt.prototype,"measureText",null),Xt([Ht()],Gt.prototype,"strokeText",null);const{copy:Vt,multiplyParent:qt}=v,{round:Qt}=Math,Jt={width:1,height:1,pixelRatio:1},Zt=["width","height","pixelRatio"];const $t={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Kt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},te=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},Kt),ee={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},se={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},re=Object.assign(Object.assign({},se),Kt),ie=te,oe={};for(let t in ie)oe[ie[t]]=t;const ne={};for(let t in ie)ne[ie[t]]=ee[t];const ae={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:he,cos:le,atan2:de,ceil:ue,abs:ce,PI:pe,sqrt:_e,pow:fe}=Math,{setPoint:ge,addPoint:ye}=j,{set:xe,toNumberPoints:me}=E,{M:we,L:be,C:ve,Q:Be,Z:ke}=te,Ce={},Te={points(t,e,s,r){let i=me(e);if(t.push(we,i[0],i[1]),s&&i.length>5){let e,o,n,a,h,l,d,u,c,p,_,f,g,y=i.length;const x=!0===s?.5:s;r&&(i=[i[y-2],i[y-1],...i,i[0],i[1],i[2],i[3]],y=i.length);for(let s=2;s<y-2;s+=2)e=i[s-2],o=i[s-1],n=i[s],a=i[s+1],h=i[s+2],l=i[s+3],_=_e(fe(n-e,2)+fe(a-o,2)),f=_e(fe(h-n,2)+fe(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=e,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(Be,d,u,n,a):t.push(ve,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(Be,c,p,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(be,i[e],i[e+1]);r&&t.push(ke)},rect(t,e,s,r,i){$t.creator.path=t,$t.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){$t.creator.path=[],ae.drawRoundRect($t.creator,e,s,r,i,o),t.push(...$t.convertToCanvasData($t.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,h,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=de(f,_),m=de(y,g),w=m-x;if(w<0&&(w+=d),w===pe||ce(_+f)<1e-12||ce(g+y)<1e-12)return t&&t.push(be,r,i),h&&(ge(h,e,s),ye(h,r,i)),p&&xe(p,e,s),void(c&&xe(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/le(w/2),k=r+B*le(x+w/2+u*v),C=i+B*he(x+w/2+u*v);return x-=u*v,m-=u*v,Le(t,k,C,a,a,0,x/l,m/l,b,h,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>Le(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,h,c,p,_){const f=o*l,g=he(f),y=le(f);let x=n*l,m=a*l;x>pe&&(x-=d),m<0&&(m+=d);let w=m-x;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const b=ue(ce(w/u)),v=w/b,B=he(v/4),k=8/3*B*B/he(v/2);m=x+v;let C,T,O,P,L,R,S,I,M=le(x),E=he(x),A=O=y*r*M-g*i*E,W=P=g*r*M+y*i*E,D=e+O,N=s+P;t&&t.push(t.length?be:we,D,N),c&&ge(c,D,N),_&&xe(_,D,N);for(let o=0;o<b;o++)C=le(m),T=he(m),O=y*r*C-g*i*T,P=g*r*C+y*i*T,L=e+A-k*(y*r*E+g*i*M),R=s+W-k*(g*r*E-y*i*M),S=e+O+k*(y*r*T+g*i*C),I=s+P+k*(g*r*T-y*i*C),t&&t.push(ve,L,R,S,I,e+O,s+P),c&&Pe(e+A,s+W,L,R,S,I,e+O,s+P,c,!0),A=O,W=P,M=C,E=T,x=m,m+=v;p&&xe(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(ve,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Pe(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?ye(h,t,e):ge(h,t,e),ye(h,n,a);for(let l=0,u=d.length;l<u;l++)Oe(d[l],t,e,s,r,i,o,n,a,Ce),ye(h,Ce.x,Ce.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return Oe(t,e,s,r,i,o,n,a,h,l),l},getDerivative(t,e,s,r,i){const o=1-t;return 3*o*o*(s-e)+6*o*t*(r-s)+3*t*t*(i-r)}},{getPointAndSet:Oe,toTwoPointBounds:Pe,ellipse:Le}=Te,{sin:Re,cos:Se,sqrt:Ie,atan2:Me}=Math,{ellipse:Ee}=Te,Ae={ellipticalArc(e,s,r,i,o,n,a,h,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*l,y=Re(g),x=Se(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,k=m*m,C=b*v-b*B-v*k;let T=0;if(C<0){const t=Ie(1-C/(b*v));i*=t,o*=t}else T=(a===h?-1:1)*Ie(C/(b*B+v*k));const O=T*i*w/o,P=-T*o*m/i,L=Me((w-P)/o,(m-O)/i),R=Me((-w-P)/o,(-m-O)/i);let S=R-L;0===h&&S>0?S-=d:1===h&&S<0&&(S+=d);const I=s+_+x*O-y*P,M=r+f+y*O+x*P,E=S<0?1:0;p||t.ellipseToCurve?Ee(e,I,M,i,o,n,L/l,R/l,E):i!==o||n?e.push(te.G,I,M,i,o,n,L/l,R/l,E):e.push(te.O,I,M,i,L/l,R/l,E)}},{M:We,m:De,L:Ne,l:Ye,H:Xe,h:ze,V:Fe,v:je,C:He,c:Ue,S:Ge,s:Ve,Q:qe,q:Qe,T:Je,t:Ze,A:$e,a:Ke,Z:ts,z:es,N:ss,D:rs,X:is,G:os,F:ns,O:as,P:hs,U:ls}=te,{rect:ds,roundRect:us,arcTo:cs,arc:ps,ellipse:_s,quadraticCurveTo:fs}=Te,{ellipticalArc:gs}=Ae,ys=bt.get("PathConvert"),xs={},ms={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=ne[r],h+=r===i?" ":oe[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?re:se;for(let e=0,h=t.length;e<h;e++)r=t[e],mt[r]?("."===r&&(ws.dot&&(bs(n,o),o=""),ws.dot++),"0"===o&&"."!==r&&(bs(n,o),o=""),o+=r):te[r]?(o&&(bs(n,o),o=""),ws.name=te[r],ws.length=ee[r],ws.index=0,bs(n,ws.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&bs(n,o),o=r):o&&(bs(n,o),o=""),i=r;return o&&bs(n,o),s?ms.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case De:t[u+1]+=a,t[u+2]+=h;case We:a=t[u+1],h=t[u+2],p.push(We,a,h),u+=3;break;case ze:t[u+1]+=a;case Xe:a=t[u+1],p.push(Ne,a,h),u+=2;break;case je:t[u+1]+=h;case Fe:h=t[u+1],p.push(Ne,a,h),u+=2;break;case Ye:t[u+1]+=a,t[u+2]+=h;case Ne:a=t[u+1],h=t[u+2],p.push(Ne,a,h),u+=3;break;case Ve:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ge;case Ge:n=o===He||o===Ge,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(He,l,d,s,r,a,h),u+=5;break;case Ue:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=He;case He:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(He,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Ze:t[u+1]+=a,t[u+2]+=h,i=Je;case Je:n=o===qe||o===Je,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?fs(p,a,h,s,r,t[u+1],t[u+2]):p.push(qe,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Qe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=qe;case qe:s=t[u+1],r=t[u+2],e?fs(p,a,h,s,r,t[u+3],t[u+4]):p.push(qe,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ke:t[u+6]+=a,t[u+7]+=h;case $e:gs(p,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case es:case ts:p.push(ts),u++;break;case ss:a=t[u+1],h=t[u+2],e?ds(p,a,h,t[u+3],t[u+4]):vs(p,t,u,5),u+=5;break;case rs:a=t[u+1],h=t[u+2],e?us(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):vs(p,t,u,9),u+=9;break;case is:a=t[u+1],h=t[u+2],e?us(p,a,h,t[u+3],t[u+4],t[u+5]):vs(p,t,u,6),u+=6;break;case os:_s(e?p:vs(p,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,xs),a=xs.x,h=xs.y,u+=9;break;case ns:e?_s(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):vs(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case as:ps(e?p:vs(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,xs),a=xs.x,h=xs.y,u+=7;break;case hs:e?ps(p,t[u+1],t[u+2],t[u+3],0,360,!1):vs(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case ls:cs(e?p:vs(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,xs),a=xs.x,h=xs.y,u+=6;break;default:return ys.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(We,t.x,t.y);break;case"L":e.push(Ne,t.x,t.y);break;case"C":e.push(He,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(qe,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ts)}})),e},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){ws.index===ws.length&&(ws.index=1,t.push(ws.name)),t.push(Number(e)),ws.index++,ws.dot=0}},{current:ws,pushData:bs,copyData:vs}=ms,{M:Bs,L:ks,C:Cs,Q:Ts,Z:Os,N:Ps,D:Ls,X:Rs,G:Ss,F:Is,O:Ms,P:Es,U:As}=te,{getMinDistanceFrom:Ws,getRadianFrom:Ds}=E,{tan:Ns,min:Ys,abs:Xs}=Math,zs={},Fs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Bs,e,s)},lineTo(t,e,s){t.push(ks,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Cs,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Ts,e,s,r,i)},closePath(t){t.push(Os)},rect(t,e,s,r,i){t.push(Ps,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(Rs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(Ls,e,s,r,i,...n):t.push(Ps,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Is,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ss,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Es,e,s,r):(void 0===o&&(o=360),t.push(Ms,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const t=Ws(n,a,e,s,r,i);o=Ys(o,Ys(t/2,t/2*Xs(Ns(Ds(n,a,e,s,r,i)/2))))}t.push(As,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){Te.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,zs),t.push(Bs,zs.x,zs.y),js(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){Te.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,zs),t.push(Bs,zs.x,zs.y),Hs(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){Te.points(t,e,s,r)}},{ellipse:js,arc:Hs}=Fs,{moveTo:Us,lineTo:Gs,quadraticCurveTo:Vs,bezierCurveTo:qs,closePath:Qs,beginPath:Js,rect:Zs,roundRect:$s,ellipse:Ks,arc:tr,arcTo:er,drawEllipse:sr,drawArc:rr,drawPoints:ir}=Fs;class or{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?$t.parse(t):t:[],this}beginPath(){return Js(this.__path),this.paint(),this}moveTo(t,e){return Us(this.__path,t,e),this.paint(),this}lineTo(t,e){return Gs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return qs(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return Vs(this.__path,t,e,s,r),this.paint(),this}closePath(){return Qs(this.__path),this.paint(),this}rect(t,e,s,r){return Zs(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return $s(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return Ks(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return tr(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return er(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return sr(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return rr(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return ir(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:nr,L:ar,C:hr,Q:lr,Z:dr,N:ur,D:cr,X:pr,G:_r,F:fr,O:gr,P:yr,U:xr}=te,mr=bt.get("PathDrawer"),wr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case nr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case ar:t.lineTo(e[r+1],e[r+2]),r+=3;break;case hr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case lr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case dr:t.closePath(),r+=1;break;case ur:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case cr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case pr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case _r:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*l,e[r+6]*l,e[r+7]*l,e[r+8]),r+=9;break;case fr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,d,!1),r+=5;break;case gr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*l,e[r+5]*l,e[r+6]),r+=7;break;case yr:t.arc(e[r+1],e[r+2],e[r+3],0,d,!1),r+=4;break;case xr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void mr.error(`command: ${s} [index:${r}]`,e)}}},{M:br,L:vr,C:Br,Q:kr,Z:Cr,N:Tr,D:Or,X:Pr,G:Lr,F:Rr,O:Sr,P:Ir,U:Mr}=te,{toTwoPointBounds:Er,toTwoPointBoundsByQuadraticCurve:Ar,arcTo:Wr,arc:Dr,ellipse:Nr}=Te,{addPointBounds:Yr,copy:Xr,addPoint:zr,setPoint:Fr,addBounds:jr,toBounds:Hr}=j,Ur=bt.get("PathBounds");let Gr,Vr,qr;const Qr={},Jr={},Zr={},$r={toBounds(t,e){$r.toTwoPointBounds(t,Jr),Hr(Jr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Fr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===Cr||n===Br||n===kr?Fr(e,h,l):Fr(e,t[a+1],t[a+2])),n){case br:case vr:h=t[a+1],l=t[a+2],zr(e,h,l),a+=3;break;case Br:i=t[a+5],o=t[a+6],Er(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,Qr),Yr(e,Qr),h=i,l=o,a+=7;break;case kr:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],Ar(h,l,s,r,i,o,Qr),Yr(e,Qr),h=i,l=o,a+=5;break;case Cr:a+=1;break;case Tr:h=t[a+1],l=t[a+2],jr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Or:case Pr:h=t[a+1],l=t[a+2],jr(e,h,l,t[a+3],t[a+4]),a+=n===Or?9:6;break;case Lr:Nr(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],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=9;break;case Rr:h=t[a+1],l=t[a+2],Vr=t[a+3],qr=t[a+4],jr(e,h-Vr,l-qr,2*Vr,2*qr),h+=Vr,a+=5;break;case Sr:Dr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=7;break;case Ir:h=t[a+1],l=t[a+2],Gr=t[a+3],jr(e,h-Gr,l-Gr,2*Gr,2*Gr),h+=Gr,a+=4;break;case Mr:Wr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=6;break;default:return void Ur.error(`command: ${n} [index:${a}]`,t)}}},{M:Kr,L:ti,Z:ei}=te,{getCenterX:si,getCenterY:ri}=E,{arcTo:ii}=Fs,oi={smooth(t,e,s){let r,i,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0,p=0;const _=t.length,f=[];for(;o<_;)switch(r=t[o],r){case Kr:h=c=t[o+1],l=p=t[o+2],o+=3,t[o]===ti?(d=t[o+1],u=t[o+2],f.push(Kr,si(h,d),ri(l,u))):f.push(Kr,h,l);break;case ti:switch(n=t[o+1],a=t[o+2],o+=3,t[o]){case ti:ii(f,n,a,t[o+1],t[o+2],e,c,p);break;case ei:ii(f,n,a,h,l,e,c,p);break;default:f.push(ti,n,a)}c=n,p=a;break;case ei:ii(f,h,l,d,u,e,c,p),f.push(ei),o+=1;break;default:i=ne[r];for(let e=0;e<i;e++)f.push(t[o+e]);o+=i}return r!==ei&&(f[1]=h,f[2]=l),f}};$t.creator=new or,$t.parse=ms.parse,$t.convertToCanvasData=ms.toCanvasData;const ni=new or,{drawRoundRect:ai}=ae;const hi={opacityTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=li.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{}}}},li=hi;li.opacityTypes.forEach((t=>li.upperCaseTypeMap[t]=t.toUpperCase()));const di=bt.get("TaskProcessor");class ui{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return zt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){di.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ci{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,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&At.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ui(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],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 pi=bt.get("Resource"),_i={tasker:new ci,map:{},get isComplete(){return fi.tasker.isComplete},set(t,e){fi.map[t]&&pi.repeat(t),fi.map[t]=e},get:t=>fi.map[t],remove(t){const e=fi.map[t];e&&(e.destroy&&e.destroy(),delete fi.map[t])},loadImage(t,e){return new Promise(((s,r)=>{const i=this.setImage(t,t,e);i.load((()=>s(i)),(t=>r(t)))}))},setImage(t,s,r){let i;return"string"==typeof s?i={url:s}:s.url||(i={url:t,view:s}),i&&(r&&(i.format=r),s=e.image(i)),fi.set(t,s),s},destroy(){fi.map={}}},fi=_i,gi={maxRecycled:10,recycledList:[],patternTasker:new ci,get(t){let s=_i.get(t.url);return s||_i.set(t.url,s=e.image(t)),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||yi.recycledList.push(t)}))},clearRecycled(){const t=yi.recycledList;t.length>yi.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&_i.remove(t.url))),t.length=0)},hasOpacityPixel:t=>hi.opacityTypes.some((e=>yi.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+hi.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+hi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){yi.recycledList=[]}},yi=gi,{IMAGE:xi,create:mi}=s;function wi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function bi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vi(t,e){return(s,r)=>ki(s,r,t,e&&e(r))}function Bi(t){return t}function ki(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};wi(t,e,Object.assign(i,r||{})),Mi(t,e,s)}function Ci(t,e){return vi(t,(t=>({set(s){this.__setAttr(t,s,e)&&Ti(this)}})))}function Ti(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const Oi=Ci;function Pi(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&Li(this)}})))}function Li(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Ti(t)}const Ri=Pi;function Si(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ii(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Ti(t))}function Mi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)n.get=function(){return this[i]};else if("function"==typeof s)n.get=function(){let t=this[i];return void 0===t?s(this.__leaf):t};else if("object"==typeof s){const t=Yt(s);n.get=function(){let e=this[i];return void 0===e?this[i]=t?{}:At.clone(s):e}}const a=t.isBranchLeaf;"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalWidth,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&r.children.length?r.boxBounds.width:s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalHeight,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&r.children.length?r.boxBounds.height:s}return t});let h,l=r;for(;!h&&l;)h=bi(l,e),l=l.__proto__;h&&h.set&&(n.set=h.set),r[o]&&(n.set=r[o],delete r[o]),wi(r,e,n)}const Ei=new bt("rewrite"),Ai=[],Wi=["destroy","constructor"];function Di(t){Ai.length&&(Ai.forEach((e=>{t&&Ei.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ai.length=0)}function Ni(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Wi.includes(r)||e&&e.includes(r)))if(t.prototype){bi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Di(!0)));const{copy:Yi,toInnerPoint:Xi,toOuterPoint:zi,scaleOfOuter:Fi,rotateOfOuter:ji,skewOfOuter:Hi,multiplyParent:Ui,divideParent:Gi,getLayout:Vi}=v,qi={},{round:Qi}=Math,Ji={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Ki(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)$i(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)to(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&to(t),t.__updateChange()},updateAllChange(t){if(so(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)eo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r,i){const o="object"==typeof e?Object.assign({},e):{x:e,y:s};r?zi(t.localTransform,o,o,!0):t.parent&&Xi(t.parent.worldTransform,o,o,!0),Zi.moveLocal(t,o.x,o.y,i)},moveLocal(t,e,s=0,r){"object"==typeof e&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Qi(e),s=Qi(s)),r?t.animate({x:e,y:s},r):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,r,i,o){Zi.zoomOfLocal(t,ro(t,e),s,r,i,o)},zoomOfLocal(t,e,s,r=s,i,o){const n=t.__localMatrix;if("number"!=typeof r&&(r&&(o=r),r=s),Yi(qi,n),Fi(qi,e,s,r),t.origin||t.around)Zi.setTransform(t,qi,i,o);else{const e=t.x+qi.e-n.e,a=t.y+qi.f-n.f;o&&!i?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*r},o):(t.x=e,t.y=a,t.scaleResize(s,r,!0!==i))}},rotateOfWorld(t,e,s,r){Zi.rotateOfLocal(t,ro(t,e),s,r)},rotateOfLocal(t,e,s,r){const i=t.__localMatrix;Yi(qi,i),ji(qi,e,s),t.origin||t.around?Z