@leafer/core
Version:
1 lines • 103 kB
JavaScript
var t;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(t||(t={}));const e={};function s(t){return void 0===t}function r(t){return null==t}function i(t){return"string"==typeof t}const{isFinite:n}=Number;function o(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;function h(t){return"string"==typeof t&&a.test(t)?+t:t}const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach(i=>{var n,o;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.constructor)===Object)return p(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&p(t[i]={},e[i],s[i]):t[i]=e[i]})},copyAttrs:(t,e,r)=>(r.forEach(r=>{s(e[r])||(t[r]=e[r])}),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},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign: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 r;for(let i in this)"_"!==i[0]&&(r=e?e[i]:void 0,t[i]=s(r)?this[i]:r);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 r={};if(t)if(l(t))for(let e of t)r[e]=this.__getInput(e);else for(let e in t)r[e]=this.__getInput(e);else{let t,e,{__input:i}=this;r.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=i?i[n]:void 0,r[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:i,e:n,f:o}=this.__leaf.__localMatrix;r.matrix={a:t,b:e,c:s,d:i,e:n,f:o}}return r}__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 g={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=y;return e[t]?e[t]++:(e[t]=1,0)}},y=g;let m,x,w;const{max:b}=Math,B=[0,0,0,0],v={zero:[...B],tempFour:B,set:(t,e,s,r,i)=>(void 0===s&&(s=r=i=e),t[0]=e,t[1]=s,t[2]=r,t[3]=i,t),setTemp:(t,e,s,r)=>k(B,t,e,s,r),toTempAB(t,e,s){w=s?o(t)?e:t:[],o(t)?(m=O(t),x=e):o(e)?(m=t,x=O(e)):(m=t,x=e),4!==m.length&&(m=C(m)),4!==x.length&&(x=C(x))},get(t,e){let r;if(!o(t))switch(t.length){case 4:r=s(e)?t:[...t];break;case 2:r=[t[0],t[1],t[0],t[1]];break;case 3:r=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(r||(r=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)r[t]>e&&(r[t]=e);return r},max:(t,e,s)=>o(t)&&o(e)?b(t,e):(T(t,e,s),k(w,b(m[0],x[0]),b(m[1],x[1]),b(m[2],x[2]),b(m[3],x[3]))),add:(t,e,s)=>o(t)&&o(e)?t+e:(T(t,e,s),k(w,m[0]+x[0],m[1]+x[1],m[2]+x[2],m[3]+x[3])),swapAndScale(t,e,s,r){if(o(t))return e===s?t*e:[t*s,t*e];const i=r?t:[],[n,a,h,l]=4===t.length?t:C(t);return k(i,h*s,l*e,n*s,a*e)}},{set:k,get:C,setTemp:O,toTempAB:T}=v,{round:P,pow:S,max:L,floor:R,PI:E}=Math,I={},M={within:(t,e,r)=>(d(e)&&(r=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(r)&&t>r&&(t=r),t),fourNumber:v.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.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 r=s(e)?1e12:S(10,e);return-0===(t=P(t*r)/r)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,r){if(r||(r={}),e){const t=(o(e)?e:e.width||0)/s.width,i=(o(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&M.assignScale(r,t);return r},getScaleFixedData(t,e,s,r,i){let{scaleX:n,scaleY:a}=t;if((r||e)&&(n<0&&(n=-n),a<0&&(a=-a)),e)if(!0===e)n=a=s?1:1/n;else{let t;o(e)?t=e:"zoom-in"===e&&(t=1),t&&(n=a=n>t||a>t?s?1:1/n:s?1:1/t)}return I.scaleX=n,I.scaleY=a,I},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(R(t),e)/t,randInt:A,randColor:t=>`rgba(${A(255)},${A(255)},${A(255)},${t||1})`};function A(t){return Math.round(Math.random()*t)}const W=E/180,N=2*E,D=E/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function z(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:F,cos:U,acos:j,sqrt:G}=Math,{float:V}=M,H={};function q(){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:q(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,n=0,o=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=n,t.f=o},get:z,getWorld:q,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},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,r){J.toInnerPoint(t,e,H),J.scaleOfInner(t,H,s,r)},scaleOfInner(t,e,s,r=s){J.translateInner(t,e.x,e.y),J.scale(t,s,r),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:n}=t,o=U(e*=W),a=F(e);t.a=s*o-r*a,t.b=s*a+r*o,t.c=i*o-n*a,t.d=i*a+n*o},rotateOfOuter(t,e,s){J.toInnerPoint(t,e,H),J.rotateOfInner(t,H,s)},rotateOfInner(t,e,s){J.translateInner(t,e.x,e.y),J.rotate(t,s),J.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:o}=t;s&&(s*=W,t.a=r+n*s,t.b=i+o*s),e&&(e*=W,t.c=n+r*e,t.d=o+i*e)},skewOfOuter(t,e,s,r){J.toInnerPoint(t,e,H),J.skewOfInner(t,H,s,r)},skewOfInner(t,e,s,r=0){J.translateInner(t,e.x,e.y),J.skew(t,s,r),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*n,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*n,t.e=e.e*s+e.f*i+o,t.f=e.e*r+e.f*n+a},multiplyParent(t,e,r,i,n){const{e:o,f:a}=t;if(r||(r=t),s(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:s,b:i,c:o,d:a}=t;r.a=s*e.a+i*e.c,r.b=s*e.b+i*e.d,r.c=o*e.a+a*e.c,r.d=o*e.b+a*e.d,n&&(r.scaleX=e.scaleX*n.scaleX,r.scaleY=e.scaleY*n.scaleY)}else r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,n&&(r.scaleX=e.scaleX,r.scaleY=e.scaleY);r.e=o*e.a+a*e.c+e.e,r.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:s,c:r,d:i,e:n,f:o}=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=-(n*i-o*r)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===i)t.e=-n,t.f=-o;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-n*i*s,t.f=-o*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c,s.y=i*t.b+n*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:n,c:o,d:a}=t,h=1/(i*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*i-l*n)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*o)*h,s.y-=(r*i-e*n)*h}},setLayout(t,e,r,i,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:s,skewX:r,skewY:i}=e,n=s*W,o=U(n),a=F(n);if(r||i){const e=r*W,s=i*W;t.a=(o+s*-a)*h,t.b=(a+s*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,(r=r||i)&&J.translateInner(t,-r.x,-r.y,!i)},getLayout(t,e,s,r){const{a:i,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(n||o){const t=i*a-n*o;if(o&&!r){d=G(i*i+n*n),c=t/d;const e=i/d;u=n>0?j(e):-j(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=D-(a>0?j(-e):-j(e))}const e=V(U(u)),s=F(u);d=V(d),c=V(c),_=e?V((o/c+s)/e/W,9):0,p=e?V((n/d-s)/e/W,9):0,u=V(u/W)}else d=i,c=a,u=_=p=0;return(e=s||e)&&(f+=e.x*i+e.y*o,g+=e.x*n+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:n,d:o}=t;i||n?s=(r*o-i*n)/(e=G(r*r+i*i)):(e=r,s=o)}return r.scaleX=e,r.scaleY=s,r},reset(t){J.set(t)}},J=Q,{float:Z}=M,{toInnerPoint:$,toOuterPoint:K}=Q,{sin:tt,cos:et,abs:st,sqrt:rt,atan2:it,min:nt,round:ot}=Math,at={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,r){t.radiusX=e,t.radiusY=s(r)?e:r},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?ot(t.x-.5)+.5:ot(t.x),t.y=e?ot(t.y-.5)+.5:ot(t.y)},move(t,e,s){d(e)?(t.x+=e.x,t.y+=e.y):(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=ht.defaultPoint);const r=et(e*=W),i=tt(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*r-o*i,t.y=s.y+n*i+o*r},tempToInnerOf(t,e){const{tempPoint:s}=ht;return dt(s,t),$(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=ht;return dt(s,t),K(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=ht;return dt(s,t),ht.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,r)=>(dt(t,e),ct(t,s,r),t),toInnerRadiusPointOf(t,e,s){s||(s=t),$(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){$(e,t,s)},toOuterOf(t,e,s){K(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)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=st(s-t),n=st(r-e);return rt(i*i+n*n)},getMinDistanceFrom:(t,e,s,r,i,n)=>nt(lt(t,e,s,r),lt(s,r,i,n)),getAngle:(t,e)=>ut(t,e)/W,getRotation:(t,e,s,r)=>(r||(r=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/W),getRadianFrom(t,e,r,i,n,o,a,h){s(a)&&(a=r,h=i);const l=t-r,d=e-i,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>it(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r,i){const n=ut(t,e);return i&&(t=e),r||(e={}),e.x=t.x+et(n)*s,e.y=t.y+tt(n)*s,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,s)=>s?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){ht.reset(t)}},ht=at,{getDistanceFrom:lt,copy:dt,setRadius:ct,getAtan2:ut}=ht;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?at.copy(this,t):at.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,s){return at.scaleOf(this,t,e,s),this}rotate(t,e){return at.rotate(this,t,e),this}rotateOf(t,e){return at.rotate(this,e,t),this}getRotation(t,e,s){return at.getRotation(this,t,e,s)}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}getCenter(t){return new _t(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,s,r){return new _t(at.getDistancePoint(this,t,e,s,r))}getAngle(t){return at.getAngle(this,t)}getAtan2(t){return at.getAtan2(this,t)}isSame(t,e){return at.isSame(this,t,e)}reset(){return at.reset(this),this}}const pt=new _t;class ft{constructor(t,e,s,r,i,n){this.set(t,e,s,r,i,n)}set(t,e,s,r,i,n){return d(t)?Q.copy(this,t):Q.set(this,t,e,s,r,i,n),this}setWith(t){return Q.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:n}=this;return{a:t,b:e,c:s,d:r,e:i,f:n}}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,s){return Q.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return Q.scaleOfInner(this,t,e,s),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,s){return Q.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return Q.skewOfInner(this,t,e,s),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,s){Q.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){Q.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return Q.setLayout(this,t,e,s),this}getLayout(t,e,s){return Q.getLayout(this,t,e,s)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const gt=new ft,yt={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){mt(t,e,s),mt(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:mt}=yt;var xt,wt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),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"}(wt||(wt={}));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 Bt={directionData:bt,tempPoint:{},get:vt,toPoint(t,e,s,r,i,n){const o=vt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(n||(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)},getPoint:(t,e,s,r=!0)=>(s||(s={}),Bt.toPoint(t,e,s,r),s)};function vt(t){return i(t)?bt[wt[t]]:t}const{toPoint:kt}=Bt,Ct={toPoint(t,e,s,r,i,n){kt(t,s,r,i,e,n)}},{tempPointBounds:Ot,setPoint:Tt,addPoint:Pt,toBounds:St}=yt,{toOuterPoint:Lt}=Q,{float:Rt,fourNumber:Et}=M,{floor:It,ceil:Mt}=Math;let At,Wt,Nt,Dt;const Yt={},Xt={},zt={},Ft={tempBounds:zt,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:n,y:o,width:a,height:h}=e;if(l(s)){const e=Et(s);r?Ut.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),Ut.set(t,n-s,o-s,a+2*s,h+2*s);i&&("width"===i?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Ut.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Gt(e,t):e=t,s||(s=t),e.offsetX=Ut.maxX(s),e.offsetY=Ut.maxY(s),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||at.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){at.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(Ut.copy(zt,t),Ut.toOuterOf(zt,e),zt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i,e:n,f:o}=e;r>0?(s.width=t.width*r,s.x=n+t.x*r):(s.width=t.width*-r,s.x=n+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=o+t.y*i):(s.height=t.height*-i,s.y=o+t.y*i-s.height)}else Yt.x=t.x,Yt.y=t.y,Lt(e,Yt,Xt),Tt(Ot,Xt.x,Xt.y),Yt.x=t.x+t.width,Lt(e,Yt,Xt),Pt(Ot,Xt.x,Xt.y),Yt.y=t.y+t.height,Lt(e,Yt,Xt),Pt(Ot,Xt.x,Xt.y),Yt.x=t.x,Lt(e,Yt,Xt),Pt(Ot,Xt.x,Xt.y),St(Ot,s)},toInnerOf(t,e,s){s||(s=t),Ut.move(s,-e.e,-e.f),Ut.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Ut.getFitScale(t,e));return new ft(r,0,0,r,-e.x*r,-e.y*r)},getFitScale(t,e,s){const r=t.width/e.width,i=t.height/e.height;return s?Math.max(r,i):Math.min(r,i)},put(t,e,s="center",r=1,n=!0,o){o||(o=e),i(r)&&(r=Ut.getFitScale(t,e,"cover"===r)),zt.width=n?e.width*=r:e.width*r,zt.height=n?e.height*=r:e.height*r,Ct.toPoint(s,zt,t,o,!0,!0)},getSpread(t,e,s){const r={};return Ut.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){Ut.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ut.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=s>t.y?Mt(t.height+s-t.y):Mt(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=Rt(t.x,e),t.y=Rt(t.y,e),t.width=Rt(t.width,e),t.height=Rt(t.height,e)},add(t,e,s){At=t.x+t.width,Wt=t.y+t.height,Nt=e.x,Dt=e.y,s||(Nt+=e.width,Dt+=e.height),At=At>Nt?At:Nt,Wt=Wt>Dt?Wt:Dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Wt-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ut.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ut.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,n=!0;for(let o=0,a=e.length;o<a;o++)i=s?s(e[o],o):e[o],i&&(i.width||i.height)&&(n?(n=!1,r||Gt(t,i)):jt(t,i));n&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Tt(Ot,t.x,t.y):Pt(Ot,t.x,t.y)),St(Ot,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){jt(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}]},getPoint:(t,e,s=!1,r)=>Bt.getPoint(e,t,r,s),hitRadiusPoint:(t,e,s)=>(s&&(e=at.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=at.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=Ut.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=Ut.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=Ut.tempToOuterOf(e,s)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:n,height:o}=e;return At=r+n,Wt=i+o,Nt=t.x+t.width,Dt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,At=At<Nt?At:Nt,Wt=Wt<Dt?Wt:Dt,n=At-r,o=Wt-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){Ut.copy(t,Ut.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,hasSize:t=>t.width&&t.height,reset(t){Ut.set(t)}},Ut=Ft,{add:jt,copy:Gt}=Ut;class Vt{get minX(){return Ft.minX(this)}get minY(){return Ft.minY(this)}get maxX(){return Ft.maxX(this)}get maxY(){return Ft.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return d(t)?Ft.copy(this,t):Ft.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 Vt(this)}move(t,e){return Ft.move(this,t,e),this}scale(t,e,s){return Ft.scale(this,t,e,s),this}scaleOf(t,e,s){return Ft.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Ft.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ft.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ft.getFitMatrix(this,t,e)}put(t,e,s){Ft.put(this,t,e,s)}spread(t,e){return Ft.spread(this,t,e),this}shrink(t,e){return Ft.shrink(this,t,e),this}ceil(){return Ft.ceil(this),this}unsign(){return Ft.unsign(this),this}float(t){return Ft.float(this,t),this}add(t){return Ft.add(this,t),this}addList(t){return Ft.setList(this,t,!0),this}setList(t){return Ft.setList(this,t),this}addListWithFn(t,e){return Ft.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ft.setListWithFn(this,t,e),this}setPoint(t){return Ft.setPoint(this,t),this}setPoints(t){return Ft.setPoints(this,t),this}addPoint(t){return Ft.addPoint(this,t),this}getPoints(){return Ft.getPoints(this)}getPoint(t,e,s){return Ft.getPoint(this,t,e,s)}hitPoint(t,e){return Ft.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ft.hitRadiusPoint(this,t,e)}hit(t,e){return Ft.hit(this,t,e)}includes(t,e){return Ft.includes(this,t,e)}intersect(t,e){return Ft.intersect(this,t,e),this}getIntersect(t,e){return new Vt(Ft.getIntersectData(this,t,e))}isSame(t){return Ft.isSame(this,t)}isEmpty(){return Ft.isEmpty(this)}reset(){Ft.reset(this)}}const Ht=new Vt;class qt{constructor(t,e,s,r,i,n){d(t)?this.copy(t):this.set(t,e,s,r,i,n)}set(t=0,e=0,s=0,r=0,i=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=n}copy(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=t;this.set(e,s,r,i,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:n,height:o}=this;return new Vt(i,e,n||t.width-i-s,o||t.height-e-r)}}const Qt={number:(t,e)=>d(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,Kt={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",isLarge:(t,e,s,r)=>t.width*t.height*(e?e*s:1)>(r||te.maxCacheSize),isSuperLarge:(t,e,s)=>te.isLarge(t,e,s,te.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=te;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,r,i,n,o,a,h,l){const d=$t(Zt(e+(r||0)),1),c=$t(Zt(s+(i||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:s))&&("x"===l.type?u=!0:_=!0);const f=Kt.origin.createCanvas(_?2*d:d,u?2*c:c),g=f.getContext("2d");if(a&&(g.globalAlpha=a),g.imageSmoothingEnabled=!1!==o,te.canUse(t)){if(n){const r=e/n.width,i=s/n.height;g.setTransform(r,0,0,i,-n.x*r,-n.y*i),g.drawImage(t,0,0,t.width,t.height)}else g.drawImage(t,0,0,e,s);p&&(g.drawImage(f,0,0,d,c,u?p-d:d,u?c:p-c,d,c),g.drawImage(f,0,0,d,c,u?p:d,u?c:p,d,c))}return f},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&_.stintSet(s,"transform",e)}}},{image:te}=Kt,{randColor:ee}=M;class se{constructor(t){this.repeatMap={},this.name=t}static get(t){return new se(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const s=ee();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===se.showBounds,i=t.__nowWorld,n=ee();r&&(e.setWorld(i),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),r?e.stroke():e.strokeWorld(i,n)}log(...t){if(ie.enable){if(ie.filterList.length&&ie.filterList.every(t=>t!==this.name))return;if(ie.excludeList.length&&ie.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ie.enable&&this.warn(...t)}warn(...t){ie.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 re(t){return t?i(t)&&(t=[t]):t=[],t}se.filterList=[],se.excludeList=[],se.showWarn=!0;const ie=se,ne=se.get("RunTime"),oe={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=g.create(g.RUNTIME);return ae.currentId=ae.idMap[s]=e?performance.now():Date.now(),ae.currentName=ae.nameMap[s]=t,ae.nameToIdMap[t]=s,s},end(t,e){const s=ae.idMap[t],r=ae.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;ae.idMap[t]=ae.nameMap[t]=ae.nameToIdMap[r]=void 0,ne.log(r,i,"ms")},endOfName(t,e){const r=ae.nameToIdMap[t];s(r)||ae.end(r,e)}},ae=oe,he=[],le={list:{},add(t,...e){this.list[t]=!0,he.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>he.forEach(t=>le.has(t,!0)));const de={editor:t=>le.need("editor")},ce=se.get("UICreator"),ue={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ce.repeat(e),_e[e]=t},get(t,e,r,i,n,o){if(!_e[t])return void ce.warn("not register "+t);const a=new _e[t](e);return s(r)||(a.x=r,i&&(a.y=i),n&&(a.width=n),o&&(a.height=o)),a}},{list:_e}=ue,pe=se.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],i(e)&&(ge[e]&&pe.repeat(e),ge[e]=t)})},changeName(t,e){const s=ge[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,ge[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ge[t](...e)},{nameList:ge}=fe;class ye{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let r=0,i=s.length;r<i;r++)if(e=s[r],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const r=de.canvas(t);return this.add(r),r}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],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 me(t,e,s,r){var i,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(n<3?i(o):n>3?i(e,s,o):i(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function xe(t,e,s,r){return new(s||(s=Promise))(function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(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(o,a)}h((r=r.apply(t,e||[])).next())})}function we(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(r.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,r)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Be(){return(t,e)=>{be.push(e)}}const ve=[];class ke{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||ve)}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,s,r,i,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,n)}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,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,r,i,n,o,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,n){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,n){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,n,o,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,n){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}me([we("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),me([we("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),me([we("globalAlpha")],ke.prototype,"opacity",void 0),me([we()],ke.prototype,"fillStyle",void 0),me([we()],ke.prototype,"strokeStyle",void 0),me([we("lineWidth")],ke.prototype,"strokeWidth",void 0),me([we("lineCap")],ke.prototype,"strokeCap",void 0),me([we("lineJoin")],ke.prototype,"strokeJoin",void 0),me([we("lineDashOffset")],ke.prototype,"dashOffset",void 0),me([we()],ke.prototype,"miterLimit",void 0),me([we()],ke.prototype,"shadowBlur",void 0),me([we()],ke.prototype,"shadowColor",void 0),me([we()],ke.prototype,"shadowOffsetX",void 0),me([we()],ke.prototype,"shadowOffsetY",void 0),me([we()],ke.prototype,"filter",void 0),me([we()],ke.prototype,"font",void 0),me([we()],ke.prototype,"fontKerning",void 0),me([we()],ke.prototype,"fontStretch",void 0),me([we()],ke.prototype,"fontVariantCaps",void 0),me([we()],ke.prototype,"textAlign",void 0),me([we()],ke.prototype,"textBaseline",void 0),me([we()],ke.prototype,"textRendering",void 0),me([we()],ke.prototype,"wordSpacing",void 0),me([we()],ke.prototype,"letterSpacing",void 0),me([we()],ke.prototype,"direction",void 0),me([Be()],ke.prototype,"setTransform",null),me([Be()],ke.prototype,"resetTransform",null),me([Be()],ke.prototype,"getTransform",null),me([Be()],ke.prototype,"save",null),me([Be()],ke.prototype,"restore",null),me([Be()],ke.prototype,"translate",null),me([Be()],ke.prototype,"scale",null),me([Be()],ke.prototype,"rotate",null),me([Be()],ke.prototype,"fill",null),me([Be()],ke.prototype,"stroke",null),me([Be()],ke.prototype,"clip",null),me([Be()],ke.prototype,"fillRect",null),me([Be()],ke.prototype,"strokeRect",null),me([Be()],ke.prototype,"clearRect",null),me([Be()],ke.prototype,"beginPath",null),me([Be()],ke.prototype,"moveTo",null),me([Be()],ke.prototype,"lineTo",null),me([Be()],ke.prototype,"bezierCurveTo",null),me([Be()],ke.prototype,"quadraticCurveTo",null),me([Be()],ke.prototype,"closePath",null),me([Be()],ke.prototype,"arc",null),me([Be()],ke.prototype,"arcTo",null),me([Be()],ke.prototype,"ellipse",null),me([Be()],ke.prototype,"rect",null),me([Be()],ke.prototype,"roundRect",null),me([Be()],ke.prototype,"createConicGradient",null),me([Be()],ke.prototype,"createLinearGradient",null),me([Be()],ke.prototype,"createPattern",null),me([Be()],ke.prototype,"createRadialGradient",null),me([Be()],ke.prototype,"fillText",null),me([Be()],ke.prototype,"measureText",null),me([Be()],ke.prototype,"strokeText",null);const{copy:Ce,multiplyParent:Oe,pixelScale:Te}=Q,{round:Pe}=Math,Se=new Vt,Le=new Vt,Re={width:1,height:1,pixelRatio:1},Ee=["width","height","pixelRatio"];class Ie extends ke{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=Re),this.manager=e,this.innerId=g.create(g.CNAVAS);const{width:s,height:r,pixelRatio:i}=t;this.autoLayout=!s||!r,this.size.pixelRatio=i||Kt.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 s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const r=this.size;_.copyAttrs(r,t,Ee),Ee.forEach(t=>r[t]||(r[t]=1)),this.bounds=new Vt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:r}=this,i=this.worldTransform;e&&Oe(t,e,i),Te(t,s,i),r&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(i.e=Pe(i.e-.5)+.5,i.f=Pe(i.f-.5)+.5):(i.e=Pe(i.e),i.f=Pe(i.f))),this.setTransform(i.a,i.b,i.c,i.d,i.e,i.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,s,r){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,r)}setStrokeOptions(t,e){let{strokeCap:r,strokeJoin:i,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(r=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=r,this.strokeJoin=i,this.dashPattern=n,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,s=1){return!0}setWorldShadow(t,e,s,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r,i){r&&(this.blendMode=r),e?(this.setTempPixelBounds(e,i),s?(this.setTempPixelBounds2(s,i),s=Le):s=Se,this.drawImage(t.view,Se.x,Se.y,Se.width,Se.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r,i){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ft.tempToOuterOf(s,e),r,i),this.restore()):(r&&(this.blendMode=r),this.setTempPixelBounds(e,i),this.drawImage(t.view,Se.x,Se.y,Se.width,Se.height,s.x,s.y,s.width,s.height),r&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,r,i,n){this.resetTransform(),this.copyWorld(t,e,s,r,n),i||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:r}=this,i=r.getImageData(Se.x,Se.y,Se.width,Se.height),{data:n}=i;for(let t=0,r=n.length;t<r;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));r.putImageData(i,Se.x,Se.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,r){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,r),this.fillRect(Se.x,Se.y,Se.width,Se.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,r){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,r),this.strokeRect(Se.x,Se.y,Se.width,Se.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Se.x,Se.y,Se.width,Se.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Se.x,Se.y,Se.width,Se.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Se,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Le,t,e,s)}copyToPixelBounds(t,e,s,r){t.set(e),r&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:r}=this,i=this.manager?this.manager.get(s):de.canvas(Object.assign({},s));return i.save(),t&&(Ce(i.worldTransform,this.worldTransform),i.useWorldTransform()),e&&(i.smooth=this.smooth),i.pixelSnap!==r&&(i.pixelSnap=r),i}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 Me={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ae={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},We=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},Ae),Ne={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},De={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},Ye=Object.assign(Object.assign({},De),Ae),Xe=We,ze={};for(let t in Xe)ze[Xe[t]]=t;const Fe={};for(let t in Xe)Fe[Xe[t]]=Ne[t];const Ue={drawRoundRect(t,e,s,r,i,n){const o=M.fourNumber(n,Math.min(r/2,i/2)),a=e+r,h=s+i;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(a,s,a,h,o[1]):t.lineTo(a,s),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,s,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,s,a,s,o[0]):t.lineTo(e,s)}},{sin:je,cos:Ge,hypot:Ve,atan2:He,ceil:qe,abs:Qe,PI:Je,sqrt:Ze,pow:$e}=Math,{setPoint:Ke,addPoint:ts}=yt,{set:es,toNumberPoints:ss}=at,{M:rs,L:is,C:ns,Q:os,Z:as}=We,hs={},ls={points(t,e,s,r){let i=ss(e);if(t.push(rs,i[0],i[1]),s&&i.length>5){let e,n,o,a,h,l,d,c,u,_,p,f,g,y,m,x=i.length;const w=!0===s?.5:s;r&&(i=[i[x-2],i[x-1],...i,i[0],i[1],i[2],i[3]],x=i.length);for(let s=2;s<x-2;s+=2)e=i[s-2],n=i[s-1],o=i[s],a=i[s+1],h=i[s+2],l=i[s+3],p=o-e,f=a-n,g=Ze($e(p,2)+$e(f,2)),y=Ze($e(h-o,2)+$e(l-a,2)),(g||y)&&(m=g+y,g=w*g/m,y=w*y/m,h-=e,l-=n,d=o-g*h,c=a-g*l,2===s?r||t.push(os,d,c,o,a):(p||f)&&t.push(ns,u,_,d,c,o,a),u=o+y*h,_=a+y*l);r||t.push(os,u,_,i[x-2],i[x-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(is,i[e],i[e+1]);r&&t.push(as)},rect(t,e,s,r,i){Me.creator.path=t,Me.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,n){Me.creator.path=[],Ue.drawRoundRect(Me.creator,e,s,r,i,n),t.push(...Me.convertToCanvasData(Me.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,h,l,d){const c=r-e,u=i-s,_=n-r,p=o-i;let f=He(u,c),g=He(p,_);const y=Ve(c,u),m=Ve(_,p);let x=g-f;if(x<0&&(x+=N),y<1e-12||m<1e-12||x<1e-12||Qe(x-Je)<1e-12)return t&&t.push(is,r,i),h&&(Ke(h,e,s),ts(h,r,i)),d&&es(d,e,s),void(l&&es(l,r,i));const w=c*p-_*u<0,b=w?-1:1,B=a/Ge(x/2),v=r+B*Ge(f+x/2+D*b),k=i+B*je(f+x/2+D*b);return f-=D*b,g-=D*b,us(t,v,k,a,a,0,f/W,g/W,w,h,l,d)},arc:(t,e,s,r,i,n,o,a,h,l)=>us(t,e,s,r,r,0,i,n,o,a,h,l),ellipse(t,e,s,r,i,n,o,a,h,l,d,c){const u=n*W,_=je(u),p=Ge(u);let f=o*W,g=a*W;f>Je&&(f-=N),g<0&&(g+=N);let y=g-f;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=qe(Qe(y/D)),x=y/m,w=je(x/4),b=8/3*w*w/je(x/2);g=f+x;let B,v,k,C,O,T,P,S,L=Ge(f),R=je(f),E=k=p*r*L-_*i*R,I=C=_*r*L+p*i*R,M=e+k,A=s+C;t&&t.push(t.length?is:rs,M,A),l&&Ke(l,M,A),c&&es(c,M,A);for(let n=0;n<m;n++)B=Ge(g),v=je(g),k=p*r*B-_*i*v,C=_*r*B+p*i*v,O=e+E-b*(p*r*R+_*i*L),T=s+I-b*(_*r*R-p*i*L),P=e+k+b*(p*r*v+_*i*B),S=s+C+b*(_*r*v-p*i*B),t&&t.push(ns,O,T,P,S,e+k,s+C),l&&cs(e+E,s+I,O,T,P,S,e+k,s+C,l,!0),E=k,I=C,L=B,R=v,f=g,g+=x;d&&es(d,e+k,s+C)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(ns,(e+2*r)/3,(s+2*i)/3,(n+2*r)/3,(o+2*i)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,n,o,a){cs(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(n+2*r)/3,i,n,o,a)},toTwoPointBounds(t,e,s,r,i,n,o,a,h,l){const d=[];let c,u,_,p,f,g,y,m,x=t,w=s,b=i,B=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=r,b=n,B=a),c=-3*x+9*w-9*b+3*B,u=6*x-12*w+6*b,_=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||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?ts(h,t,e):Ke(h,t,e),ts(h,o,a);for(let l=0,c=d.length;l<c;l++)ds(d[l],t,e,s,r,i,n,o,a,hs),ts(h,hs.x,hs.y)},getPointAndSet(t,e,s,r,i,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*r+_*n+p*a,l.y=c*s+u*i+_*o+p*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return ds(t,e,s,r,i,n,o,a,h,l),l},getDerivative(t,e,s,r,i){const n=1-t;return 3*n*n*(s-e)+6*n*t*(r-s)+3*t*t*(i-r)},cut(t,e,s,r,i,n,o,a,h){if(t<=0)return{left:null,right:[r,i,n,o,a,h]};if(t>=1)return{left:[r,i,n,o,a,h],right:null};const l=1-t,d=e*l+r*t,c=s*l+i*t,u=r*l+n*t,_=i*l+o*t,p=n*l+a*t,f=o*l+h*t,g=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+f*t;return{left:[d,c,g,y,g*l+m*t,y*l+x*t],right:[m,x,p,f,a,h]}}},{getPointAndSet:ds,toTwoPointBounds:cs,ellipse:us}=ls,{sin:_s,cos:ps,sqrt:fs,atan2:gs}=Math,{ellipse:ys}=ls,ms={ellipticalArc(t,e,s,r,i,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*W,p=_s(_),f=ps(_),g=-f*c-p*u,y=-f*u+p*c,m=r*r,x=i*i,w=y*y,b=g*g,B=m*x-m*w-x*b;let v=0;if(B<0){const t=fs(1-B/(m*x));r*=t,i*=t}else v=(o===a?-1:1)*fs(B/(m*w+x*b));const k=v*r*y/i,C=-v*i*g/r,O=gs((y-C)/i,(g-k)/r),T=gs((-y-C)/i,(-g-k)/r);let P=T-O;0===a&&P>0?P-=N:1===a&&P<0&&(P+=N);const S=e+c+f*k-p*C,L=s+u+p*k+f*C,R=P<0?1:0;d||Kt.ellipseToCurve?ys(t,S,L,r,i,n,O/W,T/W,R):r!==i||n?t.push(We.G,S,L,r,i,n,O/W,T/W,R):t.push(We.O,S,L,r,O/W,T/W,R)}},xs={toCommand:t=>[],toNode:t=>[]},{M:ws,m:bs,L:Bs,l:vs,H:ks,h:Cs,V:Os,v:Ts,C:Ps,c:Ss,S:Ls,s:Rs,Q:Es,q:Is,T:Ms,t:As,A:Ws,a:Ns,Z:Ds,z:Ys,N:Xs,D:zs,X:Fs,G:Us,F:js,O:Gs,P:Vs,U:Hs}=We,{rect:qs,roundRect:Qs,arcTo:Js,arc:Zs,ellipse:$s,quadraticCurveTo:Ks}=ls,{ellipticalArc:tr}=ms,er=se.get("PathConvert"),sr={},rr={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,a="";for(;n<o;){r=t[n],s=Fe[r],a+=r===i?" ":ze[r];for(let r=1;r<s;r++)a+=M.float(t[n+r],e),r===s-1||(a+=" ");i=r,n+=s}return a},parse(t,e){let s,r,i,n="";const o=[],a=e?Ye:De;for(let e=0,h=t.length;e<h;e++)r=t[e],Jt[r]?("."===r&&(ir.dot&&(nr(o,n),n=""),ir.dot++),"0"===n&&"."!==r&&(nr(o,n),n=""),n+=r):We[r]?(n&&(nr(o,n),n=""),ir.name=We[r],ir.length=Ne[r],ir.index=0,nr(o,ir.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&nr(o,n),n=r):n&&(nr(o,n),n=""),i=r;return n&&nr(o,n),s?rr.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const f=[];for(;_<p;){switch(i=t[_],i){case bs:t[_+1]+=a,t[_+2]+=h;case ws:a=t[_+1],h=t[_+2],n===i?f.push(Bs,a,h):(f.push(ws,a,h),c=a,u=h),_+=3;break;case Cs:t[_+1]+=a;case ks:a=t[_+1],f.push(Bs,a,h),_+=2;break;case Ts:t[_+1]+=h;case Os:h=t[_+1],f.push(Bs,a,h),_+=2;break;case vs:t[_+1]+=a,t[_+2]+=h;case Bs:a=t[_+1],h=t[_+2],f.push(Bs,a,h),_+=3;break;case Rs:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,i=Ls;case Ls:o=n===Ps||n===Ls,l=o?2*a-s:t[_+1],d=o?2*h-r:t[_+2],s=t[_+1],r=t[_+2],a=t[_+3],h=t[_+4],f.push(Ps,l,d,s,r,a,h),_+=5;break;case Ss:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,t[_+5]+=a,t[_+6]+=h,i=Ps;case Ps:s=t[_+3],r=t[_+4],a=t[_+5],h=t[_+6],f.push(Ps,t[_+1],t[_+2],s,r,a,h),_+=7;break;case As:t[_+1]+=a,t[_+2]+=h,i=Ms;case Ms:o=n===Es||n===Ms,s=o?2*a-s:t[_+1],r=o?2*h-r:t[_+2],e?Ks(f,a,h,s,r,t[_+1],t[_+2]):f.push(Es,s,r,t[_+1],t[_+2]),a=t[_+1],h=t[_+2],_+=3;break;case Is:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,i=Es;case Es:s=t[_+1],r=t[_+2],e?Ks(f,a,h,s,r,t[_+3],t[_+4]):f.push(Es,s,r,t[_+3],t[_+4]),a=t[_+3],h=t[_+4],_+=5;break;case Ns:t[_+6]+=a,t[_+7]+=h;case Ws:tr(f,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 Ys:case Ds:f.push(Ds),a=c,h=u,_++;break;case Xs:a=t[_+1],h=t[_+2],e?qs(f,a,h,t[_+3],t[_+4]):or(f,t,_,5),_+=5;break;case zs:a=t[_+1],h=t[_+2],e?Qs(f,a,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):or(f,t,_,9),_+=9;break;case Fs:a=t[_+1],h=t[_+2],e?Qs(f,a,h,t[_+3],t[_+4],t[_+5]):or(f,t,_,6),_+=6;break;case Us:$s(e?f:or(f,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,sr),a=sr.x,h=sr.y,_+=9;break;case js:e?$s(f,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):or(f,t,_,5),a=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case Gs:Zs(e?f:or(f,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,sr),a=sr.x,h=sr.y,_+=7;break;case Vs:e?Zs(f,t[_+1],t[_+2],t[_+3],0,360,!1):or(f,t,_,4),a=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case Hs:Js(e?f:or(f,t,_,6),a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,sr),a=sr.x,h=sr.y,_+=6;break;default:return er.error(`command: ${i} [index:${_}]`,t),f}n=i}return f},objectToCanvasData(t){if(t[0].name.length>1)return xs.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ws,t.x,t.y);break;case"L":e.push(Bs,t.x,t.y);break;case"C":e.push(Ps,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Es,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ds)}}),e}},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){ir.index===ir.length&&(ir.index=1,t.push(ir.name)),t.push(Number(e)),ir.index++,ir.dot=0}},{current:ir,pushData:nr,copyData:or}=rr,{M:ar,L:hr,C:lr,Q:dr,Z:cr,N:ur,D:_r,X:pr,G:fr,F:gr,O:yr,P:mr,U:xr}=We,{getMinDistanceFrom:wr,getRadianFrom:br}=at,{tan:Br,min:vr,abs:kr}=Math,Cr={},Or={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ar,e,s)},lineTo(t,e,s){t.push(hr,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(lr,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(dr,e,s,r,i)},closePath(t){t.push(cr)},rect(t,e,s,r,i){t.push(ur,e,s,r,i)},roundRect(t,e,s,r,i,n){if(o(n))t.push(pr,e,s,r,i,n);else{const o=M.fourNumber(n);o?t.push(_r,e,s,r,i,...o):t.push(ur,e,s,r,i)}},ellipse(t,e,s,i,n,o,a,h,l){if(i===n)return Pr(t,e,s,i,a,h,l);r(o)?t.push(gr,e,s,i,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(fr,e,s,i,n,o,a,h,l?1:0))},arc(t,e,s,i,n,o,a){r(n)?t.push(mr,e,s,i):(r(n)&&(n=0),r(o)&&(o=360),t.push(yr,e,s,i,n,o,a?1:0))},arcTo(t,e,r,i,n,o,a,h,l){if(!s(a)){const t=wr(a,h,e,r,i,n)/(l?1:2);o=vr(o,vr(t,t*kr(Br(br(a,h,e,r,i,n)/2))))}t.push(xr,e,r,i,n,o)},drawEllipse(t,e,s,i,n,o,a,h,l){ls.ellipse(null,e,s,i,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Cr),t.push(ar,Cr.x,Cr.y),Tr(t,e,s,i,n,o,a,h,l)},drawArc(t,e,s,i,n,o,a){ls.arc(null,e,s,i,r(n)?0:n,r(o)?360:o,a,null,null,Cr),t.push(ar,Cr.x,Cr.y),Pr(t,e,s,i,n,o,a)},drawPoints(t,e,s,r){ls.points(t,e,s,r)}},{ellipse:Tr,arc:Pr}=Or,{moveTo:Sr,lineTo:Lr,quadraticCurveTo:Rr,bezierCurveTo:Er,closePath:Ir,beginPath:Mr,rect:Ar,roundRect:Wr,ellipse:Nr,arc:Dr,arcTo:Yr,drawEllipse:Xr,drawArc:zr,drawPoints:Fr}=Or;class Ur{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?i(t)?Me.parse(t):t:[],this}beginPath(){return Mr(this.__path),this.paint(),this}moveTo(t,e){return Sr(this.__path,t,e),this.paint(),this}lineTo(t,e){return Lr(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return Er(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return Rr(this.__path,t,e,s,r),this.paint(),this}closePath(){return Ir(this.__path),this.paint(),this}rect(t,e,s,r){return Ar(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Wr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return Nr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return Dr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return Yr(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return Xr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return zr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return Fr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:jr,L:Gr,C:Vr,Q:Hr,Z:qr,N:Qr,D:Jr,X:Zr,G:$r,F:Kr,O:ti,P:ei,U:si}=We,ri=se.get("PathDrawer"),ii={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case jr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Gr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Vr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Hr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case qr:t.closePath(),r+=1;break;case Qr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Jr: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 Zr: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]*W,e[r+6]*W,e[r+7]*W,e[r+8]),r+=9;break;case Kr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,N,!1),r+=5;break;case ti:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*W,e[r+5]*W,e[r+6]),r+=7;break;case ei:t.arc(e[r+1],e[r+2],e[r+3],0,N,!1),r+=4;break;case si:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void ri.error(`command: ${s} [index:${r}]`,e)}}},{M:ni,L:oi,C:ai,Q:hi,Z:li,N:di,D:ci,X:ui,G:_i,F:pi,O:fi,P:gi,U:yi}=We,{toTwoPointBounds:mi,toTwoPointBoundsByQuadraticCurve:xi,arcTo:wi,arc:bi,ellipse:Bi}=ls,{addPointBounds:vi,copy:ki,addPoint:Ci,setPoint:Oi,addBounds:Ti,toBounds:Pi}=yt,Si=se.get("PathBounds");let Li,Ri,Ei;const Ii={},Mi={},Ai={},Wi={toBounds(t,e){Wi.toTwoPointBounds(t,Mi),Pi(Mi,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Oi(e,0,0);let s,r,i,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===li||o===ai||o===hi?Oi(e,h,l):Oi(e,t[a+1],t[a+2])),o){case ni:case oi:h=t[a+1],l=t[a+2],Ci(e,h,l),a+=3;break;case ai:i=t[a+5],n=t[a+6],mi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,Ii),vi(e,Ii),h=i,l=n,a+=7;break;case hi:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],xi(h,l,s,r,i,n,Ii),vi(e,Ii),h=i,l=n,a+=5;break;case li:a+=1;break;case di:h=t[a+1],l=t[a+2],Ti(e,h,l,t[a+3],t[a+4]),a+=5;break;case ci:case ui:h=t[a+1],l=t[a+2],Ti(e,h,l,t[a+3],t[a+4]),a+=o===ci?9:6;break;case _i:Bi(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],Ii,Ai),0===a?ki(e,Ii):vi(e,Ii),h=Ai.x,l=Ai.y,a+=9;break;case pi:h=t[a+1],l=t[a+2],Ri=t[a+3],Ei=t[a+4],Ti(e,h-Ri,l-Ei,2*Ri,2*Ei),h+=Ri,a+=5;break;case fi:bi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ii,Ai),0===a?ki(e,Ii):vi(e,Ii),h=Ai.x,l=Ai.y,a+=7;break;case gi:h=t[a+1],l=t[a+2],Li=t[a+3],Ti(e,h-Li,l-Li,2*Li,2*Li),h+=Li,a+=4;break;case yi:wi(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ii,Ai),0===a?ki(e,Ii):vi(e,Ii),h=Ai.x,l=Ai.y,a+=6;break;default:return void Si.error(`command: ${o} [index:${a}]`,t)}}},{M:Ni,L:Di,Z:Yi}=We,{getCenterX:Xi,getCenterY:zi}=at,{arcTo:Fi}=Or,Ui={smooth(t,e,s){let r,i,n,o=0,a=0,h=0,d=0,c=0,u=0,_=0,p=0,f=0;l(e)&&(e=e[0]||0);const g=t.length,y=9===g,m=[];for(;o<g;){switch(r=t[o],r){case Ni:d=p=t[o+1],c=f=t[o+2],o+=3,t[o]===Di?(u=t[o+1],_=t[o+2],y?m.push(Ni,d,c):m.push(Ni,Xi(d,u),zi(c,_))):m.push(Ni,d,c);break;case Di:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Di:Fi(m,a,h,t[o+1],t[o+2],e,p,f,y);break;case Yi:Fi(m,a,h,d,c,e,p,f,y);break;default:m.push(Di,a,h)}p=a,f=h;break;case Yi:i!==Yi&&(Fi(m,d,c,u,_,e,p,f,y),m.push(Yi)),o+=1;break;default:n=Fe[r];for(let e=0;e<n;e++)m.push(t[o+e]);o+=n}i=r}return r!==Yi&&(m[1]=d,m[2]=c),m}};function ji(t){return new Ur(t)}const Gi=ji();Me.c