UNPKG

@leafer/core

Version:
1 lines 104 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 o(t){return"number"==typeof t}const n=/^-?\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 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 c(t[i],e[i],s&&s[i]);s&&i in s?(null===(n=s[i])||void 0===n?void 0:n.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 o in this)if("_"!==o[0]&&(t=this["_"+o],!e(t))){if("path"===o&&!this.__pathInputed)continue;s=i?i[o]:void 0,r[o]=e(s)?t:s}}if(s&&s.matrix){const{a:t,b:e,c:s,d:i,e:o,f:n}=this.__leaf.__localMatrix;r.matrix={a:t,b:e,c:s,d:i,e:o,f:n}}return r}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const p={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=_;return e[t]?e[t]++:(e[t]=1,0)}},_=p;let f,g,y;const{max:x}=Math,m=[0,0,0,0],w={zero:[...m],tempFour:m,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)=>b(m,t,e,s,r),toTempAB(t,e,s){y=s?o(t)?e:t:[],o(t)?(f=v(t),g=e):o(e)?(f=t,g=v(e)):(f=t,g=e),4!==f.length&&(f=B(f)),4!==g.length&&(g=B(g))},get(t,s){let r;if(!o(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)=>o(t)&&o(e)?x(t,e):(C(t,e,s),b(y,x(f[0],g[0]),x(f[1],g[1]),x(f[2],g[2]),x(f[3],g[3]))),add:(t,e,s)=>o(t)&&o(e)?t+e:(C(t,e,s),b(y,f[0]+g[0],f[1]+g[1],f[2]+g[2],f[3]+g[3])),swapAndScale(t,e,s,r){if(o(t))return e===s?t*e:[t*s,t*e];const i=r?t:[],[n,a,h,l]=4===t.length?t:B(t);return b(i,h*s,l*e,n*s,a*e)}},{set:b,get:B,setTemp:v,toTempAB:C}=w,{round:k,pow:T,max:P,floor:O,PI:S}=Math,L={},R={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:w.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),R.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:T(10,s);return-0===(t=k(t*r)/r)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,r){if(r||(r={}),e){const t=(o(e)?e:e.width||0)/s.width,i=(o(e)?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&R.assignScale(r,t);return r},getScaleFixedData(t,e,s,r,i){let{scaleX:n,scaleY:a}=t;if((r||e)&&(n<0&&(n=-n),a<0&&(a=-a)),e)if(!0===e)n=a=s?1:1/n;else{let t;o(e)?t=e:"zoom-in"===e&&(t=1),t&&(n=a=n>t||a>t?s?1:1/n:s?1:1/t)}return L.scaleX=n,L.scaleY=a,L},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>P(O(t),e)/t,randInt:E,randColor:t=>`rgba(${E(255)},${E(255)},${E(255)},${t||1})`};function E(t){return Math.round(Math.random()*t)}const I=S/180,M=2*S,A=S/2;function W(){return{x:0,y:0}}function D(){return{x:0,y:0,width:0,height:0}}function N(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:Y,cos:X,acos:z,sqrt:F}=Math,{float:U}=R,H={};function j(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const V={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:j(),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:N,getWorld:j,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){G.toInnerPoint(t,e,H),G.scaleOfInner(t,H,s,r)},scaleOfInner(t,e,s,r=s){G.translateInner(t,e.x,e.y),G.scale(t,s,r),G.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=X(e*=I),a=Y(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){G.toInnerPoint(t,e,H),G.rotateOfInner(t,H,s)},rotateOfInner(t,e,s){G.translateInner(t,e.x,e.y),G.rotate(t,s),G.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=I,t.a=r+o*s,t.b=i+n*s),e&&(e*=I,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){G.toInnerPoint(t,e,H),G.skewOfInner(t,H,s,r)},skewOfInner(t,e,s,r=0){G.translateInner(t,e.x,e.y),G.skew(t,s,r),G.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,s,r,i,o){const{e:n,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:n,d:a}=t;r.a=e*s.a+i*s.c,r.b=e*s.b+i*s.d,r.c=n*s.a+a*s.c,r.d=n*s.b+a*s.d,o&&(r.scaleX=s.scaleX*o.scaleX,r.scaleY=s.scaleY*o.scaleY)}else r.a=s.a,r.b=s.b,r.c=s.c,r.d=s.d,o&&(r.scaleX=s.scaleX,r.scaleY=s.scaleY);r.e=n*s.a+a*s.c+s.e,r.f=n*s.b+a*s.d+s.f},divide(t,e){G.multiply(t,G.tempInvert(e))},divideParent(t,e){G.multiplyParent(t,G.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=G;return G.copy(e,t),G.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,s,r,i,o){const{x:n,y:a,scaleX:h,scaleY:l}=s;if(e(o)&&(o=s.rotation||s.skewX||s.skewY),o){const{rotation:e,skewX:r,skewY:i}=s,o=e*I,n=X(o),a=Y(o);if(r||i){const e=r*I,s=i*I;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,(r=r||i)&&G.translateInner(t,-r.x,-r.y,!i)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,p,_,f=h,g=l;if(o||n){const t=i*a-o*n;if(n&&!r){d=F(i*i+o*o),c=t/d;const e=i/d;u=o>0?z(e):-z(e)}else{c=F(n*n+a*a),d=t/c;const e=n/c;u=A-(a>0?z(-e):-z(e))}const e=U(X(u)),s=Y(u);d=U(d),c=U(c),p=e?U((n/c+s)/e/I,9):0,_=e?U((o/d-s)/e/I,9):0,u=U(u/I)}else d=i,c=a,u=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:c,rotation:u,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=F(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){G.set(t)}},G=V,{float:q}=R,{toInnerPoint:Q,toOuterPoint:J}=V,{sin:Z,cos:$,abs:K,sqrt:tt,atan2:et,min:st,round:rt}=Math,it={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?rt(t.x-.5)+.5:rt(t.x),t.y=e?rt(t.y-.5)+.5:rt(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=ot.defaultPoint);const r=$(e*=I),i=Z(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}=ot;return at(s,t),Q(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=ot;return at(s,t),J(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=ot;return at(s,t),ot.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,r)=>(at(t,e),ht(t,s,r),t),toInnerRadiusPointOf(t,e,s){s||(s=t),Q(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){Q(e,t,s)},toOuterOf(t,e,s){J(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)=>nt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=K(s-t),o=K(r-e);return tt(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>st(nt(t,e,s,r),nt(s,r,i,o)),getAngle:(t,e)=>lt(t,e)/I,getRotation:(t,e,s,r)=>(r||(r=e),ot.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/I),getRadianFrom(t,s,r,i,o,n,a,h){e(a)&&(a=r,h=i);const l=t-r,d=s-i,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>et(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r,i){const o=lt(t,e);return i&&(t=e),r||(e={}),e.x=t.x+$(o)*s,e.y=t.y+Z(o)*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,s)=>s?t.x===e.x&&t.y===e.y:q(t.x)===q(e.x)&&q(t.y)===q(e.y),reset(t){ot.reset(t)}},ot=it,{getDistanceFrom:nt,copy:at,setRadius:ht,getAtan2:lt}=ot;class dt{constructor(t,e){this.set(t,e)}set(t,e){return h(t)?it.copy(this,t):it.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new dt(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}rotate(t,e){return it.rotate(this,t,e),this}rotateOf(t,e){return it.rotate(this,e,t),this}getRotation(t,e,s){return it.getRotation(this,t,e,s)}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}getCenter(t){return new dt(it.getCenter(this,t))}getDistance(t){return it.getDistance(this,t)}getDistancePoint(t,e,s,r){return new dt(it.getDistancePoint(this,t,e,s,r))}getAngle(t){return it.getAngle(this,t)}getAtan2(t){return it.getAtan2(this,t)}isSame(t,e){return it.isSame(this,t,e)}reset(){return it.reset(this),this}}const ct=new dt;class ut{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return h(t)?V.copy(this,t):V.set(this,t,e,s,r,i,o),this}setWith(t){return V.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new ut(this)}translate(t,e){return V.translate(this,t,e),this}translateInner(t,e){return V.translateInner(this,t,e),this}scale(t,e){return V.scale(this,t,e),this}scaleWith(t,e){return V.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return V.pixelScale(this,t),this}scaleOfOuter(t,e,s){return V.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return V.scaleOfInner(this,t,e,s),this}rotate(t){return V.rotate(this,t),this}rotateOfOuter(t,e){return V.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return V.rotateOfInner(this,t,e),this}skew(t,e){return V.skew(this,t,e),this}skewOfOuter(t,e,s){return V.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return V.skewOfInner(this,t,e,s),this}multiply(t){return V.multiply(this,t),this}multiplyParent(t){return V.multiplyParent(this,t),this}divide(t){return V.divide(this,t),this}divideParent(t){return V.divideParent(this,t),this}invert(){return V.invert(this),this}invertWith(){return V.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){V.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){V.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return V.setLayout(this,t,e,s),this}getLayout(t,e,s){return V.getLayout(this,t,e,s)}withScale(t,e){return V.withScale(this,t,e)}reset(){V.reset(this)}}const pt=new ut,_t={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){ft(t,e,s),ft(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:ft}=_t;var gt,yt;exports.Direction4=void 0,(gt=exports.Direction4||(exports.Direction4={}))[gt.top=0]="top",gt[gt.right=1]="right",gt[gt.bottom=2]="bottom",gt[gt.left=3]="left",exports.Direction9=void 0,(yt=exports.Direction9||(exports.Direction9={}))[yt.topLeft=0]="topLeft",yt[yt.top=1]="top",yt[yt.topRight=2]="topRight",yt[yt.right=3]="right",yt[yt.bottomRight=4]="bottomRight",yt[yt.bottom=5]="bottom",yt[yt.bottomLeft=6]="bottomLeft",yt[yt.left=7]="left",yt[yt.center=8]="center",yt[yt["top-left"]=0]="top-left",yt[yt["top-right"]=2]="top-right",yt[yt["bottom-right"]=4]="bottom-right",yt[yt["bottom-left"]=6]="bottom-left";const xt=[{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}];xt.forEach(t=>t.type="percent");const mt={directionData:xt,tempPoint:{},get:wt,toPoint(t,e,s,r,i,o){const n=wt(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,r=!0)=>(s||(s={}),mt.toPoint(t,e,s,r),s)};function wt(t){return r(t)?xt[exports.Direction9[t]]:t}const{toPoint:bt}=mt,Bt={toPoint(t,e,s,r,i,o){bt(t,s,r,i,e,o)}},{tempPointBounds:vt,setPoint:Ct,addPoint:kt,toBounds:Tt}=_t,{toOuterPoint:Pt}=V,{float:Ot,fourNumber:St}=R,{floor:Lt,ceil:Rt}=Math;let Et,It,Mt,At;const Wt={},Dt={},Nt={},Yt={tempBounds:Nt,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:h,height:l}=e;if(a(s)){const e=St(s);r?Xt.set(t,o+e[3],n+e[0],h-e[1]-e[3],l-e[2]-e[0]):Xt.set(t,o-e[3],n-e[0],h+e[1]+e[3],l+e[2]+e[0])}else r&&(s=-s),Xt.set(t,o-s,n-s,h+2*s,l+2*s);i&&("width"===i?(t.y=n,t.height=l):(t.x=o,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),Xt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Ft(e,t):e=t,s||(s=t),e.offsetX=Xt.maxX(s),e.offsetY=Xt.maxY(s),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,r){r||it.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){it.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(Xt.copy(Nt,t),Xt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i,e:o,f:n}=e;r>0?(s.width=t.width*r,s.x=o+t.x*r):(s.width=t.width*-r,s.x=o+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=n+t.y*i):(s.height=t.height*-i,s.y=n+t.y*i-s.height)}else Wt.x=t.x,Wt.y=t.y,Pt(e,Wt,Dt),Ct(vt,Dt.x,Dt.y),Wt.x=t.x+t.width,Pt(e,Wt,Dt),kt(vt,Dt.x,Dt.y),Wt.y=t.y+t.height,Pt(e,Wt,Dt),kt(vt,Dt.x,Dt.y),Wt.x=t.x,Pt(e,Wt,Dt),kt(vt,Dt.x,Dt.y),Tt(vt,s)},toInnerOf(t,e,s){s||(s=t),Xt.move(s,-e.e,-e.f),Xt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Xt.getFitScale(t,e));return new ut(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,o=!0,n){n||(n=e),r(i)&&(i=Xt.getFitScale(t,e,"cover"===i)),Nt.width=o?e.width*=i:e.width*i,Nt.height=o?e.height*=i:e.height*i,Bt.toPoint(s,Nt,t,n,!0,!0)},getSpread(t,e,s){const r={};return Xt.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){Xt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Xt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Lt(t.x),t.y=Lt(t.y),t.width=e>t.x?Rt(t.width+e-t.x):Rt(t.width),t.height=s>t.y?Rt(t.height+s-t.y):Rt(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=Ot(t.x,e),t.y=Ot(t.y,e),t.width=Ot(t.width,e),t.height=Ot(t.height,e)},add(t,e,s){Et=t.x+t.width,It=t.y+t.height,Mt=e.x,At=e.y,s||(Mt+=e.width,At+=e.height),Et=Et>Mt?Et:Mt,It=It>At?It:At,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Et-t.x,t.height=It-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Xt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Xt.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||Ft(t,i)):zt(t,i));o&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(vt,t.x,t.y):kt(vt,t.x,t.y)),Tt(vt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){zt(t,e,!0)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},getPoint:(t,e,s=!1,r)=>mt.getPoint(e,t,r,s),hitRadiusPoint:(t,e,s)=>(s&&(e=it.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=it.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=Xt.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=Xt.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=Xt.tempToOuterOf(e,s)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return Et=r+o,It=i+n,Mt=t.x+t.width,At=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,Et=Et<Mt?Et:Mt,It=It<At?It:At,o=Et-r,n=It-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){Xt.copy(t,Xt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Xt.set(t)}},Xt=Yt,{add:zt,copy:Ft}=Xt;class Ut{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return h(t)?Yt.copy(this,t):Yt.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 Ut(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,s){return Yt.scale(this,t,e,s),this}scaleOf(t,e,s){return Yt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,s){Yt.put(this,t,e,s)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}getPoint(t,e,s){return Yt.getPoint(this,t,e,s)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Ut(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Ht=new Ut;const jt={number:(t,e)=>h(t)?"percent"===t.type?t.value*e:t.value:t},Vt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Gt,max:qt}=Math,Qt={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||Jt.maxCacheSize),isSuperLarge:(t,e,s)=>Jt.isLarge(t,e,s,Jt.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=Jt;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,o,n,a,h,l){const d=qt(Gt(e+(r||0)),1),c=qt(Gt(s+(i||0)),1);let u,p,_;l&&(_=jt.number(l.offset,"x"===l.type?e:s))&&("x"===l.type?u=!0:p=!0);const f=Qt.origin.createCanvas(p?2*d:d,u?2*c:c),g=f.getContext("2d");if(a&&(g.globalAlpha=a),g.imageSmoothingEnabled=!1!==n,Jt.canUse(t)){if(o){const r=e/o.width,i=s/o.height;g.setTransform(r,0,0,i,-o.x*r,-o.y*i),g.drawImage(t,0,0,t.width,t.height)}else g.drawImage(t,0,0,e,s);_&&(g.drawImage(f,0,0,d,c,u?_-d:d,u?c:_-c,d,c),g.drawImage(f,0,0,d,c,u?_:d,u?c:_,d,c))}return f},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&d.stintSet(s,"transform",e)}}},{image:Jt}=Qt,{randColor:Zt}=R;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Kt(t)}static set exclude(t){this.excludeList=Kt(t)}static drawRepaint(t,e){const s=Zt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===$t.showBounds,i=t.__nowWorld,o=Zt();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(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 Kt(t){return t?r(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const te=$t,ee=$t.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=p.create(p.RUNTIME);return re.currentId=re.idMap[s]=e?performance.now():Date.now(),re.currentName=re.nameMap[s]=t,re.nameToIdMap[t]=s,s},end(t,e){const s=re.idMap[t],r=re.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;re.idMap[t]=re.nameMap[t]=re.nameToIdMap[r]=void 0,ee.log(r,i,"ms")},endOfName(t,s){const r=re.nameToIdMap[t];e(r)||re.end(r,s)}},re=se,ie=[],oe={list:{},add(t,...e){this.list[t]=!0,ie.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(()=>ie.forEach(t=>oe.has(t,!0)));const ne={editor:t=>oe.need("editor")},ae=$t.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&ae.repeat(e),le[e]=t},get(t,s,r,i,o,n){if(!le[t])return void ae.warn("not register "+t);const a=new le[t](s);return e(r)||(a.x=r,i&&(a.y=i),o&&(a.width=o),n&&(a.height=n)),a}},{list:le}=he,de=$t.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],r(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const s=ue[t];if(s){const r=Object.keys(s).find(e=>s[e]===t);r&&(s[r]=e,ue[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;function pe(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 _e(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 fe(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 ge=[];function ye(){return(t,e)=>{ge.push(e)}}const xe=[];class me{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||xe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ge.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){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,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}}pe([fe("imageSmoothingEnabled")],me.prototype,"smooth",void 0),pe([fe("imageSmoothingQuality")],me.prototype,"smoothLevel",void 0),pe([fe("globalAlpha")],me.prototype,"opacity",void 0),pe([fe()],me.prototype,"fillStyle",void 0),pe([fe()],me.prototype,"strokeStyle",void 0),pe([fe("lineWidth")],me.prototype,"strokeWidth",void 0),pe([fe("lineCap")],me.prototype,"strokeCap",void 0),pe([fe("lineJoin")],me.prototype,"strokeJoin",void 0),pe([fe("lineDashOffset")],me.prototype,"dashOffset",void 0),pe([fe()],me.prototype,"miterLimit",void 0),pe([fe()],me.prototype,"shadowBlur",void 0),pe([fe()],me.prototype,"shadowColor",void 0),pe([fe()],me.prototype,"shadowOffsetX",void 0),pe([fe()],me.prototype,"shadowOffsetY",void 0),pe([fe()],me.prototype,"filter",void 0),pe([fe()],me.prototype,"font",void 0),pe([fe()],me.prototype,"fontKerning",void 0),pe([fe()],me.prototype,"fontStretch",void 0),pe([fe()],me.prototype,"fontVariantCaps",void 0),pe([fe()],me.prototype,"textAlign",void 0),pe([fe()],me.prototype,"textBaseline",void 0),pe([fe()],me.prototype,"textRendering",void 0),pe([fe()],me.prototype,"wordSpacing",void 0),pe([fe()],me.prototype,"letterSpacing",void 0),pe([fe()],me.prototype,"direction",void 0),pe([ye()],me.prototype,"setTransform",null),pe([ye()],me.prototype,"resetTransform",null),pe([ye()],me.prototype,"getTransform",null),pe([ye()],me.prototype,"save",null),pe([ye()],me.prototype,"restore",null),pe([ye()],me.prototype,"translate",null),pe([ye()],me.prototype,"scale",null),pe([ye()],me.prototype,"rotate",null),pe([ye()],me.prototype,"fill",null),pe([ye()],me.prototype,"stroke",null),pe([ye()],me.prototype,"clip",null),pe([ye()],me.prototype,"fillRect",null),pe([ye()],me.prototype,"strokeRect",null),pe([ye()],me.prototype,"clearRect",null),pe([ye()],me.prototype,"beginPath",null),pe([ye()],me.prototype,"moveTo",null),pe([ye()],me.prototype,"lineTo",null),pe([ye()],me.prototype,"bezierCurveTo",null),pe([ye()],me.prototype,"quadraticCurveTo",null),pe([ye()],me.prototype,"closePath",null),pe([ye()],me.prototype,"arc",null),pe([ye()],me.prototype,"arcTo",null),pe([ye()],me.prototype,"ellipse",null),pe([ye()],me.prototype,"rect",null),pe([ye()],me.prototype,"roundRect",null),pe([ye()],me.prototype,"createConicGradient",null),pe([ye()],me.prototype,"createLinearGradient",null),pe([ye()],me.prototype,"createPattern",null),pe([ye()],me.prototype,"createRadialGradient",null),pe([ye()],me.prototype,"fillText",null),pe([ye()],me.prototype,"measureText",null),pe([ye()],me.prototype,"strokeText",null);const{copy:we,multiplyParent:be,pixelScale:Be}=V,{round:ve}=Math,Ce=new Ut,ke=new Ut,Te={width:1,height:1,pixelRatio:1},Pe=["width","height","pixelRatio"];const Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Se={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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},Se),Re={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},Ee={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},Ie=Object.assign(Object.assign({},Ee),Se),Me=Le,Ae={};for(let t in Me)Ae[Me[t]]=t;const We={};for(let t in Me)We[Me[t]]=Re[t];const De={drawRoundRect(t,e,s,r,i,o){const n=R.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:Ne,cos:Ye,hypot:Xe,atan2:ze,ceil:Fe,abs:Ue,PI:He,sqrt:je,pow:Ve}=Math,{setPoint:Ge,addPoint:qe}=_t,{set:Qe,toNumberPoints:Je}=it,{M:Ze,L:$e,C:Ke,Q:ts,Z:es}=Le,ss={},rs={points(t,e,s,r){let i=Je(e);if(t.push(Ze,i[0],i[1]),s&&i.length>5){let e,o,n,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],o=i[s-1],n=i[s],a=i[s+1],h=i[s+2],l=i[s+3],_=n-e,f=a-o,g=je(Ve(_,2)+Ve(f,2)),y=je(Ve(h-n,2)+Ve(l-a,2)),(g||y)&&(x=g+y,g=w*g/x,y=w*y/x,h-=e,l-=o,d=n-g*h,c=a-g*l,2===s?r||t.push(ts,d,c,n,a):(_||f)&&t.push(Ke,u,p,d,c,n,a),u=n+y*h,p=a+y*l);r||t.push(ts,u,p,i[m-2],i[m-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push($e,i[e],i[e+1]);r&&t.push(es)},rect(t,e,s,r,i){Oe.creator.path=t,Oe.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){Oe.creator.path=[],De.drawRoundRect(Oe.creator,e,s,r,i,o),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,h,l,d){const c=r-e,u=i-s,p=o-r,_=n-i;let f=ze(u,c),g=ze(_,p);const y=Xe(c,u),x=Xe(p,_);let m=g-f;if(m<0&&(m+=M),y<1e-12||x<1e-12||m<1e-12||Ue(m-He)<1e-12)return t&&t.push($e,r,i),h&&(Ge(h,e,s),qe(h,r,i)),d&&Qe(d,e,s),void(l&&Qe(l,r,i));const w=c*_-p*u<0,b=w?-1:1,B=a/Ye(m/2),v=r+B*Ye(f+m/2+A*b),C=i+B*Ne(f+m/2+A*b);return f-=A*b,g-=A*b,ns(t,v,C,a,a,0,f/I,g/I,w,h,l,d)},arc:(t,e,s,r,i,o,n,a,h,l)=>ns(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,h,l,d,c){const u=o*I,p=Ne(u),_=Ye(u);let f=n*I,g=a*I;f>He&&(f-=M),g<0&&(g+=M);let y=g-f;y<0?y+=M:y>M&&(y-=M),h&&(y-=M);const x=Fe(Ue(y/A)),m=y/x,w=Ne(m/4),b=8/3*w*w/Ne(m/2);g=f+m;let B,v,C,k,T,P,O,S,L=Ye(f),R=Ne(f),E=C=_*r*L-p*i*R,W=k=p*r*L+_*i*R,D=e+C,N=s+k;t&&t.push(t.length?$e:Ze,D,N),l&&Ge(l,D,N),c&&Qe(c,D,N);for(let o=0;o<x;o++)B=Ye(g),v=Ne(g),C=_*r*B-p*i*v,k=p*r*B+_*i*v,T=e+E-b*(_*r*R+p*i*L),P=s+W-b*(p*r*R-_*i*L),O=e+C+b*(_*r*v+p*i*B),S=s+k+b*(p*r*v-_*i*B),t&&t.push(Ke,T,P,O,S,e+C,s+k),l&&os(e+E,s+W,T,P,O,S,e+C,s+k,l,!0),E=C,W=k,L=B,R=v,f=g,g+=m;d&&Qe(d,e+C,s+k)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(Ke,(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){os(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 c,u,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),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?qe(h,t,e):Ge(h,t,e),qe(h,n,a);for(let l=0,c=d.length;l<c;l++)is(d[l],t,e,s,r,i,o,n,a,ss),qe(h,ss.x,ss.y)},getPointAndSet(t,e,s,r,i,o,n,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*o+_*a,l.y=c*s+u*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return is(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)},cut(t,e,s,r,i,o,n,a,h){if(t<=0)return{left:null,right:[r,i,o,n,a,h]};if(t>=1)return{left:[r,i,o,n,a,h],right:null};const l=1-t,d=e*l+r*t,c=s*l+i*t,u=r*l+o*t,p=i*l+n*t,_=o*l+a*t,f=n*l+h*t,g=d*l+u*t,y=c*l+p*t,x=u*l+_*t,m=p*l+f*t;return{left:[d,c,g,y,g*l+x*t,y*l+m*t],right:[x,m,_,f,a,h]}}},{getPointAndSet:is,toTwoPointBounds:os,ellipse:ns}=rs,{sin:as,cos:hs,sqrt:ls,atan2:ds}=Math,{ellipse:cs}=rs,us={ellipticalArc(t,e,s,r,i,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,p=o*I,_=as(p),f=hs(p),g=-f*c-_*u,y=-f*u+_*c,x=r*r,m=i*i,w=y*y,b=g*g,B=x*m-x*w-m*b;let v=0;if(B<0){const t=ls(1-B/(x*m));r*=t,i*=t}else v=(n===a?-1:1)*ls(B/(x*w+m*b));const C=v*r*y/i,k=-v*i*g/r,T=ds((y-k)/i,(g-C)/r),P=ds((-y-k)/i,(-g-C)/r);let O=P-T;0===a&&O>0?O-=M:1===a&&O<0&&(O+=M);const S=e+c+f*C-_*k,L=s+u+_*C+f*k,R=O<0?1:0;d||Qt.ellipseToCurve?cs(t,S,L,r,i,o,T/I,P/I,R):r!==i||o?t.push(Le.G,S,L,r,i,o,T/I,P/I,R):t.push(Le.O,S,L,r,T/I,P/I,R)}},ps={toCommand:t=>[],toNode:t=>[]},{M:_s,m:fs,L:gs,l:ys,H:xs,h:ms,V:ws,v:bs,C:Bs,c:vs,S:Cs,s:ks,Q:Ts,q:Ps,T:Os,t:Ss,A:Ls,a:Rs,Z:Es,z:Is,N:Ms,D:As,X:Ws,G:Ds,F:Ns,O:Ys,P:Xs,U:zs}=Le,{rect:Fs,roundRect:Us,arcTo:Hs,arc:js,ellipse:Vs,quadraticCurveTo:Gs}=rs,{ellipticalArc:qs}=us,Qs=$t.get("PathConvert"),Js={},Zs={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,a="";for(;o<n;){r=t[o],s=We[r],a+=r===i?" ":Ae[r];for(let r=1;r<s;r++)a+=R.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?Ie:Ee;for(let e=0,h=t.length;e<h;e++)r=t[e],Vt[r]?("."===r&&($s.dot&&(Ks(n,o),o=""),$s.dot++),"0"===o&&"."!==r&&(Ks(n,o),o=""),o+=r):Le[r]?(o&&(Ks(n,o),o=""),$s.name=Le[r],$s.length=Re[r],$s.index=0,Ks(n,$s.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&Ks(n,o),o=r):o&&(Ks(n,o),o=""),i=r;return o&&Ks(n,o),s?Zs.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=t.length;const f=[];for(;p<_;){switch(i=t[p],i){case fs:t[p+1]+=a,t[p+2]+=h;case _s:a=t[p+1],h=t[p+2],o===i?f.push(gs,a,h):(f.push(_s,a,h),c=a,u=h),p+=3;break;case ms:t[p+1]+=a;case xs:a=t[p+1],f.push(gs,a,h),p+=2;break;case bs:t[p+1]+=h;case ws:h=t[p+1],f.push(gs,a,h),p+=2;break;case ys:t[p+1]+=a,t[p+2]+=h;case gs:a=t[p+1],h=t[p+2],f.push(gs,a,h),p+=3;break;case ks:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,i=Cs;case Cs:n=o===Bs||o===Cs,l=n?2*a-s:t[p+1],d=n?2*h-r:t[p+2],s=t[p+1],r=t[p+2],a=t[p+3],h=t[p+4],f.push(Bs,l,d,s,r,a,h),p+=5;break;case vs:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,t[p+5]+=a,t[p+6]+=h,i=Bs;case Bs:s=t[p+3],r=t[p+4],a=t[p+5],h=t[p+6],f.push(Bs,t[p+1],t[p+2],s,r,a,h),p+=7;break;case Ss:t[p+1]+=a,t[p+2]+=h,i=Os;case Os:n=o===Ts||o===Os,s=n?2*a-s:t[p+1],r=n?2*h-r:t[p+2],e?Gs(f,a,h,s,r,t[p+1],t[p+2]):f.push(Ts,s,r,t[p+1],t[p+2]),a=t[p+1],h=t[p+2],p+=3;break;case Ps:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,i=Ts;case Ts:s=t[p+1],r=t[p+2],e?Gs(f,a,h,s,r,t[p+3],t[p+4]):f.push(Ts,s,r,t[p+3],t[p+4]),a=t[p+3],h=t[p+4],p+=5;break;case Rs:t[p+6]+=a,t[p+7]+=h;case Ls:qs(f,a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],e),a=t[p+6],h=t[p+7],p+=8;break;case Is:case Es:f.push(Es),a=c,h=u,p++;break;case Ms:a=t[p+1],h=t[p+2],e?Fs(f,a,h,t[p+3],t[p+4]):tr(f,t,p,5),p+=5;break;case As:a=t[p+1],h=t[p+2],e?Us(f,a,h,t[p+3],t[p+4],[t[p+5],t[p+6],t[p+7],t[p+8]]):tr(f,t,p,9),p+=9;break;case Ws:a=t[p+1],h=t[p+2],e?Us(f,a,h,t[p+3],t[p+4],t[p+5]):tr(f,t,p,6),p+=6;break;case Ds:Vs(e?f:tr(f,t,p,9),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],t[p+8],null,Js),a=Js.x,h=Js.y,p+=9;break;case Ns:e?Vs(f,t[p+1],t[p+2],t[p+3],t[p+4],0,0,360,!1):tr(f,t,p,5),a=t[p+1]+t[p+3],h=t[p+2],p+=5;break;case Ys:js(e?f:tr(f,t,p,7),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],null,Js),a=Js.x,h=Js.y,p+=7;break;case Xs:e?js(f,t[p+1],t[p+2],t[p+3],0,360,!1):tr(f,t,p,4),a=t[p+1]+t[p+3],h=t[p+2],p+=4;break;case zs:Hs(e?f:tr(f,t,p,6),a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],null,Js),a=Js.x,h=Js.y,p+=6;break;default:return Qs.error(`command: ${i} [index:${p}]`,t),f}o=i}return f},objectToCanvasData(t){if(t[0].name.length>1)return ps.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(_s,t.x,t.y);break;case"L":e.push(gs,t.x,t.y);break;case"C":e.push(Bs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ts,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Es)}}),e}},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){$s.index===$s.length&&($s.index=1,t.push($s.name)),t.push(Number(e)),$s.index++,$s.dot=0}},{current:$s,pushData:Ks,copyData:tr}=Zs,{M:er,L:sr,C:rr,Q:ir,Z:or,N:nr,D:ar,X:hr,G:lr,F:dr,O:cr,P:ur,U:pr}=Le,{getMinDistanceFrom:_r,getRadianFrom:fr}=it,{tan:gr,min:yr,abs:xr}=Math,mr={},wr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(er,e,s)},lineTo(t,e,s){t.push(sr,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(rr,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(ir,e,s,r,i)},closePath(t){t.push(or)},rect(t,e,s,r,i){t.push(nr,e,s,r,i)},roundRect(t,e,s,r,i,n){if(o(n))t.push(hr,e,s,r,i,n);else{const o=R.fourNumber(n);o?t.push(ar,e,s,r,i,...o):t.push(nr,e,s,r,i)}},ellipse(t,e,r,i,o,n,a,h,l){if(i===o)return Br(t,e,r,i,a,h,l);s(n)?t.push(dr,e,r,i,o):(s(a)&&(a=0),s(h)&&(h=360),t.push(lr,e,r,i,o,n,a,h,l?1:0))},arc(t,e,r,i,o,n,a){s(o)?t.push(ur,e,r,i):(s(o)&&(o=0),s(n)&&(n=360),t.push(cr,e,r,i,o,n,a?1:0))},arcTo(t,s,r,i,o,n,a,h,l){if(!e(a)){const t=_r(a,h,s,r,i,o)/(l?1:2);n=yr(n,yr(t,t*xr(gr(fr(a,h,s,r,i,o)/2))))}t.push(pr,s,r,i,o,n)},drawEllipse(t,e,r,i,o,n,a,h,l){rs.ellipse(null,e,r,i,o,s(n)?0:n,s(a)?0:a,s(h)?360:h,l,null,null,mr),t.push(er,mr.x,mr.y),br(t,e,r,i,o,n,a,h,l)},drawArc(t,e,r,i,o,n,a){rs.arc(null,e,r,i,s(o)?0:o,s(n)?360:n,a,null,null,mr),t.push(er,mr.x,mr.y),Br(t,e,r,i,o,n,a)},drawPoints(t,e,s,r){rs.points(t,e,s,r)}},{ellipse:br,arc:Br}=wr,{moveTo:vr,lineTo:Cr,quadraticCurveTo:kr,bezierCurveTo:Tr,closePath:Pr,beginPath:Or,rect:Sr,roundRect:Lr,ellipse:Rr,arc:Er,arcTo:Ir,drawEllipse:Mr,drawArc:Ar,drawPoints:Wr}=wr;class Dr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Oe.parse(t):t:[],this}beginPath(){return Or(this.__path),this.paint(),this}moveTo(t,e){return vr(this.__path,t,e),this.paint(),this}lineTo(t,e){return Cr(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return Tr(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return kr(this.__path,t,e,s,r),this.paint(),this}closePath(){return Pr(this.__path),this.paint(),this}rect(t,e,s,r){return Sr(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Lr(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return Rr(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return Er(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return Ir(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return Mr(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return Ar(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return Wr(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Nr,L:Yr,C:Xr,Q:zr,Z:Fr,N:Ur,D:Hr,X:jr,G:Vr,F:Gr,O:qr,P:Qr,U:Jr}=Le,Zr=$t.get("PathDrawer"),$r={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Nr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case 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 zr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Fr:t.closePath(),r+=1;break;case Ur:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Hr: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 jr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Vr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*I,e[r+6]*I,e[r+7]*I,e[r+8]),r+=9;break;case Gr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,M,!1),r+=5;break;case qr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*I,e[r+5]*I,e[r+6]),r+=7;break;case Qr:t.arc(e[r+1],e[r+2],e[r+3],0,M,!1),r+=4;break;case Jr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Zr.error(`command: ${s} [index:${r}]`,e)}}},{M:Kr,L:ti,C:ei,Q:si,Z:ri,N:ii,D:oi,X:ni,G:ai,F:hi,O:li,P:di,U:ci}=Le,{toTwoPointBounds:ui,toTwoPointBoundsByQuadraticCurve:pi,arcTo:_i,arc:fi,ellipse:gi}=rs,{addPointBounds:yi,copy:xi,addPoint:mi,setPoint:wi,addBounds:bi,toBounds:Bi}=_t,vi=$t.get("PathBounds");let Ci,ki,Ti;const Pi={},Oi={},Si={},Li={toBounds(t,e){Li.toTwoPointBounds(t,Oi),Bi(Oi,e)},toTwoPointBounds(t,e){if(!t||!t.length)return wi(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===ri||n===ei||n===si?wi(e,h,l):wi(e,t[a+1],t[a+2])),n){case Kr:case ti:h=t[a+1],l=t[a+2],mi(e,h,l),a+=3;break;case ei:i=t[a+5],o=t[a+6],ui(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,Pi),yi(e,Pi),h=i,l=o,a+=7;break;case si:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],pi(h,l,s,r,i,o,Pi),yi(e,Pi),h=i,l=o,a+=5;break;case ri:a+=1;break;case ii:h=t[a+1],l=t[a+2],bi(e,h,l,t[a+3],t[a+4]),a+=5;break;case oi:case ni:h=t[a+1],l=t[a+2],bi(e,h,l,t[a+3],t[a+4]),a+=n===oi?9:6;break;case ai:gi(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],Pi,Si),0===a?xi(e,Pi):yi(e,Pi),h=Si.x,l=Si.y,a+=9;break;case hi:h=t[a+1],l=t[a+2],ki=t[a+3],Ti=t[a+4],bi(e,h-ki,l-Ti,2*ki,2*Ti),h+=ki,a+=5;break;case li:fi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Pi,Si),0===a?xi(e,Pi):yi(e,Pi),h=Si.x,l=Si.y,a+=7;break;case di:h=t[a+1],l=t[a+2],Ci=t[a+3],bi(e,h-Ci,l-Ci,2*Ci,2*Ci),h+=Ci,a+=4;break;case ci:_i(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Pi,Si),0===a?xi(e,Pi):yi(e,Pi),h=Si.x,l=Si.y,a+=6;break;default:return void vi.error(`command: ${n} [index:${a}]`,t)}}},{M:Ri,L:Ei,Z:Ii}=Le,{getCenterX:Mi,getCenterY:Ai}=it,{arcTo:Wi}=wr,Di={smooth(t,e,s){let r,i,o,n=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=9===g,x=[];for(;n<g;){switch(r=t[n],r){case Ri:d=_=t[n+1],c=f=t[n+2],n+=3,t[n]===Ei?(u=t[n+1],p=t[n+2],y?x.push(Ri,d,c):x.push(Ri,Mi(d,u),Ai(c,p))):x.push(Ri,d,c);break;case Ei:switch(h=t[n+1],l=t[n+2],n+=3,t[n]){case Ei:Wi(x,h,l,t[n+1],t[n+2],e,_,f,y);break;case Ii:Wi(x,h,l,d,c,e,_,f,y);break;default:x.push(Ei,h,l)}_=h,f=l;break;case Ii:i!==Ii&&(Wi(x,d,c,u,p,e,_,f,y),x.push(Ii)),n+=1;break;default:o=We[r];for(let e=0;e<o;e++)x.push(t[n+e]);n+=o}i=r}return r!==Ii&&(x[1]=d,x[2]=c),x}};function Ni(t){return new Dr(t)}const Yi=Ni();Oe.creator=Ni(),Oe.parse=Zs.parse,Oe.convertToCanvasData=Zs.toCanvasData;const{drawRoundRect:Xi}=De;const zi={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Fi.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{}}}},Fi=zi;Fi.mineType=Fi.mimeType,Fi.alphaPixelTypes.forEach(t=>Fi.upperCaseTypeMap[t]=t.toUpperCase());const Ui=$t.get("TaskProcessor");class Hi{constructor(t){this.parallel=!0,this.time=1,this.id=p.create(p.TASK),this.task=t}run(){return _e(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Ui.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class ji{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,n,a,h;const l=new Hi(t);return l.parent=this,o(s)?h=s:s&&(n=s.parallel,i=s.start,a=s.time,h=s.delay,r||(r=s.canUse)),a&&(l.time=a),!1===n&&(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.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list: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 Vi=$t.get("Resource"),Gi={tasker:new ji,queue:new ji({parallel:1}),map:{},get isComplete(){return qi.tasker.isComplete},set(t,e){qi.map[t]&&Vi.repeat(t),qi.map[t]=e},get:t=>qi.map[t],remove(t){const e=qi.map[t];e&&(e.destroy&&e.destroy(),delete qi.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=ne.image(i)),qi.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){qi.map={}}},qi=Gi,Qi={maxRecycled:10,recycledList:[],patternTasker:Gi.queue,get(t,e){let s=Gi.get(t.url);return s||Gi.set(t.url,s="film"===e?ne.film(t):ne.image(t)),s.use++,s},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(Qt.image.isLarge(t)?t.url&&Gi.remove(t.url):(t.clearLevels(),Ji.recycledList.push(t)))})},recyclePaint(t){Ji.recycle(t.image)},clearRecycled(t){const e=Ji.recycledList;(e.length>Ji.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Gi.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>zi.alphaPixelTypes.some(e=>Ji.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:"+zi.mimeType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+zi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},Ji=Qi,{IMAGE:Zi,create:$i}=p;class Ki{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return e(t)?Qt.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=$i(Zi),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Qi.isFormat("svg",t)&&(this.isSVG=!0),Qi.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,s){return this.loading||(this.loading=!0,Gi.tasker.add(()=>_e(this,void 0,void 0,function*(){return yield Qt.origin["load"+this.tag](this.getLoadUrl(s),this.crossOrigin,this).t