@leafer-draw/miniapp 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +7 -3
- package/dist/miniapp.esm.js +7 -3
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +37 -26
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const s={};function i(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:n}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return g(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&g(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=i(s)?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(d(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!i(t))){if("path"===o&&!this.__pathInputed)continue;e=r?r[o]:void 0,s[o]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>B(S,t,e,s,i),toTempAB(t,e,s){v=s?a(t)?e:t:[],a(t)?(x=C(t),w=e):a(e)?(x=t,w=C(e)):(x=t,w=e),4!==x.length&&(x=R(x)),4!==w.length&&(w=R(w))},get(t,e){let s;if(!a(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>a(t)&&a(e)?b(t,e):(P(t,e,s),B(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,s)=>a(t)&&a(e)?t+e:(P(t,e,s),B(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,s,i){if(a(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,n,h,l]=4===t.length?t:R(t);return B(r,h*s,l*e,o*s,n*e)}},{set:B,get:R,setTemp:C,toTempAB:P}=k,{round:T,pow:L,max:O,floor:A,PI:E}=Math,I={},W={within:(t,e,s)=>(c(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=i(e)?1e12:L(10,e);return-0===(t=T(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(a(e)?e:e.width||0)/s.width,r=(a(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&W.assignScale(i,t);return i},getScaleFixedData(t,e,s,i,r){let{scaleX:o,scaleY:n}=t;if((i||e)&&(o<0&&(o=-o),n<0&&(n=-n)),e)if(!0===e)o=n=s?1:1/o;else{let t;a(e)?t=e:"zoom-in"===e&&(t=1),t&&(o=n=o>t||n>t?s?1:1/o:s?1:1/t)}return I.scaleX=o,I.scaleY=n,I},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(A(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const D=E/180,F=2*E,z=E/2;function N(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:j,acos:V,sqrt:G}=Math,{float:H}=W,q={};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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:X,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,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(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,i){$.toInnerPoint(t,e,q),$.scaleOfInner(t,q,s,i)},scaleOfInner(t,e,s,i=s){$.translateInner(t,e.x,e.y),$.scale(t,s,i),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=j(e*=D),a=U(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){$.toInnerPoint(t,e,q),$.rotateOfInner(t,q,s)},rotateOfInner(t,e,s){$.translateInner(t,e.x,e.y),$.rotate(t,s),$.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=D,t.a=i+o*s,t.b=r+n*s),e&&(e*=D,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){$.toInnerPoint(t,e,q),$.skewOfInner(t,q,s,i)},skewOfInner(t,e,s,i=0){$.translateInner(t,e.x,e.y),$.skew(t,s,i),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,r,o){const{e:n,f:a}=t;if(s||(s=t),i(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:i,b:r,c:n,d:a}=t;s.a=i*e.a+r*e.c,s.b=i*e.b+r*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,r,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(i(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:s,skewX:i,skewY:r}=e,o=s*D,n=j(o),a=U(o);if(i||r){const e=i*D,s=r*D;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||r)&&$.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=G(r*r+o*o),c=t/d;const e=r/d;u=o>0?V(e):-V(e)}else{c=G(n*n+a*a),d=t/c;const e=n/c;u=z-(a>0?V(-e):-V(e))}const e=H(j(u)),s=U(u);d=H(d),c=H(c),_=e?H((n/c+s)/e/D,9):0,p=e?H((o/d-s)/e/D,9):0,u=H(u/D)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*n,f+=e.x*o+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=G(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){$.set(t)}},$=Q,{float:Z}=W,{toInnerPoint:K,toOuterPoint:tt}=Q,{sin:et,cos:st,abs:it,sqrt:rt,atan2:ot,min:nt,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,s){c(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,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=lt.defaultPoint);const i=st(e*=D),r=et(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=lt;return ct(s,t),K(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=lt;return ct(s,t),tt(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=lt;return ct(s,t),lt.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,i)=>(ct(t,e),ut(t,s,i),t),toInnerRadiusPointOf(t,e,s){s||(s=t),K(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){K(e,t,s)},toOuterOf(t,e,s){tt(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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=it(s-t),o=it(i-e);return rt(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>nt(dt(t,e,s,i),dt(s,i,r,o)),getAngle:(t,e)=>_t(t,e)/D,getRotation:(t,e,s,i)=>(i||(i=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/D),getRadianFrom(t,e,s,r,o,n,a,h){i(a)&&(a=s,h=r);const l=t-s,d=e-r,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const o=_t(t,e);return r&&(t=e),i||(e={}),e.x=t.x+st(o)*s,e.y=t.y+et(o)*s,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,s)=>s?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:_t}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ht.copy(this,t):ht.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 ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,s){return ht.scaleOf(this,t,e,s),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,s){return ht.getRotation(this,t,e,s)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,s,i){return new pt(ht.getDistancePoint(this,t,e,s,i))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const gt=new pt;class ft{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return c(t)?Q.copy(this,t):Q.set(this,t,e,s,i,r,o),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:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}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 yt=new ft,mt={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,i,r){xt(t,e,s),xt(t,e+i,s+r)},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}=mt;var wt,vt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(vt||(vt={}));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 St={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,s,i,r,o){const n=kt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s,i=!0)=>(s||(s={}),St.toPoint(t,e,s,i),s)};function kt(t){return o(t)?bt[vt[t]]:t}const{toPoint:Bt}=St,Rt={toPoint(t,e,s,i,r,o){Bt(t,s,i,r,e,o)}},{tempPointBounds:Ct,setPoint:Pt,addPoint:Tt,toBounds:Lt}=mt,{toOuterPoint:Ot}=Q,{float:At,fourNumber:Et}=W,{floor:It,ceil:Wt}=Math;let Mt,Dt,Ft,zt;const Nt={},Yt={},Xt={},Ut={tempBounds:Xt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(d(s)){const e=Et(s);i?jt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),jt.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),jt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Gt(e,t):e=t,s||(s=t),e.offsetX=jt.maxX(s),e.offsetY=jt.maxY(s),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||ht.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){ht.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r,e:o,f:n}=e;i>0?(s.width=t.width*i,s.x=o+t.x*i):(s.width=t.width*-i,s.x=o+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=n+t.y*r):(s.height=t.height*-r,s.y=n+t.y*r-s.height)}else Nt.x=t.x,Nt.y=t.y,Ot(e,Nt,Yt),Pt(Ct,Yt.x,Yt.y),Nt.x=t.x+t.width,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Nt.y=t.y+t.height,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Nt.x=t.x,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Lt(Ct,s)},toInnerOf(t,e,s){s||(s=t),jt.move(s,-e.e,-e.f),jt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,jt.getFitScale(t,e));return new ft(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,n){n||(n=e),o(i)&&(i=jt.getFitScale(t,e,"cover"===i)),Xt.width=r?e.width*=i:e.width*i,Xt.height=r?e.height*=i:e.height*i,Rt.toPoint(s,Xt,t,n,!0,!0)},getSpread(t,e,s){const i={};return jt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){jt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){jt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Wt(t.width+e-t.x):Wt(t.width),t.height=s>t.y?Wt(t.height+s-t.y):Wt(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,s){Mt=t.x+t.width,Dt=t.y+t.height,Ft=e.x,zt=e.y,s||(Ft+=e.width,zt+=e.height),Mt=Mt>Ft?Mt:Ft,Dt=Dt>zt?Dt:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Dt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){jt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){jt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Gt(t,r)):Vt(t,r));o&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Ct,t.x,t.y):Tt(Ct,t.x,t.y)),Lt(Ct,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},getPoint:(t,e,s=!1,i)=>St.getPoint(e,t,i,s),hitRadiusPoint:(t,e,s)=>(s&&(e=ht.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=ht.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=jt.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=jt.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=jt.tempToOuterOf(e,s)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return Mt=i+o,Dt=r+n,Ft=t.x+t.width,zt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Mt=Mt<Ft?Mt:Ft,Dt=Dt<zt?Dt:zt,o=Mt-i,n=Dt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){jt.copy(t,jt.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){jt.set(t)}},jt=Ut,{add:Vt,copy:Gt}=jt;class Ht{get minX(){return Ut.minX(this)}get minY(){return Ut.minY(this)}get maxX(){return Ut.maxX(this)}get maxY(){return Ut.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return c(t)?Ut.copy(this,t):Ut.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Ht(this)}move(t,e){return Ut.move(this,t,e),this}scale(t,e,s){return Ut.scale(this,t,e,s),this}scaleOf(t,e,s){return Ut.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Ut.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ut.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ut.getFitMatrix(this,t,e)}put(t,e,s){Ut.put(this,t,e,s)}spread(t,e){return Ut.spread(this,t,e),this}shrink(t,e){return Ut.shrink(this,t,e),this}ceil(){return Ut.ceil(this),this}unsign(){return Ut.unsign(this),this}float(t){return Ut.float(this,t),this}add(t){return Ut.add(this,t),this}addList(t){return Ut.setList(this,t,!0),this}setList(t){return Ut.setList(this,t),this}addListWithFn(t,e){return Ut.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ut.setListWithFn(this,t,e),this}setPoint(t){return Ut.setPoint(this,t),this}setPoints(t){return Ut.setPoints(this,t),this}addPoint(t){return Ut.addPoint(this,t),this}getPoints(){return Ut.getPoints(this)}getPoint(t,e,s){return Ut.getPoint(this,t,e,s)}hitPoint(t,e){return Ut.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ut.hitRadiusPoint(this,t,e)}hit(t,e){return Ut.hit(this,t,e)}includes(t,e){return Ut.includes(this,t,e)}intersect(t,e){return Ut.intersect(this,t,e),this}getIntersect(t,e){return new Ht(Ut.getIntersectData(this,t,e))}isSame(t){return Ut.isSame(this,t)}isEmpty(){return Ut.isEmpty(this)}reset(){Ut.reset(this)}}const qt=new Ht;class Jt{constructor(t,e,s,i,r,o){c(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Ht(r,e,o||t.width-r-s,n||t.height-e-i)}}const Qt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},$t={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Zt,max:Kt}=Math,te={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,i)=>t.width*t.height*(e?e*s:1)>(i||ee.maxCacheSize),isSuperLarge:(t,e,s)=>ee.isLarge(t,e,s,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=ee;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h,l){const d=Kt(Zt(e+(i||0)),1),c=Kt(Zt(s+(r||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:s))&&("x"===l.type?u=!0:_=!0);const g=te.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==n,ee.canUse(t)){if(o){const i=e/o.width,r=s/o.height;f.setTransform(i,0,0,r,-o.x*i,-o.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,s);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&p.stintSet(s,"transform",e)}}},{image:ee}=te,{randColor:se}=W;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const s=se();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===ie.showBounds,r=t.__nowWorld,o=se();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?o(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const oe=ie,ne=ie.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=y.create(y.RUNTIME);return he.currentId=he.idMap[s]=e?performance.now():Date.now(),he.currentName=he.nameMap[s]=t,he.nameToIdMap[t]=s,s},end(t,e){const s=he.idMap[t],i=he.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[i]=void 0,ne.log(i,r,"ms")},endOfName(t,e){const s=he.nameToIdMap[t];i(s)||he.end(s,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.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(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=ie.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,s,r,o,n){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return i(s)||(a.x=s,r&&(a.y=r),o&&(a.width=o),n&&(a.height=n)),a}},{list:pe}=_e,ge=ie.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],o(e)&&(ye[e]&&ge.repeat(e),ye[e]=t)})},changeName(t,e){const s=ye[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ye[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=fe;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=ce.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function we(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function ve(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Be=class{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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;be.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};xe([ve("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),xe([ve("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),xe([ve("globalAlpha")],Be.prototype,"opacity",void 0),xe([ve()],Be.prototype,"fillStyle",void 0),xe([ve()],Be.prototype,"strokeStyle",void 0),xe([ve("lineWidth")],Be.prototype,"strokeWidth",void 0),xe([ve("lineCap")],Be.prototype,"strokeCap",void 0),xe([ve("lineJoin")],Be.prototype,"strokeJoin",void 0),xe([ve("lineDashOffset")],Be.prototype,"dashOffset",void 0),xe([ve()],Be.prototype,"miterLimit",void 0),xe([ve()],Be.prototype,"shadowBlur",void 0),xe([ve()],Be.prototype,"shadowColor",void 0),xe([ve()],Be.prototype,"shadowOffsetX",void 0),xe([ve()],Be.prototype,"shadowOffsetY",void 0),xe([ve()],Be.prototype,"filter",void 0),xe([ve()],Be.prototype,"font",void 0),xe([ve()],Be.prototype,"fontKerning",void 0),xe([ve()],Be.prototype,"fontStretch",void 0),xe([ve()],Be.prototype,"fontVariantCaps",void 0),xe([ve()],Be.prototype,"textAlign",void 0),xe([ve()],Be.prototype,"textBaseline",void 0),xe([ve()],Be.prototype,"textRendering",void 0),xe([ve()],Be.prototype,"wordSpacing",void 0),xe([ve()],Be.prototype,"letterSpacing",void 0),xe([ve()],Be.prototype,"direction",void 0),xe([Se()],Be.prototype,"setTransform",null),xe([Se()],Be.prototype,"resetTransform",null),xe([Se()],Be.prototype,"getTransform",null),xe([Se()],Be.prototype,"save",null),xe([Se()],Be.prototype,"restore",null),xe([Se()],Be.prototype,"translate",null),xe([Se()],Be.prototype,"scale",null),xe([Se()],Be.prototype,"rotate",null),xe([Se()],Be.prototype,"fill",null),xe([Se()],Be.prototype,"stroke",null),xe([Se()],Be.prototype,"clip",null),xe([Se()],Be.prototype,"fillRect",null),xe([Se()],Be.prototype,"strokeRect",null),xe([Se()],Be.prototype,"clearRect",null),xe([Se()],Be.prototype,"beginPath",null),xe([Se()],Be.prototype,"moveTo",null),xe([Se()],Be.prototype,"lineTo",null),xe([Se()],Be.prototype,"bezierCurveTo",null),xe([Se()],Be.prototype,"quadraticCurveTo",null),xe([Se()],Be.prototype,"closePath",null),xe([Se()],Be.prototype,"arc",null),xe([Se()],Be.prototype,"arcTo",null),xe([Se()],Be.prototype,"ellipse",null),xe([Se()],Be.prototype,"rect",null),xe([Se()],Be.prototype,"roundRect",null),xe([Se()],Be.prototype,"createConicGradient",null),xe([Se()],Be.prototype,"createLinearGradient",null),xe([Se()],Be.prototype,"createPattern",null),xe([Se()],Be.prototype,"createRadialGradient",null),xe([Se()],Be.prototype,"fillText",null),xe([Se()],Be.prototype,"measureText",null),xe([Se()],Be.prototype,"strokeText",null);const{copy:Re,multiplyParent:Ce,pixelScale:Pe}=Q,{round:Te}=Math,Le=new Ht,Oe=new Ht,Ae={width:1,height:1,pixelRatio:1},Ee=["width","height","pixelRatio"];class Ie extends Be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ae),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.size.pixelRatio=r||te.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,Ee),Ee.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Ht(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&Ce(t,e,r),Pe(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=Te(r.e-.5)+.5,r.f=Te(r.f-.5)+.5):(r.e=Te(r.e),r.f=Te(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),i(e.dashPattern)||(o=e.dashPattern),i(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=o,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=Oe):s=Le,this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ut.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(Le.x,Le.y,Le.width,Le.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,Le.x,Le.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(Le.x,Le.y,Le.width,Le.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(Le.x,Le.y,Le.width,Le.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Le.x,Le.y,Le.width,Le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Le.x,Le.y,Le.width,Le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Le,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Oe,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):ce.canvas(Object.assign({},s));return r.save(),t&&(Re(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const We={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},De=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Me),Fe={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},ze={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},Ne=Object.assign(Object.assign({},ze),Me),Ye=De,Xe={};for(let t in Ye)Xe[Ye[t]]=t;const Ue={};for(let t in Ye)Ue[Ye[t]]=Fe[t];const je={drawRoundRect(t,e,s,i,r,o){const n=W.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;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:Ve,cos:Ge,hypot:He,atan2:qe,ceil:Je,abs:Qe,PI:$e,sqrt:Ze,pow:Ke}=Math,{setPoint:ts,addPoint:es}=mt,{set:ss,toNumberPoints:is}=ht,{M:rs,L:os,C:ns,Q:as,Z:hs}=De,ls={},ds={points(t,e,s,i){let r=is(e);if(t.push(rs,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y,m,x=r.length;const w=!0===s?.5:s;i&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let s=2;s<x-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=n-e,g=a-o,f=Ze(Ke(p,2)+Ke(g,2)),y=Ze(Ke(h-n,2)+Ke(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=o,d=n-f*h,c=a-f*l,2===s?i||t.push(as,d,c,n,a):(p||g)&&t.push(ns,u,_,d,c,n,a),u=n+y*h,_=a+y*l);i||t.push(as,u,_,r[x-2],r[x-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(os,r[e],r[e+1]);i&&t.push(hs)},rect(t,e,s,i,r){We.creator.path=t,We.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){We.creator.path=[],je.drawRoundRect(We.creator,e,s,i,r,o),t.push(...We.convertToCanvasData(We.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let g=qe(u,c),f=qe(p,_);const y=He(c,u),m=He(_,p);let x=f-g;if(x<0&&(x+=F),y<1e-12||m<1e-12||x<1e-12||Qe(x-$e)<1e-12)return t&&t.push(os,i,r),h&&(ts(h,e,s),es(h,i,r)),d&&ss(d,e,s),void(l&&ss(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Ge(x/2),S=i+b*Ge(g+x/2+z*v),k=r+b*Ve(g+x/2+z*v);return g-=z*v,f-=z*v,_s(t,S,k,a,a,0,g/D,f/D,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>_s(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*D,_=Ve(u),p=Ge(u);let g=n*D,f=a*D;g>$e&&(g-=F),f<0&&(f+=F);let y=f-g;y<0?y+=F:y>F&&(y-=F),h&&(y-=F);const m=Je(Qe(y/z)),x=y/m,w=Ve(x/4),v=8/3*w*w/Ve(x/2);f=g+x;let b,S,k,B,R,C,P,T,L=Ge(g),O=Ve(g),A=k=p*i*L-_*r*O,E=B=_*i*L+p*r*O,I=e+k,W=s+B;t&&t.push(t.length?os:rs,I,W),l&&ts(l,I,W),c&&ss(c,I,W);for(let o=0;o<m;o++)b=Ge(f),S=Ve(f),k=p*i*b-_*r*S,B=_*i*b+p*r*S,R=e+A-v*(p*i*O+_*r*L),C=s+E-v*(_*i*O-p*r*L),P=e+k+v*(p*i*S+_*r*b),T=s+B+v*(_*i*S-p*r*b),t&&t.push(ns,R,C,P,T,e+k,s+B),l&&us(e+A,s+E,R,C,P,T,e+k,s+B,l,!0),A=k,E=B,L=b,O=S,g=f,f+=x;d&&ss(d,e+k,s+B)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(ns,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){us(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?es(h,t,e):ts(h,t,e),es(h,n,a);for(let l=0,c=d.length;l<c;l++)cs(d[l],t,e,s,i,r,o,n,a,ls),es(h,ls.x,ls.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return cs(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)},cut(t,e,s,i,r,o,n,a,h){if(t<=0)return{left:null,right:[i,r,o,n,a,h]};if(t>=1)return{left:[i,r,o,n,a,h],right:null};const l=1-t,d=e*l+i*t,c=s*l+r*t,u=i*l+o*t,_=r*l+n*t,p=o*l+a*t,g=n*l+h*t,f=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+x*t],right:[m,x,p,g,a,h]}}},{getPointAndSet:cs,toTwoPointBounds:us,ellipse:_s}=ds,{sin:ps,cos:gs,sqrt:fs,atan2:ys}=Math,{ellipse:ms}=ds,xs={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*D,p=ps(_),g=gs(_),f=-g*c-p*u,y=-g*u+p*c,m=i*i,x=r*r,w=y*y,v=f*f,b=m*x-m*w-x*v;let S=0;if(b<0){const t=fs(1-b/(m*x));i*=t,r*=t}else S=(n===a?-1:1)*fs(b/(m*w+x*v));const k=S*i*y/r,B=-S*r*f/i,R=ys((y-B)/r,(f-k)/i),C=ys((-y-B)/r,(-f-k)/i);let P=C-R;0===a&&P>0?P-=F:1===a&&P<0&&(P+=F);const T=e+c+g*k-p*B,L=s+u+p*k+g*B,O=P<0?1:0;d||te.ellipseToCurve?ms(t,T,L,i,r,o,R/D,C/D,O):i!==r||o?t.push(De.G,T,L,i,r,o,R/D,C/D,O):t.push(De.O,T,L,i,R/D,C/D,O)}},ws={toCommand:t=>[],toNode:t=>[]},{M:vs,m:bs,L:Ss,l:ks,H:Bs,h:Rs,V:Cs,v:Ps,C:Ts,c:Ls,S:Os,s:As,Q:Es,q:Is,T:Ws,t:Ms,A:Ds,a:Fs,Z:zs,z:Ns,N:Ys,D:Xs,X:Us,G:js,F:Vs,O:Gs,P:Hs,U:qs}=De,{rect:Js,roundRect:Qs,arcTo:$s,arc:Zs,ellipse:Ks,quadraticCurveTo:ti}=ds,{ellipticalArc:ei}=xs,si=ie.get("PathConvert"),ii={},ri={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=Ue[i],a+=i===r?" ":Xe[i];for(let i=1;i<s;i++)a+=W.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?Ne:ze;for(let e=0,h=t.length;e<h;e++)i=t[e],$t[i]?("."===i&&(oi.dot&&(ni(n,o),o=""),oi.dot++),"0"===o&&"."!==i&&(ni(n,o),o=""),o+=i):De[i]?(o&&(ni(n,o),o=""),oi.name=De[i],oi.length=Fe[i],oi.index=0,ni(n,oi.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&ni(n,o),o=i):o&&(ni(n,o),o=""),r=i;return o&&ni(n,o),s?ri.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case bs:t[c+1]+=a,t[c+2]+=h;case vs:a=t[c+1],h=t[c+2],_.push(o===r?Ss:vs,a,h),c+=3;break;case Rs:t[c+1]+=a;case Bs:a=t[c+1],_.push(Ss,a,h),c+=2;break;case Ps:t[c+1]+=h;case Cs:h=t[c+1],_.push(Ss,a,h),c+=2;break;case ks:t[c+1]+=a,t[c+2]+=h;case Ss:a=t[c+1],h=t[c+2],_.push(Ss,a,h),c+=3;break;case As:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Os;case Os:n=o===Ts||o===Os,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(Ts,l,d,s,i,a,h),c+=5;break;case Ls:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=Ts;case Ts:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(Ts,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ms:t[c+1]+=a,t[c+2]+=h,r=Ws;case Ws:n=o===Es||o===Ws,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?ti(_,a,h,s,i,t[c+1],t[c+2]):_.push(Es,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Is:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Es;case Es:s=t[c+1],i=t[c+2],e?ti(_,a,h,s,i,t[c+3],t[c+4]):_.push(Es,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Fs:t[c+6]+=a,t[c+7]+=h;case Ds:ei(_,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 Ns:case zs:_.push(zs),c++;break;case Ys:a=t[c+1],h=t[c+2],e?Js(_,a,h,t[c+3],t[c+4]):ai(_,t,c,5),c+=5;break;case Xs:a=t[c+1],h=t[c+2],e?Qs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ai(_,t,c,9),c+=9;break;case Us:a=t[c+1],h=t[c+2],e?Qs(_,a,h,t[c+3],t[c+4],t[c+5]):ai(_,t,c,6),c+=6;break;case js:Ks(e?_:ai(_,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,ii),a=ii.x,h=ii.y,c+=9;break;case Vs:e?Ks(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ai(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Gs:Zs(e?_:ai(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ii),a=ii.x,h=ii.y,c+=7;break;case Hs:e?Zs(_,t[c+1],t[c+2],t[c+3],0,360,!1):ai(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case qs:$s(e?_:ai(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ii),a=ii.x,h=ii.y,c+=6;break;default:return si.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return ws.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vs,t.x,t.y);break;case"L":e.push(Ss,t.x,t.y);break;case"C":e.push(Ts,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Es,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(zs)}}),e}},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){oi.index===oi.length&&(oi.index=1,t.push(oi.name)),t.push(Number(e)),oi.index++,oi.dot=0}},{current:oi,pushData:ni,copyData:ai}=ri,{M:hi,L:li,C:di,Q:ci,Z:ui,N:_i,D:pi,X:gi,G:fi,F:yi,O:mi,P:xi,U:wi}=De,{getMinDistanceFrom:vi,getRadianFrom:bi}=ht,{tan:Si,min:ki,abs:Bi}=Math,Ri={},Ci={beginPath(t){t.length=0},moveTo(t,e,s){t.push(hi,e,s)},lineTo(t,e,s){t.push(li,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(di,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(ci,e,s,i,r)},closePath(t){t.push(ui)},rect(t,e,s,i,r){t.push(_i,e,s,i,r)},roundRect(t,e,s,i,r,o){if(a(o))t.push(gi,e,s,i,r,o);else{const n=W.fourNumber(o);n?t.push(pi,e,s,i,r,...n):t.push(_i,e,s,i,r)}},ellipse(t,e,s,i,o,n,a,h,l){if(i===o)return Ti(t,e,s,i,a,h,l);r(n)?t.push(yi,e,s,i,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(fi,e,s,i,o,n,a,h,l?1:0))},arc(t,e,s,i,o,n,a){r(o)?t.push(xi,e,s,i):(r(o)&&(o=0),r(n)&&(n=360),t.push(mi,e,s,i,o,n,a?1:0))},arcTo(t,e,s,r,o,n,a,h,l){if(!i(a)){const t=vi(a,h,e,s,r,o)/(l?1:2);n=ki(n,ki(t,t*Bi(Si(bi(a,h,e,s,r,o)/2))))}t.push(wi,e,s,r,o,n)},drawEllipse(t,e,s,i,o,n,a,h,l){ds.ellipse(null,e,s,i,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,Ri),t.push(hi,Ri.x,Ri.y),Pi(t,e,s,i,o,n,a,h,l)},drawArc(t,e,s,i,o,n,a){ds.arc(null,e,s,i,r(o)?0:o,r(n)?360:n,a,null,null,Ri),t.push(hi,Ri.x,Ri.y),Ti(t,e,s,i,o,n,a)},drawPoints(t,e,s,i){ds.points(t,e,s,i)}},{ellipse:Pi,arc:Ti}=Ci,{moveTo:Li,lineTo:Oi,quadraticCurveTo:Ai,bezierCurveTo:Ei,closePath:Ii,beginPath:Wi,rect:Mi,roundRect:Di,ellipse:Fi,arc:zi,arcTo:Ni,drawEllipse:Yi,drawArc:Xi,drawPoints:Ui}=Ci;class ji{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?We.parse(t):t:[],this}beginPath(){return Wi(this.__path),this.paint(),this}moveTo(t,e){return Li(this.__path,t,e),this.paint(),this}lineTo(t,e){return Oi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Ei(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return Ai(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ii(this.__path),this.paint(),this}rect(t,e,s,i){return Mi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Di(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Fi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return zi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Ni(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Yi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Xi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Ui(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Vi,L:Gi,C:Hi,Q:qi,Z:Ji,N:Qi,D:$i,X:Zi,G:Ki,F:tr,O:er,P:sr,U:ir}=De,rr=ie.get("PathDrawer"),or={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Vi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Gi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Hi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case qi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ji:t.closePath(),i+=1;break;case Qi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case $i:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Zi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ki:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*D,e[i+6]*D,e[i+7]*D,e[i+8]),i+=9;break;case tr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,F,!1),i+=5;break;case er:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*D,e[i+5]*D,e[i+6]),i+=7;break;case sr:t.arc(e[i+1],e[i+2],e[i+3],0,F,!1),i+=4;break;case ir:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void rr.error(`command: ${s} [index:${i}]`,e)}}},{M:nr,L:ar,C:hr,Q:lr,Z:dr,N:cr,D:ur,X:_r,G:pr,F:gr,O:fr,P:yr,U:mr}=De,{toTwoPointBounds:xr,toTwoPointBoundsByQuadraticCurve:wr,arcTo:vr,arc:br,ellipse:Sr}=ds,{addPointBounds:kr,copy:Br,addPoint:Rr,setPoint:Cr,addBounds:Pr,toBounds:Tr}=mt,Lr=ie.get("PathBounds");let Or,Ar,Er;const Ir={},Wr={},Mr={},Dr={toBounds(t,e){Dr.toTwoPointBounds(t,Wr),Tr(Wr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Cr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===dr||n===hr||n===lr?Cr(e,h,l):Cr(e,t[a+1],t[a+2])),n){case nr:case ar:h=t[a+1],l=t[a+2],Rr(e,h,l),a+=3;break;case hr:r=t[a+5],o=t[a+6],xr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Ir),kr(e,Ir),h=r,l=o,a+=7;break;case lr:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],wr(h,l,s,i,r,o,Ir),kr(e,Ir),h=r,l=o,a+=5;break;case dr:a+=1;break;case cr:h=t[a+1],l=t[a+2],Pr(e,h,l,t[a+3],t[a+4]),a+=5;break;case ur:case _r:h=t[a+1],l=t[a+2],Pr(e,h,l,t[a+3],t[a+4]),a+=n===ur?9:6;break;case pr:Sr(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],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=9;break;case gr:h=t[a+1],l=t[a+2],Ar=t[a+3],Er=t[a+4],Pr(e,h-Ar,l-Er,2*Ar,2*Er),h+=Ar,a+=5;break;case fr:br(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=7;break;case yr:h=t[a+1],l=t[a+2],Or=t[a+3],Pr(e,h-Or,l-Or,2*Or,2*Or),h+=Or,a+=4;break;case mr:vr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=6;break;default:return void Lr.error(`command: ${n} [index:${a}]`,t)}}},{M:Fr,L:zr,Z:Nr}=De,{getCenterX:Yr,getCenterY:Xr}=ht,{arcTo:Ur}=Ci,jr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;n<f;){switch(i=t[n],i){case Fr:l=p=t[n+1],c=g=t[n+2],n+=3,t[n]===zr?(u=t[n+1],_=t[n+2],y?m.push(Fr,l,c):m.push(Fr,Yr(l,u),Xr(c,_))):m.push(Fr,l,c);break;case zr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case zr:Ur(m,a,h,t[n+1],t[n+2],e,p,g,y);break;case Nr:Ur(m,a,h,l,c,e,p,g,y);break;default:m.push(zr,a,h)}p=a,g=h;break;case Nr:r!==Nr&&(Ur(m,l,c,u,_,e,p,g,y),m.push(Nr)),n+=1;break;default:o=Ue[i];for(let e=0;e<o;e++)m.push(t[n+e]);n+=o}r=i}return i!==Nr&&(m[1]=l,m[2]=c),m}};function Vr(t){return new ji(t)}const Gr=Vr();We.creator=Vr(),We.parse=ri.parse,We.convertToCanvasData=ri.toCanvasData;const{drawRoundRect:Hr}=je;function qr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Hr(this,t,e,s,i,r)})}(t)}const Jr={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=Qr.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{}}}},Qr=Jr;Qr.mineType=Qr.mimeType,Qr.alphaPixelTypes.forEach(t=>Qr.upperCaseTypeMap[t]=t.toUpperCase());const $r=ie.get("TaskProcessor");class Zr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return we(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){$r.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Kr{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 i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e,s){let r,o,n,h;const l=new Zr(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,r=e.start,n=e.time,h=e.delay,s||(s=e.canUse)),n&&(l.time=n),!1===o&&(l.parallel=!1),s&&(l.canUse=s),i(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},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:i}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=i+e.parallel;if(r>s.length&&(r=s.length),e.parallel>1)for(let e=i;e<r&&(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,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 to=ie.get("Resource"),eo={tasker:new Kr,queue:new Kr({parallel:1}),map:{},get isComplete(){return so.tasker.isComplete},set(t,e){so.map[t]&&to.repeat(t),so.map[t]=e},get:t=>so.map[t],remove(t){const e=so.map[t];e&&(e.destroy&&e.destroy(),delete so.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return o(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=ce.image(i)),so.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){so.map={}}},so=eo,io={maxRecycled:10,recycledList:[],patternTasker:eo.queue,get(t,e){let s=eo.get(t.url);return s||eo.set(t.url,s="film"===e?ce.film(t):ce.image(t)),s.use++,s},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(te.image.isLarge(t)?t.url&&eo.remove(t.url):(t.clearLevels(),ro.recycledList.push(t)))})},recyclePaint(t){ro.recycle(t.image)},clearRecycled(t){const e=ro.recycledList;(e.length>ro.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&eo.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Jr.alphaPixelTypes.some(e=>ro.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:"+Jr.mimeType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Jr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},ro=io,{IMAGE:oo,create:no}=y;class ao{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return i(t)?te.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=no(oo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}io.isFormat("svg",t)&&(this.isSVG=!0),io.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,s){return this.loading||(this.loading=!0,eo.tasker.add(()=>we(this,void 0,void 0,function*(){return yield te.origin["load"+this.tag](this.getLoadUrl(s),this.crossOrigin,this).then(t=>{s&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,s,i,r,o,n,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=te.image.resize(this.view,t,e,r,o,void 0,n,s,i,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,s,i){const r=te.canvas.createPattern(t,e);return te.image.setPatternTransform(r,s,i),r}render(t,e,s,i,r,o,n,a,h){t.drawImage(this.view,e,s,i,r)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,s){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class ho extends ao{get tag(){return"Film"}}class lo extends ao{get tag(){return"Video"}}function co(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function uo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function _o(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function po(t,e){return(s,i)=>fo(s,i,t,e&&e(i))}function go(t){return t}function fo(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};co(t,e,Object.assign(r,i||{})),Vo(t,e,s)}function yo(t){return po(t)}function mo(t,e){return po(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function xo(t,e){return po(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function wo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Bo(this))}}))}function vo(t,e){return po(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function bo(t,e){return po(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function So(t,e){return po(t,t=>({set(s){this.__setAttr(t,s,e)&&Bo(this)}}))}function ko(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(Bo(this),this.__.__removeNaturalSize())}}))}function Bo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Ro(t){return po(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Bo(this)}}))}const Co=So;function Po(t,e){return po(t,t=>({set(s){this.__setAttr(t,s)&&(To(this),e&&(this.__.__useStroke=!0))}}))}function To(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Bo(t)}const Lo=Po;function Oo(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ao(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Eo(t){return po(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Io(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Mo(this)}}))}function Wo(t){return po(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Do(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Do(this,t,e,s),this.mask&&Mo(this)}}))}function Mo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Do(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Bo(t))}function Fo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__layout.childrenSortChange()})}}))}function zo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function No(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Yo(t){return po(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Xo(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Uo(t){return(e,s)=>{co(e,"__DataProcessor",{get:()=>t})}}function jo(t){return(e,s)=>{co(e,"__LayoutProcessor",{get:()=>t})}}function Vo(t,e,s){const r=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=_o(e,s);if(i(s))a.get=function(){return this[o]};else if("function"==typeof s)a.get=function(){const t=this[o];return null==t?s(this.__leaf):t};else if(c(s)){const t=_(s);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=r;for(;!l&&d;)l=uo(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),r[n]&&(a.set=r[n],delete r[n]),co(r,e,a)}const Go=new ie("rewrite"),Ho=[],qo=["destroy","constructor"];function Jo(t){return(e,s)=>{Ho.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Qo(){return t=>{$o()}}function $o(t){Ho.length&&(Ho.forEach(e=>{t&&Go.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Ho.length=0)}function Zo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(qo.includes(i)||e&&e.includes(i)))if(t.prototype){uo(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Ko(){return t=>{_e.register(t)}}function tn(){return t=>{fe.register(t)}}setTimeout(()=>$o(!0));const{copy:en,toInnerPoint:sn,toOuterPoint:rn,scaleOfOuter:on,rotateOfOuter:nn,skewOfOuter:an,multiplyParent:hn,divideParent:ln,getLayout:dn}=Q,cn={},{round:un}=Math,_n={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),fn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)gn(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)yn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&yn(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&pn.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(xn(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)mn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,s,i,r,o){i||(i=t.__nowWorld),t.__worldFlipped||te.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,o):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},renderComplex(t,e,s){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,s=0,i,r){const o=c(e)?Object.assign({},e):{x:e,y:s};i?rn(t.localTransform,o,o,!0):t.parent&&sn(t.parent.scrollWorldTransform,o,o,!0),pn.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){c(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=un(e),s=un(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){pn.zoomOfLocal(t,wn(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(a(i)||(i&&(o=i),i=s),en(cn,n),on(cn,e,s,i),pn.hasHighPosition(t))pn.setTransform(t,cn,r,o);else{const e=t.x+cn.e-n.e,a=t.y+cn.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){pn.rotateOfLocal(t,wn(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;en(cn,r),nn(cn,e,s),pn.hasHighPosition(t)?pn.setTransform(t,cn,!1,i):t.set({x:t.x+cn.e-r.e,y:t.y+cn.f-r.f,rotation:W.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){pn.skewOfLocal(t,wn(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){en(cn,t.__localMatrix),an(cn,e,s,i),pn.setTransform(t,cn,r,o)},transformWorld(t,e,s,i){en(cn,t.worldTransform),hn(cn,e),t.parent&&ln(cn,t.parent.scrollWorldTransform),pn.setTransform(t,cn,s,i)},transform(t,e,s,i){en(cn,t.localTransform),hn(cn,e),pn.setTransform(t,cn,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&pn.getInnerOrigin(t,r.origin),n=dn(e,o,r.around&&pn.getInnerOrigin(t,r.around));if(pn.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Ut.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=pn.getInnerOrigin(t,r.origin);ht.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return on(s,pn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>ht.tempToOuterOf(pn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return St.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(en(cn,t.worldTransform),ln(cn,e.scrollWorldTransform),s?cn:Object.assign({},cn)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,s,i){t.setTransform(pn.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||pn.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,s=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const i=e.x*s,r=e.y*s;e.x-=i,e.y-=r,t.move(i,r),te.requestRender(()=>pn.animateMove(t,e,s))}}},pn=_n,{updateAllMatrix:gn,updateMatrix:fn,updateAllWorldOpacity:yn,updateAllChange:mn,updateChange:xn}=pn;function wn(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const vn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds(t){const{__:e,__layout:s}=t;return e.eraser||0===e.visible?null:s.localOuterBounds||s.localRenderBounds},maskLocalBoxBounds:(t,e)=>Sn(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Sn(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:s}=t;return Sn(t,e)&&(s.localOuterBounds||s.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let bn;function Sn(t,e){return e||(bn=0),t.__.mask&&(bn=1),bn<0?null:(bn&&(bn=-1),!0)}const{updateBounds:kn}=_n,Bn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Rn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Cn(e[t],e)},updateBounds(t,e){const s=[t];Cn(t,s),Pn(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)kn(i[t]);e&&e===s||kn(s)}},move(t,e,s){let i;const{children:r}=t;for(let o=0,n=r.length;o<n;o++)i=(t=r[o]).__world,i.e+=e,i.f+=s,i.x+=e,i.y+=s,t.isBranch&&Tn(t,e,s)},scale(t,e,s,i,r,o,n){let a;const{children:h}=t,l=i-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=i,a.d*=r,(a.b||a.c)&&(a.b*=i,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-o)*l+e,a.y=a.f+=(a.f-n)*d+s):(a.e+=(a.e-o)*l+e,a.f+=(a.f-n)*d+s,a.x+=(a.x-o)*l+e,a.y+=(a.y-n)*d+s),a.width*=i,a.height*=r,a.scaleX*=i,a.scaleY*=r,t.isBranch&&Ln(t,e,s,i,r,o,n)}},{pushAllChildBranch:Rn,pushAllBranchStack:Cn,updateBoundsByBranchStack:Pn,move:Tn,scale:Ln}=Bn,On={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:An,updateBounds:En}=_n,{toOuterOf:In,getPoints:Wn,copy:Mn}=Ut,Dn="_localContentBounds",Fn="_worldContentBounds",zn="_worldBoxBounds",Nn="_worldStrokeBounds";class Yn{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return In(this.contentBounds,this.leaf.__localMatrix,this[Dn]||(this[Dn]={})),this[Dn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return In(this.contentBounds,this.leaf.__world,this[Fn]||(this[Fn]={})),this[Fn]}get worldBoxBounds(){return In(this.boxBounds,this.leaf.__world,this[zn]||(this[zn]={})),this[zn]}get worldStrokeBounds(){return In(this.strokeBounds,this.leaf.__world,this[Nn]||(this[Nn]={})),this[Nn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return En(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,te.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return An(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=Q.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=An(i,e,!0)}if(n||(n=Q.getLayout(o)),Mn(n,a),ht.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Wn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return i(o)||r.forEach(t=>s.innerToWorld(t,null,!1,o)),r}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Xn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&te.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&te.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&te.event.stop(this.origin)}}class Un extends Xn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Un.ADD="child.add",Un.REMOVE="child.remove",Un.CREATED="created",Un.MOUNTED="mounted",Un.UNMOUNTED="unmounted",Un.DESTROY="destroy";const jn="property.scroll";class Vn extends Xn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Vn.CHANGE="property.change",Vn.LEAFER_CHANGE="property.leafer_change",Vn.SCROLL=jn;const Gn={scrollX:jn,scrollY:jn};class Hn extends Xn{constructor(t,e){super(t),Object.assign(this,e)}}Hn.LOAD="image.load",Hn.LOADED="image.loaded",Hn.ERROR="image.error";class qn extends Xn{static checkHas(t,e,s){"on"===s?e===Zn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Jn)||t.hasEvent(Qn)||t.hasEvent($n),t.__hasWorldEvent=t.hasEvent(Zn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Jn,t),"inner"===e&&t.emit(Qn,t)),t.emit($n,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Zn,t)}}qn.RESIZE="bounds.resize",qn.INNER="bounds.inner",qn.LOCAL="bounds.local",qn.WORLD="bounds.world";const{RESIZE:Jn,INNER:Qn,LOCAL:$n,WORLD:Zn}=qn,Kn={};[Jn,Qn,$n,Zn].forEach(t=>Kn[t]=1);class ta extends Xn{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(ta.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}ta.RESIZE="resize";class ea extends Xn{constructor(t,e){super(t),this.data=e}}ea.REQUEST="watch.request",ea.DATA="watch.data";class sa extends Xn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}sa.REQUEST="layout.request",sa.START="layout.start",sa.BEFORE="layout.before",sa.LAYOUT="layout",sa.AFTER="layout.after",sa.AGAIN="layout.again",sa.END="layout.end";class ia extends Xn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}ia.REQUEST="render.request",ia.CHILD_START="render.child_start",ia.CHILD_END="render.child_end",ia.START="render.start",ia.BEFORE="render.before",ia.RENDER="render",ia.AFTER="render.after",ia.AGAIN="render.again",ia.END="render.end",ia.NEXT="render.next";class ra extends Xn{}ra.START="leafer.start",ra.BEFORE_READY="leafer.before_ready",ra.READY="leafer.ready",ra.AFTER_READY="leafer.after_ready",ra.VIEW_READY="leafer.view_ready",ra.VIEW_COMPLETED="leafer.view_completed",ra.STOP="leafer.stop",ra.RESTART="leafer.restart",ra.END="leafer.end",ra.UPDATE_MODE="leafer.update_mode",ra.TRANSFORM="leafer.transform",ra.MOVE="leafer.move",ra.SCALE="leafer.scale",ra.ROTATE="leafer.rotate",ra.SKEW="leafer.skew";const{MOVE:oa,SCALE:na,ROTATE:aa,SKEW:ha}=ra,la={x:oa,y:oa,scaleX:na,scaleY:na,rotation:aa,skewX:ha,skewY:ha},da={};class ca{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)d(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const a=ua(this,i,!0),h=o(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=a[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):a[t]=[l],Kn[t]&&qn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=o(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=ua(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Kn[t]&&qn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&fe.has(t)&&(e=fe.get(t,{type:t,target:this,current:this}));const i=ua(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,o=s&&s[t],n=r&&r[t];return!!(i(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ua(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:da)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:da)}}const{on:_a,on_:pa,off:ga,off_:fa,once:ya,emit:ma,emitEvent:xa,hasEvent:wa,destroy:va}=ca.prototype,ba={on:_a,on_:pa,off:ga,off_:fa,once:ya,emit:ma,emitEvent:xa,hasEvent:wa,destroyEventer:va},Sa=ie.get("setAttr"),ka={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!s||n(e)||i(e)||(Sa.warn(this.innerName,t,e),e=void 0),c(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Vn(Vn.LEAFER_CHANGE,this,t,r,e));const s=la[t];s&&(this.emitEvent(new ra(s,this)),this.emitEvent(new ra(ra.TRANSFORM,this)))}this.emitPropertyEvent(Vn.CHANGE,t,r,e);const s=Gn[t];return s&&this.emitPropertyEvent(s,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new Vn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ba,multiplyParent:Ra,translateInner:Ca,defaultWorld:Pa}=Q,{toPoint:Ta,tempPoint:La}=St,Oa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;Ra(this.__local||e,t?t.__scrollWorld||t.__world:Pa,s,!!e.affectScaleOrRotation,r),i&&Ca(Object.assign(i,s),r.scrollX,r.scrollY),e.scaleFixed&&_n.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Ba(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Ta(s.around||s.origin,t.boxBounds,La),Ca(e,-La.x,-La.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Aa,updateAllMatrix:Ea}=_n,{updateBounds:Ia}=Bn,{toOuterOf:Wa,copyAndSpread:Ma,copy:Da}=Ut,{toBounds:Fa}=Dr,za={__updateWorldBounds(){const{__layout:t,__world:e}=this;Wa(t.renderBounds,e,e),this.__hasComplex&&_n.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&qn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&qn.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner",e.__strokeGeometry&&(e.__strokeGeometry=void 0)),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner",e.__strokeGeometry&&(e.__strokeGeometry=void 0)),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.outerScale&&_n.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Wa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Wa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Wa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Fa(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ea(this),Ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ea(this),Ia(this,this))):Aa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;a(s)&&s<=0?Da(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,s)}},Na={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1:e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),_n.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ya}=vn,{hasSize:Xa}=Ut,Ua={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const s=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Xa(s)){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(r,s,s,i.__blendMode,!0),r.recycle(s)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let s;const{children:i}=this;for(let r=0,o=i.length;r<o;r++)s=i[r],Ya(s,e)||(s.__hasComplex?_n.renderComplex(s,t,e):s.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ya(s[i],e)||s[i].__clip(t,e)}}},{LEAF:ja,create:Va}=y,{stintSet:Ga}=p,{toInnerPoint:Ha,toOuterPoint:qa,multiplyParent:Ja}=Q,{toOuterOf:Qa}=Ut,{copy:$a,move:Za}=ht,{getScaleFixedData:Ka}=W,{moveLocal:th,zoomOfLocal:eh,rotateOfLocal:sh,skewOfLocal:ih,moveWorld:rh,zoomOfWorld:oh,rotateOfWorld:nh,skewOfWorld:ah,transform:hh,transformWorld:lh,setTransform:dh,getFlipTransform:ch,getLocalOrigin:uh,getRelativeWorld:_h,drop:ph}=_n;let gh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Yn}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Va(ja),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Un.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Un.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Un.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Un.MOUNTED),t.cacheId&&_n.cacheId(this)):this.__emitLifeEvent(Un.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ja(s,t.matrix,e,void 0,s),Qa(this.__layout.renderBounds,e,e),Ga(e,"half",s.half),Ga(e,"ignorePixelSnap",s.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,s=!0){return Ka(io.patternLocked?this.__world:this.__nowWorld||this.__world,e,s,t)}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?_h(this,e):this.worldTransform,r=s?t:{};return Qa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&$a(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&$a(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Ha(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){qa(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){const r=this.getInnerPoint(t,e,s,i);return s?r:this.getBoxPointByInner(r,null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Za(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Za(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){dh(this,t,e,s)}transform(t,e,s){hh(this,t,e,s)}move(t,e,s){th(this,t,e,s)}moveInner(t,e,s){rh(this,t,e,!0,s)}scaleOf(t,e,s,i,r){eh(this,uh(this,t),e,s,i,r)}rotateOf(t,e,s){sh(this,uh(this,t),e,s)}skewOf(t,e,s,i,r){ih(this,uh(this,t),e,s,i,r)}transformWorld(t,e,s){lh(this,t,e,s)}moveWorld(t,e,s){rh(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){oh(this,t,e,s,i,r)}rotateOfWorld(t,e){nh(this,t,e)}skewOfWorld(t,e,s,i,r){ah(this,t,e,s,i,r)}flip(t,e){hh(this,ch(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(t){}getMotionPathData(){return de.need("path")}getMotionPoint(t){return de.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){ph(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Vo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=So),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Un(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Un.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};gh=xe([Zo(ka),Zo(Oa),Zo(za),Zo(ba),Zo(Na)],gh);const{setListWithFn:fh}=Ut,{sort:yh}=Bn,{localBoxBounds:mh,localStrokeBounds:xh,localRenderBounds:wh,maskLocalBoxBounds:vh,maskLocalStrokeBounds:bh,maskLocalRenderBounds:Sh}=vn,kh=new ie("Branch");let Bh=class extends gh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){let t;const{children:e}=this;for(let s=0,i=e.length;s<i;s++)if(t=e[s].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){fh(e||this.__layout.boxBounds,this.children,this.__hasMask?vh:mh)}__updateStrokeBounds(t){fh(t||this.__layout.strokeBounds,this.children,this.__hasMask?bh:xh)}__updateRenderBounds(t){fh(t||this.__layout.renderBounds,this.children,this.__hasMask?Sh:wh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(yh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return kh.warn("add self or destroyed");const s=i(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),s||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Un.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Un.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):i(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Un.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Un.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Un(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Bh=xe([Zo(Ua)],Bh);class Rh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,o=e.length;r<o;r++)i(s)?e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;i(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Rh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ch{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Ph="2.1.1";class Th extends Ie{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(o(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=te.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&te.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:s,pixelRatio:i}=this.config,r={width:e||t.width,height:s||t.height,pixelRatio:i};this.resize(r),this.context&&(this.viewSelect&&(te.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,s,i,r){this.context.roundRect(t,e,s,i,a(r)?[r]:r)}),qr(this.context.__proto__))}__createView(){this.view=te.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:s}=this;this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(t){this.viewSelect&&te.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,this.updateViewSize(),t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),te.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:s}=this,i={width:t,height:e,pixelRatio:s};this.isSameSize(i)||this.emitResize(i)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,te.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};p.copyAttrs(e,this,Ee),this.resize(t),i(this.width)||this.resizeListener(new ta(t,e))}}function Lh(t,e){te.origin={createCanvas:(t,s,i)=>{const r={type:"2d",width:t,height:s};return e.createOffscreenCanvas?e.createOffscreenCanvas(r):e.createOffScreenCanvas(r)},canvasToDataURL:(t,e,s)=>t.toDataURL(Jr.mimeType(e),s),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>{let i=t.toDataURL(Jr.mimeType(Jr.fileType(e)),s);return i=i.substring(i.indexOf("64,")+3),te.origin.download(i,e)},download:(t,s)=>new Promise((i,r)=>{let o;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,o=!0);const n=e.getFileSystemManager();n.writeFile({filePath:s,data:t,encoding:"base64",success(){o?te.miniapp.saveToAlbum(s).then(()=>{n.unlink({filePath:s}),i()}):i()},fail(t){r(t)}})}),loadImage:(t,e,s)=>new Promise((e,s)=>{const i=te.getCanvas().view.createImage();i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.src=te.image.getRealURL(t)}),loadContent:(t,s="text")=>new Promise((i,r)=>e.request({url:t,responseType:"arrayBuffer"===s?"arraybuffer":"text",success:t=>i("json"===s&&"string"==typeof t.data?JSON.parse(t.data):t.data),fail:r})),noRepeat:"repeat-x"},te.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const s=t[1];e({x:s.top,y:s.left,width:s.width,height:s.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const s=t[0];e({view:s.node,width:s.width,height:s.height})})}),saveToAlbum:t=>new Promise(s=>{e.getSetting({success:i=>{i.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){s(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){s(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},te.event={stopDefault(t){},stopNow(t){},stop(t){}},te.canvas=ce.canvas(),te.conicGradientSupport=!!te.canvas.context.createConicGradient,co(te,"devicePixelRatio",{get:()=>Math.max(1,e.getWindowInfo?e.getWindowInfo().pixelRatio:e.getSystemInfoSync().pixelRatio)})}Object.assign(ce,{canvas:(t,e)=>new Th(t,e),image:t=>new ao(t)}),te.name="miniapp",te.getCanvas=function(){const{renderCanvas:t}=te;return t&&t.view?t:te.canvas},te.requestRender=function(t){const{view:e}=te.getCanvas();e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)};class Oh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Rh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Rh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ia.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Un.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ea(ea.DATA,{updatedList:this.updatedList})),this.__updatedList=new Rh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Vn.CHANGE,this.__onAttrChange,this],[[Un.ADD,Un.REMOVE],this.__onChildEvent,this],[ea.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ah,updateBounds:Eh,updateChange:Ih}=_n,{pushAllChildBranch:Wh,pushAllParent:Mh}=Bn;const{worldBounds:Dh}=vn;class Fh{constructor(t){this.updatedBounds=new Ht,this.beforeBounds=new Ht,this.afterBounds=new Ht,d(t)&&(t=new Rh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Dh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:zh,updateAllChange:Nh}=_n,Yh=ie.get("Layouter");class Xh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Ch,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(sa.START),this.layoutOnce(),t.emitEvent(new sa(sa.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ea.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ae.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=sa,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new sa(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(Ah(t,!0),e.add(t),t.isBranch&&Wh(t,e),Mh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||Eh(i[t])}Eh(s)}})}(this.__levelList),function(t){t.list.forEach(Ih)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new sa(o,a,this.times)),s.emitEvent(new sa(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=sa,o=this.getBlocks(new Rh(e));e.emitEvent(new sa(s,o,this.times)),Xh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new sa(i,o,this.times)),e.emitEvent(new sa(r,o,this.times)),this.addBlocks(o),ae.end(t)}static fullLayout(t){zh(t,!0),t.isBranch?Bn.updateBounds(t):_n.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Fh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Fh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[sa.REQUEST,this.layout,this],[sa.AGAIN,this.layoutAgain,this],[ea.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Uh=ie.get("Renderer");class jh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(sa.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ia.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ia.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ia.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Ht,Uh.log(e.innerName,"---\x3e");try{this.emitRender(ia.START),this.renderOnce(t),this.emitRender(ia.END,this.totalBounds),io.clearRecycled()}catch(t){this.rendering=!1,Uh.error(t)}Uh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Uh.warn("rendering");if(this.times>3)return Uh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Ht,this.renderOptions={},t)this.emitRender(ia.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ia.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ia.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ia.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ae.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Ht(i);s.save(),i.spread(jh.clipSpread).ceil();const{ceilPartPixel:o}=this.config;s.clipWorld(i,o),s.clearWorld(i,o),this.__render(i,r),s.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:s,target:i}=this,r=t.includes(i.__world),o=r?{includes:r}:{bounds:t,includes:r};this.needFill&&s.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(s,t),this.config.useCellRender&&(o.cellList=this.getCellList()),te.render(i,s,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Ht;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return te.requestRender(e);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};te.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Ht(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Ht(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:s}=t;s&&s.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Uh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,s)})}emitRender(t,e,s){this.target.emitEvent(new ia(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[ia.REQUEST,this.update,this],[sa.END,this.__onLayoutEnd,this],[ia.AGAIN,this.renderAgain,this],[ta.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Vh(t){return po(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const s=this.__layout;s.renderChanged||s.renderChange(),s.surfaceChange()}}))}function Gh(t){return po(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Hh(){return(t,e)=>{const s="_"+e;co(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function qh(t){return(e,s)=>{co(e,s,_o(s,t))}}jh.clipSpread=10,Object.assign(ce,{watcher:(t,e)=>new Oh(t,e),layouter:(t,e)=>new Xh(t,e),renderer:(t,e,s)=>new jh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),te.layout=Xh.fullLayout,te.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new Rh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Jh={},Qh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},$h=Qt,Zh={},Kh={},tl={},el={},sl={},il={apply(){de.need("filter")}},rl={},ol={setStyleName:()=>de.need("state"),set:()=>de.need("state")},nl={list:{},register(t,e){nl.list[t]=e},get:t=>nl.list[t]},{parse:al,objectToCanvasData:hl}=ri,{stintSet:ll}=p,{hasTransparent:dl}=Qh,cl={originPaint:{}},ul=ie.get("UIData");class _l extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ul.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ul.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(ll(this,"__isTransparentFill",dl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(ll(this,"__isTransparentStroke",dl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?al(t,this.__useArrow):hl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){pl(this,"shadow",t)}setInnerShadow(t){pl(this,"innerShadow",t)}setFilter(t){pl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Kh.compute("fill",this.__leaf),e&&Kh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeScaleFixed)||(s=t.strokeScaleFixed)),s){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,s,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;ll(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=cl)):(this.__isStrokes=!0,this._stroke||(this._stroke=cl))}__removePaint(t,e){e&&this.__removeInput(t),tl.recycleImage(t,this),"fill"===t?(ll(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ll(this,"__isAlphaPixelStroke",void 0),ll(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function pl(t,e,s){t.__setInput(e,s),d(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class gl extends _l{}class fl extends gl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class yl extends gl{__getInputData(t,e){const s=super.__getInputData(t,e);return Ee.forEach(t=>delete s[t]),s}}class ml extends fl{}class xl extends _l{get __usePathBox(){return this.points||this.__pathInputed}}class wl extends _l{get __boxStroke(){return!this.__pathInputed}}class vl extends _l{get __boxStroke(){return!this.__pathInputed}}class bl extends _l{get __usePathBox(){return this.points||this.__pathInputed}}class Sl extends _l{get __boxStroke(){return!this.__pathInputed}}class kl extends _l{get __pathInputed(){return 2}}class Bl extends gl{}const Rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Cl extends _l{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=Rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=_e.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.textEditing&&delete s.textEditing,s}}class Pl extends wl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url&&delete s.fill,s}}class Tl extends wl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:Ll,add:Ol}=k,Al={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke||s.__useArrow)){const e=s.__isLinePath?0:("miter"===s.strokeJoin?10:1)*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=Ll(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=sl.getShadowRenderSpread(this,e)),i&&(t=Ll(t,i)),o&&(t=Ol(t,il.getSpread(o))),n&&(t=Ol(t,n)),a&&(t=Ol(t,a));let l=t;return s&&(l=Ll(l,sl.getInnerShadowSpread(this,s))),r&&(l=Ll(l,r)),this.__layout.renderShapeSpread=l,h?Ll(h.__updateRenderSpread(),t):t}},{stintSet:El}=p,Il={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);El(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),El(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;El(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!sl.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(d(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Wl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Kh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&sl.shadow(this,t,h),a&&(i.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e)),r&&(i.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&sl.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e)),c&&il.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Qh.string(e.color))}r&&(i.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e))}}else i.__pathForRender?Wl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Kh.fills(i,this,t,e):Kh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Kh.strokes(r,this,t,e):Kh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Wl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&Kh.stroke(r,t,e,s),i&&Kh.fill(i,t,e,s),o&&t.__drawAfterFill(e,s),r&&!n&&Kh.stroke(r,t,e,s)}const Ml={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var Dl;let Fl=Dl=class extends gh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Gr.set(this.path=t||[]),t||this.__drawPathByBox(Gr),Gr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}clearProxyData(){}find(t,e){return de.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return de.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Gr.set(s=[]),this.__drawPathByBox(Gr,!e)),t?ri.toCanvasData(s,!0):s}getPathString(t,e,s){return ri.stringify(this.getPath(t,e),s)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||rl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?jr.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&Zh.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&Zh.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,s){e?or.drawPathByData(t,e):this.__drawPathByBox(t,s)}__drawPathByBox(t,e){const{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(s,i,r,o,a(e)?[e]:e)}else t.rect(s,i,r,o);t.closePath()}drawImagePlaceholder(t,e,s){Kh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){return this.set(t),de.need("animate")}killAnimate(t,e){}export(t,e){return de.need("export")}syncExport(t,e){return de.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Dl.one(e)}static one(t,e,s,i,r){return _e.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Ko()(this)}static registerData(t){Uo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xe([Uo(_l)],Fl.prototype,"__",void 0),xe([Hh()],Fl.prototype,"zoomLayer",void 0),xe([yo("")],Fl.prototype,"id",void 0),xe([yo("")],Fl.prototype,"name",void 0),xe([yo("")],Fl.prototype,"className",void 0),xe([Ao("pass-through")],Fl.prototype,"blendMode",void 0),xe([Io(1)],Fl.prototype,"opacity",void 0),xe([Wo(!0)],Fl.prototype,"visible",void 0),xe([Ao(!1)],Fl.prototype,"locked",void 0),xe([Eo(!1)],Fl.prototype,"dim",void 0),xe([Eo(!1)],Fl.prototype,"dimskip",void 0),xe([Fo(0)],Fl.prototype,"zIndex",void 0),xe([zo(!1)],Fl.prototype,"mask",void 0),xe([No(!1)],Fl.prototype,"eraser",void 0),xe([mo(0,!0)],Fl.prototype,"x",void 0),xe([mo(0,!0)],Fl.prototype,"y",void 0),xe([So(100,!0)],Fl.prototype,"width",void 0),xe([So(100,!0)],Fl.prototype,"height",void 0),xe([vo(1,!0)],Fl.prototype,"scaleX",void 0),xe([vo(1,!0)],Fl.prototype,"scaleY",void 0),xe([bo(0,!0)],Fl.prototype,"rotation",void 0),xe([bo(0,!0)],Fl.prototype,"skewX",void 0),xe([bo(0,!0)],Fl.prototype,"skewY",void 0),xe([mo(0,!0)],Fl.prototype,"offsetX",void 0),xe([mo(0,!0)],Fl.prototype,"offsetY",void 0),xe([xo(0,!0)],Fl.prototype,"scrollX",void 0),xe([xo(0,!0)],Fl.prototype,"scrollY",void 0),xe([wo()],Fl.prototype,"origin",void 0),xe([wo()],Fl.prototype,"around",void 0),xe([yo(!1)],Fl.prototype,"lazy",void 0),xe([ko(1)],Fl.prototype,"pixelRatio",void 0),xe([Oo(0)],Fl.prototype,"renderSpread",void 0),xe([Ro()],Fl.prototype,"path",void 0),xe([Co()],Fl.prototype,"windingRule",void 0),xe([Co(!0)],Fl.prototype,"closed",void 0),xe([So(0)],Fl.prototype,"padding",void 0),xe([So(!1)],Fl.prototype,"lockRatio",void 0),xe([So()],Fl.prototype,"widthRange",void 0),xe([So()],Fl.prototype,"heightRange",void 0),xe([yo(!1)],Fl.prototype,"draggable",void 0),xe([yo()],Fl.prototype,"dragBounds",void 0),xe([yo("auto")],Fl.prototype,"dragBoundsType",void 0),xe([yo(!1)],Fl.prototype,"editable",void 0),xe([Yo(!0)],Fl.prototype,"hittable",void 0),xe([Yo("path")],Fl.prototype,"hitFill",void 0),xe([Lo("path")],Fl.prototype,"hitStroke",void 0),xe([Yo(!1)],Fl.prototype,"hitBox",void 0),xe([Yo(!0)],Fl.prototype,"hitChildren",void 0),xe([Yo(!0)],Fl.prototype,"hitSelf",void 0),xe([Yo()],Fl.prototype,"hitRadius",void 0),xe([Xo("")],Fl.prototype,"cursor",void 0),xe([Ao()],Fl.prototype,"fill",void 0),xe([Lo(void 0,!0)],Fl.prototype,"stroke",void 0),xe([Lo("inside")],Fl.prototype,"strokeAlign",void 0),xe([Lo(1,!0)],Fl.prototype,"strokeWidth",void 0),xe([Lo(!1)],Fl.prototype,"strokeScaleFixed",void 0),xe([Lo("none")],Fl.prototype,"strokeCap",void 0),xe([Lo("miter")],Fl.prototype,"strokeJoin",void 0),xe([Lo()],Fl.prototype,"dashPattern",void 0),xe([Lo(0)],Fl.prototype,"dashOffset",void 0),xe([Lo(10)],Fl.prototype,"miterLimit",void 0),xe([Co(0)],Fl.prototype,"cornerRadius",void 0),xe([Co()],Fl.prototype,"cornerSmoothing",void 0),xe([Vh()],Fl.prototype,"shadow",void 0),xe([Vh()],Fl.prototype,"innerShadow",void 0),xe([Vh()],Fl.prototype,"blur",void 0),xe([Vh()],Fl.prototype,"backgroundBlur",void 0),xe([Vh()],Fl.prototype,"grayscale",void 0),xe([Vh()],Fl.prototype,"filter",void 0),xe([Ao()],Fl.prototype,"placeholderColor",void 0),xe([yo(100)],Fl.prototype,"placeholderDelay",void 0),xe([yo({})],Fl.prototype,"data",void 0),xe([Jo(gh.prototype.reset)],Fl.prototype,"reset",null),Fl=Dl=xe([Zo(Al),Zo(Il),Qo()],Fl);let zl=class extends Fl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const s=e.children=[];this.children.forEach(e=>e.skipJSON||s.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Nl;xe([Uo(gl)],zl.prototype,"__",void 0),xe([So(0)],zl.prototype,"width",void 0),xe([So(0)],zl.prototype,"height",void 0),zl=xe([Zo(Bh),Ko()],zl);const Yl=ie.get("Leafer");let Xl=Nl=class extends zl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&eo.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Nl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=ce.canvas(i);this.__controllers.push(this.renderer=ce.renderer(this,r,i),this.watcher=ce.watcher(this,i),this.layouter=ce.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ce.selector(this),this.interaction=ce.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ce.hitCanvasManager()),this.canvasManager=new me,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),On.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ra.RESTART):this.emitLeafer(ra.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(ra.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Ee);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Ht(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const s=p.copyAttrs({},this.canvas,Ee);e.resize(t),this.updateLazyBounds(),this.__onResize(new ta(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Ee),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Jt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ee.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ra.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=p.copyAttrs({},i,Ee);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ra.BEFORE_READY),this.emitLeafer(ra.READY),this.emitLeafer(ra.AFTER_READY),On.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ra.VIEW_READY),On.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){On.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(ra.VIEW_COMPLETED),On.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return de.need("view")}getValidMove(t,e,s){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ra(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[ra.START,()=>ae.end(t)],[sa.START,this.updateLazyBounds,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ea.DATA,this.__onWatchData,this],[sa.END,this.__onLayoutEnd,this],[ia.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Nl.list.remove(this);try{this.stop(),this.emitLeafer(ra.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{io.clearRecycled()},100)}catch(t){Yl.error(t)}}};t?e():setTimeout(e)}};Xl.list=new Rh,xe([Uo(yl)],Xl.prototype,"__",void 0),xe([So()],Xl.prototype,"pixelRatio",void 0),xe([yo("normal")],Xl.prototype,"mode",void 0),Xl=Nl=xe([Ko()],Xl);let Ul=class extends Fl{get __tag(){return"Rect"}};xe([Uo(wl)],Ul.prototype,"__",void 0),Ul=xe([Zo(Ml),Qo(),Ko()],Ul);const{add:jl,includes:Vl,scroll:Gl}=Ut,Hl=Ul.prototype,ql=zl.prototype;let Jl=class extends zl{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n&&n.includes("scroll"))&&(jl(a,o),Gl(a,s)),this.__updateRectRenderBounds(),t=!Vl(o,a),t&&"show"===n&&jl(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xe([Uo(fl)],Jl.prototype,"__",void 0),xe([So(100)],Jl.prototype,"width",void 0),xe([So(100)],Jl.prototype,"height",void 0),xe([yo(!1)],Jl.prototype,"resizeChildren",void 0),xe([Oo("show")],Jl.prototype,"overflow",void 0),xe([Jo(Hl.__updateStrokeSpread)],Jl.prototype,"__updateStrokeSpread",null),xe([Jo(Hl.__updateRenderSpread)],Jl.prototype,"__updateRectRenderSpread",null),xe([Jo(Hl.__updateBoxBounds)],Jl.prototype,"__updateRectBoxBounds",null),xe([Jo(Hl.__updateStrokeBounds)],Jl.prototype,"__updateStrokeBounds",null),xe([Jo(Hl.__updateRenderBounds)],Jl.prototype,"__updateRectRenderBounds",null),xe([Jo(Hl.__updateChange)],Jl.prototype,"__updateRectChange",null),xe([Jo(Hl.__render)],Jl.prototype,"__renderRect",null),xe([Jo(ql.__render)],Jl.prototype,"__renderGroup",null),Jl=xe([Qo(),Ko()],Jl);let Ql=class extends Jl{get __tag(){return"Frame"}get isFrame(){return!0}};xe([Uo(ml)],Ql.prototype,"__",void 0),xe([Ao("#FFFFFF")],Ql.prototype,"fill",void 0),xe([Oo("hide")],Ql.prototype,"overflow",void 0),Ql=xe([Ko()],Ql);const{moveTo:$l,closePath:Zl,ellipse:Kl}=Ci;let td=class extends Fl{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:s,innerRadius:i,startAngle:r,endAngle:o}=t,n=e/2,a=s/2,h=t.path=[];let l;i?r||o?(i<1?Kl(h,n,a,n*i,a*i,0,r,o,!1):l=!0,Kl(h,n,a,n,a,0,o,r,!0)):(i<1&&(Kl(h,n,a,n*i,a*i),$l(h,e,a)),Kl(h,n,a,n,a,0,360,0,!0)):r||o?($l(h,n,a),Kl(h,n,a,n,a,0,r,o,!1)):Kl(h,n,a,n,a),l||Zl(h),(te.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};xe([Uo(vl)],td.prototype,"__",void 0),xe([Co(0)],td.prototype,"innerRadius",void 0),xe([Co(0)],td.prototype,"startAngle",void 0),xe([Co(0)],td.prototype,"endAngle",void 0),td=xe([Ko()],td);const{sin:ed,cos:sd,PI:id}=Math,{moveTo:rd,lineTo:od,closePath:nd,drawPoints:ad}=Ci;let hd=class extends Fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ad(e,t.points,t.curve,t.closed);else{const{width:s,height:i,sides:r,startAngle:o}=t,n=s/2,a=i/2;let h,l=0;o?(l=o*D,rd(e,n+n*ed(l),a-a*sd(l))):rd(e,n,0);for(let t=1;t<r;t++)h=2*t*id/r+l,od(e,n+n*ed(h),a-a*sd(h));nd(e)}}};xe([Uo(bl)],hd.prototype,"__",void 0),xe([Co(3)],hd.prototype,"sides",void 0),xe([Co(0)],hd.prototype,"startAngle",void 0),xe([Co()],hd.prototype,"points",void 0),xe([Co(0)],hd.prototype,"curve",void 0),hd=xe([Qo(),Ko()],hd);const{sin:ld,cos:dd,PI:cd}=Math,{moveTo:ud,lineTo:_d,closePath:pd}=Ci;let gd=class extends Fl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i,startAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];let h,l=0;r?(l=r*D,ud(a,o+o*ld(l),n-n*dd(l))):ud(a,o,0);for(let t=1;t<2*s;t++)h=t*cd/s+l,_d(a,o+(t%2==0?o:o*i)*ld(h),n-(t%2==0?n:n*i)*dd(h));pd(a)}};xe([Uo(Sl)],gd.prototype,"__",void 0),xe([Co(5)],gd.prototype,"corners",void 0),xe([Co(.382)],gd.prototype,"innerRadius",void 0),xe([Co(0)],gd.prototype,"startAngle",void 0),gd=xe([Ko()],gd);const{moveTo:fd,lineTo:yd,drawPoints:md}=Ci,{rotate:xd,getAngle:wd,getDistance:vd,defaultPoint:bd}=ht;let Sd=class extends Fl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&xd(s,e),s}set toPoint(t){this.width=vd(bd,t),this.rotation=wd(bd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?md(e,t.points,t.curve,t.closed):(fd(e,0,0),yd(e,this.width,0))}};xe([Uo(xl)],Sd.prototype,"__",void 0),xe([Po("center")],Sd.prototype,"strokeAlign",void 0),xe([So(0)],Sd.prototype,"height",void 0),xe([Co()],Sd.prototype,"points",void 0),xe([Co(0)],Sd.prototype,"curve",void 0),xe([Co(!1)],Sd.prototype,"closed",void 0),Sd=xe([Ko()],Sd);let kd=class extends Ul{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};xe([Uo(Pl)],kd.prototype,"__",void 0),xe([So("")],kd.prototype,"url",void 0),kd=xe([Ko()],kd);const Bd=kd;let Rd=class extends Ul{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ce.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ao({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Hn(Hn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new ft(t.worldTransform).invert(),o=new ft;e&&o.translate(e.x,e.y),s&&(a(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xe([Uo(Tl)],Rd.prototype,"__",void 0),xe([Gh(100)],Rd.prototype,"width",void 0),xe([Gh(100)],Rd.prototype,"height",void 0),xe([Gh(1)],Rd.prototype,"pixelRatio",void 0),xe([Gh(!0)],Rd.prototype,"smooth",void 0),xe([yo(!1)],Rd.prototype,"safeResize",void 0),xe([Gh()],Rd.prototype,"contextSettings",void 0),Rd=xe([Ko()],Rd);const{copyAndSpread:Cd,includes:Pd,setList:Td}=Ut,{stintSet:Ld}=p;let Od=class extends Fl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=$h.number(e,r),t.__letterSpacing=$h.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,Ld(t,"__padding",l&&W.fourNumber(l)),Ld(t,"__clipText","show"!==h&&!t.__autoSize),Ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData;console.log(a);const h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&(e.renderChanged=!0),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!Pd(h,a)),this.isOverflow?(Td(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:s}=this.__;return e<s&&(t=k.max(t,(s-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Cd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xe([Uo(Cl)],Od.prototype,"__",void 0),xe([So(0)],Od.prototype,"width",void 0),xe([So(0)],Od.prototype,"height",void 0),xe([Ao()],Od.prototype,"boxStyle",void 0),xe([yo(!1)],Od.prototype,"resizeFontSize",void 0),xe([Ao("#000000")],Od.prototype,"fill",void 0),xe([Po("outside")],Od.prototype,"strokeAlign",void 0),xe([Yo("all")],Od.prototype,"hitFill",void 0),xe([So("")],Od.prototype,"text",void 0),xe([So("")],Od.prototype,"placeholder",void 0),xe([So("caption")],Od.prototype,"fontFamily",void 0),xe([So(12)],Od.prototype,"fontSize",void 0),xe([So("normal")],Od.prototype,"fontWeight",void 0),xe([So(!1)],Od.prototype,"italic",void 0),xe([So("none")],Od.prototype,"textCase",void 0),xe([So("none")],Od.prototype,"textDecoration",void 0),xe([So(0)],Od.prototype,"letterSpacing",void 0),xe([So({type:"percent",value:1.5})],Od.prototype,"lineHeight",void 0),xe([So(0)],Od.prototype,"paraIndent",void 0),xe([So(0)],Od.prototype,"paraSpacing",void 0),xe([So("x")],Od.prototype,"writingMode",void 0),xe([So("left")],Od.prototype,"textAlign",void 0),xe([So("top")],Od.prototype,"verticalAlign",void 0),xe([So(!0)],Od.prototype,"autoSizeAlign",void 0),xe([So("normal")],Od.prototype,"textWrap",void 0),xe([So("show")],Od.prototype,"textOverflow",void 0),xe([Ao(!1)],Od.prototype,"textEditing",void 0),Od=xe([Ko()],Od);let Ad=class extends Fl{get __tag(){return"Path"}};xe([Uo(kl)],Ad.prototype,"__",void 0),xe([Po("center")],Ad.prototype,"strokeAlign",void 0),Ad=xe([Ko()],Ad);let Ed=class extends zl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Ad(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};function Id(t,e,s){t.__.__font?Kh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Wd(t,e,s,i,r){const o=s.__;c(t)?Kh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),i.stroke()),o.__useArrow&&Kh.strokeArrow(t,s,i,r)}function Md(t,e,s,i,r){const o=s.__;c(t)?Kh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),Kh.drawTextStroke(s,i,r))}function Dd(t,e,s,i,r){const o=i.getSameCanvas(!0,!0);o.font=s.__.__font,Md(t,2,s,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",Kh.fillText(s,o,r),o.blendMode="normal",_n.copyCanvasByWorld(s,i,o),o.recycle(s.__nowWorld)}xe([Uo(Bl)],Ed.prototype,"__",void 0),xe([(t,e)=>{co(t,e,{get(){return this.__path}})}],Ed.prototype,"path",void 0),Ed=xe([Zo(ji,["set","path","paint"]),Ko()],Ed);const{getSpread:Fd,copyAndSpread:zd,toOuterOf:Nd,getOuterOf:Yd,getByMove:Xd,move:Ud,getIntersectData:jd}=Ut,Vd={};let Gd;const{stintSet:Hd}=p,{hasTransparent:qd}=Qh;function Jd(t,e,s){if(!c(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:n}=s.__layout,{type:a}=e;switch(a){case"image":case"film":case"video":if(!e.url)return;r=tl.image(s,t,e,n,!Gd||!Gd[e.url]),"image"!==a&&tl[a](r);break;case"linear":r=el.linearGradient(e,n);break;case"radial":r=el.radialGradient(e,n);break;case"angular":r=el.conicGradient(e,n);break;case"solid":const{color:o,opacity:h}=e;r={type:a,style:Qh.string(o,h)};break;default:i(e.r)||(r={type:"solid",style:Qh.string(e)})}if(r&&(r.originPaint=e,o(r.style)&&qd(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Qd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];d(a)||(a=[a]),Gd=tl.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=Jd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));i.length?(s["_"+t]=i,i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(Hd(s,"__isAlphaPixelFill",r),Hd(s,"__isTransparentFill",o)):(Hd(s,"__isAlphaPixelStroke",r),Hd(s,"__isTransparentStroke",o),Hd(s,"__hasMultiStrokeStyle",n))):(s.__removePaint(t,!1),s["_"+t]="")},fill:function(t,e,s,i){s.fillStyle=t,Id(e,s,i)},fills:function(t,e,s,i){let r,o,n;for(let a=0,h=t.length;a<h;a++){if(r=t[a],o=r.originPaint,r.image){if(n?n++:n=1,tl.checkImage(r,!e.__.__font,e,s,i))continue;if(!r.style){1===n&&r.image.isPlacehold&&e.drawImagePlaceholder(r,s,i);continue}}if(s.fillStyle=r.style,r.transform||o.scaleFixed){if(s.save(),r.transform&&s.transform(r.transform),o.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&s.scale(t,i)}o.blendMode&&(s.blendMode=o.blendMode),Id(e,s,i),s.restore()}else o.blendMode?(s.saveBlendMode(o.blendMode),Id(e,s,i),s.restoreBlendMode()):Id(e,s,i)}},fillPathOrText:Id,fillText:function(t,e,s){const i=t.__,{rows:r,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,s=r.length;t<s;t++)n=r[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}},stroke:function(t,e,s,i){const r=e.__;if(r.__strokeWidth)if(r.__font)Kh.strokeText(t,e,s,i);else if(r.__pathForStroke)Kh.fillStroke(t,e,s,i);else switch(r.strokeAlign){case"center":Wd(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),Wd(t,2,e,s,i),s.restore()}(t,e,s,i);break;case"outside":!function(t,e,s,i){const r=e.__;if(r.__fillAfterStroke)Wd(t,2,e,s,i);else{const{renderBounds:o}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),Wd(t,2,e,n,i),n.clipUI(r),n.clearWorld(o),_n.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){Kh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":Md(t,1,e,s,i);break;case"inside":Dd(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?Md(t,2,e,s,i):Dd(t,"outside",e,s,i)}},drawTextStroke:function(t,e,s){let i,r=t.__.__textDrawData;const{rows:o,decorationY:n}=r;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(n){const{decorationHeight:t}=r;o.forEach(s=>n.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}},drawStrokesStyle:function(t,e,s,i,r,o){let n;const a=i.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(n=t[l],(!n.image||!tl.checkImage(n,!1,i,r,o))&&n.style){if(h){const{strokeStyle:t}=n;t?r.setStroke(n.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(n.style,a.__strokeWidth*e,a)}else r.strokeStyle=n.style;n.originPaint.blendMode?(r.saveBlendMode(n.originPaint.blendMode),s?Kh.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):s?Kh.drawTextStroke(i,r,o):r.stroke()}},shape:function(t,e,s){const i=e.getSameCanvas(),r=e.bounds,o=t.__nowWorld,n=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;Nd(n.strokeSpread?(zd(Vd,n.boxBounds,n.strokeSpread),Vd):n.boxBounds,o,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=i,h=u=a,l=o;else{let i;if(te.fullImageShadow)i=a;else{const t=n.renderShapeSpread?Fd(r,k.swapAndScale(n.renderShapeSpread,p,g)):r;i=jd(t,a)}c=r.getFitMatrix(i);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=f,g*=y),u=Yd(a,c),h=Xd(u,-c.e,-c.f),l=Yd(o,c),Ud(l,-c.e,-c.f);const m=s.matrix;m?(d=new ft(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(i,s),{canvas:i,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let $d,Zd=new Ht;const{isSame:Kd}=Ut;function tc(t,e,s,i,r,o){let n=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=i.width/a.pixelRatio,a.__naturalHeight=i.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate("width"),_n.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),n=!1)),"brush"===s.mode&&tl.brush(r),!r.data){tl.createData(r,i,s,o);const{transform:t}=r.data,{opacity:e}=s,n=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!r.brush;(n||e&&e<1||s.blendMode)&&(r.complex=!n||2)}return s.filter&&tl.applyFilter(r,i,s.filter,t),n}function ec(t,e){rc(t,Hn.LOAD,e)}function sc(t,e){rc(t,Hn.LOADED,e)}function ic(t,e,s){e.error=s,t.forceUpdate("surface"),rc(t,Hn.ERROR,e)}function rc(t,e,s){t.hasEvent(e)&&t.emitEvent(new Hn(e,s))}function oc(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:nc,translate:ac}=Q,hc=new Ht,lc={},dc={};function cc(t,e,s,i){const r=o(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let uc={},_c={a:1,b:0,c:0,d:1,e:0,f:0};const{get:pc,set:gc,rotateOfOuter:fc,translate:yc,scaleOfOuter:mc,multiplyParent:xc,scale:wc,rotate:vc,skew:bc}=Q;function Sc(t,e,s,i,r,o,n,a){n&&vc(t,n),a&&bc(t,a.x,a.y),r&&wc(t,r,o),yc(t,e.x+s,e.y+i)}const{get:kc,scale:Bc,copy:Rc}=Q,{getFloorScale:Cc}=W,{abs:Pc}=Math;const Tc={image:function(t,e,s,i,r){let o,n;const a=io.get(s,s.type);return $d&&s===$d.paint&&Kd(i,$d.boxBounds)?o=$d.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),$d=a.use>1?{leafPaint:o,paint:s,boxBounds:Zd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(tc(t,e,s,a,o,i),r&&(ec(t,n),sc(t,n))):a.error?r&&ic(t,n,a.error):(r&&(oc(t,!0),ec(t,n)),o.loadId=a.load(()=>{oc(t,!1),t.destroyed||(tc(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),sc(t,n)),o.loadId=void 0},e=>{oc(t,!1),ic(t,n,e),o.loadId=void 0},s.lod&&a.getThumbSize(s.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,s,i,r){const{scaleX:o,scaleY:n}=tl.getImageRenderScaleData(t,s,i,r),a=t.film?t.nowIndex:o+"-"+n,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:_}=r;if(!d||t.patternId===a&&!u||_){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===te.name||u||(e=te.image.isLarge(h,o,n)||h.width*o>8096||h.height*n>8096)),e)s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill());else if(!t.style||c.sync||u?tl.createPattern(t,s,i,r):tl.createPatternTask(t,s,i,r),!l||!t.style)return!1;return tl.drawImage(t,o,n,s,i,r),!0},drawImage:function(t,e,s,i,r,o){const{data:n,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:o,opacity:a}=t.originPaint,{transform:h}=n;r.save(),2===l&&r.clipUI(i),o&&(r.blendMode=o),a&&(r.opacity*=a),h&&r.transform(h),u.render(r,0,0,d,c,i,t,e,s),r.restore()}else n.scaleX&&(d*=n.scaleX,c*=n.scaleY),u.render(r,0,0,d,c,i,t,e,s)},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(t.brush&&tl.addBrushScale(r,t,e),s){const{pixelRatio:t}=s;r.scaleX*=t,r.scaleY*=t}return o&&o.scaleX&&(r.scaleX*=Math.abs(o.scaleX),r.scaleY*=Math.abs(o.scaleY)),r},recycleImage:function(t,e){const s=e["_"+t];if(d(s)){let i,r,o,n,a;const h=e.__leaf;for(let l=0,c=s.length;l<c;l++)i=s[l],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,io.recyclePaint(i),i.brush&&tl.recycleBrush(i,h),e.__willDestroy&&r.parent&&tl.recycleFilter(r,h),r.loading&&(n||(n=e.__input&&e.__input[t]||[],d(n)||(n=[n])),r.unload(s[l].loadId,!n.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,s,i){t.patternTask||(t.patternTask=io.patternTasker.add(()=>we(this,void 0,void 0,function*(){tl.createPattern(t,e,s,i),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,s.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:o}=tl.getImageRenderScaleData(t,e,s,i),n=t.film?t.nowIndex:r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!te.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:s,brush:i,data:a}=t,{opacity:h}=t.originPaint,{transform:l,gap:d}=a,c=tl.getPatternFixScale(t,r,o);let u,_,p,{width:g,height:f}=s;if(c&&(r*=c,o*=c),g*=r,f*=o,d&&(_=d.x*r/Pc(a.scaleX||1),p=d.y*o/Pc(a.scaleY||1),i)){const s=tl.getBrushScale(t,e);_/=s,p/=s}(l||1!==r||1!==o)&&(r*=Cc(g+(_||0)),o*=Cc(f+(p||0)),u=kc(),l&&Rc(u,l),Bc(u,1/r,1/o));const y=s.getCanvas(g,f,h,void 0,_,p,e.leafer&&e.leafer.config.smooth,a.interlace),m=i?y:s.getPattern(y,a.repeat||te.origin.noRepeat||"no-repeat",u,t);t.style=m,t.patternId=n}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,o=te.image.maxPatternSize,n=i.width*i.height;return i.isSVG?e>1&&(r=Math.ceil(e)/e):o>n&&(o=n),(n*=e*s)>o&&(r=Math.sqrt(o/n)),r},createData:function(t,e,s,i){t.data=tl.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=hc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:r}=s,{mode:n,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,interlace:m}=t,x=e.width===i&&e.height===r,w={mode:n},v="center"!==h&&(_||0)%180==90;let b,S;switch(Ut.set(dc,0,0,v?r:i,v?i:r),n&&"cover"!==n&&"fit"!==n?((d||u)&&(W.getScaleData(d,u,s,lc),b=lc.scaleX,S=lc.scaleY),(h||y||f)&&(b&&Ut.scale(dc,b,S,!0),h&&Rt.toPoint(h,dc,e,dc,!0,!0))):x&&!_||(b=S=Ut.getFitScale(e,dc,"fit"!==n),Ut.put(e,s,h,b,!1,dc),Ut.scale(dc,b,S,!0)),l&&ht.move(dc,l),n){case"stretch":x?b&&(b=S=void 0):(b=e.width/i,S=e.height/r,tl.stretchMode(w,e,b,S));break;case"normal":case"clip":if(dc.x||dc.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),tl.clipMode(w,e,dc.x,dc.y,b,S,_,p,t,s),t&&(b=b?b*t:t,S=S?S*s:s)}break;case"repeat":case"brush":(!x||b||_||p)&&tl.repeatMode(w,e,i,r,dc.x,dc.y,b,S,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=c(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;c(t)?(o=t.x,n=t.y):o=n=t;return{x:cc(o,s,r.width,e&&e.x),y:cc(n,i,r.height,e&&e.y)}}(y,s&&f,dc.width,dc.height,e));break;default:b&&tl.fillOrFitMode(w,e,dc.x,dc.y,b,S,_)}return w.transform||(e.x||e.y)&&ac(w.transform=nc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=S),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=a(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,s,i){const r=pc(),{x:o,y:n}=e;o||n?yc(r,o,n):s>0&&i>0&&(r.onlyScale=!0),wc(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,o,n){const a=pc();yc(a,e.x+s,e.y+i),wc(a,r,o),n&&fc(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a},clipMode:function(t,e,s,i,r,o,n,a,h,l){const d=pc();Sc(d,e,s,i,r,o,n,a),h&&(n||a?(gc(_c),mc(_c,e,h,l),xc(d,_c)):mc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,o,n,a,h,l,d,c){const u=pc();if(c)Sc(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)fc(u,{x:s/2,y:i/2},h);else switch(vc(u,h),h){case 90:yc(u,i,0);break;case 180:yc(u,s,i);break;case 270:yc(u,0,s)}uc.x=e.x+r,uc.y=e.y+o,yc(u,uc.x,uc.y),n&&mc(u,uc,n,a)}t.transform=u}},{toPoint:Lc}=St,{hasTransparent:Oc}=Qh,Ac={},Ec={};function Ic(t,e,s,i){if(s){let r,n,a,h;for(let t=0,l=s.length;t<l;t++)r=s[t],o(r)?(a=t/(l-1),n=Qh.string(r,i)):(a=r.offset,n=Qh.string(r.color,i)),e.addColorStop(a,n),!h&&Oc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Wc,getDistance:Mc}=ht,{get:Dc,rotateOfOuter:Fc,scaleOfOuter:zc}=Q,{toPoint:Nc}=St,Yc={},Xc={};function Uc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=Wc(e,s);o=Dc(),r?(zc(o,e,n/a*(i||1),1),Fc(o,e,t+90)):(zc(o,e,1,n/a*(i||1)),Fc(o,e,t))}return o}const{getDistance:jc}=ht,{toPoint:Vc}=St,Gc={},Hc={};const qc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:o}=t;Lc(s||"top",e,Ac),Lc(i||"bottom",e,Ec);const n=te.canvas.createLinearGradient(Ac.x,Ac.y,Ec.x,Ec.y),a={type:r,style:n};return Ic(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;Nc(s||"center",e,Yc),Nc(i||"bottom",e,Xc);const a=te.canvas.createRadialGradient(Yc.x,Yc.y,0,Yc.x,Yc.y,Mc(Yc,Xc)),h={type:r,style:a};Ic(h,a,t.stops,o);const l=Uc(e,Yc,Xc,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,rotation:n,stretch:a}=t;Vc(s||"center",e,Gc),Vc(i||"bottom",e,Hc);const h=te.conicGradientSupport?te.canvas.createConicGradient(n?n*D:0,Gc.x,Gc.y):te.canvas.createRadialGradient(Gc.x,Gc.y,0,Gc.x,Gc.y,jc(Gc,Hc)),l={type:r,style:h};Ic(l,h,t.stops,o);const d=Uc(e,Gc,Hc,a||1,te.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Uc},{copy:Jc,move:Qc,toOffsetOutBounds:$c}=Ut,{max:Zc,abs:Kc}=Math,tu={},eu=new ft,su={};function iu(t,e){let s,i,r,o,n=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,o=1.5*(t.blur||0),r=Kc(t.spread||0),n=Zc(n,r+o-i),a=Zc(a,r+o+s),h=Zc(h,r+o+i),l=Zc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function ru(t,e,s){const{shapeBounds:i}=s;let r,o;te.fullImageShadow?(Jc(tu,t.bounds),Qc(tu,e.x-i.x,e.y-i.y),r=t.bounds,o=tu):(r=i,o=e),t.copyWorld(s.canvas,r,o)}const{toOffsetOutBounds:ou}=Ut,nu={};const au=iu;const hu={shadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{shadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;$c(h,su,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(su.offsetX+(n.x||0)*c*f,su.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,Qh.string(n.color)),r=sl.getShadowTransform(t,_,s,n,su,f),r&&_.setTransform(r),ru(_,su,s),r&&_.resetTransform(),i=l,n.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,o,"copy"),i=o),a?_.copyWorld(a,o,o,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),_n.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{innerShadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;ou(h,nu,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(nu.offsetX+(n.x||0)*c*f,nu.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=sl.getShadowTransform(t,_,s,n,nu,f,!0),r&&_.setTransform(r),ru(_,nu,s),_.restore(),a?(_.copyWorld(_,l,o,"copy"),_.copyWorld(a,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Qh.string(n.color),"source-in"),_n.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:iu,getShadowTransform:function(t,e,s,i,r,o,n){if(i.spread){const s=2*i.spread*o*(n?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return eu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),eu}},isTransformShadow(t){},getInnerShadowSpread:au},{excludeRenderBounds:lu}=vn;let du;function cu(t,e,s,i,r,o,n,a){switch(e){case"grayscale":du||(du=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);_u(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":_u(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function uu(t){return t.getSameCanvas(!1,!0)}function _u(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}zl.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(cu(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||lu(s,e)||s.__render(t,e),o=s.__.opacity,du=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=uu(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=uu(t)),r||(r=uu(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&cu(this,n,t,r,i,o,void 0,!1),lu(s,e)||s.__render(r||t,e),d&&cu(this,n,t,r,i,o,d,!1)}cu(this,n,t,r,i,o,void 0,!0)};const pu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",gu=pu+"_#~&*+\\=|≮≯≈≠=…",fu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function yu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const mu=yu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),xu=yu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),wu=yu(pu),vu=yu(gu),bu=yu("- —/~|┆·");var Su;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Su||(Su={}));const{Letter:ku,Single:Bu,Before:Ru,After:Cu,Symbol:Pu,Break:Tu}=Su;function Lu(t){return mu[t]?ku:bu[t]?Tu:xu[t]?Ru:wu[t]?Cu:vu[t]?Pu:fu.test(t)?Bu:ku}const Ou={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Au(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Eu}=Ou,{Letter:Iu,Single:Wu,Before:Mu,After:Du,Symbol:Fu,Break:zu}=Su;let Nu,Yu,Xu,Uu,ju,Vu,Gu,Hu,qu,Ju,Qu,$u,Zu,Ku,t_,e_,s_,i_=[];function r_(t,e){qu&&!Hu&&(Hu=qu),Nu.data.push({char:t,width:e}),Xu+=e}function o_(){Uu+=Xu,Nu.width=Xu,Yu.words.push(Nu),Nu={data:[]},Xu=0}function n_(){Ku&&(t_.paraNumber++,Yu.paraStart=!0,Ku=!1),qu&&(Yu.startCharSize=Hu,Yu.endCharSize=qu,Hu=0),Yu.width=Uu,e_.width?Eu(Yu):s_&&a_(),i_.push(Yu),Yu={words:[]},Uu=0}function a_(){Uu>(t_.maxWidth||0)&&(t_.maxWidth=Uu)}const{top:h_,right:l_,bottom:d_,left:c_}=wt;function u_(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const __={getDrawData:function(t,e){o(t)||(t=String(t));let s=0,i=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(s=a[c_],r-=a[l_]+a[c_],!r&&(r=.01)):e.autoSizeAlign||(s=a[c_]),n?(i=a[h_],n-=a[h_]+a[d_],!n&&(n=.01)):e.autoSizeAlign||(i=a[h_]));const h={bounds:{x:s,y:i,width:r,height:n},rows:[],paraNumber:0,font:te.canvas.font=e.__font};return function(t,e,s){t_=t,i_=t.rows,e_=t.bounds,s_=!e_.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=te,{width:a}=e_;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;Ku=!0,Qu=null,Hu=Gu=qu=Xu=Uu=0,Nu={data:[]},Yu={words:[]};for(let s=0,l=(e=[...e]).length;s<l;s++)Vu=e[s],"\n"===Vu?(Xu&&o_(),Yu.paraEnd=!0,n_(),Ku=!0):(Ju=Lu(Vu),Ju===Iu&&"none"!==o&&(Vu=Au(Vu,o,!Xu)),Gu=n.measureText(Vu).width,i&&(i<0&&(qu=Gu),Gu+=i),$u=Ju===Wu&&(Qu===Wu||Qu===Iu)||Qu===Wu&&Ju!==Du,Zu=!(Ju!==Mu&&Ju!==Wu||Qu!==Fu&&Qu!==Du),ju=Ku&&r?a-r:a,t&&a&&Uu+Xu+Gu>ju&&(h?(Xu&&o_(),Uu&&n_()):(Zu||(Zu=Ju===Iu&&Qu==Du),$u||Zu||Ju===zu||Ju===Mu||Ju===Wu||Xu+Gu>ju?(Xu&&o_(),Uu&&n_()):Uu&&n_()))," "===Vu&&!0!==Ku&&Uu+Xu===0||(Ju===zu?(" "===Vu&&Xu&&o_(),r_(Vu,Gu),o_()):$u||Zu?(Xu&&o_(),r_(Vu,Gu)):r_(Vu,Gu)),Qu=Ju);Xu&&o_(),Uu&&n_(),i_.length>0&&(i_[i_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{t_.paraNumber++,Uu=n.measureText(t).width,i_.push({x:r||0,text:t,width:Uu,paraStart:!0}),s_&&a_()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":u_(e,"x",t[c_]);break;case"right":u_(e,"x",-t[l_])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":u_(e,"y",t[h_]);break;case"bottom":u_(e,"y",-t[d_])}}(a,h,e,r,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,o),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(h,e),e.__isCharMode&&function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,__letterSpacing:n}=e,a=s&&r.includes("both"),h=a||s&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;i.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,y=t.words.length,h&&(x=!t.paraEnd||a,c=s-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=n||t.isOverflow||l?0:u?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,s)=>{1===g?(f={char:"",x:d},d=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,s,i,r){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=s===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,s,i){const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(o&&r.splice(o),i&&n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?te.canvas.measureText(n).width:0,l=s+i-h;("none"===e.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],a=t.x+t.width,!(i===s&&a<l));i--){if(a<l&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:n,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,s,r),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,c(o)?(s=o.type,o.color&&(t.decorationColor=Qh.string(o.color)),o.offset&&(i=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(h,e),h}};const p_={string:function(t,e){if(!t)return"#000";const s=a(e)&&e<1;if(o(t)){if(!s||!Qh.object)return t;t=Qh.object(t)}let r=i(t.a)?1:t.a;s&&(r*=e);const n=t.r+","+t.g+","+t.b;return 1===r?"rgb("+n+")":"rgba("+n+","+r+")"}};Object.assign(Jh,__),Object.assign(Qh,p_),Object.assign(Kh,Qd),Object.assign(tl,Tc),Object.assign(el,qc),Object.assign(sl,hu);try{wx&&Lh(0,wx)}catch(t){}export{Rt as AlignHelper,e as Answer,St as AroundHelper,Jt as AutoBounds,ds as BezierHelper,Ht as Bounds,qn as BoundsEvent,Ut as BoundsHelper,Jl as Box,fl as BoxData,Bh as Branch,Bn as BranchHelper,Ua as BranchRender,Rd as Canvas,Tl as CanvasData,me as CanvasManager,Un as ChildEvent,Qh as ColorConvert,ce as Creator,p as DataHelper,ie as Debug,wt as Direction4,vt as Direction9,sl as Effect,td as Ellipse,vl as EllipseData,xs as EllipseHelper,Xn as Event,fe as EventCreator,ca as Eventer,rl as Export,Jr as FileHelper,il as Filter,k as FourNumberHelper,Ql as Frame,ml as FrameData,zl as Group,gl as GroupData,kd as Image,Pl as ImageData,Hn as ImageEvent,io as ImageManager,y as IncrementId,sa as LayoutEvent,Xh as Layouter,gh as Leaf,za as LeafBounds,vn as LeafBoundsHelper,f as LeafData,ka as LeafDataProxy,ba as LeafEventer,_n as LeafHelper,Yn as LeafLayout,Ch as LeafLevelList,Rh as LeafList,Oa as LeafMatrix,Na as LeafRender,Xl as Leafer,Th as LeaferCanvas,Ie as LeaferCanvasBase,yl as LeaferData,ra as LeaferEvent,ho as LeaferFilm,ao as LeaferImage,lo as LeaferVideo,Sd as Line,xl as LineData,W as MathHelper,ft as Matrix,Q as MatrixHelper,Bd as MyImage,ze as NeedConvertToCanvasCommandMap,D as OneRadian,F as PI2,z as PI_2,Kh as Paint,el as PaintGradient,tl as PaintImage,Ad as Path,Zh as PathArrow,Dr as PathBounds,Ci as PathCommandDataHelper,De as PathCommandMap,ws as PathCommandNodeHelper,ri as PathConvert,jr as PathCorner,ji as PathCreator,kl as PathData,or as PathDrawer,We as PathHelper,t as PathNodeHandleType,Ue as PathNumberCommandLengthMap,Xe as PathNumberCommandMap,Ed as Pen,Bl as PenData,te as Platform,de as Plugin,pt as Point,ht as PointHelper,hd as Polygon,bl as PolygonData,Vn as PropertyEvent,Ul as Rect,wl as RectData,je as RectHelper,Ml as RectRender,ia as RenderEvent,jh as Renderer,ta as ResizeEvent,eo as Resource,ae as Run,gd as Star,Sl as StarData,ol as State,$t as StringNumberMap,Zr as TaskItem,Kr as TaskProcessor,Od as Text,Jh as TextConvert,Cl as TextData,nl as Transition,mt as TwoPointBoundsHelper,Fl as UI,Al as UIBounds,_e as UICreator,_l as UIData,Il as UIRender,$h as UnitConvert,Qt as UnitConvertHelper,On as WaitHelper,ea as WatchEvent,Oh as Watcher,Oo as affectRenderBoundsType,Po as affectStrokeBoundsType,go as attr,wo as autoLayoutType,So as boundsType,qr as canvasPatch,Ee as canvasSizeAttrs,qh as createAttr,_o as createDescriptor,Xo as cursorType,Uo as dataProcessor,yo as dataType,po as decorateLeafAttr,Vo as defineDataProcessor,co as defineKey,fo as defineLeafAttr,Eo as dimType,Bo as doBoundsType,To as doStrokeType,Vh as effectType,s as emptyData,No as eraserType,Gn as extraPropertyEventMap,Y as getBoundsData,uo as getDescriptor,X as getMatrixData,N as getPointData,Yo as hitType,d as isArray,u as isData,_ as isEmptyData,n as isFinite,r as isNull,a as isNumber,c as isObject,o as isString,i as isUndefined,jo as layoutProcessor,la as leaferTransformAttrMap,zo as maskType,ko as naturalBoundsType,Io as opacityType,Vr as path,Ro as pathInputType,Co as pathType,Gr as pen,mo as positionType,Ko as registerUI,tn as registerUIEvent,Gh as resizeType,Jo as rewrite,Qo as rewriteAble,bo as rotationType,vo as scaleType,xo as scrollType,Fo as sortType,Lo as strokeType,Ao as surfaceType,qt as tempBounds,yt as tempMatrix,gt as tempPoint,l as tryToNumber,Lh as useCanvas,Zo as useModule,Ph as version,Wo as visibleType,Hh as zoomLayerType};
|
|
1
|
+
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const s={};function i(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var n,o;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return g(t[r],e[r],s&&s[r]);s&&r in s?(null===(o=s[r])||void 0===o?void 0:o.constructor)===Object&&g(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=i(s)?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(d(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!i(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,s[n]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:n,f:o}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>B(S,t,e,s,i),toTempAB(t,e,s){v=s?a(t)?e:t:[],a(t)?(x=C(t),w=e):a(e)?(x=t,w=C(e)):(x=t,w=e),4!==x.length&&(x=R(x)),4!==w.length&&(w=R(w))},get(t,e){let s;if(!a(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>a(t)&&a(e)?b(t,e):(P(t,e,s),B(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,s)=>a(t)&&a(e)?t+e:(P(t,e,s),B(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,s,i){if(a(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[n,o,h,l]=4===t.length?t:R(t);return B(r,h*s,l*e,n*s,o*e)}},{set:B,get:R,setTemp:C,toTempAB:P}=k,{round:T,pow:L,max:O,floor:A,PI:E}=Math,I={},W={within:(t,e,s)=>(c(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=i(e)?1e12:L(10,e);return-0===(t=T(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(a(e)?e:e.width||0)/s.width,r=(a(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&W.assignScale(i,t);return i},getScaleFixedData(t,e,s,i,r){let{scaleX:n,scaleY:o}=t;if((i||e)&&(n<0&&(n=-n),o<0&&(o=-o)),e)if(!0===e)n=o=s?1:1/n;else{let t;a(e)?t=e:"zoom-in"===e&&(t=1),t&&(n=o=n>t||o>t?s?1:1/n:s?1:1/t)}return I.scaleX=n,I.scaleY=o,I},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(A(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const D=E/180,F=2*E,z=E/2;function N(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:j,acos:V,sqrt:H}=Math,{float:q}=W,G={};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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:X,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,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(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,i){$.toInnerPoint(t,e,G),$.scaleOfInner(t,G,s,i)},scaleOfInner(t,e,s,i=s){$.translateInner(t,e.x,e.y),$.scale(t,s,i),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:n}=t,o=j(e*=D),a=U(e);t.a=s*o-i*a,t.b=s*a+i*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,s){$.toInnerPoint(t,e,G),$.rotateOfInner(t,G,s)},rotateOfInner(t,e,s){$.translateInner(t,e.x,e.y),$.rotate(t,s),$.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=D,t.a=i+n*s,t.b=r+o*s),e&&(e*=D,t.c=n+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){$.toInnerPoint(t,e,G),$.skewOfInner(t,G,s,i)},skewOfInner(t,e,s,i=0){$.translateInner(t,e.x,e.y),$.skew(t,s,i),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},multiplyParent(t,e,s,r,n){const{e:o,f:a}=t;if(s||(s=t),i(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:i,b:r,c:o,d:a}=t;s.a=i*e.a+r*e.c,s.b=i*e.b+r*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,n&&(s.scaleX=e.scaleX*n.scaleX,s.scaleY=e.scaleY*n.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,n&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-n*r*s,t.f=-o*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*r-l*n)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*o)*h,s.y-=(i*r-e*n)*h}},setLayout(t,e,s,r,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(i(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:s,skewX:i,skewY:r}=e,n=s*D,o=j(n),a=U(n);if(i||r){const e=i*D,s=r*D;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,(s=s||r)&&$.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,i){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!i){d=H(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=H(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?V(-e):-V(e))}const e=q(j(u)),s=U(u);d=q(d),c=q(c),_=e?q((o/c+s)/e/D,9):0,p=e?q((n/d-s)/e/D,9):0,u=q(u/D)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:n,d:o}=t;r||n?s=(i*o-r*n)/(e=H(i*i+r*r)):(e=i,s=o)}return i.scaleX=e,i.scaleY=s,i},reset(t){$.set(t)}},$=Q,{float:Z}=W,{toInnerPoint:K,toOuterPoint:tt}=Q,{sin:et,cos:st,abs:it,sqrt:rt,atan2:nt,min:ot,round:at}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,s){c(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,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=lt.defaultPoint);const i=st(e*=D),r=et(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=lt;return ct(s,t),K(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=lt;return ct(s,t),tt(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=lt;return ct(s,t),lt.toInnerRadiusPointOf(t,e,s),s},copyRadiusPoint:(t,e,s,i)=>(ct(t,e),ut(t,s,i),t),toInnerRadiusPointOf(t,e,s){s||(s=t),K(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){K(e,t,s)},toOuterOf(t,e,s){tt(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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=it(s-t),n=it(i-e);return rt(r*r+n*n)},getMinDistanceFrom:(t,e,s,i,r,n)=>ot(dt(t,e,s,i),dt(s,i,r,n)),getAngle:(t,e)=>_t(t,e)/D,getRotation:(t,e,s,i)=>(i||(i=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/D),getRadianFrom(t,e,s,r,n,o,a,h){i(a)&&(a=s,h=r);const l=t-s,d=e-r,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const n=_t(t,e);return r&&(t=e),i||(e={}),e.x=t.x+st(n)*s,e.y=t.y+et(n)*s,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,s)=>s?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:_t}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ht.copy(this,t):ht.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 ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,s){return ht.scaleOf(this,t,e,s),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,s){return ht.getRotation(this,t,e,s)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,s,i){return new pt(ht.getDistancePoint(this,t,e,s,i))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const gt=new pt;class ft{constructor(t,e,s,i,r,n){this.set(t,e,s,i,r,n)}set(t,e,s,i,r,n){return c(t)?Q.copy(this,t):Q.set(this,t,e,s,i,r,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:i,e:r,f:n}=this;return{a:t,b:e,c:s,d:i,e:r,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 yt=new ft,mt={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,i,r){xt(t,e,s),xt(t,e+i,s+r)},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}=mt;var wt,vt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(vt||(vt={}));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 St={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,s,i,r,n){const o=kt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,r&&(n||(s.x-=r.x,s.y-=r.y),o.x&&(s.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(s.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s,i=!0)=>(s||(s={}),St.toPoint(t,e,s,i),s)};function kt(t){return n(t)?bt[vt[t]]:t}const{toPoint:Bt}=St,Rt={toPoint(t,e,s,i,r,n){Bt(t,s,i,r,e,n)}},{tempPointBounds:Ct,setPoint:Pt,addPoint:Tt,toBounds:Lt}=mt,{toOuterPoint:Ot}=Q,{float:At,fourNumber:Et}=W,{floor:It,ceil:Wt}=Math;let Mt,Dt,Ft,zt;const Nt={},Yt={},Xt={},Ut={tempBounds:Xt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:n,y:o,width:a,height:h}=e;if(d(s)){const e=Et(s);i?jt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),jt.set(t,n-s,o-s,a+2*s,h+2*s);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),jt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Ht(e,t):e=t,s||(s=t),e.offsetX=jt.maxX(s),e.offsetY=jt.maxY(s),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||ht.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){ht.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r,e:n,f:o}=e;i>0?(s.width=t.width*i,s.x=n+t.x*i):(s.width=t.width*-i,s.x=n+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=o+t.y*r):(s.height=t.height*-r,s.y=o+t.y*r-s.height)}else Nt.x=t.x,Nt.y=t.y,Ot(e,Nt,Yt),Pt(Ct,Yt.x,Yt.y),Nt.x=t.x+t.width,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Nt.y=t.y+t.height,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Nt.x=t.x,Ot(e,Nt,Yt),Tt(Ct,Yt.x,Yt.y),Lt(Ct,s)},toInnerOf(t,e,s){s||(s=t),jt.move(s,-e.e,-e.f),jt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,jt.getFitScale(t,e));return new ft(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),n(i)&&(i=jt.getFitScale(t,e,"cover"===i)),Xt.width=r?e.width*=i:e.width*i,Xt.height=r?e.height*=i:e.height*i,Rt.toPoint(s,Xt,t,o,!0,!0)},getSpread(t,e,s){const i={};return jt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){jt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){jt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Wt(t.width+e-t.x):Wt(t.width),t.height=s>t.y?Wt(t.height+s-t.y):Wt(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,s){Mt=t.x+t.width,Dt=t.y+t.height,Ft=e.x,zt=e.y,s||(Ft+=e.width,zt+=e.height),Mt=Mt>Ft?Mt:Ft,Dt=Dt>zt?Dt:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Dt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){jt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){jt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||Ht(t,r)):Vt(t,r));n&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Ct,t.x,t.y):Tt(Ct,t.x,t.y)),Lt(Ct,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},getPoint:(t,e,s=!1,i)=>St.getPoint(e,t,i,s),hitRadiusPoint:(t,e,s)=>(s&&(e=ht.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=ht.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=jt.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=jt.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=jt.tempToOuterOf(e,s)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:n,height:o}=e;return Mt=i+n,Dt=r+o,Ft=t.x+t.width,zt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Mt=Mt<Ft?Mt:Ft,Dt=Dt<zt?Dt:zt,n=Mt-i,o=Dt-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){jt.copy(t,jt.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){jt.set(t)}},jt=Ut,{add:Vt,copy:Ht}=jt;class qt{get minX(){return Ut.minX(this)}get minY(){return Ut.minY(this)}get maxX(){return Ut.maxX(this)}get maxY(){return Ut.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return c(t)?Ut.copy(this,t):Ut.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new qt(this)}move(t,e){return Ut.move(this,t,e),this}scale(t,e,s){return Ut.scale(this,t,e,s),this}scaleOf(t,e,s){return Ut.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Ut.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ut.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ut.getFitMatrix(this,t,e)}put(t,e,s){Ut.put(this,t,e,s)}spread(t,e){return Ut.spread(this,t,e),this}shrink(t,e){return Ut.shrink(this,t,e),this}ceil(){return Ut.ceil(this),this}unsign(){return Ut.unsign(this),this}float(t){return Ut.float(this,t),this}add(t){return Ut.add(this,t),this}addList(t){return Ut.setList(this,t,!0),this}setList(t){return Ut.setList(this,t),this}addListWithFn(t,e){return Ut.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ut.setListWithFn(this,t,e),this}setPoint(t){return Ut.setPoint(this,t),this}setPoints(t){return Ut.setPoints(this,t),this}addPoint(t){return Ut.addPoint(this,t),this}getPoints(){return Ut.getPoints(this)}getPoint(t,e,s){return Ut.getPoint(this,t,e,s)}hitPoint(t,e){return Ut.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ut.hitRadiusPoint(this,t,e)}hit(t,e){return Ut.hit(this,t,e)}includes(t,e){return Ut.includes(this,t,e)}intersect(t,e){return Ut.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ut.getIntersectData(this,t,e))}isSame(t){return Ut.isSame(this,t)}isEmpty(){return Ut.isEmpty(this)}reset(){Ut.reset(this)}}const Gt=new qt;class Jt{constructor(t,e,s,i,r,n){c(t)?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new qt(r,e,n||t.width-r-s,o||t.height-e-i)}}const Qt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},$t={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Zt,max:Kt}=Math,te={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,i)=>t.width*t.height*(e?e*s:1)>(i||ee.maxCacheSize),isSuperLarge:(t,e,s)=>ee.isLarge(t,e,s,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=ee;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,n,o,a,h,l){const d=Kt(Zt(e+(i||0)),1),c=Kt(Zt(s+(r||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:s))&&("x"===l.type?u=!0:_=!0);const g=te.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ee.canUse(t)){if(n){const i=e/n.width,r=s/n.height;f.setTransform(i,0,0,r,-n.x*i,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,s);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&p.stintSet(s,"transform",e)}}},{image:ee}=te,{randColor:se}=W;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const s=se();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===ie.showBounds,r=t.__nowWorld,n=se();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),i?e.stroke():e.strokeWorld(r,n)}log(...t){if(ne.enable){if(ne.filterList.length&&ne.filterList.every(t=>t!==this.name))return;if(ne.excludeList.length&&ne.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ne.enable&&this.warn(...t)}warn(...t){ne.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?n(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const ne=ie,oe=ie.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=y.create(y.RUNTIME);return he.currentId=he.idMap[s]=e?performance.now():Date.now(),he.currentName=he.nameMap[s]=t,he.nameToIdMap[t]=s,s},end(t,e){const s=he.idMap[t],i=he.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[i]=void 0,oe.log(i,r,"ms")},endOfName(t,e){const s=he.nameToIdMap[t];i(s)||he.end(s,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.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(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=ie.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,s,r,n,o){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return i(s)||(a.x=s,r&&(a.y=r),n&&(a.width=n),o&&(a.height=o)),a}},{list:pe}=_e,ge=ie.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],n(e)&&(ye[e]&&ge.repeat(e),ye[e]=t)})},changeName(t,e){const s=ye[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ye[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=fe;class me{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=ce.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function we(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}h((i=i.apply(t,e||[])).next())})}function ve(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Be=class{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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;be.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};xe([ve("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),xe([ve("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),xe([ve("globalAlpha")],Be.prototype,"opacity",void 0),xe([ve()],Be.prototype,"fillStyle",void 0),xe([ve()],Be.prototype,"strokeStyle",void 0),xe([ve("lineWidth")],Be.prototype,"strokeWidth",void 0),xe([ve("lineCap")],Be.prototype,"strokeCap",void 0),xe([ve("lineJoin")],Be.prototype,"strokeJoin",void 0),xe([ve("lineDashOffset")],Be.prototype,"dashOffset",void 0),xe([ve()],Be.prototype,"miterLimit",void 0),xe([ve()],Be.prototype,"shadowBlur",void 0),xe([ve()],Be.prototype,"shadowColor",void 0),xe([ve()],Be.prototype,"shadowOffsetX",void 0),xe([ve()],Be.prototype,"shadowOffsetY",void 0),xe([ve()],Be.prototype,"filter",void 0),xe([ve()],Be.prototype,"font",void 0),xe([ve()],Be.prototype,"fontKerning",void 0),xe([ve()],Be.prototype,"fontStretch",void 0),xe([ve()],Be.prototype,"fontVariantCaps",void 0),xe([ve()],Be.prototype,"textAlign",void 0),xe([ve()],Be.prototype,"textBaseline",void 0),xe([ve()],Be.prototype,"textRendering",void 0),xe([ve()],Be.prototype,"wordSpacing",void 0),xe([ve()],Be.prototype,"letterSpacing",void 0),xe([ve()],Be.prototype,"direction",void 0),xe([Se()],Be.prototype,"setTransform",null),xe([Se()],Be.prototype,"resetTransform",null),xe([Se()],Be.prototype,"getTransform",null),xe([Se()],Be.prototype,"save",null),xe([Se()],Be.prototype,"restore",null),xe([Se()],Be.prototype,"translate",null),xe([Se()],Be.prototype,"scale",null),xe([Se()],Be.prototype,"rotate",null),xe([Se()],Be.prototype,"fill",null),xe([Se()],Be.prototype,"stroke",null),xe([Se()],Be.prototype,"clip",null),xe([Se()],Be.prototype,"fillRect",null),xe([Se()],Be.prototype,"strokeRect",null),xe([Se()],Be.prototype,"clearRect",null),xe([Se()],Be.prototype,"beginPath",null),xe([Se()],Be.prototype,"moveTo",null),xe([Se()],Be.prototype,"lineTo",null),xe([Se()],Be.prototype,"bezierCurveTo",null),xe([Se()],Be.prototype,"quadraticCurveTo",null),xe([Se()],Be.prototype,"closePath",null),xe([Se()],Be.prototype,"arc",null),xe([Se()],Be.prototype,"arcTo",null),xe([Se()],Be.prototype,"ellipse",null),xe([Se()],Be.prototype,"rect",null),xe([Se()],Be.prototype,"roundRect",null),xe([Se()],Be.prototype,"createConicGradient",null),xe([Se()],Be.prototype,"createLinearGradient",null),xe([Se()],Be.prototype,"createPattern",null),xe([Se()],Be.prototype,"createRadialGradient",null),xe([Se()],Be.prototype,"fillText",null),xe([Se()],Be.prototype,"measureText",null),xe([Se()],Be.prototype,"strokeText",null);const{copy:Re,multiplyParent:Ce,pixelScale:Pe}=Q,{round:Te}=Math,Le=new qt,Oe=new qt,Ae={width:1,height:1,pixelRatio:1},Ee=["width","height","pixelRatio"];class Ie extends Be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ae),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.size.pixelRatio=r||te.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,Ee),Ee.forEach(t=>i[t]||(i[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&Ce(t,e,r),Pe(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=Te(r.e-.5)+.5,r.f=Te(r.f-.5)+.5):(r.e=Te(r.e),r.f=Te(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:r,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),i(e.dashPattern)||(n=e.dashPattern),i(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=Oe):s=Le,this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ut.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,n){this.resetTransform(),this.copyWorld(t,e,s,i,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(Le.x,Le.y,Le.width,Le.height),{data:n}=r;for(let t=0,i=n.length;t<i;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));i.putImageData(r,Le.x,Le.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(Le.x,Le.y,Le.width,Le.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(Le.x,Le.y,Le.width,Le.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Le.x,Le.y,Le.width,Le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Le.x,Le.y,Le.width,Le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Le,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(Oe,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):ce.canvas(Object.assign({},s));return r.save(),t&&(Re(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const We={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},De=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Me),Fe={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},ze={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},Ne=Object.assign(Object.assign({},ze),Me),Ye=De,Xe={};for(let t in Ye)Xe[Ye[t]]=t;const Ue={};for(let t in Ye)Ue[Ye[t]]=Fe[t];const je={drawRoundRect(t,e,s,i,r,n){const o=W.fourNumber(n,Math.min(i/2,r/2)),a=e+i,h=s+r;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:Ve,cos:He,hypot:qe,atan2:Ge,ceil:Je,abs:Qe,PI:$e,sqrt:Ze,pow:Ke}=Math,{setPoint:ts,addPoint:es}=mt,{set:ss,toNumberPoints:is}=ht,{M:rs,L:ns,C:os,Q:as,Z:hs}=De,ls={},ds={points(t,e,s,i){let r=is(e);if(t.push(rs,r[0],r[1]),s&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y,m,x=r.length;const w=!0===s?.5:s;i&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let s=2;s<x-2;s+=2)e=r[s-2],n=r[s-1],o=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=o-e,g=a-n,f=Ze(Ke(p,2)+Ke(g,2)),y=Ze(Ke(h-o,2)+Ke(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=n,d=o-f*h,c=a-f*l,2===s?i||t.push(as,d,c,o,a):(p||g)&&t.push(os,u,_,d,c,o,a),u=o+y*h,_=a+y*l);i||t.push(as,u,_,r[x-2],r[x-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(ns,r[e],r[e+1]);i&&t.push(hs)},rect(t,e,s,i,r){We.creator.path=t,We.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,n){We.creator.path=[],je.drawRoundRect(We.creator,e,s,i,r,n),t.push(...We.convertToCanvasData(We.creator.path,!0))},arcTo(t,e,s,i,r,n,o,a,h,l,d){const c=i-e,u=r-s,_=n-i,p=o-r;let g=Ge(u,c),f=Ge(p,_);const y=qe(c,u),m=qe(_,p);let x=f-g;if(x<0&&(x+=F),y<1e-12||m<1e-12||x<1e-12||Qe(x-$e)<1e-12)return t&&t.push(ns,i,r),h&&(ts(h,e,s),es(h,i,r)),d&&ss(d,e,s),void(l&&ss(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/He(x/2),S=i+b*He(g+x/2+z*v),k=r+b*Ve(g+x/2+z*v);return g-=z*v,f-=z*v,_s(t,S,k,a,a,0,g/D,f/D,w,h,l,d)},arc:(t,e,s,i,r,n,o,a,h,l)=>_s(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,n,o,a,h,l,d,c){const u=n*D,_=Ve(u),p=He(u);let g=o*D,f=a*D;g>$e&&(g-=F),f<0&&(f+=F);let y=f-g;y<0?y+=F:y>F&&(y-=F),h&&(y-=F);const m=Je(Qe(y/z)),x=y/m,w=Ve(x/4),v=8/3*w*w/Ve(x/2);f=g+x;let b,S,k,B,R,C,P,T,L=He(g),O=Ve(g),A=k=p*i*L-_*r*O,E=B=_*i*L+p*r*O,I=e+k,W=s+B;t&&t.push(t.length?ns:rs,I,W),l&&ts(l,I,W),c&&ss(c,I,W);for(let n=0;n<m;n++)b=He(f),S=Ve(f),k=p*i*b-_*r*S,B=_*i*b+p*r*S,R=e+A-v*(p*i*O+_*r*L),C=s+E-v*(_*i*O-p*r*L),P=e+k+v*(p*i*S+_*r*b),T=s+B+v*(_*i*S-p*r*b),t&&t.push(os,R,C,P,T,e+k,s+B),l&&us(e+A,s+E,R,C,P,T,e+k,s+B,l,!0),A=k,E=B,L=b,O=S,g=f,f+=x;d&&ss(d,e+k,s+B)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(os,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){us(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=n,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?es(h,t,e):ts(h,t,e),es(h,o,a);for(let l=0,c=d.length;l<c;l++)cs(d[l],t,e,s,i,r,n,o,a,ls),es(h,ls.x,ls.y)},getPointAndSet(t,e,s,i,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return cs(t,e,s,i,r,n,o,a,h,l),l},getDerivative(t,e,s,i,r){const n=1-t;return 3*n*n*(s-e)+6*n*t*(i-s)+3*t*t*(r-i)},cut(t,e,s,i,r,n,o,a,h){if(t<=0)return{left:null,right:[i,r,n,o,a,h]};if(t>=1)return{left:[i,r,n,o,a,h],right:null};const l=1-t,d=e*l+i*t,c=s*l+r*t,u=i*l+n*t,_=r*l+o*t,p=n*l+a*t,g=o*l+h*t,f=d*l+u*t,y=c*l+_*t,m=u*l+p*t,x=_*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+x*t],right:[m,x,p,g,a,h]}}},{getPointAndSet:cs,toTwoPointBounds:us,ellipse:_s}=ds,{sin:ps,cos:gs,sqrt:fs,atan2:ys}=Math,{ellipse:ms}=ds,xs={ellipticalArc(t,e,s,i,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*D,p=ps(_),g=gs(_),f=-g*c-p*u,y=-g*u+p*c,m=i*i,x=r*r,w=y*y,v=f*f,b=m*x-m*w-x*v;let S=0;if(b<0){const t=fs(1-b/(m*x));i*=t,r*=t}else S=(o===a?-1:1)*fs(b/(m*w+x*v));const k=S*i*y/r,B=-S*r*f/i,R=ys((y-B)/r,(f-k)/i),C=ys((-y-B)/r,(-f-k)/i);let P=C-R;0===a&&P>0?P-=F:1===a&&P<0&&(P+=F);const T=e+c+g*k-p*B,L=s+u+p*k+g*B,O=P<0?1:0;d||te.ellipseToCurve?ms(t,T,L,i,r,n,R/D,C/D,O):i!==r||n?t.push(De.G,T,L,i,r,n,R/D,C/D,O):t.push(De.O,T,L,i,R/D,C/D,O)}},ws={toCommand:t=>[],toNode:t=>[]},{M:vs,m:bs,L:Ss,l:ks,H:Bs,h:Rs,V:Cs,v:Ps,C:Ts,c:Ls,S:Os,s:As,Q:Es,q:Is,T:Ws,t:Ms,A:Ds,a:Fs,Z:zs,z:Ns,N:Ys,D:Xs,X:Us,G:js,F:Vs,O:Hs,P:qs,U:Gs}=De,{rect:Js,roundRect:Qs,arcTo:$s,arc:Zs,ellipse:Ks,quadraticCurveTo:ti}=ds,{ellipticalArc:ei}=xs,si=ie.get("PathConvert"),ii={},ri={current:{dot:0},stringify(t,e){let s,i,r,n=0,o=t.length,a="";for(;n<o;){i=t[n],s=Ue[i],a+=i===r?" ":Xe[i];for(let i=1;i<s;i++)a+=W.float(t[n+i],e),i===s-1||(a+=" ");r=i,n+=s}return a},parse(t,e){let s,i,r,n="";const o=[],a=e?Ne:ze;for(let e=0,h=t.length;e<h;e++)i=t[e],$t[i]?("."===i&&(ni.dot&&(oi(o,n),n=""),ni.dot++),"0"===n&&"."!==i&&(oi(o,n),n=""),n+=i):De[i]?(n&&(oi(o,n),n=""),ni.name=De[i],ni.length=Fe[i],ni.index=0,oi(o,ni.name),"m"===i?ni.name=De.l:"M"===i?ni.name=De.L:!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&oi(o,n),n=i):n&&(oi(o,n),n=""),r=i;return n&&oi(o,n),s?ri.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const g=[];for(;_<p;){switch(r=t[_],r){case bs:t[_+1]+=a,t[_+2]+=h;case vs:a=c=t[_+1],h=u=t[_+2],g.push(vs,a,h),_+=3;break;case Rs:t[_+1]+=a;case Bs:a=t[_+1],g.push(Ss,a,h),_+=2;break;case Ps:t[_+1]+=h;case Cs:h=t[_+1],g.push(Ss,a,h),_+=2;break;case ks:t[_+1]+=a,t[_+2]+=h;case Ss:a=t[_+1],h=t[_+2],g.push(Ss,a,h),_+=3;break;case As:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,r=Os;case Os:o=n===Ts||n===Os,l=o?2*a-s:t[_+1],d=o?2*h-i:t[_+2],s=t[_+1],i=t[_+2],a=t[_+3],h=t[_+4],g.push(Ts,l,d,s,i,a,h),_+=5;break;case Ls:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,t[_+5]+=a,t[_+6]+=h,r=Ts;case Ts:s=t[_+3],i=t[_+4],a=t[_+5],h=t[_+6],g.push(Ts,t[_+1],t[_+2],s,i,a,h),_+=7;break;case Ms:t[_+1]+=a,t[_+2]+=h,r=Ws;case Ws:o=n===Es||n===Ws,s=o?2*a-s:t[_+1],i=o?2*h-i:t[_+2],e?ti(g,a,h,s,i,t[_+1],t[_+2]):g.push(Es,s,i,t[_+1],t[_+2]),a=t[_+1],h=t[_+2],_+=3;break;case Is:t[_+1]+=a,t[_+2]+=h,t[_+3]+=a,t[_+4]+=h,r=Es;case Es:s=t[_+1],i=t[_+2],e?ti(g,a,h,s,i,t[_+3],t[_+4]):g.push(Es,s,i,t[_+3],t[_+4]),a=t[_+3],h=t[_+4],_+=5;break;case Fs:t[_+6]+=a,t[_+7]+=h;case Ds:ei(g,a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],e),a=t[_+6],h=t[_+7],_+=8;break;case Ns:case zs:g.push(zs),a=c,h=u,_++;break;case Ys:a=t[_+1],h=t[_+2],e?Js(g,a,h,t[_+3],t[_+4]):ai(g,t,_,5),_+=5;break;case Xs:a=t[_+1],h=t[_+2],e?Qs(g,a,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):ai(g,t,_,9),_+=9;break;case Us:a=t[_+1],h=t[_+2],e?Qs(g,a,h,t[_+3],t[_+4],t[_+5]):ai(g,t,_,6),_+=6;break;case js:Ks(e?g:ai(g,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,ii),a=ii.x,h=ii.y,_+=9;break;case Vs:e?Ks(g,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):ai(g,t,_,5),a=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case Hs:Zs(e?g:ai(g,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,ii),a=ii.x,h=ii.y,_+=7;break;case qs:e?Zs(g,t[_+1],t[_+2],t[_+3],0,360,!1):ai(g,t,_,4),a=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case Gs:$s(e?g:ai(g,t,_,6),a,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,ii),a=ii.x,h=ii.y,_+=6;break;default:return si.error(`command: ${r} [index:${_}]`,t),g}n=r}return g},objectToCanvasData(t){if(t[0].name.length>1)return ws.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vs,t.x,t.y);break;case"L":e.push(Ss,t.x,t.y);break;case"C":e.push(Ts,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Es,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(zs)}}),e}},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){ni.index===ni.length&&(ni.index=1,t.push(ni.name)),t.push(Number(e)),ni.index++,ni.dot=0}},{current:ni,pushData:oi,copyData:ai}=ri,{M:hi,L:li,C:di,Q:ci,Z:ui,N:_i,D:pi,X:gi,G:fi,F:yi,O:mi,P:xi,U:wi}=De,{getMinDistanceFrom:vi,getRadianFrom:bi}=ht,{tan:Si,min:ki,abs:Bi}=Math,Ri={},Ci={beginPath(t){t.length=0},moveTo(t,e,s){t.push(hi,e,s)},lineTo(t,e,s){t.push(li,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(di,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(ci,e,s,i,r)},closePath(t){t.push(ui)},rect(t,e,s,i,r){t.push(_i,e,s,i,r)},roundRect(t,e,s,i,r,n){if(a(n))t.push(gi,e,s,i,r,n);else{const o=W.fourNumber(n);o?t.push(pi,e,s,i,r,...o):t.push(_i,e,s,i,r)}},ellipse(t,e,s,i,n,o,a,h,l){if(i===n)return Ti(t,e,s,i,a,h,l);r(o)?t.push(yi,e,s,i,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(fi,e,s,i,n,o,a,h,l?1:0))},arc(t,e,s,i,n,o,a){r(n)?t.push(xi,e,s,i):(r(n)&&(n=0),r(o)&&(o=360),t.push(mi,e,s,i,n,o,a?1:0))},arcTo(t,e,s,r,n,o,a,h,l){if(!i(a)){const t=vi(a,h,e,s,r,n)/(l?1:2);o=ki(o,ki(t,t*Bi(Si(bi(a,h,e,s,r,n)/2))))}t.push(wi,e,s,r,n,o)},drawEllipse(t,e,s,i,n,o,a,h,l){ds.ellipse(null,e,s,i,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Ri),t.push(hi,Ri.x,Ri.y),Pi(t,e,s,i,n,o,a,h,l)},drawArc(t,e,s,i,n,o,a){ds.arc(null,e,s,i,r(n)?0:n,r(o)?360:o,a,null,null,Ri),t.push(hi,Ri.x,Ri.y),Ti(t,e,s,i,n,o,a)},drawPoints(t,e,s,i){ds.points(t,e,s,i)}},{ellipse:Pi,arc:Ti}=Ci,{moveTo:Li,lineTo:Oi,quadraticCurveTo:Ai,bezierCurveTo:Ei,closePath:Ii,beginPath:Wi,rect:Mi,roundRect:Di,ellipse:Fi,arc:zi,arcTo:Ni,drawEllipse:Yi,drawArc:Xi,drawPoints:Ui}=Ci;class ji{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?We.parse(t):t:[],this}beginPath(){return Wi(this.__path),this.paint(),this}moveTo(t,e){return Li(this.__path,t,e),this.paint(),this}lineTo(t,e){return Oi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,n){return Ei(this.__path,t,e,s,i,r,n),this.paint(),this}quadraticCurveTo(t,e,s,i){return Ai(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ii(this.__path),this.paint(),this}rect(t,e,s,i){return Mi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Di(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,n,o,a){return Fi(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}arc(t,e,s,i,r,n){return zi(this.__path,t,e,s,i,r,n),this.paint(),this}arcTo(t,e,s,i,r){return Ni(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,n,o,a){return Yi(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}drawArc(t,e,s,i,r,n){return Xi(this.__path,t,e,s,i,r,n),this.paint(),this}drawPoints(t,e,s){return Ui(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Vi,L:Hi,C:qi,Q:Gi,Z:Ji,N:Qi,D:$i,X:Zi,G:Ki,F:tr,O:er,P:sr,U:ir}=De,rr=ie.get("PathDrawer"),nr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Vi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Hi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case qi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Gi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ji:t.closePath(),i+=1;break;case Qi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case $i:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Zi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ki:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*D,e[i+6]*D,e[i+7]*D,e[i+8]),i+=9;break;case tr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,F,!1),i+=5;break;case er:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*D,e[i+5]*D,e[i+6]),i+=7;break;case sr:t.arc(e[i+1],e[i+2],e[i+3],0,F,!1),i+=4;break;case ir:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void rr.error(`command: ${s} [index:${i}]`,e)}}},{M:or,L:ar,C:hr,Q:lr,Z:dr,N:cr,D:ur,X:_r,G:pr,F:gr,O:fr,P:yr,U:mr}=De,{toTwoPointBounds:xr,toTwoPointBoundsByQuadraticCurve:wr,arcTo:vr,arc:br,ellipse:Sr}=ds,{addPointBounds:kr,copy:Br,addPoint:Rr,setPoint:Cr,addBounds:Pr,toBounds:Tr}=mt,Lr=ie.get("PathBounds");let Or,Ar,Er;const Ir={},Wr={},Mr={},Dr={toBounds(t,e){Dr.toTwoPointBounds(t,Wr),Tr(Wr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Cr(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===dr||o===hr||o===lr?Cr(e,h,l):Cr(e,t[a+1],t[a+2])),o){case or:case ar:h=t[a+1],l=t[a+2],Rr(e,h,l),a+=3;break;case hr:r=t[a+5],n=t[a+6],xr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Ir),kr(e,Ir),h=r,l=n,a+=7;break;case lr:s=t[a+1],i=t[a+2],r=t[a+3],n=t[a+4],wr(h,l,s,i,r,n,Ir),kr(e,Ir),h=r,l=n,a+=5;break;case dr:a+=1;break;case cr:h=t[a+1],l=t[a+2],Pr(e,h,l,t[a+3],t[a+4]),a+=5;break;case ur:case _r:h=t[a+1],l=t[a+2],Pr(e,h,l,t[a+3],t[a+4]),a+=o===ur?9:6;break;case pr:Sr(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],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=9;break;case gr:h=t[a+1],l=t[a+2],Ar=t[a+3],Er=t[a+4],Pr(e,h-Ar,l-Er,2*Ar,2*Er),h+=Ar,a+=5;break;case fr:br(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=7;break;case yr:h=t[a+1],l=t[a+2],Or=t[a+3],Pr(e,h-Or,l-Or,2*Or,2*Or),h+=Or,a+=4;break;case mr:vr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ir,Mr),0===a?Br(e,Ir):kr(e,Ir),h=Mr.x,l=Mr.y,a+=6;break;default:return void Lr.error(`command: ${o} [index:${a}]`,t)}}},{M:Fr,L:zr,Z:Nr}=De,{getCenterX:Yr,getCenterY:Xr}=ht,{arcTo:Ur}=Ci,jr={smooth(t,e,s){let i,r,n,o=0,a=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;o<f;){switch(i=t[o],i){case Fr:l=p=t[o+1],c=g=t[o+2],o+=3,t[o]===zr?(u=t[o+1],_=t[o+2],y?m.push(Fr,l,c):m.push(Fr,Yr(l,u),Xr(c,_))):m.push(Fr,l,c);break;case zr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case zr:Ur(m,a,h,t[o+1],t[o+2],e,p,g,y);break;case Nr:Ur(m,a,h,l,c,e,p,g,y);break;default:m.push(zr,a,h)}p=a,g=h;break;case Nr:r!==Nr&&(Ur(m,l,c,u,_,e,p,g,y),m.push(Nr)),o+=1;break;default:n=Ue[i];for(let e=0;e<n;e++)m.push(t[o+e]);o+=n}r=i}return i!==Nr&&(m[1]=l,m[2]=c),m}};function Vr(t){return new ji(t)}const Hr=Vr();We.creator=Vr(),We.parse=ri.parse,We.convertToCanvasData=ri.toCanvasData;const{drawRoundRect:qr}=je;function Gr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){qr(this,t,e,s,i,r)})}(t)}const Jr={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=Qr.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{}}}},Qr=Jr;Qr.mineType=Qr.mimeType,Qr.alphaPixelTypes.forEach(t=>Qr.upperCaseTypeMap[t]=t.toUpperCase());const $r=ie.get("TaskProcessor");class Zr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return we(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){$r.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Kr{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 i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e,s){let r,n,o,h;const l=new Zr(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,r=e.start,o=e.time,h=e.delay,s||(s=e.canUse)),o&&(l.time=o),!1===n&&(l.parallel=!1),s&&(l.canUse=s),i(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},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:i}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=i+e.parallel;if(r>s.length&&(r=s.length),e.parallel>1)for(let e=i;e<r&&(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,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 tn=ie.get("Resource"),en={tasker:new Kr,queue:new Kr({parallel:1}),map:{},get isComplete(){return sn.tasker.isComplete},set(t,e){sn.map[t]&&tn.repeat(t),sn.map[t]=e},get:t=>sn.map[t],remove(t){const e=sn.map[t];e&&(e.destroy&&e.destroy(),delete sn.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return n(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=ce.image(i)),sn.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){sn.map={}}},sn=en,rn={maxRecycled:10,recycledList:[],patternTasker:en.queue,get(t,e){let s=en.get(t.url);return s||en.set(t.url,s="film"===e?ce.film(t):ce.image(t)),s.use++,s},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(te.image.isLarge(t)?t.url&&en.remove(t.url):(t.clearLevels(),nn.recycledList.push(t)))})},recyclePaint(t){nn.recycle(t.image)},clearRecycled(t){const e=nn.recycledList;(e.length>nn.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&en.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Jr.alphaPixelTypes.some(e=>nn.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:"+Jr.mimeType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Jr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},nn=rn,{IMAGE:on,create:an}=y;class hn{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return i(t)?te.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=an(on),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}rn.isFormat("svg",t)&&(this.isSVG=!0),rn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,s){return this.loading||(this.loading=!0,en.tasker.add(()=>we(this,void 0,void 0,function*(){return yield te.origin["load"+this.tag](this.getLoadUrl(s),this.crossOrigin,this).then(t=>{s&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,s,i,r,n,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=te.image.resize(this.view,t,e,r,n,void 0,o,s,i,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,s,i){const r=te.canvas.createPattern(t,e);return te.image.setPatternTransform(r,s,i),r}render(t,e,s,i,r,n,o,a,h){t.drawImage(this.view,e,s,i,r)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,s){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class ln extends hn{get tag(){return"Film"}}class dn extends hn{get tag(){return"Video"}}function cn(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function un(t,e){return Object.getOwnPropertyDescriptor(t,e)}function _n(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function pn(t,e){return(s,i)=>fn(s,i,t,e&&e(i))}function gn(t){return t}function fn(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};cn(t,e,Object.assign(r,i||{})),Vn(t,e,s)}function yn(t){return pn(t)}function mn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function xn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function wn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Bn(this))}}))}function vn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function bn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Sn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s,e)&&Bn(this)}}))}function kn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(Bn(this),this.__.__removeNaturalSize())}}))}function Bn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Rn(t){return pn(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Bn(this)}}))}const Cn=Sn;function Pn(t,e){return pn(t,t=>({set(s){this.__setAttr(t,s)&&(Tn(this),e&&(this.__.__useStroke=!0))}}))}function Tn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Bn(t)}const Ln=Pn;function On(t){return pn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function An(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function En(t){return pn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function In(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Mn(this)}}))}function Wn(t){return pn(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Dn(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Dn(this,t,e,s),this.mask&&Mn(this)}}))}function Mn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Dn(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Bn(t))}function Fn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__layout.childrenSortChange()})}}))}function zn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Nn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Yn(t){return pn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Xn(t){return pn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Un(t){return(e,s)=>{cn(e,"__DataProcessor",{get:()=>t})}}function jn(t){return(e,s)=>{cn(e,"__LayoutProcessor",{get:()=>t})}}function Vn(t,e,s){const r=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=_n(e,s);if(i(s))a.get=function(){return this[n]};else if("function"==typeof s)a.get=function(){const t=this[n];return null==t?s(this.__leaf):t};else if(c(s)){const t=_(s);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=r;for(;!l&&d;)l=un(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),r[o]&&(a.set=r[o],delete r[o]),cn(r,e,a)}const Hn=new ie("rewrite"),qn=[],Gn=["destroy","constructor"];function Jn(t){return(e,s)=>{qn.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Qn(){return t=>{$n()}}function $n(t){qn.length&&(qn.forEach(e=>{t&&Hn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),qn.length=0)}function Zn(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(Gn.includes(i)||e&&e.includes(i)))if(t.prototype){un(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Kn(){return t=>{_e.register(t)}}function to(){return t=>{fe.register(t)}}setTimeout(()=>$n(!0));const{copy:eo,toInnerPoint:so,toOuterPoint:io,scaleOfOuter:ro,rotateOfOuter:no,skewOfOuter:oo,multiplyParent:ao,divideParent:ho,getLayout:lo}=Q,co={},{round:uo}=Math,_o={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),fo(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)go(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)yo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&yo(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&po.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(xo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)mo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,s,i,r,n){i||(i=t.__nowWorld),t.__worldFlipped||te.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,n):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},renderComplex(t,e,s){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,s=0,i,r){const n=c(e)?Object.assign({},e):{x:e,y:s};i?io(t.localTransform,n,n,!0):t.parent&&so(t.parent.scrollWorldTransform,n,n,!0),po.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,s=0,i){c(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=uo(e),s=uo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,n){po.zoomOfLocal(t,wo(t,e),s,i,r,n)},zoomOfLocal(t,e,s,i=s,r,n){const o=t.__localMatrix;if(a(i)||(i&&(n=i),i=s),eo(co,o),ro(co,e,s,i),po.hasHighPosition(t))po.setTransform(t,co,r,n);else{const e=t.x+co.e-o.e,a=t.y+co.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},n):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){po.rotateOfLocal(t,wo(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;eo(co,r),no(co,e,s),po.hasHighPosition(t)?po.setTransform(t,co,!1,i):t.set({x:t.x+co.e-r.e,y:t.y+co.f-r.f,rotation:W.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,n){po.skewOfLocal(t,wo(t,e),s,i,r,n)},skewOfLocal(t,e,s,i=0,r,n){eo(co,t.__localMatrix),oo(co,e,s,i),po.setTransform(t,co,r,n)},transformWorld(t,e,s,i){eo(co,t.worldTransform),ao(co,e),t.parent&&ho(co,t.parent.scrollWorldTransform),po.setTransform(t,co,s,i)},transform(t,e,s,i){eo(co,t.localTransform),ao(co,e),po.setTransform(t,co,s,i)},setTransform(t,e,s,i){const r=t.__,n=r.origin&&po.getInnerOrigin(t,r.origin),o=lo(e,n,r.around&&po.getInnerOrigin(t,r.around));if(po.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),s){const e=o.scaleX/t.scaleX,s=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Ut.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=po.getInnerOrigin(t,r.origin);ht.move(o,n.x-i.x,n.y-i.y)}t.set(o),t.scaleResize(e,s,!1)}else t.set(o,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return ro(s,po.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>ht.tempToOuterOf(po.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return St.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(eo(co,t.worldTransform),ho(co,e.scrollWorldTransform),s?co:Object.assign({},co)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,s,i){t.setTransform(po.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||po.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,s=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const i=e.x*s,r=e.y*s;e.x-=i,e.y-=r,t.move(i,r),te.requestRender(()=>po.animateMove(t,e,s))}}},po=_o,{updateAllMatrix:go,updateMatrix:fo,updateAllWorldOpacity:yo,updateAllChange:mo,updateChange:xo}=po;function wo(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const vo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds(t){const{__:e,__layout:s}=t;return e.eraser||0===e.visible?null:s.localOuterBounds||s.localRenderBounds},maskLocalBoxBounds:(t,e)=>So(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>So(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:s}=t;return So(t,e)&&(s.localOuterBounds||s.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let bo;function So(t,e){return e||(bo=0),t.__.mask&&(bo=1),bo<0?null:(bo&&(bo=-1),!0)}const{updateBounds:ko}=_o,Bo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Ro(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Co(e[t],e)},updateBounds(t,e){const s=[t];Co(t,s),Po(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)ko(i[t]);e&&e===s||ko(s)}},move(t,e,s){let i;const{children:r}=t;for(let n=0,o=r.length;n<o;n++)i=(t=r[n]).__world,i.e+=e,i.f+=s,i.x+=e,i.y+=s,t.isBranch&&To(t,e,s)},scale(t,e,s,i,r,n,o){let a;const{children:h}=t,l=i-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=i,a.d*=r,(a.b||a.c)&&(a.b*=i,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-n)*l+e,a.y=a.f+=(a.f-o)*d+s):(a.e+=(a.e-n)*l+e,a.f+=(a.f-o)*d+s,a.x+=(a.x-n)*l+e,a.y+=(a.y-o)*d+s),a.width*=i,a.height*=r,a.scaleX*=i,a.scaleY*=r,t.isBranch&&Lo(t,e,s,i,r,n,o)}},{pushAllChildBranch:Ro,pushAllBranchStack:Co,updateBoundsByBranchStack:Po,move:To,scale:Lo}=Bo,Oo={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Ao,updateBounds:Eo}=_o,{toOuterOf:Io,getPoints:Wo,copy:Mo}=Ut,Do="_localContentBounds",Fo="_worldContentBounds",zo="_worldBoxBounds",No="_worldStrokeBounds";class Yo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Io(this.contentBounds,this.leaf.__localMatrix,this[Do]||(this[Do]={})),this[Do]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Io(this.contentBounds,this.leaf.__world,this[Fo]||(this[Fo]={})),this[Fo]}get worldBoxBounds(){return Io(this.boxBounds,this.leaf.__world,this[zo]||(this[zo]={})),this[zo]}get worldStrokeBounds(){return Io(this.strokeBounds,this.leaf.__world,this[No]||(this[No]={})),this[No]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Eo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,te.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Ao(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),n=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,n=Q.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),n=Ao(i,e,!0)}if(o||(o=Q.getLayout(n)),Mo(o,a),ht.copy(o,r),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(o.scaleX/=s,o.scaleY/=i,o.width*=s,o.height*=i)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Wo(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:n=e}return i(n)||r.forEach(t=>s.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Xo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&te.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&te.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&te.event.stop(this.origin)}}class Uo extends Xo{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Uo.ADD="child.add",Uo.REMOVE="child.remove",Uo.CREATED="created",Uo.MOUNTED="mounted",Uo.UNMOUNTED="unmounted",Uo.DESTROY="destroy";const jo="property.scroll";class Vo extends Xo{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Vo.CHANGE="property.change",Vo.LEAFER_CHANGE="property.leafer_change",Vo.SCROLL=jo;const Ho={scrollX:jo,scrollY:jo};class qo extends Xo{constructor(t,e){super(t),Object.assign(this,e)}}qo.LOAD="image.load",qo.LOADED="image.loaded",qo.ERROR="image.error";class Go extends Xo{static checkHas(t,e,s){"on"===s?e===Zo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Jo)||t.hasEvent(Qo)||t.hasEvent($o),t.__hasWorldEvent=t.hasEvent(Zo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Jo,t),"inner"===e&&t.emit(Qo,t)),t.emit($o,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Zo,t)}}Go.RESIZE="bounds.resize",Go.INNER="bounds.inner",Go.LOCAL="bounds.local",Go.WORLD="bounds.world";const{RESIZE:Jo,INNER:Qo,LOCAL:$o,WORLD:Zo}=Go,Ko={};[Jo,Qo,$o,Zo].forEach(t=>Ko[t]=1);class ta extends Xo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(ta.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}ta.RESIZE="resize";class ea extends Xo{constructor(t,e){super(t),this.data=e}}ea.REQUEST="watch.request",ea.DATA="watch.data";class sa extends Xo{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}sa.REQUEST="layout.request",sa.START="layout.start",sa.BEFORE="layout.before",sa.LAYOUT="layout",sa.AFTER="layout.after",sa.AGAIN="layout.again",sa.END="layout.end";class ia extends Xo{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}ia.REQUEST="render.request",ia.CHILD_START="render.child_start",ia.CHILD_END="render.child_end",ia.START="render.start",ia.BEFORE="render.before",ia.RENDER="render",ia.AFTER="render.after",ia.AGAIN="render.again",ia.END="render.end",ia.NEXT="render.next";class ra extends Xo{}ra.START="leafer.start",ra.BEFORE_READY="leafer.before_ready",ra.READY="leafer.ready",ra.AFTER_READY="leafer.after_ready",ra.VIEW_READY="leafer.view_ready",ra.VIEW_COMPLETED="leafer.view_completed",ra.STOP="leafer.stop",ra.RESTART="leafer.restart",ra.END="leafer.end",ra.UPDATE_MODE="leafer.update_mode",ra.TRANSFORM="leafer.transform",ra.MOVE="leafer.move",ra.SCALE="leafer.scale",ra.ROTATE="leafer.rotate",ra.SKEW="leafer.skew";const{MOVE:na,SCALE:oa,ROTATE:aa,SKEW:ha}=ra,la={x:na,y:na,scaleX:oa,scaleY:oa,rotation:aa,skewX:ha,skewY:ha},da={};class ca{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)d(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,o;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const a=ua(this,i,!0),h=n(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):a[t]=[l],Ko[t]&&Go.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=n(t)?t.split(" "):t;if(e){let t,r,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=ua(this,t);i.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],Ko[t]&&Go.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&fe.has(t)&&(e=fe.get(t,{type:t,target:this,current:this}));const i=ua(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&!((r=i[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,n=s&&s[t],o=r&&r[t];return!!(i(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ua(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:da)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:da)}}const{on:_a,on_:pa,off:ga,off_:fa,once:ya,emit:ma,emitEvent:xa,hasEvent:wa,destroy:va}=ca.prototype,ba={on:_a,on_:pa,off:ga,off_:fa,once:ya,emit:ma,emitEvent:xa,hasEvent:wa,destroyEventer:va},Sa=ie.get("setAttr"),ka={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!s||o(e)||i(e)||(Sa.warn(this.innerName,t,e),e=void 0),c(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Vo(Vo.LEAFER_CHANGE,this,t,r,e));const s=la[t];s&&(this.emitEvent(new ra(s,this)),this.emitEvent(new ra(ra.TRANSFORM,this)))}this.emitPropertyEvent(Vo.CHANGE,t,r,e);const s=Ho[t];return s&&this.emitPropertyEvent(s,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new Vo(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ba,multiplyParent:Ra,translateInner:Ca,defaultWorld:Pa}=Q,{toPoint:Ta,tempPoint:La}=St,Oa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;Ra(this.__local||e,t?t.__scrollWorld||t.__world:Pa,s,!!e.affectScaleOrRotation,r),i&&Ca(Object.assign(i,s),r.scrollX,r.scrollY),e.scaleFixed&&_o.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Ba(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Ta(s.around||s.origin,t.boxBounds,La),Ca(e,-La.x,-La.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Aa,updateAllMatrix:Ea}=_o,{updateBounds:Ia}=Bo,{toOuterOf:Wa,copyAndSpread:Ma,copy:Da}=Ut,{toBounds:Fa}=Dr,za={__updateWorldBounds(){const{__layout:t,__world:e}=this;Wa(t.renderBounds,e,e),this.__hasComplex&&_o.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Go.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Go.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&!t.strokeChanged&&(t.strokeChanged=!!t.boxChanged||2),t.renderSpread&&!t.renderChanged&&(t.renderChanged=!!t.boxChanged||2),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(2===t.strokeChanged?this.__updateLocalStrokeBounds():(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.resized="inner",(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0)),t.strokeChanged=void 0,this.parent&&this.parent.__layout.strokeChange()),t.renderChanged&&(2===t.renderChanged?this.__updateLocalRenderBounds():(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel()),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.outerScale&&_o.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Wa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Wa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Wa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Fa(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ea(this),Ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ea(this),Ia(this,this))):Aa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;a(s)&&s<=0?Da(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,s)}},Na={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.ignoreOpacity?1:e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),_o.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ya}=vo,{hasSize:Xa}=Ut,Ua={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const s=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Xa(s)){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(r,s,s,i.__blendMode,!0),r.recycle(s)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let s;const{children:i}=this;for(let r=0,n=i.length;r<n;r++)s=i[r],Ya(s,e)||(s.__hasComplex?_o.renderComplex(s,t,e):s.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ya(s[i],e)||s[i].__clip(t,e)}}},{LEAF:ja,create:Va}=y,{stintSet:Ha}=p,{toInnerPoint:qa,toOuterPoint:Ga,multiplyParent:Ja}=Q,{toOuterOf:Qa}=Ut,{copy:$a,move:Za}=ht,{getScaleFixedData:Ka}=W,{moveLocal:th,zoomOfLocal:eh,rotateOfLocal:sh,skewOfLocal:ih,moveWorld:rh,zoomOfWorld:nh,rotateOfWorld:oh,skewOfWorld:ah,transform:hh,transformWorld:lh,setTransform:dh,getFlipTransform:ch,getLocalOrigin:uh,getRelativeWorld:_h,drop:ph}=_o;let gh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Yo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Va(ja),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Uo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Uo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Uo.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Uo.MOUNTED),t.cacheId&&_o.cacheId(this)):this.__emitLifeEvent(Uo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ja(s,t.matrix,e,void 0,s),Qa(this.__layout.renderBounds,e,e),Ha(e,"half",s.half),Ha(e,"ignorePixelSnap",s.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e,s=!0){return Ka(rn.patternLocked?this.__world:this.__nowWorld||this.__world,e,s,t)}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?_h(this,e):this.worldTransform,r=s?t:{};return Qa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&$a(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&$a(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),qa(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){Ga(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){const r=this.getInnerPoint(t,e,s,i);return s?r:this.getBoxPointByInner(r,null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Za(r,-n,-o),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Za(r,n,o),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){dh(this,t,e,s)}transform(t,e,s){hh(this,t,e,s)}move(t,e,s){th(this,t,e,s)}moveInner(t,e,s){rh(this,t,e,!0,s)}scaleOf(t,e,s,i,r){eh(this,uh(this,t),e,s,i,r)}rotateOf(t,e,s){sh(this,uh(this,t),e,s)}skewOf(t,e,s,i,r){ih(this,uh(this,t),e,s,i,r)}transformWorld(t,e,s){lh(this,t,e,s)}moveWorld(t,e,s){rh(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){nh(this,t,e,s,i,r)}rotateOfWorld(t,e){oh(this,t,e)}skewOfWorld(t,e,s,i,r){ah(this,t,e,s,i,r)}flip(t,e){hh(this,ch(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(t){}getMotionPathData(){return de.need("path")}getMotionPoint(t){return de.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){ph(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Vn(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=Sn),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Uo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Uo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};gh=xe([Zn(ka),Zn(Oa),Zn(za),Zn(ba),Zn(Na)],gh);const{setListWithFn:fh}=Ut,{sort:yh}=Bo,{localBoxBounds:mh,localStrokeBounds:xh,localRenderBounds:wh,maskLocalBoxBounds:vh,maskLocalStrokeBounds:bh,maskLocalRenderBounds:Sh}=vo,kh=new ie("Branch");let Bh=class extends gh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){let t;const{children:e}=this;for(let s=0,i=e.length;s<i;s++)if(t=e[s].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){fh(e||this.__layout.boxBounds,this.children,this.__hasMask?vh:mh)}__updateStrokeBounds(t){fh(t||this.__layout.strokeBounds,this.children,this.__hasMask?bh:xh)}__updateRenderBounds(t){fh(t||this.__layout.renderBounds,this.children,this.__hasMask?Sh:wh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(yh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return kh.warn("add self or destroyed");const s=i(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),s||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Uo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Uo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):i(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Uo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Uo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Uo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Bh=xe([Zn(Ua)],Bh);class Rh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,n=e.length;r<n;r++)i(s)?e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;i(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Rh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ch{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Ph="2.1.3";class Th extends Ie{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(n(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=te.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&te.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:s,pixelRatio:i}=this.config,r={width:e||t.width,height:s||t.height,pixelRatio:i};this.resize(r),this.context&&(this.viewSelect&&(te.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,s,i,r){this.context.roundRect(t,e,s,i,a(r)?[r]:r)}),Gr(this.context.__proto__))}__createView(){this.view=te.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:s}=this;this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(t){this.viewSelect&&te.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,this.updateViewSize(),t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),te.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:s}=this,i={width:t,height:e,pixelRatio:s};this.isSameSize(i)||this.emitResize(i)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,te.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};p.copyAttrs(e,this,Ee),this.resize(t),i(this.width)||this.resizeListener(new ta(t,e))}}function Lh(t,e){te.origin={createCanvas:(t,s,i)=>{const r={type:"2d",width:t,height:s};return e.createOffscreenCanvas?e.createOffscreenCanvas(r):e.createOffScreenCanvas(r)},canvasToDataURL:(t,e,s)=>t.toDataURL(Jr.mimeType(e),s),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>{let i=t.toDataURL(Jr.mimeType(Jr.fileType(e)),s);return i=i.substring(i.indexOf("64,")+3),te.origin.download(i,e)},download:(t,s)=>new Promise((i,r)=>{let n;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,n=!0);const o=e.getFileSystemManager();o.writeFile({filePath:s,data:t,encoding:"base64",success(){n?te.miniapp.saveToAlbum(s).then(()=>{o.unlink({filePath:s}),i()}):i()},fail(t){r(t)}})}),loadImage:(t,e,s)=>new Promise((e,s)=>{const i=te.getCanvas().view.createImage();i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.src=te.image.getRealURL(t)}),loadContent:(t,s="text")=>new Promise((i,r)=>e.request({url:t,responseType:"arrayBuffer"===s?"arraybuffer":"text",success:t=>i("json"===s&&"string"==typeof t.data?JSON.parse(t.data):t.data),fail:r})),noRepeat:"repeat-x"},te.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const s=t[1];e({x:s.top,y:s.left,width:s.width,height:s.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const s=t[0];e({view:s.node,width:s.width,height:s.height})})}),saveToAlbum:t=>new Promise(s=>{e.getSetting({success:i=>{i.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){s(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){s(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},te.event={stopDefault(t){},stopNow(t){},stop(t){}},te.canvas=ce.canvas(),te.conicGradientSupport=!!te.canvas.context.createConicGradient,cn(te,"devicePixelRatio",{get:()=>Math.max(1,e.getWindowInfo?e.getWindowInfo().pixelRatio:e.getSystemInfoSync().pixelRatio)})}Object.assign(ce,{canvas:(t,e)=>new Th(t,e),image:t=>new hn(t)}),te.name="miniapp",te.getCanvas=function(){const{renderCanvas:t}=te;return t&&t.view?t:te.canvas},te.requestRender=function(t){const{view:e}=te.getCanvas();e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)};class Oh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Rh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Rh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ia.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Uo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ea(ea.DATA,{updatedList:this.updatedList})),this.__updatedList=new Rh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Vo.CHANGE,this.__onAttrChange,this],[[Uo.ADD,Uo.REMOVE],this.__onChildEvent,this],[ea.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ah,updateBounds:Eh,updateChange:Ih}=_o,{pushAllChildBranch:Wh,pushAllParent:Mh}=Bo;const{worldBounds:Dh}=vo;class Fh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new Rh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Dh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:zh,updateAllChange:Nh}=_o,Yh=ie.get("Layouter");class Xh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Ch,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(sa.START),this.layoutOnce(),t.emitEvent(new sa(sa.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ea.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ae.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=sa,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new sa(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(Ah(t,!0),e.add(t),t.isBranch&&Wh(t,e),Mh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||Eh(i[t])}Eh(s)}})}(this.__levelList),function(t){t.list.forEach(Ih)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new sa(n,a,this.times)),s.emitEvent(new sa(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=sa,n=this.getBlocks(new Rh(e));e.emitEvent(new sa(s,n,this.times)),Xh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new sa(i,n,this.times)),e.emitEvent(new sa(r,n,this.times)),this.addBlocks(n),ae.end(t)}static fullLayout(t){zh(t,!0),t.isBranch?Bo.updateBounds(t):_o.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Fh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Fh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[sa.REQUEST,this.layout,this],[sa.AGAIN,this.layoutAgain,this],[ea.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Uh=ie.get("Renderer");class jh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(sa.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ia.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ia.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ia.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Uh.log(e.innerName,"---\x3e");try{this.emitRender(ia.START),this.renderOnce(t),this.emitRender(ia.END,this.totalBounds),rn.clearRecycled()}catch(t){this.rendering=!1,Uh.error(t)}Uh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Uh.warn("rendering");if(this.times>3)return Uh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(ia.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ia.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ia.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ia.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ae.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new qt(i);s.save(),i.spread(jh.clipSpread).ceil();const{ceilPartPixel:n}=this.config;s.clipWorld(i,n),s.clearWorld(i,n),this.__render(i,r),s.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:s,target:i}=this,r=t.includes(i.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&s.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(s,t),this.config.useCellRender&&(n.cellList=this.getCellList()),te.render(i,s,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return te.requestRender(e);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};te.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new qt(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:s}=t;s&&s.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Uh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,s)})}emitRender(t,e,s){this.target.emitEvent(new ia(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[ia.REQUEST,this.update,this],[sa.END,this.__onLayoutEnd,this],[ia.AGAIN,this.renderAgain,this],[ta.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Vh(t){return pn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const s=this.__layout;s.renderChanged||s.renderChange(),s.surfaceChange()}}))}function Hh(t){return pn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function qh(){return(t,e)=>{const s="_"+e;cn(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function Gh(t){return(e,s)=>{cn(e,s,_n(s,t))}}jh.clipSpread=10,Object.assign(ce,{watcher:(t,e)=>new Oh(t,e),layouter:(t,e)=>new Xh(t,e),renderer:(t,e,s)=>new jh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),te.layout=Xh.fullLayout,te.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new Rh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Jh={},Qh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},$h=Qt,Zh={},Kh={},tl={},el={},sl={},il={apply(){de.need("filter")}},rl={},nl={setStyleName:()=>de.need("state"),set:()=>de.need("state")},ol={list:{},register(t,e){ol.list[t]=e},get:t=>ol.list[t]},{parse:al,objectToCanvasData:hl}=ri,{stintSet:ll}=p,{hasTransparent:dl}=Qh,cl={originPaint:{}},ul=ie.get("UIData");class _l extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ul.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ul.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(ll(this,"__isTransparentFill",dl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(ll(this,"__isTransparentStroke",dl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?al(t,this.__useArrow):hl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){pl(this,"shadow",t)}setInnerShadow(t){pl(this,"innerShadow",t)}setFilter(t){pl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Kh.compute("fill",this.__leaf),e&&Kh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeScaleFixed)||(s=t.strokeScaleFixed)),s){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,s,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;ll(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=cl)):(this.__isStrokes=!0,this._stroke||(this._stroke=cl))}__removePaint(t,e){e&&this.__removeInput(t),tl.recycleImage(t,this),"fill"===t?(ll(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ll(this,"__isAlphaPixelStroke",void 0),ll(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function pl(t,e,s){t.__setInput(e,s),d(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class gl extends _l{}class fl extends gl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class yl extends gl{__getInputData(t,e){const s=super.__getInputData(t,e);return Ee.forEach(t=>delete s[t]),s}}class ml extends fl{}class xl extends _l{get __usePathBox(){return this.points||this.__pathInputed}}class wl extends _l{get __boxStroke(){return!this.__pathInputed}}class vl extends _l{get __boxStroke(){return!this.__pathInputed}}class bl extends _l{get __usePathBox(){return this.points||this.__pathInputed}}class Sl extends _l{get __boxStroke(){return!this.__pathInputed}}class kl extends _l{get __pathInputed(){return 2}}class Bl extends gl{}const Rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Cl extends _l{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=Rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=_e.get("Rect",0);const r=e.__layout,n=s.__layout;i||(s.parent=e,s.__world=e.__world,n.boxBounds=r.boxBounds),s.set(t),n.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.textEditing&&delete s.textEditing,s}}class Pl extends wl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url&&delete s.fill,s}}class Tl extends wl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:Ll,add:Ol}=k,Al={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,n=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke||s.__useArrow)){const e=s.__isLinePath?0:("miter"===s.strokeJoin?10:1)*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),n&&(t=Ll(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=sl.getShadowRenderSpread(this,e)),i&&(t=Ll(t,i)),n&&(t=Ol(t,il.getSpread(n))),o&&(t=Ol(t,o)),a&&(t=Ol(t,a));let l=t;return s&&(l=Ll(l,sl.getInnerShadowSpread(this,s))),r&&(l=Ll(l,r)),this.__layout.renderShapeSpread=l,h?Ll(h.__updateRenderSpread(),t):t}},{stintSet:El}=p,Il={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);El(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),El(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;El(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!sl.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(d(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Wl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Kh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&sl.shadow(this,t,h),a&&(i.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),r&&(i.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),o&&this.__drawAfterFill(t,e),d&&sl.innerShadow(this,t,h),n&&!a&&(i.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),c&&il.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Qh.string(e.color))}r&&(i.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(i.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e))}}else i.__pathForRender?Wl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Kh.fills(i,this,t,e):Kh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Kh.strokes(r,this,t,e):Kh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Wl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Kh.stroke(r,t,e,s),i&&Kh.fill(i,t,e,s),n&&t.__drawAfterFill(e,s),r&&!o&&Kh.stroke(r,t,e,s)}const Ml={__drawFast(t,e){let{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(s,i,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,n),t.restore()):t.strokeRect(s+l,i+l,r,n);break;case"outside":t.strokeRect(s-l,i-l,r+h,n+h)}}}};var Dl;let Fl=Dl=class extends gh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Hr.set(this.path=t||[]),t||this.__drawPathByBox(Hr),Hr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}clearProxyData(){}find(t,e){return de.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return de.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Hr.set(s=[]),this.__drawPathByBox(Hr,!e)),t?ri.toCanvasData(s,!0):s}getPathString(t,e,s){return ri.stringify(this.getPath(t,e),s)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||rl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?jr.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&Zh.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&Zh.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,s){e?nr.drawPathByData(t,e):this.__drawPathByBox(t,s)}__drawPathByBox(t,e){const{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(s,i,r,n,a(e)?[e]:e)}else t.rect(s,i,r,n);t.closePath()}drawImagePlaceholder(t,e,s){Kh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){return this.set(t),de.need("animate")}killAnimate(t,e){}export(t,e){return de.need("export")}syncExport(t,e){return de.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Dl.one(e)}static one(t,e,s,i,r){return _e.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Kn()(this)}static registerData(t){Un(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xe([Un(_l)],Fl.prototype,"__",void 0),xe([qh()],Fl.prototype,"zoomLayer",void 0),xe([yn("")],Fl.prototype,"id",void 0),xe([yn("")],Fl.prototype,"name",void 0),xe([yn("")],Fl.prototype,"className",void 0),xe([An("pass-through")],Fl.prototype,"blendMode",void 0),xe([In(1)],Fl.prototype,"opacity",void 0),xe([Wn(!0)],Fl.prototype,"visible",void 0),xe([An(!1)],Fl.prototype,"locked",void 0),xe([En(!1)],Fl.prototype,"dim",void 0),xe([En(!1)],Fl.prototype,"dimskip",void 0),xe([Fn(0)],Fl.prototype,"zIndex",void 0),xe([zn(!1)],Fl.prototype,"mask",void 0),xe([Nn(!1)],Fl.prototype,"eraser",void 0),xe([mn(0,!0)],Fl.prototype,"x",void 0),xe([mn(0,!0)],Fl.prototype,"y",void 0),xe([Sn(100,!0)],Fl.prototype,"width",void 0),xe([Sn(100,!0)],Fl.prototype,"height",void 0),xe([vn(1,!0)],Fl.prototype,"scaleX",void 0),xe([vn(1,!0)],Fl.prototype,"scaleY",void 0),xe([bn(0,!0)],Fl.prototype,"rotation",void 0),xe([bn(0,!0)],Fl.prototype,"skewX",void 0),xe([bn(0,!0)],Fl.prototype,"skewY",void 0),xe([mn(0,!0)],Fl.prototype,"offsetX",void 0),xe([mn(0,!0)],Fl.prototype,"offsetY",void 0),xe([xn(0,!0)],Fl.prototype,"scrollX",void 0),xe([xn(0,!0)],Fl.prototype,"scrollY",void 0),xe([wn()],Fl.prototype,"origin",void 0),xe([wn()],Fl.prototype,"around",void 0),xe([yn(!1)],Fl.prototype,"lazy",void 0),xe([kn(1)],Fl.prototype,"pixelRatio",void 0),xe([On(0)],Fl.prototype,"renderSpread",void 0),xe([Rn()],Fl.prototype,"path",void 0),xe([Cn()],Fl.prototype,"windingRule",void 0),xe([Cn(!0)],Fl.prototype,"closed",void 0),xe([Sn(0)],Fl.prototype,"padding",void 0),xe([Sn(!1)],Fl.prototype,"lockRatio",void 0),xe([Sn()],Fl.prototype,"widthRange",void 0),xe([Sn()],Fl.prototype,"heightRange",void 0),xe([yn(!1)],Fl.prototype,"draggable",void 0),xe([yn()],Fl.prototype,"dragBounds",void 0),xe([yn("auto")],Fl.prototype,"dragBoundsType",void 0),xe([yn(!1)],Fl.prototype,"editable",void 0),xe([Yn(!0)],Fl.prototype,"hittable",void 0),xe([Yn("path")],Fl.prototype,"hitFill",void 0),xe([Ln("path")],Fl.prototype,"hitStroke",void 0),xe([Yn(!1)],Fl.prototype,"hitBox",void 0),xe([Yn(!0)],Fl.prototype,"hitChildren",void 0),xe([Yn(!0)],Fl.prototype,"hitSelf",void 0),xe([Yn()],Fl.prototype,"hitRadius",void 0),xe([Xn("")],Fl.prototype,"cursor",void 0),xe([An()],Fl.prototype,"fill",void 0),xe([Ln(void 0,!0)],Fl.prototype,"stroke",void 0),xe([Ln("inside")],Fl.prototype,"strokeAlign",void 0),xe([Ln(1,!0)],Fl.prototype,"strokeWidth",void 0),xe([Ln(!1)],Fl.prototype,"strokeScaleFixed",void 0),xe([Ln("none")],Fl.prototype,"strokeCap",void 0),xe([Ln("miter")],Fl.prototype,"strokeJoin",void 0),xe([Ln()],Fl.prototype,"dashPattern",void 0),xe([Ln(0)],Fl.prototype,"dashOffset",void 0),xe([Ln(10)],Fl.prototype,"miterLimit",void 0),xe([Cn(0)],Fl.prototype,"cornerRadius",void 0),xe([Cn()],Fl.prototype,"cornerSmoothing",void 0),xe([Vh()],Fl.prototype,"shadow",void 0),xe([Vh()],Fl.prototype,"innerShadow",void 0),xe([Vh()],Fl.prototype,"blur",void 0),xe([Vh()],Fl.prototype,"backgroundBlur",void 0),xe([Vh()],Fl.prototype,"grayscale",void 0),xe([Vh()],Fl.prototype,"filter",void 0),xe([An()],Fl.prototype,"placeholderColor",void 0),xe([yn(100)],Fl.prototype,"placeholderDelay",void 0),xe([yn({})],Fl.prototype,"data",void 0),xe([Jn(gh.prototype.reset)],Fl.prototype,"reset",null),Fl=Dl=xe([Zn(Al),Zn(Il),Qn()],Fl);let zl=class extends Fl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const s=e.children=[];this.children.forEach(e=>e.skipJSON||s.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Nl;xe([Un(gl)],zl.prototype,"__",void 0),xe([Sn(0)],zl.prototype,"width",void 0),xe([Sn(0)],zl.prototype,"height",void 0),zl=xe([Zn(Bh),Kn()],zl);const Yl=ie.get("Leafer");let Xl=Nl=class extends zl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&en.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Nl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=ce.canvas(i);this.__controllers.push(this.renderer=ce.renderer(this,r,i),this.watcher=ce.watcher(this,i),this.layouter=ce.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ce.selector(this),this.interaction=ce.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ce.hitCanvasManager()),this.canvasManager=new me,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Oo.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ra.RESTART):this.emitLeafer(ra.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(ra.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Ee);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const s=p.copyAttrs({},this.canvas,Ee);e.resize(t),this.updateLazyBounds(),this.__onResize(new ta(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Ee),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Jt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ee.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ra.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=p.copyAttrs({},i,Ee);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ra.BEFORE_READY),this.emitLeafer(ra.READY),this.emitLeafer(ra.AFTER_READY),Oo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ra.VIEW_READY),Oo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,o.x+o.width)),s||(r=Math.max(1,o.y+o.height)),this.__doResize({width:i,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Oo.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(ra.VIEW_COMPLETED),Oo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return de.need("view")}getValidMove(t,e,s){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ra(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[ra.START,()=>ae.end(t)],[sa.START,this.updateLazyBounds,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ea.DATA,this.__onWatchData,this],[sa.END,this.__onLayoutEnd,this],[ia.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Nl.list.remove(this);try{this.stop(),this.emitLeafer(ra.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{rn.clearRecycled()},100)}catch(t){Yl.error(t)}}};t?e():setTimeout(e)}};Xl.list=new Rh,xe([Un(yl)],Xl.prototype,"__",void 0),xe([Sn()],Xl.prototype,"pixelRatio",void 0),xe([yn("normal")],Xl.prototype,"mode",void 0),Xl=Nl=xe([Kn()],Xl);let Ul=class extends Fl{get __tag(){return"Rect"}};xe([Un(wl)],Ul.prototype,"__",void 0),Ul=xe([Zn(Ml),Qn(),Kn()],Ul);const{add:jl,includes:Vl,scroll:Hl}=Ut,ql=Ul.prototype,Gl=zl.prototype;let Jl=class extends zl{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const s=this.__,i=this.__layout,{renderBounds:r,boxBounds:n}=i,{overflow:o}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(jl(a,n),Hl(a,s)),this.__updateRectRenderBounds(),t=!Vl(n,a),t&&"show"===o&&jl(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};xe([Un(fl)],Jl.prototype,"__",void 0),xe([Sn(100)],Jl.prototype,"width",void 0),xe([Sn(100)],Jl.prototype,"height",void 0),xe([yn(!1)],Jl.prototype,"resizeChildren",void 0),xe([On("show")],Jl.prototype,"overflow",void 0),xe([Jn(ql.__updateStrokeSpread)],Jl.prototype,"__updateStrokeSpread",null),xe([Jn(ql.__updateRenderSpread)],Jl.prototype,"__updateRectRenderSpread",null),xe([Jn(ql.__updateBoxBounds)],Jl.prototype,"__updateRectBoxBounds",null),xe([Jn(ql.__updateStrokeBounds)],Jl.prototype,"__updateStrokeBounds",null),xe([Jn(ql.__updateRenderBounds)],Jl.prototype,"__updateRectRenderBounds",null),xe([Jn(ql.__updateChange)],Jl.prototype,"__updateRectChange",null),xe([Jn(ql.__render)],Jl.prototype,"__renderRect",null),xe([Jn(Gl.__render)],Jl.prototype,"__renderGroup",null),Jl=xe([Qn(),Kn()],Jl);let Ql=class extends Jl{get __tag(){return"Frame"}get isFrame(){return!0}};xe([Un(ml)],Ql.prototype,"__",void 0),xe([An("#FFFFFF")],Ql.prototype,"fill",void 0),xe([On("hide")],Ql.prototype,"overflow",void 0),Ql=xe([Kn()],Ql);const{moveTo:$l,closePath:Zl,ellipse:Kl}=Ci;let td=class extends Fl{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:s,innerRadius:i,startAngle:r,endAngle:n}=t,o=e/2,a=s/2,h=t.path=[];let l;i?r||n?(i<1?Kl(h,o,a,o*i,a*i,0,r,n,!1):l=!0,Kl(h,o,a,o,a,0,n,r,!0)):(i<1&&(Kl(h,o,a,o*i,a*i),$l(h,e,a)),Kl(h,o,a,o,a,0,360,0,!0)):r||n?($l(h,o,a),Kl(h,o,a,o,a,0,r,n,!1)):Kl(h,o,a,o,a),l||Zl(h),(te.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};xe([Un(vl)],td.prototype,"__",void 0),xe([Cn(0)],td.prototype,"innerRadius",void 0),xe([Cn(0)],td.prototype,"startAngle",void 0),xe([Cn(0)],td.prototype,"endAngle",void 0),td=xe([Kn()],td);const{sin:ed,cos:sd,PI:id}=Math,{moveTo:rd,lineTo:nd,closePath:od,drawPoints:ad}=Ci;let hd=class extends Fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ad(e,t.points,t.curve,t.closed);else{const{width:s,height:i,sides:r,startAngle:n}=t,o=s/2,a=i/2;let h,l=0;n?(l=n*D,rd(e,o+o*ed(l),a-a*sd(l))):rd(e,o,0);for(let t=1;t<r;t++)h=2*t*id/r+l,nd(e,o+o*ed(h),a-a*sd(h));od(e)}}};xe([Un(bl)],hd.prototype,"__",void 0),xe([Cn(3)],hd.prototype,"sides",void 0),xe([Cn(0)],hd.prototype,"startAngle",void 0),xe([Cn()],hd.prototype,"points",void 0),xe([Cn(0)],hd.prototype,"curve",void 0),hd=xe([Qn(),Kn()],hd);const{sin:ld,cos:dd,PI:cd}=Math,{moveTo:ud,lineTo:_d,closePath:pd}=Ci;let gd=class extends Fl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i,startAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];let h,l=0;r?(l=r*D,ud(a,n+n*ld(l),o-o*dd(l))):ud(a,n,0);for(let t=1;t<2*s;t++)h=t*cd/s+l,_d(a,n+(t%2==0?n:n*i)*ld(h),o-(t%2==0?o:o*i)*dd(h));pd(a)}};xe([Un(Sl)],gd.prototype,"__",void 0),xe([Cn(5)],gd.prototype,"corners",void 0),xe([Cn(.382)],gd.prototype,"innerRadius",void 0),xe([Cn(0)],gd.prototype,"startAngle",void 0),gd=xe([Kn()],gd);const{moveTo:fd,lineTo:yd,drawPoints:md}=Ci,{rotate:xd,getAngle:wd,getDistance:vd,defaultPoint:bd}=ht;let Sd=class extends Fl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&xd(s,e),s}set toPoint(t){this.width=vd(bd,t),this.rotation=wd(bd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?md(e,t.points,t.curve,t.closed):(fd(e,0,0),yd(e,this.width,0))}};xe([Un(xl)],Sd.prototype,"__",void 0),xe([Pn("center")],Sd.prototype,"strokeAlign",void 0),xe([Sn(0)],Sd.prototype,"height",void 0),xe([Cn()],Sd.prototype,"points",void 0),xe([Cn(0)],Sd.prototype,"curve",void 0),xe([Cn(!1)],Sd.prototype,"closed",void 0),Sd=xe([Kn()],Sd);let kd=class extends Ul{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};xe([Un(Pl)],kd.prototype,"__",void 0),xe([Sn("")],kd.prototype,"url",void 0),kd=xe([Kn()],kd);const Bd=kd;let Rd=class extends Ul{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ce.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new hn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new qo(qo.LOADED,{image:t}))})}draw(t,e,s,i){const r=new ft(t.worldTransform).invert(),n=new ft;e&&n.translate(e.x,e.y),s&&(a(s)?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xe([Un(Tl)],Rd.prototype,"__",void 0),xe([Hh(100)],Rd.prototype,"width",void 0),xe([Hh(100)],Rd.prototype,"height",void 0),xe([Hh(1)],Rd.prototype,"pixelRatio",void 0),xe([Hh(!0)],Rd.prototype,"smooth",void 0),xe([yn(!1)],Rd.prototype,"safeResize",void 0),xe([Hh()],Rd.prototype,"contextSettings",void 0),Rd=xe([Kn()],Rd);const{copyAndSpread:Cd,includes:Pd,setList:Td}=Ut,{stintSet:Ld}=p;let Od=class extends Fl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=$h.number(e,r),t.__letterSpacing=$h.number(s,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${i||"caption"}`,Ld(t,"__padding",l&&W.fourNumber(l)),Ld(t,"__clipText","show"!==h&&!t.__autoSize),Ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&(e.renderChanged=!0),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,s,i,r]=t.__padding;n&&(h.x-=r,h.width+=s+r),o&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!Pd(h,a)),this.isOverflow?(Td(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:s}=this.__;return e<s&&(t=k.max(t,(s-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Cd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};xe([Un(Cl)],Od.prototype,"__",void 0),xe([Sn(0)],Od.prototype,"width",void 0),xe([Sn(0)],Od.prototype,"height",void 0),xe([An()],Od.prototype,"boxStyle",void 0),xe([yn(!1)],Od.prototype,"resizeFontSize",void 0),xe([An("#000000")],Od.prototype,"fill",void 0),xe([Pn("outside")],Od.prototype,"strokeAlign",void 0),xe([Yn("all")],Od.prototype,"hitFill",void 0),xe([Sn("")],Od.prototype,"text",void 0),xe([Sn("")],Od.prototype,"placeholder",void 0),xe([Sn("caption")],Od.prototype,"fontFamily",void 0),xe([Sn(12)],Od.prototype,"fontSize",void 0),xe([Sn("normal")],Od.prototype,"fontWeight",void 0),xe([Sn(!1)],Od.prototype,"italic",void 0),xe([Sn("none")],Od.prototype,"textCase",void 0),xe([Sn("none")],Od.prototype,"textDecoration",void 0),xe([Sn(0)],Od.prototype,"letterSpacing",void 0),xe([Sn({type:"percent",value:1.5})],Od.prototype,"lineHeight",void 0),xe([Sn(0)],Od.prototype,"paraIndent",void 0),xe([Sn(0)],Od.prototype,"paraSpacing",void 0),xe([Sn("x")],Od.prototype,"writingMode",void 0),xe([Sn("left")],Od.prototype,"textAlign",void 0),xe([Sn("top")],Od.prototype,"verticalAlign",void 0),xe([Sn(!0)],Od.prototype,"autoSizeAlign",void 0),xe([Sn("normal")],Od.prototype,"textWrap",void 0),xe([Sn("show")],Od.prototype,"textOverflow",void 0),xe([An(!1)],Od.prototype,"textEditing",void 0),Od=xe([Kn()],Od);let Ad=class extends Fl{get __tag(){return"Path"}};xe([Un(kl)],Ad.prototype,"__",void 0),xe([Pn("center")],Ad.prototype,"strokeAlign",void 0),Ad=xe([Kn()],Ad);let Ed=class extends zl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Ad(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,n){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,n,o,a){return this}drawArc(t,e,s,i,r,n){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};function Id(t,e,s){t.__.__font?Kh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Wd(t,e,s,i,r){const n=s.__;c(t)?Kh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,n.__strokeWidth*e,n),i.stroke()),n.__useArrow&&Kh.strokeArrow(t,s,i,r)}function Md(t,e,s,i,r){const n=s.__;c(t)?Kh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,n.__strokeWidth*e,n),Kh.drawTextStroke(s,i,r))}function Dd(t,e,s,i,r){const n=i.getSameCanvas(!0,!0);n.font=s.__.__font,Md(t,2,s,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Kh.fillText(s,n,r),n.blendMode="normal",_o.copyCanvasByWorld(s,i,n),n.recycle(s.__nowWorld)}xe([Un(Bl)],Ed.prototype,"__",void 0),xe([(t,e)=>{cn(t,e,{get(){return this.__path}})}],Ed.prototype,"path",void 0),Ed=xe([Zn(ji,["set","path","paint"]),Kn()],Ed);const{getSpread:Fd,copyAndSpread:zd,toOuterOf:Nd,getOuterOf:Yd,getByMove:Xd,move:Ud,getIntersectData:jd}=Ut,Vd={};let Hd;const{stintSet:qd}=p,{hasTransparent:Gd}=Qh;function Jd(t,e,s){if(!c(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:o}=s.__layout,{type:a}=e;switch(a){case"image":case"film":case"video":if(!e.url)return;r=tl.image(s,t,e,o,!Hd||!Hd[e.url]),"image"!==a&&tl[a](r);break;case"linear":r=el.linearGradient(e,o);break;case"radial":r=el.radialGradient(e,o);break;case"angular":r=el.conicGradient(e,o);break;case"solid":const{color:n,opacity:h}=e;r={type:a,style:Qh.string(n,h)};break;default:i(e.r)||(r={type:"solid",style:Qh.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&Gd(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Qd={compute:function(t,e){const s=e.__,i=[];let r,n,o,a=s.__input[t];d(a)||(a=[a]),Hd=tl.recycleImage(t,s);for(let s,r=0,n=a.length;r<n;r++)(s=Jd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(o||(o=1),s.strokeStyle.strokeWidth&&(o=Math.max(o,s.strokeStyle.strokeWidth))));i.length?(s["_"+t]=i,i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(qd(s,"__isAlphaPixelFill",r),qd(s,"__isTransparentFill",n)):(qd(s,"__isAlphaPixelStroke",r),qd(s,"__isTransparentStroke",n),qd(s,"__hasMultiStrokeStyle",o))):(s.__removePaint(t,!1),s["_"+t]="")},fill:function(t,e,s,i){s.fillStyle=t,Id(e,s,i)},fills:function(t,e,s,i){let r,n,o;for(let a=0,h=t.length;a<h;a++){if(r=t[a],n=r.originPaint,r.image){if(o?o++:o=1,tl.checkImage(r,!e.__.__font,e,s,i))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,s,i);continue}}if(s.fillStyle=r.style,r.transform||n.scaleFixed){if(s.save(),r.transform&&s.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0,n.scaleFixed,!1);1!==t&&s.scale(t,i)}n.blendMode&&(s.blendMode=n.blendMode),Id(e,s,i),s.restore()}else n.blendMode?(s.saveBlendMode(n.blendMode),Id(e,s,i),s.restoreBlendMode()):Id(e,s,i)}},fillPathOrText:Id,fillText:function(t,e,s){const i=t.__,{rows:r,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,s=r.length;t<s;t++)o=r[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}},stroke:function(t,e,s,i){const r=e.__;if(r.__strokeWidth)if(r.__font)Kh.strokeText(t,e,s,i);else if(r.__pathForStroke)Kh.fillStroke(t,e,s,i);else switch(r.strokeAlign){case"center":Wd(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),Wd(t,2,e,s,i),s.restore()}(t,e,s,i);break;case"outside":!function(t,e,s,i){const r=e.__;if(r.__fillAfterStroke)Wd(t,2,e,s,i);else{const{renderBounds:n}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),Wd(t,2,e,o,i),o.clipUI(r),o.clearWorld(n),_o.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){Kh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":Md(t,1,e,s,i);break;case"inside":Dd(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?Md(t,2,e,s,i):Dd(t,"outside",e,s,i)}},drawTextStroke:function(t,e,s){let i,r=t.__.__textDrawData;const{rows:n,decorationY:o}=r;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(o){const{decorationHeight:t}=r;n.forEach(s=>o.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}},drawStrokesStyle:function(t,e,s,i,r,n){let o;const a=i.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!tl.checkImage(o,!1,i,r,n))&&o.style){if(h){const{strokeStyle:t}=o;t?r.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(o.style,a.__strokeWidth*e,a)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),s?Kh.drawTextStroke(i,r,n):r.stroke(),r.restoreBlendMode()):s?Kh.drawTextStroke(i,r,n):r.stroke()}},shape:function(t,e,s){const i=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;Nd(o.strokeSpread?(zd(Vd,o.boxBounds,o.strokeSpread),Vd):o.boxBounds,n,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=i,h=u=a,l=n;else{let i;if(te.fullImageShadow)i=a;else{const t=o.renderShapeSpread?Fd(r,k.swapAndScale(o.renderShapeSpread,p,g)):r;i=jd(t,a)}c=r.getFitMatrix(i);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=f,g*=y),u=Yd(a,c),h=Xd(u,-c.e,-c.f),l=Yd(n,c),Ud(l,-c.e,-c.f);const m=s.matrix;m?(d=new ft(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(i,s),{canvas:i,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let $d,Zd=new qt;const{isSame:Kd}=Ut;function tc(t,e,s,i,r,n){let o=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=i.width/a.pixelRatio,a.__naturalHeight=i.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate("width"),_o.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),o=!1)),"brush"===s.mode&&tl.brush(r,t),!r.data){tl.createData(r,i,s,n);const{transform:t}=r.data,{opacity:e}=s,o=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!r.brush;(o||e&&e<1||s.blendMode)&&(r.complex=!o||2)}return s.filter&&tl.applyFilter(r,i,s.filter,t),o}function ec(t,e){rc(t,qo.LOAD,e)}function sc(t,e){rc(t,qo.LOADED,e)}function ic(t,e,s){e.error=s,t.forceUpdate("surface"),rc(t,qo.ERROR,e)}function rc(t,e,s){t.hasEvent(e)&&t.emitEvent(new qo(e,s))}function nc(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:oc,translate:ac}=Q,hc=new qt,lc={},dc={};function cc(t,e,s,i){const r=n(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let uc={},_c={a:1,b:0,c:0,d:1,e:0,f:0};const{get:pc,set:gc,rotateOfOuter:fc,translate:yc,scaleOfOuter:mc,multiplyParent:xc,scale:wc,rotate:vc,skew:bc}=Q;function Sc(t,e,s,i,r,n,o,a){o&&vc(t,o),a&&bc(t,a.x,a.y),r&&wc(t,r,n),yc(t,e.x+s,e.y+i)}const{get:kc,scale:Bc,copy:Rc}=Q,{getFloorScale:Cc}=W,{abs:Pc}=Math;const Tc={image:function(t,e,s,i,r){let n,o;const a=rn.get(s,s.type);return $d&&s===$d.paint&&Kd(i,$d.boxBounds)?n=$d.leafPaint:(n={type:s.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),$d=a.use>1?{leafPaint:n,paint:s,boxBounds:Zd.set(i)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:s}),a.ready?(tc(t,e,s,a,n,i),r&&(ec(t,o),sc(t,o))):a.error?r&&ic(t,o,a.error):(r&&(nc(t,!0),ec(t,o)),n.loadId=a.load(()=>{nc(t,!1),t.destroyed||(tc(t,e,s,a,n,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),sc(t,o)),n.loadId=void 0},e=>{nc(t,!1),ic(t,o,e),n.loadId=void 0},s.lod&&a.getThumbSize(s.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,s,i,r){const{scaleX:n,scaleY:o}=tl.getImageRenderScaleData(t,s,i,r),a=t.film?t.nowIndex:n+"-"+o,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:_}=r;if(!d||t.patternId===a&&!u||_){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===te.name||u||(e=te.image.isLarge(h,n,o)||h.width*n>8096||h.height*o>8096)),e)s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill());else if(!t.style||c.sync||u?tl.createPattern(t,s,i,r):tl.createPatternTask(t,s,i,r),!l||!t.style)return!1;return tl.drawImage(t,n,o,s,i,r),!0},drawImage:function(t,e,s,i,r,n){const{data:o,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:n,opacity:a}=t.originPaint,{transform:h}=o;r.save(),2===l&&r.clipUI(i),n&&(r.blendMode=n),a&&(r.opacity*=a),h&&r.transform(h),u.render(r,0,0,d,c,i,t,e,s),r.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),u.render(r,0,0,d,c,i,t,e,s)},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(t.brush&&tl.addBrushScale(r,t,e),s){const{pixelRatio:t}=s;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const s=e["_"+t];if(d(s)){let i,r,n,o,a;const h=e.__leaf;for(let l=0,c=s.length;l<c;l++)i=s[l],r=i.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,rn.recyclePaint(i),i.brush&&tl.recycleBrush(i,h),e.__willDestroy&&r.parent&&tl.recycleFilter(r,h),r.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),r.unload(s[l].loadId,!o.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,s,i){t.patternTask||(t.patternTask=rn.patternTasker.add(()=>we(this,void 0,void 0,function*(){tl.createPattern(t,e,s,i),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,s.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:n}=tl.getImageRenderScaleData(t,e,s,i),o=t.film?t.nowIndex:r+"-"+n;if(t.patternId!==o&&!e.destroyed&&(!te.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:a,brush:h,data:l}=t,{opacity:d}=t.originPaint,{transform:c,gap:u}=l,_=tl.getPatternFixScale(t,r,n);let p,g,f,{width:y,height:m}=a;if(_&&(r*=_,n*=_),y*=r,m*=n,u&&(g=u.x*r/Pc(l.scaleX||1),f=u.y*n/Pc(l.scaleY||1),h)){const s=tl.getBrushScale(t,e);g/=s,f/=s}(c||1!==r||1!==n)&&(r*=Cc(y+(g||0)),n*=Cc(m+(f||0)),p=kc(),c&&Rc(p,c),Bc(p,1/r,1/n));const x=a.getCanvas(y,m,d,void 0,g,f,e.leafer&&e.leafer.config.smooth,l.interlace);h?(t.style=x,tl.cacheBrush(t,e,s,i)):t.style=a.getPattern(x,l.repeat||te.origin.noRepeat||"no-repeat",p,t),t.patternId=o}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,n=te.image.maxPatternSize,o=i.width*i.height;return i.isSVG?e>1&&(r=Math.ceil(e)/e):n>o&&(n=o),(o*=e*s)>n&&(r=Math.sqrt(n/o)),r},createData:function(t,e,s,i){t.data=tl.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=hc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:r}=s,{mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,interlace:m}=t,x=e.width===i&&e.height===r,w={mode:o},v="center"!==h&&(_||0)%180==90;let b,S;switch(Ut.set(dc,0,0,v?r:i,v?i:r),o&&"cover"!==o&&"fit"!==o?((d||u)&&(W.getScaleData(d,u,s,lc),b=lc.scaleX,S=lc.scaleY),(h||y||f)&&(b&&Ut.scale(dc,b,S,!0),h&&Rt.toPoint(h,dc,e,dc,!0,!0))):x&&!_||(b=S=Ut.getFitScale(e,dc,"fit"!==o),Ut.put(e,s,h,b,!1,dc),Ut.scale(dc,b,S,!0)),l&&ht.move(dc,l),o){case"stretch":x?b&&(b=S=void 0):(b=e.width/i,S=e.height/r,tl.stretchMode(w,e,b,S));break;case"normal":case"clip":if(dc.x||dc.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),tl.clipMode(w,e,dc.x,dc.y,b,S,_,p,t,s),t&&(b=b?b*t:t,S=S?S*s:s)}break;case"repeat":case"brush":(!x||b||_||p)&&tl.repeatMode(w,e,i,r,dc.x,dc.y,b,S,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=c(f);(y||s)&&(w.gap=function(t,e,s,i,r){let n,o;c(t)?(n=t.x,o=t.y):n=o=t;return{x:cc(n,s,r.width,e&&e.x),y:cc(o,i,r.height,e&&e.y)}}(y,s&&f,dc.width,dc.height,e));break;default:b&&tl.fillOrFitMode(w,e,dc.x,dc.y,b,S,_)}return w.transform||(e.x||e.y)&&ac(w.transform=oc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=S),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=a(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,s,i){const r=pc(),{x:n,y:o}=e;n||o?yc(r,n,o):s>0&&i>0&&(r.onlyScale=!0),wc(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,n,o){const a=pc();yc(a,e.x+s,e.y+i),wc(a,r,n),o&&fc(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,s,i,r,n,o,a,h,l){const d=pc();Sc(d,e,s,i,r,n,o,a),h&&(o||a?(gc(_c),mc(_c,e,h,l),xc(d,_c)):mc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,n,o,a,h,l,d,c){const u=pc();if(c)Sc(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)fc(u,{x:s/2,y:i/2},h);else switch(vc(u,h),h){case 90:yc(u,i,0);break;case 180:yc(u,s,i);break;case 270:yc(u,0,s)}uc.x=e.x+r,uc.y=e.y+n,yc(u,uc.x,uc.y),o&&mc(u,uc,o,a)}t.transform=u}},{toPoint:Lc}=St,{hasTransparent:Oc}=Qh,Ac={},Ec={};function Ic(t,e,s,i){if(s){let r,o,a,h;for(let t=0,l=s.length;t<l;t++)r=s[t],n(r)?(a=t/(l-1),o=Qh.string(r,i)):(a=r.offset,o=Qh.string(r.color,i)),e.addColorStop(a,o),!h&&Oc(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Wc,getDistance:Mc}=ht,{get:Dc,rotateOfOuter:Fc,scaleOfOuter:zc}=Q,{toPoint:Nc}=St,Yc={},Xc={};function Uc(t,e,s,i,r){let n;const{width:o,height:a}=t;if(o!==a||i){const t=Wc(e,s);n=Dc(),r?(zc(n,e,o/a*(i||1),1),Fc(n,e,t+90)):(zc(n,e,1,o/a*(i||1)),Fc(n,e,t))}return n}const{getDistance:jc}=ht,{toPoint:Vc}=St,Hc={},qc={};const Gc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:n}=t;Lc(s||"top",e,Ac),Lc(i||"bottom",e,Ec);const o=te.canvas.createLinearGradient(Ac.x,Ac.y,Ec.x,Ec.y),a={type:r,style:o};return Ic(a,o,t.stops,n),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:n,stretch:o}=t;Nc(s||"center",e,Yc),Nc(i||"bottom",e,Xc);const a=te.canvas.createRadialGradient(Yc.x,Yc.y,0,Yc.x,Yc.y,Mc(Yc,Xc)),h={type:r,style:a};Ic(h,a,t.stops,n);const l=Uc(e,Yc,Xc,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:n,rotation:o,stretch:a}=t;Vc(s||"center",e,Hc),Vc(i||"bottom",e,qc);const h=te.conicGradientSupport?te.canvas.createConicGradient(o?o*D:0,Hc.x,Hc.y):te.canvas.createRadialGradient(Hc.x,Hc.y,0,Hc.x,Hc.y,jc(Hc,qc)),l={type:r,style:h};Ic(l,h,t.stops,n);const d=Uc(e,Hc,qc,a||1,te.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Uc},{copy:Jc,move:Qc,toOffsetOutBounds:$c}=Ut,{max:Zc,abs:Kc}=Math,tu={},eu=new ft,su={};function iu(t,e){let s,i,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,n=1.5*(t.blur||0),r=Kc(t.spread||0),o=Zc(o,r+n-i),a=Zc(a,r+n+s),h=Zc(h,r+n+i),l=Zc(l,r+n-s)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function ru(t,e,s){const{shapeBounds:i}=s;let r,n;te.fullImageShadow?(Jc(tu,t.bounds),Qc(tu,e.x-i.x,e.y-i.y),r=t.bounds,n=tu):(r=i,n=e),t.copyWorld(s.canvas,r,n)}const{toOffsetOutBounds:nu}=Ut,ou={};const au=iu;const hu={shadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;$c(h,su,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(su.offsetX+(o.x||0)*c*f,su.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Qh.string(o.color)),r=sl.getShadowTransform(t,_,s,o,su,f),r&&_.setTransform(r),ru(_,su,s),r&&_.resetTransform(),i=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),i=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),_o.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;nu(h,ou,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(ou.offsetX+(o.x||0)*c*f,ou.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),r=sl.getShadowTransform(t,_,s,o,ou,f,!0),r&&_.setTransform(r),ru(_,ou,s),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Qh.string(o.color),"source-in"),_o.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:iu,getShadowTransform:function(t,e,s,i,r,n,o){if(i.spread){const s=2*i.spread*n*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return eu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),eu}},isTransformShadow(t){},getInnerShadowSpread:au},{excludeRenderBounds:lu}=vo;let du;function cu(t,e,s,i,r,n,o,a){switch(e){case"grayscale":du||(du=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,n){const o=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,o),n&&i.recycle(o);_u(t,e,s,1,r,n)}(t,s,i,r,o,a);break;case"opacity-path":_u(t,s,i,n,o,a);break;case"path":a&&s.restore()}}function uu(t){return t.getSameCanvas(!1,!0)}function _u(t,e,s,i,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,o,void 0,r),n?s.recycle(o):s.clearWorld(o)}zl.prototype.__renderMask=function(t,e){let s,i,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){o&&(cu(this,o,t,r,i,n,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||lu(s,e)||s.__render(t,e),n=s.__.opacity,du=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=uu(t))):(o="path",t.save()),s.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",i||(i=uu(t)),r||(r=uu(t)),s.__render(i,e));continue}const d=1===n&&s.__.__blendMode;d&&cu(this,o,t,r,i,n,void 0,!1),lu(s,e)||s.__render(r||t,e),d&&cu(this,o,t,r,i,n,d,!1)}cu(this,o,t,r,i,n,void 0,!0)};const pu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",gu=pu+"_#~&*+\\=|≮≯≈≠=…",fu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function yu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const mu=yu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),xu=yu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),wu=yu(pu),vu=yu(gu),bu=yu("- —/~|┆·");var Su;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Su||(Su={}));const{Letter:ku,Single:Bu,Before:Ru,After:Cu,Symbol:Pu,Break:Tu}=Su;function Lu(t){return mu[t]?ku:bu[t]?Tu:xu[t]?Ru:wu[t]?Cu:vu[t]?Pu:fu.test(t)?Bu:ku}const Ou={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Au(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Eu}=Ou,{Letter:Iu,Single:Wu,Before:Mu,After:Du,Symbol:Fu,Break:zu}=Su;let Nu,Yu,Xu,Uu,ju,Vu,Hu,qu,Gu,Ju,Qu,$u,Zu,Ku,t_,e_,s_,i_=[];function r_(t,e){Gu&&!qu&&(qu=Gu),Nu.data.push({char:t,width:e}),Xu+=e}function n_(){Uu+=Xu,Nu.width=Xu,Yu.words.push(Nu),Nu={data:[]},Xu=0}function o_(){Ku&&(t_.paraNumber++,Yu.paraStart=!0,Ku=!1),Gu&&(Yu.startCharSize=qu,Yu.endCharSize=Gu,qu=0),Yu.width=Uu,e_.width?Eu(Yu):s_&&a_(),i_.push(Yu),Yu={words:[]},Uu=0}function a_(){Uu>(t_.maxWidth||0)&&(t_.maxWidth=Uu)}const{top:h_,right:l_,bottom:d_,left:c_}=wt;function u_(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const __={getDrawData:function(t,e){n(t)||(t=String(t));let s=0,i=0,r=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(s=a[c_],r-=a[l_]+a[c_],!r&&(r=.01)):e.autoSizeAlign||(s=a[c_]),o?(i=a[h_],o-=a[h_]+a[d_],!o&&(o=.01)):e.autoSizeAlign||(i=a[h_]));const h={bounds:{x:s,y:i,width:r,height:o},rows:[],paraNumber:0,font:te.canvas.font=e.__font};return function(t,e,s){t_=t,i_=t.rows,e_=t.bounds,s_=!e_.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:n}=s,{canvas:o}=te,{width:a}=e_;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;Ku=!0,Qu=null,qu=Hu=Gu=Xu=Uu=0,Nu={data:[]},Yu={words:[]};for(let s=0,l=(e=[...e]).length;s<l;s++)Vu=e[s],"\n"===Vu?(Xu&&n_(),Yu.paraEnd=!0,o_(),Ku=!0):(Ju=Lu(Vu),Ju===Iu&&"none"!==n&&(Vu=Au(Vu,n,!Xu)),Hu=o.measureText(Vu).width,i&&(i<0&&(Gu=Hu),Hu+=i),$u=Ju===Wu&&(Qu===Wu||Qu===Iu)||Qu===Wu&&Ju!==Du,Zu=!(Ju!==Mu&&Ju!==Wu||Qu!==Fu&&Qu!==Du),ju=Ku&&r?a-r:a,t&&a&&Uu+Xu+Hu>ju&&(h?(Xu&&n_(),Uu&&o_()):(Zu||(Zu=Ju===Iu&&Qu==Du),$u||Zu||Ju===zu||Ju===Mu||Ju===Wu||Xu+Hu>ju?(Xu&&n_(),Uu&&o_()):Uu&&o_()))," "===Vu&&!0!==Ku&&Uu+Xu===0||(Ju===zu?(" "===Vu&&Xu&&n_(),r_(Vu,Hu),n_()):$u||Zu?(Xu&&n_(),r_(Vu,Hu)):r_(Vu,Hu)),Qu=Ju);Xu&&n_(),Uu&&o_(),i_.length>0&&(i_[i_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{t_.paraNumber++,Uu=o.measureText(t).width,i_.push({x:r||0,text:t,width:Uu,paraStart:!0}),s_&&a_()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":u_(e,"x",t[c_]);break;case"right":u_(e,"x",-t[l_])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":u_(e,"y",t[h_]);break;case"bottom":u_(e,"y",-t[d_])}}(a,h,e,r,o),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(x=s[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=n,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(h,e),e.__isCharMode&&function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:n,__letterSpacing:o}=e,a=s&&r.includes("both"),h=a||s&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;i.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(x=!t.paraEnd||a,c=s-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,s)=>{1===g?(f={char:"",x:d},d=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,s,i,r){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=s===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,s,i){const{rows:r,overflow:n}=t;let{textOverflow:o}=e;if(n&&r.splice(n),i&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?te.canvas.measureText(o).width:0,l=s+i-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],a=t.x+t.width,!(i===s&&a<l));i--){if(a<l&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,s,r),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(s=n.type,n.color&&(t.decorationColor=Qh.string(n.color)),n.offset&&(i=Math.min(.3*r,Math.max(n.offset,.15*-r)))):s=n,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(h,e),h}};const p_={string:function(t,e){if(!t)return"#000";const s=a(e)&&e<1;if(n(t)){if(!s||!Qh.object)return t;t=Qh.object(t)}let r=i(t.a)?1:t.a;s&&(r*=e);const o=t.r+","+t.g+","+t.b;return 1===r?"rgb("+o+")":"rgba("+o+","+r+")"}};Object.assign(Jh,__),Object.assign(Qh,p_),Object.assign(Kh,Qd),Object.assign(tl,Tc),Object.assign(el,Gc),Object.assign(sl,hu);try{wx&&Lh(0,wx)}catch(t){}export{Rt as AlignHelper,e as Answer,St as AroundHelper,Jt as AutoBounds,ds as BezierHelper,qt as Bounds,Go as BoundsEvent,Ut as BoundsHelper,Jl as Box,fl as BoxData,Bh as Branch,Bo as BranchHelper,Ua as BranchRender,Rd as Canvas,Tl as CanvasData,me as CanvasManager,Uo as ChildEvent,Qh as ColorConvert,ce as Creator,p as DataHelper,ie as Debug,wt as Direction4,vt as Direction9,sl as Effect,td as Ellipse,vl as EllipseData,xs as EllipseHelper,Xo as Event,fe as EventCreator,ca as Eventer,rl as Export,Jr as FileHelper,il as Filter,k as FourNumberHelper,Ql as Frame,ml as FrameData,zl as Group,gl as GroupData,kd as Image,Pl as ImageData,qo as ImageEvent,rn as ImageManager,y as IncrementId,sa as LayoutEvent,Xh as Layouter,gh as Leaf,za as LeafBounds,vo as LeafBoundsHelper,f as LeafData,ka as LeafDataProxy,ba as LeafEventer,_o as LeafHelper,Yo as LeafLayout,Ch as LeafLevelList,Rh as LeafList,Oa as LeafMatrix,Na as LeafRender,Xl as Leafer,Th as LeaferCanvas,Ie as LeaferCanvasBase,yl as LeaferData,ra as LeaferEvent,ln as LeaferFilm,hn as LeaferImage,dn as LeaferVideo,Sd as Line,xl as LineData,W as MathHelper,ft as Matrix,Q as MatrixHelper,Bd as MyImage,ze as NeedConvertToCanvasCommandMap,D as OneRadian,F as PI2,z as PI_2,Kh as Paint,el as PaintGradient,tl as PaintImage,Ad as Path,Zh as PathArrow,Dr as PathBounds,Ci as PathCommandDataHelper,De as PathCommandMap,ws as PathCommandNodeHelper,ri as PathConvert,jr as PathCorner,ji as PathCreator,kl as PathData,nr as PathDrawer,We as PathHelper,t as PathNodeHandleType,Ue as PathNumberCommandLengthMap,Xe as PathNumberCommandMap,Ed as Pen,Bl as PenData,te as Platform,de as Plugin,pt as Point,ht as PointHelper,hd as Polygon,bl as PolygonData,Vo as PropertyEvent,Ul as Rect,wl as RectData,je as RectHelper,Ml as RectRender,ia as RenderEvent,jh as Renderer,ta as ResizeEvent,en as Resource,ae as Run,gd as Star,Sl as StarData,nl as State,$t as StringNumberMap,Zr as TaskItem,Kr as TaskProcessor,Od as Text,Jh as TextConvert,Cl as TextData,ol as Transition,mt as TwoPointBoundsHelper,Fl as UI,Al as UIBounds,_e as UICreator,_l as UIData,Il as UIRender,$h as UnitConvert,Qt as UnitConvertHelper,Oo as WaitHelper,ea as WatchEvent,Oh as Watcher,On as affectRenderBoundsType,Pn as affectStrokeBoundsType,gn as attr,wn as autoLayoutType,Sn as boundsType,Gr as canvasPatch,Ee as canvasSizeAttrs,Gh as createAttr,_n as createDescriptor,Xn as cursorType,Un as dataProcessor,yn as dataType,pn as decorateLeafAttr,Vn as defineDataProcessor,cn as defineKey,fn as defineLeafAttr,En as dimType,Bn as doBoundsType,Tn as doStrokeType,Vh as effectType,s as emptyData,Nn as eraserType,Ho as extraPropertyEventMap,Y as getBoundsData,un as getDescriptor,X as getMatrixData,N as getPointData,Yn as hitType,d as isArray,u as isData,_ as isEmptyData,o as isFinite,r as isNull,a as isNumber,c as isObject,n as isString,i as isUndefined,jn as layoutProcessor,la as leaferTransformAttrMap,zn as maskType,kn as naturalBoundsType,In as opacityType,Vr as path,Rn as pathInputType,Cn as pathType,Hr as pen,mn as positionType,Kn as registerUI,to as registerUIEvent,Hh as resizeType,Jn as rewrite,Qn as rewriteAble,bn as rotationType,vn as scaleType,xn as scrollType,Fn as sortType,Ln as strokeType,An as surfaceType,Gt as tempBounds,yt as tempMatrix,gt as tempPoint,l as tryToNumber,Lh as useCanvas,Zn as useModule,Ph as version,Wn as visibleType,qh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=miniapp.module.min.js.map
|