UNPKG

@leafer/core

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