UNPKG

@leafer/core

Version:
1 lines 102 kB
"use strict";var t;exports.Answer=void 0,(t=exports.Answer||(exports.Answer={}))[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip";function e(t){return void 0===t}function s(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:i}=Number;function n(t){return"number"==typeof t}const o=/^-?\d+(?:\.\d+)?$/;const{isArray:a}=Array;function h(t){return t&&"object"==typeof t}function l(t){return"{}"===JSON.stringify(t)}const d={default:(t,e)=>(c(e,t),c(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 c(t[i],e[i],s&&s[i]);s&&i in s?(null===(o=s[i])||void 0===o?void 0:o.constructor)===Object&&c(t[i]={},e[i],s[i]):t[i]=e[i]})},copyAttrs:(t,s,r)=>(r.forEach(r=>{e(s[r])||(t[r]=s[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:c}=d;class u{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 s=this.__input[t];if(!e(s))return s}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:s}=this;let r;for(let i in this)"_"!==i[0]&&(r=s?s[i]:void 0,t[i]=e(r)?this[i]:r);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const s=this.__input[t];if(!e(s))return s}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!e(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,s){const r={};if(t)if(a(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,s,{__input:i}=this;r.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!e(t))){if("path"===n&&!this.__pathInputed)continue;s=i?i[n]:void 0,r[n]=e(s)?t:s}}if(s&&s.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}}const{floor:p,max:_}=Math,f={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||g.maxCacheSize),isSuperLarge:(t,e,s)=>g.isLarge(t,e,s,g.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=f.image;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){const l=f.origin.createCanvas(_(p(e+(r||0)),1),_(p(s+(i||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,n){const r=e/n.width,i=s/n.height;d.setTransform(r,0,0,i,-n.x*r,-n.y*i),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&d.stintSet(s,"transform",e)}}},{image:g}=f,y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=y;let m,w,b;const{max:B}=Math,v=[0,0,0,0],C={zero:[...v],tempFour:v,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(v,t,e,s,r),toTempAB(t,e,s){b=s?n(t)?e:t:[],n(t)?(m=P(t),w=e):n(e)?(m=t,w=P(e)):(m=t,w=e),4!==m.length&&(m=T(m)),4!==w.length&&(w=T(w))},get(t,s){let r;if(!n(t))switch(t.length){case 4:r=e(s)?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]),!e(s))for(let t=0;t<4;t++)r[t]>s&&(r[t]=s);return r},max:(t,e,s)=>n(t)&&n(e)?B(t,e):(O(t,e,s),k(b,B(m[0],w[0]),B(m[1],w[1]),B(m[2],w[2]),B(m[3],w[3]))),add:(t,e,s)=>n(t)&&n(e)?t+e:(O(t,e,s),k(b,m[0]+w[0],m[1]+w[1],m[2]+w[2],m[3]+w[3])),swapAndScale(t,e,s,r){if(n(t))return e===s?t*e:[t*s,t*e];const i=r?t:[],[o,a,h,l]=4===t.length?t:T(t);return k(i,h*s,l*e,o*s,a*e)}},{set:k,get:T,setTemp:P,toTempAB:O}=C,{round:L,pow:S,max:R,floor:E,PI:M}=Math,I={within:(t,s,r)=>(h(s)&&(r=s.max,s=s.min),!e(s)&&t<s&&(t=s),!e(r)&&t>r&&(t=r),t),fourNumber:C.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.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,s){const r=e(s)?1e12:S(10,s);return-0===(t=L(t*r)/r)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,r){if(r||(r={}),e){const t=(n(e)?e:e.width||0)/s.width,i=(n(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&I.assignScale(r,t);return r},assignScale(t,e){n(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>R(E(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=M/180,D=2*M,N=M/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:H,acos:U,sqrt:j}=Math,{float:G}=I,V={};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,V),J.scaleOfInner(t,V,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=H(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,V),J.rotateOfInner(t,V,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,V),J.skewOfInner(t,V,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,s,r,i,n){const{e:o,f:a}=t;if(r||(r=t),e(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:e,b:i,c:o,d:a}=t;r.a=e*s.a+i*s.c,r.b=e*s.b+i*s.d,r.c=o*s.a+a*s.c,r.d=o*s.b+a*s.d,n&&(r.scaleX=s.scaleX*n.scaleX,r.scaleY=s.scaleY*n.scaleY)}else r.a=s.a,r.b=s.b,r.c=s.c,r.d=s.d,n&&(r.scaleX=s.scaleX,r.scaleY=s.scaleY);r.e=o*s.a+a*s.c+s.e,r.f=o*s.b+a*s.d+s.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,s,r,i,n){const{x:o,y:a,scaleX:h,scaleY:l}=s;if(e(n)&&(n=s.rotation||s.skewX||s.skewY),n){const{rotation:e,skewX:r,skewY:i}=s,n=e*W,o=H(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=j(i*i+n*n),c=t/d;const e=i/d;u=n>0?U(e):-U(e)}else{c=j(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?U(-e):-U(e))}const e=G(H(u)),s=F(u);d=G(d),c=G(c),p=e?G((o/c+s)/e/W,9):0,_=e?G((n/d-s)/e/W,9):0,u=G(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:p,skewY:_}},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=j(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}=I,{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,s,r){t.radiusX=s,t.radiusY=e(r)?s: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){h(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,s,r,i,n,o,a,h){e(a)&&(a=r,h=i);const l=t-r,d=s-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 h(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>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 pt{constructor(t,e){this.set(t,e)}set(t,e){return h(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 pt(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 pt(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,s,r){return new pt(at.getDistancePoint(this,t,e,s,r))}getAngle(t){return at.getAngle(this,t)}getAtan2(t){return at.getAtan2(this,t)}isSame(t){return at.isSame(this,t)}reset(){return at.reset(this),this}}const _t=new pt;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 h(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){xt(t,e,s),xt(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:xt}=yt;var mt,wt;exports.Direction4=void 0,(mt=exports.Direction4||(exports.Direction4={}))[mt.top=0]="top",mt[mt.right=1]="right",mt[mt.bottom=2]="bottom",mt[mt.left=3]="left",exports.Direction9=void 0,(wt=exports.Direction9||(exports.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["bottom-left"]=6]="bottom-left";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)=>(s||(s={}),Bt.toPoint(t,e,s,!0),s)};function vt(t){return r(t)?bt[exports.Direction9[t]]:t}const{toPoint:Ct}=Bt,kt={toPoint(t,e,s,r,i,n){Ct(t,s,r,i,e,n)}},{tempPointBounds:Tt,setPoint:Pt,addPoint:Ot,toBounds:Lt}=yt,{toOuterPoint:St}=Q,{float:Rt,fourNumber:Et}=I,{floor:Mt,ceil:It}=Math;let At,Wt,Dt,Nt;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:h,height:l}=e;if(a(s)){const e=Et(s);r?Ht.set(t,n+e[3],o+e[0],h-e[1]-e[3],l-e[2]-e[0]):Ht.set(t,n-e[3],o-e[0],h+e[1]+e[3],l+e[2]+e[0])}else r&&(s=-s),Ht.set(t,n-s,o-s,h+2*s,l+2*s);i&&("width"===i?(t.y=o,t.height=l):(t.x=n,t.width=h))},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),Ht.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?jt(e,t):e=t,s||(s=t),e.offsetX=Ht.maxX(s),e.offsetY=Ht.maxY(s),Ht.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)=>(Ht.copy(zt,t),Ht.toOuterOf(zt,e),zt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.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,St(e,Yt,Xt),Pt(Tt,Xt.x,Xt.y),Yt.x=t.x+t.width,St(e,Yt,Xt),Ot(Tt,Xt.x,Xt.y),Yt.y=t.y+t.height,St(e,Yt,Xt),Ot(Tt,Xt.x,Xt.y),Yt.x=t.x,St(e,Yt,Xt),Ot(Tt,Xt.x,Xt.y),Lt(Tt,s)},toInnerOf(t,e,s){s||(s=t),Ht.move(s,-e.e,-e.f),Ht.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Ht.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",i=1,n=!0,o){o||(o=e),r(i)&&(i=Ht.getFitScale(t,e,"cover"===i)),zt.width=n?e.width*=i:e.width*i,zt.height=n?e.height*=i:e.height*i,kt.toPoint(s,zt,t,o,!0,!0)},getSpread(t,e,s){const r={};return Ht.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){Ht.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ht.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=s>t.y?It(t.height+s-t.y):It(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,Dt=e.x,Nt=e.y,s||(Dt+=e.width,Nt+=e.height),At=At>Dt?At:Dt,Wt=Wt>Nt?Wt:Nt,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){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ht.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ht.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||jt(t,i)):Ut(t,i));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Tt,t.x,t.y):Ot(Tt,t.x,t.y)),Lt(Tt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Ut(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=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=Ht.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=Ht.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=Ht.tempToOuterOf(e,s)),!Ht.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,Dt=t.x+t.width,Nt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,At=At<Dt?At:Dt,Wt=Wt<Nt?Wt:Nt,n=At-r,o=Wt-i,{x:r,y:i,width:n,height:o}},intersect(t,e,s){Ht.copy(t,Ht.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){Ht.set(t)}},Ht=Ft,{add:Ut,copy:jt}=Ht;class Gt{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 h(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 Gt(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)}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 Gt(Ft.getIntersectData(this,t,e))}isSame(t){return Ft.isSame(this,t)}isEmpty(){return Ft.isEmpty(this)}reset(){Ft.reset(this)}}const Vt=new Gt;const qt={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:Qt}=I;class Jt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Jt(t)}static set filter(t){this.filterList=Zt(t)}static set exclude(t){this.excludeList=Zt(t)}static drawRepaint(t,e){const s=Qt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===Jt.showBounds,i=t.__nowWorld,n=Qt();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($t.enable){if($t.filterList.length&&$t.filterList.every(t=>t!==this.name))return;if($t.excludeList.length&&$t.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){$t.enable&&this.warn(...t)}warn(...t){$t.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 Zt(t){return t?r(t)&&(t=[t]):t=[],t}Jt.filterList=[],Jt.excludeList=[],Jt.showWarn=!0;const $t=Jt,Kt=Jt.get("RunTime"),te={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=y.create(y.RUNTIME);return ee.currentId=ee.idMap[s]=e?performance.now():Date.now(),ee.currentName=ee.nameMap[s]=t,ee.nameToIdMap[t]=s,s},end(t,e){const s=ee.idMap[t],r=ee.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;ee.idMap[t]=ee.nameMap[t]=ee.nameToIdMap[r]=void 0,Kt.log(r,i,"ms")},endOfName(t,s){const r=ee.nameToIdMap[t];e(r)||ee.end(r,s)}},ee=te,se=[],re={list:{},add(t,...e){this.list[t]=!0,se.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(()=>se.forEach(t=>re.has(t,!0)));const ie={editor:t=>re.need("editor")},ne=Jt.get("UICreator"),oe={list:{},register(t){const{__tag:e}=t.prototype;ae[e]&&ne.repeat(e),ae[e]=t},get(t,s,r,i,n,o){ae[t]||ne.error("not register "+t);const a=new ae[t](s);return e(r)||(a.x=r,i&&(a.y=i),n&&(a.width=n),o&&(a.height=o)),a}},{list:ae}=oe,he=Jt.get("EventCreator"),le={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],r(e)&&(de[e]&&he.repeat(e),de[e]=t)})},changeName(t,e){const s=de[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,de[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new de[t](...e)},{nameList:de}=le;function ce(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 ue(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 pe(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 _e=[];function fe(){return(t,e)=>{_e.push(e)}}const ge=[];class ye{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||ge)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;_e.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){h(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}}ce([pe("imageSmoothingEnabled")],ye.prototype,"smooth",void 0),ce([pe("imageSmoothingQuality")],ye.prototype,"smoothLevel",void 0),ce([pe("globalAlpha")],ye.prototype,"opacity",void 0),ce([pe()],ye.prototype,"fillStyle",void 0),ce([pe()],ye.prototype,"strokeStyle",void 0),ce([pe("lineWidth")],ye.prototype,"strokeWidth",void 0),ce([pe("lineCap")],ye.prototype,"strokeCap",void 0),ce([pe("lineJoin")],ye.prototype,"strokeJoin",void 0),ce([pe("lineDashOffset")],ye.prototype,"dashOffset",void 0),ce([pe()],ye.prototype,"miterLimit",void 0),ce([pe()],ye.prototype,"shadowBlur",void 0),ce([pe()],ye.prototype,"shadowColor",void 0),ce([pe()],ye.prototype,"shadowOffsetX",void 0),ce([pe()],ye.prototype,"shadowOffsetY",void 0),ce([pe()],ye.prototype,"filter",void 0),ce([pe()],ye.prototype,"font",void 0),ce([pe()],ye.prototype,"fontKerning",void 0),ce([pe()],ye.prototype,"fontStretch",void 0),ce([pe()],ye.prototype,"fontVariantCaps",void 0),ce([pe()],ye.prototype,"textAlign",void 0),ce([pe()],ye.prototype,"textBaseline",void 0),ce([pe()],ye.prototype,"textRendering",void 0),ce([pe()],ye.prototype,"wordSpacing",void 0),ce([pe()],ye.prototype,"letterSpacing",void 0),ce([pe()],ye.prototype,"direction",void 0),ce([fe()],ye.prototype,"setTransform",null),ce([fe()],ye.prototype,"resetTransform",null),ce([fe()],ye.prototype,"getTransform",null),ce([fe()],ye.prototype,"save",null),ce([fe()],ye.prototype,"restore",null),ce([fe()],ye.prototype,"translate",null),ce([fe()],ye.prototype,"scale",null),ce([fe()],ye.prototype,"rotate",null),ce([fe()],ye.prototype,"fill",null),ce([fe()],ye.prototype,"stroke",null),ce([fe()],ye.prototype,"clip",null),ce([fe()],ye.prototype,"fillRect",null),ce([fe()],ye.prototype,"strokeRect",null),ce([fe()],ye.prototype,"clearRect",null),ce([fe()],ye.prototype,"beginPath",null),ce([fe()],ye.prototype,"moveTo",null),ce([fe()],ye.prototype,"lineTo",null),ce([fe()],ye.prototype,"bezierCurveTo",null),ce([fe()],ye.prototype,"quadraticCurveTo",null),ce([fe()],ye.prototype,"closePath",null),ce([fe()],ye.prototype,"arc",null),ce([fe()],ye.prototype,"arcTo",null),ce([fe()],ye.prototype,"ellipse",null),ce([fe()],ye.prototype,"rect",null),ce([fe()],ye.prototype,"roundRect",null),ce([fe()],ye.prototype,"createConicGradient",null),ce([fe()],ye.prototype,"createLinearGradient",null),ce([fe()],ye.prototype,"createPattern",null),ce([fe()],ye.prototype,"createRadialGradient",null),ce([fe()],ye.prototype,"fillText",null),ce([fe()],ye.prototype,"measureText",null),ce([fe()],ye.prototype,"strokeText",null);const{copy:xe,multiplyParent:me,pixelScale:we}=Q,{round:be}=Math,Be=new Gt,ve=new Gt,Ce={width:1,height:1,pixelRatio:1},ke=["width","height","pixelRatio"];const Te={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Pe),Le={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Se={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Re=Object.assign(Object.assign({},Se),Pe),Ee=Oe,Me={};for(let t in Ee)Me[Ee[t]]=t;const Ie={};for(let t in Ee)Ie[Ee[t]]=Le[t];const Ae={drawRoundRect(t,e,s,r,i,n){const o=I.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:We,cos:De,hypot:Ne,atan2:Ye,ceil:Xe,abs:ze,PI:Fe,sqrt:He,pow:Ue}=Math,{setPoint:je,addPoint:Ge}=yt,{set:Ve,toNumberPoints:qe}=at,{M:Qe,L:Je,C:Ze,Q:$e,Z:Ke}=Oe,ts={},es={points(t,e,s,r){let i=qe(e);if(t.push(Qe,i[0],i[1]),s&&i.length>5){let e,n,o,a,h,l,d,c,u,p,_,f,g,y,x,m=i.length;const w=!0===s?.5:s;r&&(i=[i[m-2],i[m-1],...i,i[0],i[1],i[2],i[3]],m=i.length);for(let s=2;s<m-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],_=o-e,f=a-n,g=He(Ue(_,2)+Ue(f,2)),y=He(Ue(h-o,2)+Ue(l-a,2)),(g||y)&&(x=g+y,g=w*g/x,y=w*y/x,h-=e,l-=n,d=o-g*h,c=a-g*l,2===s?r||t.push($e,d,c,o,a):(_||f)&&t.push(Ze,u,p,d,c,o,a),u=o+y*h,p=a+y*l);r||t.push($e,u,p,i[m-2],i[m-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(Je,i[e],i[e+1]);r&&t.push(Ke)},rect(t,e,s,r,i){Te.creator.path=t,Te.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){Te.creator.path=[],Ae.drawRoundRect(Te.creator,e,s,r,i,n),t.push(...Te.convertToCanvasData(Te.creator.path,!0))},arcTo(t,e,s,r,i,n,o,a,h,l,d){const c=r-e,u=i-s,p=n-r,_=o-i;let f=Ye(u,c),g=Ye(_,p);const y=Ne(c,u),x=Ne(p,_);let m=g-f;if(m<0&&(m+=D),y<1e-12||x<1e-12||m<1e-12||ze(m-Fe)<1e-12)return t&&t.push(Je,r,i),h&&(je(h,e,s),Ge(h,r,i)),d&&Ve(d,e,s),void(l&&Ve(l,r,i));const w=c*_-p*u<0,b=w?-1:1,B=a/De(m/2),v=r+B*De(f+m/2+N*b),C=i+B*We(f+m/2+N*b);return f-=N*b,g-=N*b,is(t,v,C,a,a,0,f/W,g/W,w,h,l,d)},arc:(t,e,s,r,i,n,o,a,h,l)=>is(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,p=We(u),_=De(u);let f=o*W,g=a*W;f>Fe&&(f-=D),g<0&&(g+=D);let y=g-f;y<0?y+=D:y>D&&(y-=D),h&&(y-=D);const x=Xe(ze(y/N)),m=y/x,w=We(m/4),b=8/3*w*w/We(m/2);g=f+m;let B,v,C,k,T,P,O,L,S=De(f),R=We(f),E=C=_*r*S-p*i*R,M=k=p*r*S+_*i*R,I=e+C,A=s+k;t&&t.push(t.length?Je:Qe,I,A),l&&je(l,I,A),c&&Ve(c,I,A);for(let n=0;n<x;n++)B=De(g),v=We(g),C=_*r*B-p*i*v,k=p*r*B+_*i*v,T=e+E-b*(_*r*R+p*i*S),P=s+M-b*(p*r*R-_*i*S),O=e+C+b*(_*r*v+p*i*B),L=s+k+b*(p*r*v-_*i*B),t&&t.push(Ze,T,P,O,L,e+C,s+k),l&&rs(e+E,s+M,T,P,O,L,e+C,s+k,l,!0),E=C,M=k,S=B,R=v,f=g,g+=m;d&&Ve(d,e+C,s+k)},quadraticCurveTo(t,e,s,r,i,n,o){t.push(Ze,(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){rs(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,x,m=t,w=s,b=i,B=o;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=n,B=a),c=-3*m+9*w-9*b+3*B,u=6*m-12*w+6*b,p=3*w-3*m,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*c,x=Math.sqrt(y),y<0||(f=(-u+x)/(2*c),0<f&&f<1&&d.push(f),g=(-u-x)/(2*c),0<g&&g<1&&d.push(g));l?Ge(h,t,e):je(h,t,e),Ge(h,o,a);for(let l=0,c=d.length;l<c;l++)ss(d[l],t,e,s,r,i,n,o,a,ts),Ge(h,ts.x,ts.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,p=3*d*t*t,_=t*t*t;l.x=c*e+u*r+p*n+_*a,l.y=c*s+u*i+p*o+_*h},getPoint(t,e,s,r,i,n,o,a,h){const l={};return ss(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)}},{getPointAndSet:ss,toTwoPointBounds:rs,ellipse:is}=es,{sin:ns,cos:os,sqrt:as,atan2:hs}=Math,{ellipse:ls}=es,ds={ellipticalArc(t,e,s,r,i,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,p=n*W,_=ns(p),g=os(p),y=-g*c-_*u,x=-g*u+_*c,m=r*r,w=i*i,b=x*x,B=y*y,v=m*w-m*b-w*B;let C=0;if(v<0){const t=as(1-v/(m*w));r*=t,i*=t}else C=(o===a?-1:1)*as(v/(m*b+w*B));const k=C*r*x/i,T=-C*i*y/r,P=hs((x-T)/i,(y-k)/r),O=hs((-x-T)/i,(-y-k)/r);let L=O-P;0===a&&L>0?L-=D:1===a&&L<0&&(L+=D);const S=e+c+g*k-_*T,R=s+u+_*k+g*T,E=L<0?1:0;d||f.ellipseToCurve?ls(t,S,R,r,i,n,P/W,O/W,E):r!==i||n?t.push(Oe.G,S,R,r,i,n,P/W,O/W,E):t.push(Oe.O,S,R,r,P/W,O/W,E)}},cs={toCommand:t=>[],toNode:t=>[]},{M:us,m:ps,L:_s,l:fs,H:gs,h:ys,V:xs,v:ms,C:ws,c:bs,S:Bs,s:vs,Q:Cs,q:ks,T:Ts,t:Ps,A:Os,a:Ls,Z:Ss,z:Rs,N:Es,D:Ms,X:Is,G:As,F:Ws,O:Ds,P:Ns,U:Ys}=Oe,{rect:Xs,roundRect:zs,arcTo:Fs,arc:Hs,ellipse:Us,quadraticCurveTo:js}=es,{ellipticalArc:Gs}=ds,Vs=Jt.get("PathConvert"),qs={},Qs={current:{dot:0},stringify(t,e){let s,r,i,n=0,o=t.length,a="";for(;n<o;){r=t[n],s=Ie[r],a+=r===i?" ":Me[r];for(let r=1;r<s;r++)a+=I.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?Re:Se;for(let e=0,h=t.length;e<h;e++)r=t[e],qt[r]?("."===r&&(Js.dot&&(Zs(o,n),n=""),Js.dot++),"0"===n&&"."!==r&&(Zs(o,n),n=""),n+=r):Oe[r]?(n&&(Zs(o,n),n=""),Js.name=Oe[r],Js.length=Le[r],Js.index=0,Zs(o,Js.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?n+=r:(n&&Zs(o,n),n=r):n&&(Zs(o,n),n=""),i=r;return n&&Zs(o,n),s?Qs.toCanvasData(o,e):o},toCanvasData(t,e){let s,r,i,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(i=t[c],i){case ps:t[c+1]+=a,t[c+2]+=h;case us:a=t[c+1],h=t[c+2],p.push(us,a,h),c+=3;break;case ys:t[c+1]+=a;case gs:a=t[c+1],p.push(_s,a,h),c+=2;break;case ms:t[c+1]+=h;case xs:h=t[c+1],p.push(_s,a,h),c+=2;break;case fs:t[c+1]+=a,t[c+2]+=h;case _s:a=t[c+1],h=t[c+2],p.push(_s,a,h),c+=3;break;case vs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Bs;case Bs:o=n===ws||n===Bs,l=o?2*a-s:t[c+1],d=o?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],p.push(ws,l,d,s,r,a,h),c+=5;break;case bs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=ws;case ws:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],p.push(ws,t[c+1],t[c+2],s,r,a,h),c+=7;break;case Ps:t[c+1]+=a,t[c+2]+=h,i=Ts;case Ts:o=n===Cs||n===Ts,s=o?2*a-s:t[c+1],r=o?2*h-r:t[c+2],e?js(p,a,h,s,r,t[c+1],t[c+2]):p.push(Cs,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ks:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Cs;case Cs:s=t[c+1],r=t[c+2],e?js(p,a,h,s,r,t[c+3],t[c+4]):p.push(Cs,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ls:t[c+6]+=a,t[c+7]+=h;case Os:Gs(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Rs:case Ss:p.push(Ss),c++;break;case Es:a=t[c+1],h=t[c+2],e?Xs(p,a,h,t[c+3],t[c+4]):$s(p,t,c,5),c+=5;break;case Ms:a=t[c+1],h=t[c+2],e?zs(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):$s(p,t,c,9),c+=9;break;case Is:a=t[c+1],h=t[c+2],e?zs(p,a,h,t[c+3],t[c+4],t[c+5]):$s(p,t,c,6),c+=6;break;case As:Us(e?p:$s(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,qs),a=qs.x,h=qs.y,c+=9;break;case Ws:e?Us(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):$s(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ds:Hs(e?p:$s(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,qs),a=qs.x,h=qs.y,c+=7;break;case Ns:e?Hs(p,t[c+1],t[c+2],t[c+3],0,360,!1):$s(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ys:Fs(e?p:$s(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,qs),a=qs.x,h=qs.y,c+=6;break;default:return Vs.error(`command: ${i} [index:${c}]`,t),p}n=i}return p},objectToCanvasData(t){if(t[0].name.length>1)return cs.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(us,t.x,t.y);break;case"L":e.push(_s,t.x,t.y);break;case"C":e.push(ws,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Cs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ss)}}),e}},copyData(t,e,s,r){for(let i=s,n=s+r;i<n;i++)t.push(e[i])},pushData(t,e){Js.index===Js.length&&(Js.index=1,t.push(Js.name)),t.push(Number(e)),Js.index++,Js.dot=0}},{current:Js,pushData:Zs,copyData:$s}=Qs,{M:Ks,L:tr,C:er,Q:sr,Z:rr,N:ir,D:nr,X:or,G:ar,F:hr,O:lr,P:dr,U:cr}=Oe,{getMinDistanceFrom:ur,getRadianFrom:pr}=at,{tan:_r,min:fr,abs:gr}=Math,yr={},xr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ks,e,s)},lineTo(t,e,s){t.push(tr,e,s)},bezierCurveTo(t,e,s,r,i,n,o){t.push(er,e,s,r,i,n,o)},quadraticCurveTo(t,e,s,r,i){t.push(sr,e,s,r,i)},closePath(t){t.push(rr)},rect(t,e,s,r,i){t.push(ir,e,s,r,i)},roundRect(t,e,s,r,i,o){if(n(o))t.push(or,e,s,r,i,o);else{const n=I.fourNumber(o);n?t.push(nr,e,s,r,i,...n):t.push(ir,e,s,r,i)}},ellipse(t,e,r,i,n,o,a,h,l){if(i===n)return wr(t,e,r,i,a,h,l);s(o)?t.push(hr,e,r,i,n):(s(a)&&(a=0),s(h)&&(h=360),t.push(ar,e,r,i,n,o,a,h,l?1:0))},arc(t,e,r,i,n,o,a){s(n)?t.push(dr,e,r,i):(s(n)&&(n=0),s(o)&&(o=360),t.push(lr,e,r,i,n,o,a?1:0))},arcTo(t,s,r,i,n,o,a,h){if(!e(a)){const t=ur(a,h,s,r,i,n);o=fr(o,fr(t/2,t/2*gr(_r(pr(a,h,s,r,i,n)/2))))}t.push(cr,s,r,i,n,o)},drawEllipse(t,e,r,i,n,o,a,h,l){es.ellipse(null,e,r,i,n,s(o)?0:o,s(a)?0:a,s(h)?360:h,l,null,null,yr),t.push(Ks,yr.x,yr.y),mr(t,e,r,i,n,o,a,h,l)},drawArc(t,e,r,i,n,o,a){es.arc(null,e,r,i,s(n)?0:n,s(o)?360:o,a,null,null,yr),t.push(Ks,yr.x,yr.y),wr(t,e,r,i,n,o,a)},drawPoints(t,e,s,r){es.points(t,e,s,r)}},{ellipse:mr,arc:wr}=xr,{moveTo:br,lineTo:Br,quadraticCurveTo:vr,bezierCurveTo:Cr,closePath:kr,beginPath:Tr,rect:Pr,roundRect:Or,ellipse:Lr,arc:Sr,arcTo:Rr,drawEllipse:Er,drawArc:Mr,drawPoints:Ir}=xr;class Ar{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Te.parse(t):t:[],this}beginPath(){return Tr(this.__path),this.paint(),this}moveTo(t,e){return br(this.__path,t,e),this.paint(),this}lineTo(t,e){return Br(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,n){return Cr(this.__path,t,e,s,r,i,n),this.paint(),this}quadraticCurveTo(t,e,s,r){return vr(this.__path,t,e,s,r),this.paint(),this}closePath(){return kr(this.__path),this.paint(),this}rect(t,e,s,r){return Pr(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Or(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,n,o,a){return Lr(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}arc(t,e,s,r,i,n){return Sr(this.__path,t,e,s,r,i,n),this.paint(),this}arcTo(t,e,s,r,i){return Rr(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,n,o,a){return Er(this.__path,t,e,s,r,i,n,o,a),this.paint(),this}drawArc(t,e,s,r,i,n){return Mr(this.__path,t,e,s,r,i,n),this.paint(),this}drawPoints(t,e,s){return Ir(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Wr,L:Dr,C:Nr,Q:Yr,Z:Xr,N:zr,D:Fr,X:Hr,G:Ur,F:jr,O:Gr,P:Vr,U:qr}=Oe,Qr=Jt.get("PathDrawer"),Jr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Wr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Dr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Nr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case Yr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Xr:t.closePath(),r+=1;break;case zr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Fr: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 Hr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Ur: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 jr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,D,!1),r+=5;break;case Gr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*W,e[r+5]*W,e[r+6]),r+=7;break;case Vr:t.arc(e[r+1],e[r+2],e[r+3],0,D,!1),r+=4;break;case qr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Qr.error(`command: ${s} [index:${r}]`,e)}}},{M:Zr,L:$r,C:Kr,Q:ti,Z:ei,N:si,D:ri,X:ii,G:ni,F:oi,O:ai,P:hi,U:li}=Oe,{toTwoPointBounds:di,toTwoPointBoundsByQuadraticCurve:ci,arcTo:ui,arc:pi,ellipse:_i}=es,{addPointBounds:fi,copy:gi,addPoint:yi,setPoint:xi,addBounds:mi,toBounds:wi}=yt,bi=Jt.get("PathBounds");let Bi,vi,Ci;const ki={},Ti={},Pi={},Oi={toBounds(t,e){Oi.toTwoPointBounds(t,Ti),wi(Ti,e)},toTwoPointBounds(t,e){if(!t||!t.length)return xi(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===ei||o===Kr||o===ti?xi(e,h,l):xi(e,t[a+1],t[a+2])),o){case Zr:case $r:h=t[a+1],l=t[a+2],yi(e,h,l),a+=3;break;case Kr:i=t[a+5],n=t[a+6],di(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,n,ki),fi(e,ki),h=i,l=n,a+=7;break;case ti:s=t[a+1],r=t[a+2],i=t[a+3],n=t[a+4],ci(h,l,s,r,i,n,ki),fi(e,ki),h=i,l=n,a+=5;break;case ei:a+=1;break;case si:h=t[a+1],l=t[a+2],mi(e,h,l,t[a+3],t[a+4]),a+=5;break;case ri:case ii:h=t[a+1],l=t[a+2],mi(e,h,l,t[a+3],t[a+4]),a+=o===ri?9:6;break;case ni:_i(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],ki,Pi),0===a?gi(e,ki):fi(e,ki),h=Pi.x,l=Pi.y,a+=9;break;case oi:h=t[a+1],l=t[a+2],vi=t[a+3],Ci=t[a+4],mi(e,h-vi,l-Ci,2*vi,2*Ci),h+=vi,a+=5;break;case ai:pi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ki,Pi),0===a?gi(e,ki):fi(e,ki),h=Pi.x,l=Pi.y,a+=7;break;case hi:h=t[a+1],l=t[a+2],Bi=t[a+3],mi(e,h-Bi,l-Bi,2*Bi,2*Bi),h+=Bi,a+=4;break;case li:ui(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ki,Pi),0===a?gi(e,ki):fi(e,ki),h=Pi.x,l=Pi.y,a+=6;break;default:return void bi.error(`command: ${o} [index:${a}]`,t)}}},{M:Li,L:Si,Z:Ri}=Oe,{getCenterX:Ei,getCenterY:Mi}=at,{arcTo:Ii}=xr,Ai={smooth(t,e,s){let r,i,n,o=0,h=0,l=0,d=0,c=0,u=0,p=0,_=0,f=0;a(e)&&(e=e[0]||0);const g=t.length,y=[];for(;o<g;){switch(r=t[o],r){case Li:d=_=t[o+1],c=f=t[o+2],o+=3,t[o]===Si?(u=t[o+1],p=t[o+2],y.push(Li,Ei(d,u),Mi(c,p))):y.push(Li,d,c);break;case Si:switch(h=t[o+1],l=t[o+2],o+=3,t[o]){case Si:Ii(y,h,l,t[o+1],t[o+2],e,_,f);break;case Ri:Ii(y,h,l,d,c,e,_,f);break;default:y.push(Si,h,l)}_=h,f=l;break;case Ri:i!==Ri&&(Ii(y,d,c,u,p,e,_,f),y.push(Ri)),o+=1;break;default:n=Ie[r];for(let e=0;e<n;e++)y.push(t[o+e]);o+=n}i=r}return r!==Ri&&(y[1]=d,y[2]=c),y}};function Wi(t){return new Ar(t)}const Di=Wi();Te.creator=Wi(),Te.parse=Qs.parse,Te.convertToCanvasData=Qs.toCanvasData;const{drawRoundRect:Ni}=Ae;const Yi={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=Xi.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{}}}},Xi=Yi;Xi.alphaPixelTypes.forEach(t=>Xi.upperCaseTypeMap[t]=t.toUpperCase());const zi=Jt.get("TaskProcessor");class Fi{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return ue(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){zi.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Hi{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&&d.assign(this.config,t),this.empty()}add(t,s,r){let i,o,a,h;const l=new Fi(t);return l.parent=this,n(s)?h=s:s&&(o=s.parallel,i=s.start,a=s.time,h=s.delay,r||(r=s.canUse)),a&&(l.time=a),!1===o&&(l.parallel=!1),r&&(l.canUse=r),e(h)?this.push(l,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,i))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:s,index:r}=this;this.parallelList=[],this.parallelSuccessNumber=0;let i=r+e.parallel;if(i>s.length&&(i=s.length),e.parallel>1)for(let e=r;e<i&&(t=s[e],t.parallel);e++)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 Ui=Jt.get("Resource"),ji={tasker:new Hi,map:{},get isComplete(){return Gi.tasker.isComplete},set(t,e){Gi.map[t]&&Ui.repeat(t),Gi.map[t]=e},get:t=>Gi.map[t],remove(t){const e=Gi.map[t];e&&(e.destroy&&e.destroy(),delete Gi.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 i;return r(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=ie.image(i)),Gi.set(t,e),e},destroy(){Gi.map={}}},Gi=ji,Vi={maxRecycled:10,recycledList:[],patternTasker:new Hi({parallel:1}),get(t){let e=ji.get(t.url);return e||ji.set(t.url,e=ie.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(f.image.isLarge(t)?t.url&&ji.remove(t.url):(t.clearLevels(),qi.recycledList.push(t)))})},recyclePaint(t){qi.recycle(t.image)},clearRecycled(t){const e=qi.recycledList;(e.length>qi.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&ji.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Yi.alphaPixelTypes.some(e=>qi.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Yi.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Yi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},qi=Vi,{IMAGE:Qi,create:Ji}=y;function Zi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function $i(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ki(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function tn(t,e){return(s,r)=>sn(s,r,t,e&&e(r))}function en(t){return t}function sn(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Zi(t,e,Object.assign(i,r||{})),un(t,e,s)}function rn(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&nn(this)}}))}function nn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const on=rn;function an(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s)&&(hn(this),e&&(this.__.__useStroke=!0))}}))}function hn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&nn(t)}const ln=an;function dn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function cn(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||nn(t))}function un(t,s,r){const i=t.__DataProcessor.prototype,n="_"+s,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(s),a=Ki(s,r);if(e(r))a.get=function(){return this[n]};else if("function"==typeof r)a.get=function(){const t=this[n];return null==t?r(this.__leaf):t};else if(h(r)){const t=l(r);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:d.clone(r):e}}const c=t.isBranchLeaf;"width"===s?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!r||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:c&&s.children.length?s.boxBounds.width:r}return t}:"height"===s&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;retu