leafer-draw 1.10.1 → 1.11.1
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/web.js +49 -27
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +50 -28
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";function s(t){return void 0===t}function i(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function n(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;const{isArray:h}=Array;function l(t){return t&&"object"==typeof t}function d(t){return"{}"===JSON.stringify(t)}const c={default:(t,e)=>(u(e,t),u(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 u(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&u(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),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:u}=c;class _{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(h(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!s(t))){if("path"===o&&!this.__pathInputed)continue;e=r?r[o]:void 0,i[o]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:o,f:n}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:o,f:n}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:p,max:g}=Math,f={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,s,i)=>t.width*t.height*(e?e*s:1)>(i||y.maxCacheSize),isSuperLarge:(t,e,s)=>y.isLarge(t,e,s,y.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=f.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h){const l=f.origin.createCanvas(g(p(e+(i||0)),1),g(p(s+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==n,o){const i=e/o.width,r=s/o.height;d.setTransform(i,0,0,r,-o.x*i,-o.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&c.stintSet(s,"transform",e)}}},{image:y}=f,m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=m;let w,v,b;const{max:B}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,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)=>R(k,t,e,s,i),toTempAB(t,e,s){b=s?n(t)?e:t:[],n(t)?(w=T(t),v=e):n(e)?(w=t,v=T(e)):(w=t,v=e),4!==w.length&&(w=C(w)),4!==v.length&&(v=C(v))},get(t,e){let i;if(!n(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,s)=>n(t)&&n(e)?B(t,e):(P(t,e,s),R(b,B(w[0],v[0]),B(w[1],v[1]),B(w[2],v[2]),B(w[3],v[3]))),add:(t,e,s)=>n(t)&&n(e)?t+e:(P(t,e,s),R(b,w[0]+v[0],w[1]+v[1],w[2]+v[2],w[3]+v[3])),swapAndScale(t,e,s,i){if(n(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,a,h,l]=4===t.length?t:C(t);return R(r,h*s,l*e,o*s,a*e)}},{set:R,get:C,setTemp:T,toTempAB:P}=S,{round:L,pow:I,max:E,floor:O,PI:A}=Math,M={within:(t,e,i)=>(l(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,s=0){let 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 i=s(e)?1e12:I(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(n(e)?e:e.width||0)/s.width,r=(n(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&M.assignScale(i,t);return i},assignScale(t,e){n(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>E(O(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const D=A/180,F=2*A,z=A/2;function U(){return{x:0,y:0}}function N(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:G,sqrt:V}=Math,{float:j}=M,q={};function Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),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:Y,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,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=H(e*=D),a=X(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,i,r,o){const{e:n,f:a}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:n,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=n*e.a+a*e.c,i.d=n*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=n*e.a+a*e.c+e.e,i.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,i,r,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(s(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:s,skewX:i,skewY:r}=e,o=s*D,n=H(o),a=X(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,(i=i||r)&&$.translateInner(t,-i.x,-i.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=V(r*r+o*o),c=t/d;const e=r/d;u=o>0?G(e):-G(e)}else{c=V(n*n+a*a),d=t/c;const e=n/c;u=z-(a>0?G(-e):-G(e))}const e=j(H(u)),s=X(u);d=j(d),c=j(c),_=e?j((n/c+s)/e/D,9):0,p=e?j((o/d-s)/e/D,9):0,u=j(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=V(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){$.set(t)}},$=J,{toInnerPoint:Z,toOuterPoint:K}=J,{sin:tt,cos:et,abs:st,sqrt:it,atan2:rt,min:ot,round:nt}=Math,at={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},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?nt(t.x-.5)+.5:nt(t.x),t.y=e?nt(t.y-.5)+.5:nt(t.y)},move(t,e,s){l(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=ht.defaultPoint);const i=et(e*=D),r=tt(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}=ht;return dt(s,t),Z(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=ht;return dt(s,t),K(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=ht;return dt(s,t),ht.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),Z(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){Z(e,t,s)},toOuterOf(t,e,s){K(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=st(s-t),o=st(i-e);return it(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>ot(lt(t,e,s,i),lt(s,i,r,o)),getAngle:(t,e)=>ct(t,e)/D,getRotation:(t,e,s,i)=>(i||(i=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/D),getRadianFrom(t,e,i,r,o,n,a,h){s(a)&&(a=i,h=r);const l=t-i,d=e-r,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=ct(t,e);return(e=i?e:{}).x=t.x+et(r)*s,e.y=t.y+tt(r)*s,e},toNumberPoints(t){let e=t;return l(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){ht.reset(t)}},ht=at,{getDistanceFrom:lt,copy:dt,getAtan2:ct}=ht;class ut{constructor(t,e){this.set(t,e)}set(t,e){return l(t)?at.copy(this,t):at.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ut(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,s){return at.scaleOf(this,t,e,s),this}rotate(t,e){return at.rotate(this,t,e),this}rotateOf(t,e){return at.rotate(this,e,t),this}getRotation(t,e,s){return at.getRotation(this,t,e,s)}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}getCenter(t){return new ut(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,s){return new ut(at.getDistancePoint(this,t,e,s))}getAngle(t){return at.getAngle(this,t)}getAtan2(t){return at.getAtan2(this,t)}reset(){return at.reset(this),this}}const _t=new ut;class pt{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return l(t)?J.copy(this,t):J.set(this,t,e,s,i,r,o),this}setWith(t){return J.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 pt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,s){return J.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return J.scaleOfInner(this,t,e,s),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,s){return J.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return J.skewOfInner(this,t,e,s),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){J.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){J.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return J.setLayout(this,t,e,s),this}getLayout(t,e,s){return J.getLayout(this,t,e,s)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const gt=new pt,ft={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){yt(t,e,s),yt(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:yt}=ft;var mt,xt;t.Direction4=void 0,(mt=t.Direction4||(t.Direction4={}))[mt.top=0]="top",mt[mt.right=1]="right",mt[mt.bottom=2]="bottom",mt[mt.left=3]="left",t.Direction9=void 0,(xt=t.Direction9||(t.Direction9={}))[xt.topLeft=0]="topLeft",xt[xt.top=1]="top",xt[xt.topRight=2]="topRight",xt[xt.right=3]="right",xt[xt.bottomRight=4]="bottomRight",xt[xt.bottom=5]="bottom",xt[xt.bottomLeft=6]="bottomLeft",xt[xt.left=7]="left",xt[xt.center=8]="center",xt[xt["top-left"]=0]="top-left",xt[xt["top-right"]=2]="top-right",xt[xt["bottom-right"]=4]="bottom-right",xt[xt["bottom-left"]=6]="bottom-left";const wt=[{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}];wt.forEach(t=>t.type="percent");const vt={directionData:wt,tempPoint:{},get:bt,toPoint(t,e,s,i,r,o){const n=bt(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)=>(s||(s={}),vt.toPoint(t,e,s,!0),s)};function bt(e){return r(e)?wt[t.Direction9[e]]:e}const{toPoint:Bt}=vt,kt={toPoint(t,e,s,i,r,o){Bt(t,s,i,r,e,o)}},{tempPointBounds:St,setPoint:Rt,addPoint:Ct,toBounds:Tt}=ft,{toOuterPoint:Pt}=J,{float:Lt,fourNumber:It}=M,{floor:Et,ceil:Ot}=Math;let At,Mt,Wt,Dt;const Ft={},zt={},Ut={},Nt={tempBounds:Ut,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:l}=e;if(h(s)){const e=It(s);i?Yt.set(t,o+e[3],n+e[0],a-e[1]-e[3],l-e[2]-e[0]):Yt.set(t,o-e[3],n-e[0],a+e[1]+e[3],l+e[2]+e[0])}else i&&(s=-s),Yt.set(t,o-s,n-s,a+2*s,l+2*s);r&&("width"===r?(t.y=n,t.height=l):(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),Yt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Ht(e,t):e=t,s||(s=t),e.offsetX=Yt.maxX(s),e.offsetY=Yt.maxY(s),Yt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||at.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){at.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Yt.copy(Ut,t),Yt.toOuterOf(Ut,e),Ut),getOuterOf:(t,e)=>(t=Object.assign({},t),Yt.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 Ft.x=t.x,Ft.y=t.y,Pt(e,Ft,zt),Rt(St,zt.x,zt.y),Ft.x=t.x+t.width,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Ft.y=t.y+t.height,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Ft.x=t.x,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Tt(St,s)},toInnerOf(t,e,s){s||(s=t),Yt.move(s,-e.e,-e.f),Yt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Yt.getFitScale(t,e));return new pt(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,o=!0,n){n||(n=e),r(i)&&(i=Yt.getFitScale(t,e,"cover"===i)),Ut.width=o?e.width*=i:e.width*i,Ut.height=o?e.height*=i:e.height*i,kt.toPoint(s,Ut,t,n,!0,!0)},getSpread(t,e,s){const i={};return Yt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Yt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Yt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Et(t.x),t.y=Et(t.y),t.width=e>t.x?Ot(t.width+e-t.x):Ot(t.width),t.height=s>t.y?Ot(t.height+s-t.y):Ot(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,s){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Dt=e.y,s||(Wt+=e.width,Dt+=e.height),At=At>Wt?At:Wt,Mt=Mt>Dt?Mt:Dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Yt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Yt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Yt.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||Ht(t,r)):Xt(t,r));o&&Yt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(St,t.x,t.y):Ct(St,t.x,t.y)),Tt(St,t)},setPoint(t,e){Yt.set(t,e.x,e.y)},addPoint(t,e){Xt(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}]},hitRadiusPoint:(t,e,s)=>(s&&(e=at.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=at.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Yt.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=Yt.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=Yt.tempToOuterOf(e,s)),!Yt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return At=i+o,Mt=r+n,Wt=t.x+t.width,Dt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Dt?Mt:Dt,o=At-i,n=Mt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Yt.copy(t,Yt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Yt.set(t)}},Yt=Nt,{add:Xt,copy:Ht}=Yt;class Gt{get minX(){return Nt.minX(this)}get minY(){return Nt.minY(this)}get maxX(){return Nt.maxX(this)}get maxY(){return Nt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return l(t)?Nt.copy(this,t):Nt.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 Gt(this)}move(t,e){return Nt.move(this,t,e),this}scale(t,e,s){return Nt.scale(this,t,e,s),this}scaleOf(t,e,s){return Nt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Nt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Nt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Nt.getFitMatrix(this,t,e)}put(t,e,s){Nt.put(this,t,e,s)}spread(t,e){return Nt.spread(this,t,e),this}shrink(t,e){return Nt.shrink(this,t,e),this}ceil(){return Nt.ceil(this),this}unsign(){return Nt.unsign(this),this}float(t){return Nt.float(this,t),this}add(t){return Nt.add(this,t),this}addList(t){return Nt.setList(this,t,!0),this}setList(t){return Nt.setList(this,t),this}addListWithFn(t,e){return Nt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Nt.setListWithFn(this,t,e),this}setPoint(t){return Nt.setPoint(this,t),this}setPoints(t){return Nt.setPoints(this,t),this}addPoint(t){return Nt.addPoint(this,t),this}getPoints(){return Nt.getPoints(this)}hitPoint(t,e){return Nt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Nt.hitRadiusPoint(this,t,e)}hit(t,e){return Nt.hit(this,t,e)}includes(t,e){return Nt.includes(this,t,e)}intersect(t,e){return Nt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Nt.getIntersectData(this,t,e))}isSame(t){return Nt.isSame(this,t)}isEmpty(){return Nt.isEmpty(this)}reset(){Nt.reset(this)}}const Vt=new Gt;class jt{constructor(t,e,s,i,r,o){l(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 Gt(r,e,o||t.width-r-s,n||t.height-e-i)}}const qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Qt}=M;class Jt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Jt(t)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const s=Qt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Jt.showBounds,r=t.__nowWorld,o=Qt();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(Zt.enable){if(Zt.filterList.length&&Zt.filterList.every(t=>t!==this.name))return;if(Zt.excludeList.length&&Zt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Zt.enable&&this.warn(...t)}warn(...t){Zt.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 $t(t){return t?r(t)&&(t=[t]):t=[],t}Jt.filterList=[],Jt.excludeList=[],Jt.showWarn=!0;const Zt=Jt,Kt=Jt.get("RunTime"),te={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=m.create(m.RUNTIME);return ee.currentId=ee.idMap[s]=e?performance.now():Date.now(),ee.currentName=ee.nameMap[s]=t,ee.nameToIdMap[t]=s,s},end(t,e){const s=ee.idMap[t],i=ee.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;ee.idMap[t]=ee.nameMap[t]=ee.nameToIdMap[i]=void 0,Kt.log(i,r,"ms")},endOfName(t,e){const i=ee.nameToIdMap[t];s(i)||ee.end(i,e)}},ee=te,se=[],ie={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>ie.has(t,!0)));const re={editor:t=>ie.need("editor")},oe=Jt.get("UICreator"),ne={list:{},register(t){const{__tag:e}=t.prototype;ae[e]&&oe.repeat(e),ae[e]=t},get(t,e,i,r,o,n){ae[t]||oe.error("not register "+t);const a=new ae[t](e);return s(i)||(a.x=i,r&&(a.y=r),o&&(a.width=o),n&&(a.height=n)),a}},{list:ae}=ne,he=Jt.get("EventCreator"),le={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],r(e)&&(de[e]&&he.repeat(e),de[e]=t)})},changeName(t,e){const s=de[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,de[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new de[t](...e)},{nameList:de}=le;class ce{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=re.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 ue(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 _e(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 pe(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 ge=[];function fe(){return(t,e)=>{ge.push(e)}}const ye=[];class me{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ye)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ge.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){l(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}}ue([pe("imageSmoothingEnabled")],me.prototype,"smooth",void 0),ue([pe("imageSmoothingQuality")],me.prototype,"smoothLevel",void 0),ue([pe("globalAlpha")],me.prototype,"opacity",void 0),ue([pe()],me.prototype,"fillStyle",void 0),ue([pe()],me.prototype,"strokeStyle",void 0),ue([pe("lineWidth")],me.prototype,"strokeWidth",void 0),ue([pe("lineCap")],me.prototype,"strokeCap",void 0),ue([pe("lineJoin")],me.prototype,"strokeJoin",void 0),ue([pe("lineDashOffset")],me.prototype,"dashOffset",void 0),ue([pe()],me.prototype,"miterLimit",void 0),ue([pe()],me.prototype,"shadowBlur",void 0),ue([pe()],me.prototype,"shadowColor",void 0),ue([pe()],me.prototype,"shadowOffsetX",void 0),ue([pe()],me.prototype,"shadowOffsetY",void 0),ue([pe()],me.prototype,"filter",void 0),ue([pe()],me.prototype,"font",void 0),ue([pe()],me.prototype,"fontKerning",void 0),ue([pe()],me.prototype,"fontStretch",void 0),ue([pe()],me.prototype,"fontVariantCaps",void 0),ue([pe()],me.prototype,"textAlign",void 0),ue([pe()],me.prototype,"textBaseline",void 0),ue([pe()],me.prototype,"textRendering",void 0),ue([pe()],me.prototype,"wordSpacing",void 0),ue([pe()],me.prototype,"letterSpacing",void 0),ue([pe()],me.prototype,"direction",void 0),ue([fe()],me.prototype,"setTransform",null),ue([fe()],me.prototype,"resetTransform",null),ue([fe()],me.prototype,"getTransform",null),ue([fe()],me.prototype,"save",null),ue([fe()],me.prototype,"restore",null),ue([fe()],me.prototype,"translate",null),ue([fe()],me.prototype,"scale",null),ue([fe()],me.prototype,"rotate",null),ue([fe()],me.prototype,"fill",null),ue([fe()],me.prototype,"stroke",null),ue([fe()],me.prototype,"clip",null),ue([fe()],me.prototype,"fillRect",null),ue([fe()],me.prototype,"strokeRect",null),ue([fe()],me.prototype,"clearRect",null),ue([fe()],me.prototype,"beginPath",null),ue([fe()],me.prototype,"moveTo",null),ue([fe()],me.prototype,"lineTo",null),ue([fe()],me.prototype,"bezierCurveTo",null),ue([fe()],me.prototype,"quadraticCurveTo",null),ue([fe()],me.prototype,"closePath",null),ue([fe()],me.prototype,"arc",null),ue([fe()],me.prototype,"arcTo",null),ue([fe()],me.prototype,"ellipse",null),ue([fe()],me.prototype,"rect",null),ue([fe()],me.prototype,"roundRect",null),ue([fe()],me.prototype,"createConicGradient",null),ue([fe()],me.prototype,"createLinearGradient",null),ue([fe()],me.prototype,"createPattern",null),ue([fe()],me.prototype,"createRadialGradient",null),ue([fe()],me.prototype,"fillText",null),ue([fe()],me.prototype,"measureText",null),ue([fe()],me.prototype,"strokeText",null);const{copy:xe,multiplyParent:we,pixelScale:ve}=J,{round:be}=Math,Be=new Gt,ke=new Gt,Se={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Ce extends me{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=Se),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.size.pixelRatio=r||f.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;c.copyAttrs(i,t,Re),Re.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Gt(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&&we(t,e,r),ve(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=be(r.e-.5)+.5,r.f=be(r.f-.5)+.5):(r.e=be(r.e),r.f=be(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:i,strokeJoin:r,dashPattern:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(o=e.dashPattern),s(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,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=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=ke):s=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Nt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){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(Be.x,Be.y,Be.width,Be.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,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(Be.x,Be.y,Be.width,Be.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Be,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(ke,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):re.canvas(Object.assign({},s));return r.save(),t&&(xe(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 Te={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Pe),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ee={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Oe=Object.assign(Object.assign({},Ee),Pe),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Ie[t];const De={drawRoundRect(t,e,s,i,r,o){const n=M.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:Fe,cos:ze,hypot:Ue,atan2:Ne,ceil:Ye,abs:Xe,PI:He,sqrt:Ge,pow:Ve}=Math,{setPoint:je,addPoint:qe}=ft,{set:Qe,toNumberPoints:Je}=at,{M:$e,L:Ze,C:Ke,Q:ts,Z:es}=Le,ss={},is={points(t,e,s,i){let r=Je(e);if(t.push($e,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-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=Ge(Ve(n-e,2)+Ve(a-o,2)),g=Ge(Ve(h-n,2)+Ve(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(ts,d,c,n,a):t.push(Ke,u,_,d,c,n,a),u=n+g*h,_=a+g*l);i||t.push(ts,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ze,r[e],r[e+1]);i&&t.push(es)},rect(t,e,s,i,r){Te.creator.path=t,Te.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){Te.creator.path=[],De.drawRoundRect(Te.creator,e,s,i,r,o),t.push(...Te.convertToCanvasData(Te.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=Ne(u,c),f=Ne(p,_);const y=Ue(c,u),m=Ue(_,p);let x=f-g;if(x<0&&(x+=F),y<1e-12||m<1e-12||x<1e-12||Xe(x-He)<1e-12)return t&&t.push(Ze,i,r),h&&(je(h,e,s),qe(h,i,r)),d&&Qe(d,e,s),void(l&&Qe(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/ze(x/2),B=i+b*ze(g+x/2+z*v),k=r+b*Fe(g+x/2+z*v);return g-=z*v,f-=z*v,ns(t,B,k,a,a,0,g/D,f/D,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>ns(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,_=Fe(u),p=ze(u);let g=n*D,f=a*D;g>He&&(g-=F),f<0&&(f+=F);let y=f-g;y<0?y+=F:y>F&&(y-=F),h&&(y-=F);const m=Ye(Xe(y/z)),x=y/m,w=Fe(x/4),v=8/3*w*w/Fe(x/2);f=g+x;let b,B,k,S,R,C,T,P,L=ze(g),I=Fe(g),E=k=p*i*L-_*r*I,O=S=_*i*L+p*r*I,A=e+k,M=s+S;t&&t.push(t.length?Ze:$e,A,M),l&&je(l,A,M),c&&Qe(c,A,M);for(let o=0;o<m;o++)b=ze(f),B=Fe(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+E-v*(p*i*I+_*r*L),C=s+O-v*(_*i*I-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(Ke,R,C,T,P,e+k,s+S),l&&os(e+E,s+O,R,C,T,P,e+k,s+S,l,!0),E=k,O=S,L=b,I=B,g=f,f+=x;d&&Qe(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Ke,(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){os(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?qe(h,t,e):je(h,t,e),qe(h,n,a);for(let l=0,c=d.length;l<c;l++)rs(d[l],t,e,s,i,r,o,n,a,ss),qe(h,ss.x,ss.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 rs(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)}},{getPointAndSet:rs,toTwoPointBounds:os,ellipse:ns}=is,{sin:as,cos:hs,sqrt:ls,atan2:ds}=Math,{ellipse:cs}=is,us={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*D,p=as(_),g=hs(_),y=-g*c-p*u,m=-g*u+p*c,x=i*i,w=r*r,v=m*m,b=y*y,B=x*w-x*v-w*b;let k=0;if(B<0){const t=ls(1-B/(x*w));i*=t,r*=t}else k=(n===a?-1:1)*ls(B/(x*v+w*b));const S=k*i*m/r,R=-k*r*y/i,C=ds((m-R)/r,(y-S)/i),T=ds((-m-R)/r,(-y-S)/i);let P=T-C;0===a&&P>0?P-=F:1===a&&P<0&&(P+=F);const L=e+c+g*S-p*R,I=s+u+p*S+g*R,E=P<0?1:0;d||f.ellipseToCurve?cs(t,L,I,i,r,o,C/D,T/D,E):i!==r||o?t.push(Le.G,L,I,i,r,o,C/D,T/D,E):t.push(Le.O,L,I,i,C/D,T/D,E)}},{M:_s,m:ps,L:gs,l:fs,H:ys,h:ms,V:xs,v:ws,C:vs,c:bs,S:Bs,s:ks,Q:Ss,q:Rs,T:Cs,t:Ts,A:Ps,a:Ls,Z:Is,z:Es,N:Os,D:As,X:Ms,G:Ws,F:Ds,O:Fs,P:zs,U:Us}=Le,{rect:Ns,roundRect:Ys,arcTo:Xs,arc:Hs,ellipse:Gs,quadraticCurveTo:Vs}=is,{ellipticalArc:js}=us,qs=Jt.get("PathConvert"),Qs={},Js={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=We[i],a+=i===r?" ":Me[i];for(let i=1;i<s;i++)a+=M.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?Oe:Ee;for(let e=0,h=t.length;e<h;e++)i=t[e],qt[i]?("."===i&&($s.dot&&(Zs(n,o),o=""),$s.dot++),"0"===o&&"."!==i&&(Zs(n,o),o=""),o+=i):Le[i]?(o&&(Zs(n,o),o=""),$s.name=Le[i],$s.length=Ie[i],$s.index=0,Zs(n,$s.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Zs(n,o),o=i):o&&(Zs(n,o),o=""),r=i;return o&&Zs(n,o),s?Js.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 ps:t[c+1]+=a,t[c+2]+=h;case _s:a=t[c+1],h=t[c+2],_.push(_s,a,h),c+=3;break;case ms:t[c+1]+=a;case ys:a=t[c+1],_.push(gs,a,h),c+=2;break;case ws:t[c+1]+=h;case xs:h=t[c+1],_.push(gs,a,h),c+=2;break;case fs:t[c+1]+=a,t[c+2]+=h;case gs:a=t[c+1],h=t[c+2],_.push(gs,a,h),c+=3;break;case ks:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Bs;case Bs:n=o===vs||o===Bs,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(vs,l,d,s,i,a,h),c+=5;break;case bs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=vs;case vs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(vs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ts:t[c+1]+=a,t[c+2]+=h,r=Cs;case Cs:n=o===Ss||o===Cs,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Vs(_,a,h,s,i,t[c+1],t[c+2]):_.push(Ss,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Rs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ss;case Ss:s=t[c+1],i=t[c+2],e?Vs(_,a,h,s,i,t[c+3],t[c+4]):_.push(Ss,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ls:t[c+6]+=a,t[c+7]+=h;case Ps:js(_,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 Es:case Is:_.push(Is),c++;break;case Os:a=t[c+1],h=t[c+2],e?Ns(_,a,h,t[c+3],t[c+4]):Ks(_,t,c,5),c+=5;break;case As:a=t[c+1],h=t[c+2],e?Ys(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ks(_,t,c,9),c+=9;break;case Ms:a=t[c+1],h=t[c+2],e?Ys(_,a,h,t[c+3],t[c+4],t[c+5]):Ks(_,t,c,6),c+=6;break;case Ws:Gs(e?_:Ks(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Qs),a=Qs.x,h=Qs.y,c+=9;break;case Ds:e?Gs(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ks(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Fs:Hs(e?_:Ks(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qs),a=Qs.x,h=Qs.y,c+=7;break;case zs:e?Hs(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ks(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Us:Xs(e?_:Ks(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qs),a=Qs.x,h=Qs.y,c+=6;break;default:return qs.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(_s,t.x,t.y);break;case"L":e.push(gs,t.x,t.y);break;case"C":e.push(vs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ss,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Is)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){$s.index===$s.length&&($s.index=1,t.push($s.name)),t.push(Number(e)),$s.index++,$s.dot=0}},{current:$s,pushData:Zs,copyData:Ks}=Js,{M:ti,L:ei,C:si,Q:ii,Z:ri,N:oi,D:ni,X:ai,G:hi,F:li,O:di,P:ci,U:ui}=Le,{getMinDistanceFrom:_i,getRadianFrom:pi}=at,{tan:gi,min:fi,abs:yi}=Math,mi={},xi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ti,e,s)},lineTo(t,e,s){t.push(ei,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(si,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(ii,e,s,i,r)},closePath(t){t.push(ri)},rect(t,e,s,i,r){t.push(oi,e,s,i,r)},roundRect(t,e,s,i,r,o){if(n(o))t.push(ai,e,s,i,r,o);else{const n=M.fourNumber(o);n?t.push(ni,e,s,i,r,...n):t.push(oi,e,s,i,r)}},ellipse(t,e,s,r,o,n,a,h,l){i(n)?t.push(li,e,s,r,o):(i(a)&&(a=0),i(h)&&(h=360),t.push(hi,e,s,r,o,n,a,h,l?1:0))},arc(t,e,s,r,o,n,a){i(o)?t.push(ci,e,s,r):(i(n)&&(n=360),t.push(di,e,s,r,o,n,a?1:0))},arcTo(t,e,i,r,o,n,a,h){if(!s(a)){const t=_i(a,h,e,i,r,o);n=fi(n,fi(t/2,t/2*yi(gi(pi(a,h,e,i,r,o)/2))))}t.push(ui,e,i,r,o,n)},drawEllipse(t,e,s,r,o,n,a,h,l){is.ellipse(null,e,s,r,o,i(n)?0:n,i(a)?0:a,i(h)?360:h,l,null,null,mi),t.push(ti,mi.x,mi.y),wi(t,e,s,r,o,n,a,h,l)},drawArc(t,e,s,r,o,n,a){is.arc(null,e,s,r,i(o)?0:o,i(n)?360:n,a,null,null,mi),t.push(ti,mi.x,mi.y),vi(t,e,s,r,o,n,a)},drawPoints(t,e,s,i){is.points(t,e,s,i)}},{ellipse:wi,arc:vi}=xi,{moveTo:bi,lineTo:Bi,quadraticCurveTo:ki,bezierCurveTo:Si,closePath:Ri,beginPath:Ci,rect:Ti,roundRect:Pi,ellipse:Li,arc:Ii,arcTo:Ei,drawEllipse:Oi,drawArc:Ai,drawPoints:Mi}=xi;class Wi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Te.parse(t):t:[],this}beginPath(){return Ci(this.__path),this.paint(),this}moveTo(t,e){return bi(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Si(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return ki(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ri(this.__path),this.paint(),this}rect(t,e,s,i){return Ti(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Pi(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Li(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Ii(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Ei(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Oi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Ai(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Mi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Di,L:Fi,C:zi,Q:Ui,Z:Ni,N:Yi,D:Xi,X:Hi,G:Gi,F:Vi,O:ji,P:qi,U:Qi}=Le,Ji=Jt.get("PathDrawer"),$i={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Di:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Fi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case zi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ui:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ni:t.closePath(),i+=1;break;case Yi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Xi: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 Hi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Gi: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 Vi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,F,!1),i+=5;break;case ji: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 qi:t.arc(e[i+1],e[i+2],e[i+3],0,F,!1),i+=4;break;case Qi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Ji.error(`command: ${s} [index:${i}]`,e)}}},{M:Zi,L:Ki,C:tr,Q:er,Z:sr,N:ir,D:rr,X:or,G:nr,F:ar,O:hr,P:lr,U:dr}=Le,{toTwoPointBounds:cr,toTwoPointBoundsByQuadraticCurve:ur,arcTo:_r,arc:pr,ellipse:gr}=is,{addPointBounds:fr,copy:yr,addPoint:mr,setPoint:xr,addBounds:wr,toBounds:vr}=ft,br=Jt.get("PathBounds");let Br,kr,Sr;const Rr={},Cr={},Tr={},Pr={toBounds(t,e){Pr.toTwoPointBounds(t,Cr),vr(Cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return xr(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===sr||n===tr||n===er?xr(e,h,l):xr(e,t[a+1],t[a+2])),n){case Zi:case Ki:h=t[a+1],l=t[a+2],mr(e,h,l),a+=3;break;case tr:r=t[a+5],o=t[a+6],cr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Rr),fr(e,Rr),h=r,l=o,a+=7;break;case er:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],ur(h,l,s,i,r,o,Rr),fr(e,Rr),h=r,l=o,a+=5;break;case sr:a+=1;break;case ir:h=t[a+1],l=t[a+2],wr(e,h,l,t[a+3],t[a+4]),a+=5;break;case rr:case or:h=t[a+1],l=t[a+2],wr(e,h,l,t[a+3],t[a+4]),a+=n===rr?9:6;break;case nr:gr(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],Rr,Tr),0===a?yr(e,Rr):fr(e,Rr),h=Tr.x,l=Tr.y,a+=9;break;case ar:h=t[a+1],l=t[a+2],kr=t[a+3],Sr=t[a+4],wr(e,h-kr,l-Sr,2*kr,2*Sr),h+=kr,a+=5;break;case hr:pr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Rr,Tr),0===a?yr(e,Rr):fr(e,Rr),h=Tr.x,l=Tr.y,a+=7;break;case lr:h=t[a+1],l=t[a+2],Br=t[a+3],wr(e,h-Br,l-Br,2*Br,2*Br),h+=Br,a+=4;break;case dr:_r(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Rr,Tr),0===a?yr(e,Rr):fr(e,Rr),h=Tr.x,l=Tr.y,a+=6;break;default:return void br.error(`command: ${n} [index:${a}]`,t)}}},{M:Lr,L:Ir,Z:Er}=Le,{getCenterX:Or,getCenterY:Ar}=at,{arcTo:Mr}=xi,Wr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;n<g;){switch(i=t[n],i){case Lr:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===Ir?(c=t[n+1],u=t[n+2],f.push(Lr,Or(l,c),Ar(d,u))):f.push(Lr,l,d);break;case Ir:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Ir:Mr(f,a,h,t[n+1],t[n+2],e,_,p);break;case Er:Mr(f,a,h,l,d,e,_,p);break;default:f.push(Ir,a,h)}_=a,p=h;break;case Er:r!==Er&&(Mr(f,l,d,c,u,e,_,p),f.push(Er)),n+=1;break;default:o=We[i];for(let e=0;e<o;e++)f.push(t[n+e]);n+=o}r=i}return i!==Er&&(f[1]=l,f[2]=d),f}};function Dr(t){return new Wi(t)}const Fr=Dr();Te.creator=Dr(),Te.parse=Js.parse,Te.convertToCanvasData=Js.toCanvasData;const{drawRoundRect:zr}=De;function Ur(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){zr(this,t,e,s,i,r)})}(t)}const Nr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Yr.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{}}}},Yr=Nr;Yr.alphaPixelTypes.forEach(t=>Yr.upperCaseTypeMap[t]=t.toUpperCase());const Xr=Jt.get("TaskProcessor");class Hr{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return _e(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Xr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Gr{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&&c.assign(this.config,t),this.empty()}add(t,e,i){let r,o,a,h;const l=new Hr(t);return l.parent=this,n(e)?h=e:e&&(o=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===o&&(l.parallel=!1),i&&(l.canUse=i),s(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.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:s,index: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 Vr=Jt.get("Resource"),jr={tasker:new Gr,map:{},get isComplete(){return qr.tasker.isComplete},set(t,e){qr.map[t]&&Vr.repeat(t),qr.map[t]=e},get:t=>qr.map[t],remove(t){const e=qr.map[t];e&&(e.destroy&&e.destroy(),delete qr.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 r(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=re.image(i)),qr.set(t,e),e},destroy(){qr.map={}}},qr=jr,Qr={maxRecycled:10,recycledList:[],patternTasker:new Gr,get(t){let e=jr.get(t.url);return e||jr.set(t.url,e=re.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Jr.recycledList.push(t)})},clearRecycled(){const t=Jr.recycledList;t.length>Jr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&jr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Nr.alphaPixelTypes.some(e=>Jr.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:"+Nr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Nr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Jr.recycledList=[]}},Jr=Qr,{IMAGE:$r,create:Zr}=m;class Kr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Zr($r),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Qr.isFormat("svg",t)&&(this.isSVG=!0),Qr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;jr.tasker.add(()=>_e(this,void 0,void 0,function*(){return yield f.origin.loadImage(this.url,s(t)?f.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return 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=t.naturalWidth||t.width,this.height=t.naturalHeight||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){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 a=f.image.resize(this.view,t,e,r,o,void 0,n,s,i);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,s,i){const r=f.canvas.createPattern(t,e);return f.image.setPatternTransform(r,s,i),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function to(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function eo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function so(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function io(t,e){return(s,i)=>oo(s,i,t,e&&e(i))}function ro(t){return t}function oo(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};to(t,e,Object.assign(r,i||{})),Ao(t,e,s)}function no(t){return io(t)}function ao(t,e){return io(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function ho(t,e){return io(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function lo(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),go(this))}}))}function co(t,e){return io(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function uo(t,e){return io(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function _o(t,e){return io(t,t=>({set(s){this.__setAttr(t,s,e)&&go(this)}}))}function po(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(go(this),this.__.__removeNaturalSize())}}))}function go(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function fo(t){return io(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),go(this)}}))}const yo=_o;function mo(t,e){return io(t,t=>({set(s){this.__setAttr(t,s)&&(xo(this),e&&(this.__.__useStroke=!0))}}))}function xo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&go(t)}const wo=mo;function vo(t){return io(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function bo(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Bo(t){return io(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;c.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function ko(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ro(this)}}))}function So(t){return io(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Co(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Co(this,t,e,s),this.mask&&Ro(this)}}))}function Ro(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Co(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||go(t))}function To(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Po(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Lo(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Io(t){return io(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Jt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Eo(t){return io(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Oo(t){return(e,s)=>{to(e,"__DataProcessor",{get:()=>t})}}function Ao(t,e,i){const r=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=so(e,i);if(s(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(l(i)){const t=d(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:c.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let u,_=r;for(;!u&&_;)u=eo(_,e),_=_.__proto__;u&&u.set&&(a.set=u.set),r[n]&&(a.set=r[n],delete r[n]),to(r,e,a)}const Mo=new Jt("rewrite"),Wo=[],Do=["destroy","constructor"];function Fo(t){return(e,s)=>{Wo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function zo(){return t=>{Uo()}}function Uo(t){Wo.length&&(Wo.forEach(e=>{t&&Mo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Wo.length=0)}function No(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(Do.includes(i)||e&&e.includes(i)))if(t.prototype){eo(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Yo(){return t=>{ne.register(t)}}setTimeout(()=>Uo(!0));const{copy:Xo,toInnerPoint:Ho,toOuterPoint:Go,scaleOfOuter:Vo,rotateOfOuter:jo,skewOfOuter:qo,multiplyParent:Qo,divideParent:Jo,getLayout:$o}=J,Zo={},{round:Ko}=Math,tn={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),rn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)sn(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++)on(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&on(t),t.__updateChange()},updateAllChange(t){if(an(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)nn(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||f.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,o):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},moveWorld(t,e,s=0,i,r){const o=l(e)?Object.assign({},e):{x:e,y:s};i?Go(t.localTransform,o,o,!0):t.parent&&Ho(t.parent.scrollWorldTransform,o,o,!0),en.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){l(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Ko(e),s=Ko(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){en.zoomOfLocal(t,hn(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const a=t.__localMatrix;if(n(i)||(i&&(o=i),i=s),Xo(Zo,a),Vo(Zo,e,s,i),en.hasHighPosition(t))en.setTransform(t,Zo,r,o);else{const e=t.x+Zo.e-a.e,n=t.y+Zo.f-a.f;o&&!r?t.animate({x:e,y:n,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=n,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){en.rotateOfLocal(t,hn(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Xo(Zo,r),jo(Zo,e,s),en.hasHighPosition(t)?en.setTransform(t,Zo,!1,i):t.set({x:t.x+Zo.e-r.e,y:t.y+Zo.f-r.f,rotation:M.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){en.skewOfLocal(t,hn(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Xo(Zo,t.__localMatrix),qo(Zo,e,s,i),en.setTransform(t,Zo,r,o)},transformWorld(t,e,s,i){Xo(Zo,t.worldTransform),Qo(Zo,e),t.parent&&Jo(Zo,t.parent.scrollWorldTransform),en.setTransform(t,Zo,s,i)},transform(t,e,s,i){Xo(Zo,t.localTransform),Qo(Zo,e),en.setTransform(t,Zo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&en.getInnerOrigin(t,r.origin),n=$o(e,o,r.around&&en.getInnerOrigin(t,r.around));if(en.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){Nt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=en.getInnerOrigin(t,r.origin);at.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 Vo(s,en.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>at.tempToOuterOf(en.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return vt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Xo(Zo,t.worldTransform),Jo(Zo,e.scrollWorldTransform),s?Zo:Object.assign({},Zo)),drop(t,e,s,i){t.setTransform(en.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||en.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),f.requestRender(()=>en.animateMove(t,e,s))}}},en=tn,{updateAllMatrix:sn,updateMatrix:rn,updateAllWorldOpacity:on,updateAllChange:nn,updateChange:an}=en;function hn(t,e){return t.updateLayout(),t.parent?at.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ln={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=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>cn(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>cn(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>cn(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let dn;function cn(t,e){return e||(dn=0),t.__.mask&&(dn=1),dn<0?null:(dn&&(dn=-1),!0)}const{updateBounds:un}=tn,_n={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),pn(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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++)gn(e[t],e)},updateBounds(t,e){const s=[t];gn(t,s),fn(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++)un(i[t]);e&&e===s||un(s)}}},{pushAllChildBranch:pn,pushAllBranchStack:gn,updateBoundsByBranchStack:fn}=_n,yn={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:mn,updateBounds:xn}=tn,{toOuterOf:wn,getPoints:vn,copy:bn}=Nt,Bn="_localContentBounds",kn="_worldContentBounds",Sn="_worldBoxBounds",Rn="_worldStrokeBounds";class Cn{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 wn(this.contentBounds,this.leaf.__localMatrix,this[Bn]||(this[Bn]={})),this[Bn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return wn(this.contentBounds,this.leaf.__world,this[kn]||(this[kn]={})),this[kn]}get worldBoxBounds(){return wn(this.boxBounds,this.leaf.__world,this[Sn]||(this[Sn]={})),this[Sn]}get worldStrokeBounds(){return wn(this.strokeBounds,this.leaf.__world,this[Rn]||(this[Rn]={})),this[Rn]}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 xn(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,f.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 J.defaultMatrix;case"page":t=e.zoomLayer;default:return mn(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 Gt(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=J.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=mn(i,e,!0)}if(n||(n=J.getLayout(o)),bn(n,a),at.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:i}=this,r=vn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return s(o)||r.forEach(t=>i.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,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Tn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&f.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&f.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&f.event.stop(this.origin)}}class Pn extends Tn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Pn.ADD="child.add",Pn.REMOVE="child.remove",Pn.CREATED="created",Pn.MOUNTED="mounted",Pn.UNMOUNTED="unmounted",Pn.DESTROY="destroy";const Ln="property.scroll";class In extends Tn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}In.CHANGE="property.change",In.LEAFER_CHANGE="property.leafer_change",In.SCROLL=Ln;const En={scrollX:Ln,scrollY:Ln};class On extends Tn{constructor(t,e){super(t),Object.assign(this,e)}}On.LOAD="image.load",On.LOADED="image.loaded",On.ERROR="image.error";class An extends Tn{static checkHas(t,e,s){"on"===s?e===Fn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Mn)||t.hasEvent(Wn)||t.hasEvent(Dn),t.__hasWorldEvent=t.hasEvent(Fn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Mn,t),"inner"===e&&t.emit(Wn,t)),t.emit(Dn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Fn,this)}}An.RESIZE="bounds.resize",An.INNER="bounds.inner",An.LOCAL="bounds.local",An.WORLD="bounds.world";const{RESIZE:Mn,INNER:Wn,LOCAL:Dn,WORLD:Fn}=An,zn={};[Mn,Wn,Dn,Fn].forEach(t=>zn[t]=1);class Un extends Tn{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){l(t)?(super(Un.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Un.RESIZE="resize";class Nn extends Tn{constructor(t,e){super(t),this.data=e}}Nn.REQUEST="watch.request",Nn.DATA="watch.data";class Yn extends Tn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Yn.REQUEST="layout.request",Yn.START="layout.start",Yn.BEFORE="layout.before",Yn.LAYOUT="layout",Yn.AFTER="layout.after",Yn.AGAIN="layout.again",Yn.END="layout.end";class Xn extends Tn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Xn.REQUEST="render.request",Xn.CHILD_START="render.child_start",Xn.CHILD_END="render.child_end",Xn.START="render.start",Xn.BEFORE="render.before",Xn.RENDER="render",Xn.AFTER="render.after",Xn.AGAIN="render.again",Xn.END="render.end",Xn.NEXT="render.next";class Hn extends Tn{}Hn.START="leafer.start",Hn.BEFORE_READY="leafer.before_ready",Hn.READY="leafer.ready",Hn.AFTER_READY="leafer.after_ready",Hn.VIEW_READY="leafer.view_ready",Hn.VIEW_COMPLETED="leafer.view_completed",Hn.STOP="leafer.stop",Hn.RESTART="leafer.restart",Hn.END="leafer.end",Hn.UPDATE_MODE="leafer.update_mode",Hn.TRANSFORM="leafer.transform",Hn.MOVE="leafer.move",Hn.SCALE="leafer.scale",Hn.ROTATE="leafer.rotate",Hn.SKEW="leafer.skew";const{MOVE:Gn,SCALE:Vn,ROTATE:jn,SKEW:qn}=Hn,Qn={x:Gn,y:Gn,scaleX:Vn,scaleY:Vn,rotation:jn,skewX:qn,skewY:qn},Jn={};class $n{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(h(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)h(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,o,n;s&&("once"===s?o=!0:"boolean"==typeof s?i=s:(i=s.capture,o=s.once));const a=Zn(this,i,!0),l=r(t)?t.split(" "):t,d=o?{listener:e,once:o}:{listener:e};l.forEach(t=>{t&&(n=a[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(d):a[t]=[d],zn[t]&&An.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=r(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Zn(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],zn[t]&&An.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):h(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=h(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):h(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 h(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));l(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&le.has(t)&&(e=le.get(t,{type:t,target:this,current:this}));const i=Zn(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:i,__captureMap:r}=this,o=i&&i[t],n=r&&r[t];return!!(s(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Zn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Jn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Jn)}}const{on:Kn,on_:ta,off:ea,off_:sa,once:ia,emit:ra,emitEvent:oa,hasEvent:na,destroy:aa}=$n.prototype,ha={on:Kn,on_:ta,off:ea,off_:sa,once:ia,emit:ra,emitEvent:oa,hasEvent:na,destroyEventer:aa},la=Jt.get("setAttr"),da={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||o(e)||s(e)||(la.warn(this.innerName,t,e),e=void 0),l(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new In(In.LEAFER_CHANGE,this,t,r,e));const s=Qn[t];s&&(this.emitEvent(new Hn(s,this)),this.emitEvent(new Hn(Hn.TRANSFORM,this)))}this.emitPropertyEvent(In.CHANGE,t,r,e);const s=En[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 In(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ca,multiplyParent:ua,translateInner:_a,defaultWorld:pa}=J,{toPoint:ga,tempPoint:fa}=vt,ya={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;ua(this.__local||e,t?t.__scrollWorld||t.__world:pa,s,!!e.affectScaleOrRotation,r),i&&_a(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ca(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)&&(ga(s.around||s.origin,t.boxBounds,fa),_a(e,-fa.x,-fa.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ma,updateAllMatrix:xa}=tn,{updateBounds:wa}=_n,{toOuterOf:va,copyAndSpread:ba,copy:Ba}=Nt,{toBounds:ka}=Pr,Sa={__updateWorldBounds(){const{__layout:t,__world:e}=this;va(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&An.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&An.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),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"),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.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),va(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){va(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){va(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?ka(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(),xa(this),wa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(xa(this),wa(this,this))):ma(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;n(s)&&s<=0?Ba(e.renderBounds,e.strokeBounds):ba(e.renderBounds,e.boxBounds,s)}},Ra={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(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.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),tn.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Jt.showBounds&&Jt.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:Ca}=ln,Ta={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ca(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ca(s[i],e)||s[i].__clip(t,e)}}},Pa={},{LEAF:La,create:Ia}=m,{stintSet:Ea}=c,{toInnerPoint:Oa,toOuterPoint:Aa,multiplyParent:Ma}=J,{toOuterOf:Wa}=Nt,{copy:Da,move:Fa}=at,{moveLocal:za,zoomOfLocal:Ua,rotateOfLocal:Na,skewOfLocal:Ya,moveWorld:Xa,zoomOfWorld:Ha,rotateOfWorld:Ga,skewOfWorld:Va,transform:ja,transformWorld:qa,setTransform:Qa,getFlipTransform:Ja,getLocalOrigin:$a,getRelativeWorld:Za,drop:Ka}=tn;t.Leaf=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 _}get __LayoutProcessor(){return Cn}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=Ia(La),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Pn.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(Pn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Pn.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(Pn.MOUNTED)):this.__emitLifeEvent(Pn.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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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 Ma(s,t.matrix,e,void 0,s),Wa(this.__layout.renderBounds,e,e),Ea(e,"half",s.half),Ea(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){let{scaleX:s,scaleY:i}=Qr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Pa.scaleX=s,Pa.scaleY=i,Pa}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?Za(this,e):this.worldTransform,r=s?t:{};return Wa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Da(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Da(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Oa(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Aa(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Fa(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 Fa(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){Qa(this,t,e,s)}transform(t,e,s){ja(this,t,e,s)}move(t,e,s){za(this,t,e,s)}moveInner(t,e,s){Xa(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Ua(this,$a(this,t),e,s,i,r)}rotateOf(t,e,s){Na(this,$a(this,t),e,s)}skewOf(t,e,s,i,r){Ya(this,$a(this,t),e,s,i,r)}transformWorld(t,e,s){qa(this,t,e,s)}moveWorld(t,e,s){Xa(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Ha(this,t,e,s,i,r)}rotateOfWorld(t,e){Ga(this,t,e)}skewOfWorld(t,e,s,i,r){Va(this,t,e,s,i,r)}flip(t,e){ja(this,Ja(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){return!0}__hit(t){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(){}getMotionPathData(){return ie.need("path")}getMotionPoint(t){return ie.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){Ka(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):Ao(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=_o),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Pn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Pn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ue([No(da),No(ya),No(Sa),No(ha),No(Ra)],t.Leaf);const{setListWithFn:th}=Nt,{sort:eh}=_n,{localBoxBounds:sh,localStrokeBounds:ih,localRenderBounds:rh,maskLocalBoxBounds:oh,maskLocalStrokeBounds:nh,maskLocalRenderBounds:ah}=ln,hh=new Jt("Branch");t.Branch=class extends t.Leaf{__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(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){th(e||this.__layout.boxBounds,this.children,this.__hasMask?oh:sh)}__updateStrokeBounds(t){th(t||this.__layout.strokeBounds,this.children,this.__hasMask?nh:ih)}__updateRenderBounds(t){th(t||this.__layout.renderBounds,this.children,this.__hasMask?ah:rh)}__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(eh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return hh.warn("add self or destroyed");const i=s(e);if(!t.__){if(h(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ne.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?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(Pn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Pn.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)):s(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(Pn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Pn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Pn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=ue([No(Ta)],t.Branch);class lh{get length(){return this.list.length}constructor(t){this.reset(),t&&(h(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,o=e.length;r<o;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 lh;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 dh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(h(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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 ch=Jt.get("LeaferCanvas");class uh extends Ce{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}f.syncDomFont&&!this.parentView&&(s.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=r(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else ch.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:i}=this;t.width?(s(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):s(e)||(r.width=e),t.height?(s(i)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):s(i)||(r.height=i)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),ch.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),f.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=f.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t),n={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:f.devicePixelRatio};if(!this.isSameSize(n)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=i+"px",this.emitResize(n)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};c.copyAttrs(e,this,Re),this.resize(t),this.resizeListener&&!s(this.width)&&this.resizeListener(new Un(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Ur(CanvasRenderingContext2D.prototype),Ur(Path2D.prototype);const{mineType:_h,fileType:ph}=Nr;function gh(t,e){f.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=_h(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,_h(e),s)),canvasSaveAs:(t,e,s)=>{const i=t.toDataURL(_h(ph(e)),s);return f.origin.download(i,e)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((e,s)=>{const i=new f.origin.Image,{crossOrigin:r}=f.image;r&&(i.setAttribute("crossOrigin",r),i.crossOrigin=r),i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.src=f.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},f.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},f.canvas=re.canvas(),f.conicGradientSupport=!!f.canvas.context.createConicGradient}Object.assign(re,{canvas:(t,e)=>new uh(t,e),image:t=>new Kr(t)}),f.name="web",f.isMobile="ontouchstart"in window,f.requestRender=function(t){window.requestAnimationFrame(t)},to(f,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:fh}=navigator;fh.indexOf("Firefox")>-1?(f.conicGradientRotate90=!0,f.intWheelDeltaY=!0,f.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(f.fullImageShadow=!0),fh.indexOf("Windows")>-1?(f.os="Windows",f.intWheelDeltaY=!0):fh.indexOf("Mac")>-1?f.os="Mac":fh.indexOf("Linux")>-1&&(f.os="Linux");class yh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new lh;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 lh,this.target=t,e&&(this.config=c.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(Xn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Pn.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 Nn(Nn.DATA,{updatedList:this.updatedList})),this.__updatedList=new lh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[In.CHANGE,this.__onAttrChange,this],[[Pn.ADD,Pn.REMOVE],this.__onChildEvent,this],[Nn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:mh,updateBounds:xh,updateChange:wh}=tn,{pushAllChildBranch:vh,pushAllParent:bh}=_n;const{worldBounds:Bh}=ln;class kh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,h(t)&&(t=new lh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Bh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Bh),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:Sh,updateAllChange:Rh}=tn,Ch=Jt.get("Layouter");class Th{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new dh,this.target=t,e&&(this.config=c.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(Yn.START),this.layoutOnce(),t.emitEvent(new Yn(Yn.END,this.layoutedBlocks,this.times))}catch(t){Ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ch.warn("layouting"):this.times>3?Ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Nn.REQUEST),this.totalTimes>1?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=te.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Yn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Yn(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?(mh(t,!0),e.add(t),t.isBranch&&vh(t,e),bh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),bh(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||xh(i[t])}xh(s)}})}(this.__levelList),function(t){t.list.forEach(wh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Yn(o,a,this.times)),s.emitEvent(new Yn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,te.end(e)}fullLayout(){const t=te.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Yn,o=this.getBlocks(new lh(e));e.emitEvent(new Yn(s,o,this.times)),Th.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Yn(i,o,this.times)),e.emitEvent(new Yn(r,o,this.times)),this.addBlocks(o),te.end(t)}static fullLayout(t){Sh(t,!0),t.isBranch?_n.updateBounds(t):tn.updateBounds(t),Rh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new kh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new kh(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_([[Yn.REQUEST,this.layout,this],[Yn.AGAIN,this.layoutAgain,this],[Nn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ph=Jt.get("Renderer");class Lh{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,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=c.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.__requestRender()}requestLayout(){this.target.emit(Yn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Xn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Xn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Xn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Ph.log(e.innerName,"---\x3e");try{this.emitRender(Xn.START),this.renderOnce(t),this.emitRender(Xn.END,this.totalBounds),Qr.clearRecycled()}catch(t){this.rendering=!1,Ph.error(t)}Ph.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ph.warn("rendering");if(this.times>3)return Ph.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Xn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Xn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Xn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Xn.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=te.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Gt(i);s.save(),i.spread(Lh.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),te.end(e)}fullRender(){const t=te.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),te.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Jt.showRepaint&&Jt.drawRepaint(s,t),f.render(this.target,s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;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 f.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()};f.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Gt(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 Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ph.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Xn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Xn.REQUEST,this.update,this],[Yn.END,this.__onLayoutEnd,this],[Xn.AGAIN,this.renderAgain,this],[Un.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 Ih(t){return io(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eh(t){return io(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Oh(){return(t,e)=>{const s="_"+e;to(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}})}}Lh.clipSpread=10,Object.assign(re,{watcher:(t,e)=>new yh(t,e),layouter:(t,e)=>new Th(t,e),renderer:(t,e,s)=>new Lh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),f.layout=Th.fullLayout,f.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new lh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Ah={},Mh={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}},Wh={number:(t,e)=>l(t)?"percent"===t.type?t.value*e:t.value:t},Dh={},Fh={},zh={},Uh={},Nh={},Yh={apply(){ie.need("filter")}},Xh={},Hh={setStyleName:()=>ie.need("state"),set:()=>ie.need("state")},Gh={list:{},register(t,e){Gh.list[t]=e},get:t=>Gh.list[t]},{parse:Vh,objectToCanvasData:jh}=Js,{stintSet:qh}=c,{hasTransparent:Qh}=Mh,Jh={},$h=Jt.get("UIData");class Zh extends _{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;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}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!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!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,$h.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,$h.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(qh(this,"__isTransparentFill",Qh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(qh(this,"__isTransparentStroke",Qh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?Vh(t):jh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Kh(this,"shadow",t)}setInnerShadow(t){Kh(this,"innerShadow",t)}setFilter(t){Kh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Fh.compute("fill",this.__leaf),e&&Fh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),h(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Jh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Jh))}__removePaint(t,e){e&&this.__removeInput(t),zh.recycleImage(t,this),"fill"===t?(qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(qh(this,"__isAlphaPixelStroke",void 0),qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Kh(t,e,s){t.__setInput(e,s),h(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 tl extends Zh{}class el extends tl{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 sl extends tl{__getInputData(t,e){const s=super.__getInputData(t,e);return Re.forEach(t=>delete s[t]),s}}class il extends el{}class rl extends Zh{get __usePathBox(){return this.points||this.__pathInputed}}class ol extends Zh{get __boxStroke(){return!this.__pathInputed}}class nl extends Zh{get __boxStroke(){return!this.__pathInputed}}class al extends rl{}class hl extends Zh{}class ll extends Zh{get __pathInputed(){return 2}}class dl extends tl{}const cl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ul extends Zh{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=cl[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=ne.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}}class _l extends ol{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",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 pl extends ol{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:gl,add:fl}=S,yl={__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)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=gl(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=Nh.getShadowRenderSpread(this,e)),i&&(t=gl(t,i)),o&&(t=fl(t,Yh.getSpread(o))),n&&(t=fl(t,n)),a&&(t=fl(t,a));let l=t;return s&&(l=gl(l,Nh.getInnerShadowSpread(this,s))),r&&(l=gl(l,r)),this.__layout.renderShapeSpread=l,h?gl(h.__updateRenderSpread(),t):t}},{stintSet:ml}=c,xl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ml(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ml(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;ml(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Nh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(h(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),ml(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__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=Fh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Nh.shadow(this,t,h),a&&(i.__isStrokes?Fh.strokes(o,this,t,e):Fh.stroke(o,this,t,e)),r&&(i.__isFills?Fh.fills(r,this,t,e):Fh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&Nh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Fh.strokes(o,this,t,e):Fh.stroke(o,this,t,e)),c&&Yh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Fh.strokes(o,this,t,e):Fh.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,Mh.string(e.color))}r&&(i.__isFills?Fh.fills(r,this,t,e):Fh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Fh.strokes(o,this,t,e):Fh.stroke(o,this,t,e))}}else i.__pathInputed?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?Fh.fills(i,this,t,e):Fh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Fh.strokes(r,this,t,e):Fh.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&&Fh.stroke(r,t,e,s),i&&Fh.fill(i,t,e,s),o&&t.__drawAfterFill(e,s),r&&!n&&Fh.stroke(r,t,e,s)}const vl={__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 bl,Bl;t.UI=bl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.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 Fr.set(this.path=t||[]),t||this.__drawPathByBox(Fr),Fr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return r(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ie.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ie.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Fr.set(s=[]),this.__drawPathByBox(Fr)),t?Js.toCanvasData(s,!0):s}getPathString(t,e,s){return Js.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Xh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Wr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Dh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?$i.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,n(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e,s){Fh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){return this.set(t),ie.need("animate")}killAnimate(t,e){}export(t,e){return ie.need("export")}syncExport(t,e){return ie.need("export")}clone(t){const e=c.clone(this.toJSON());return t&&Object.assign(e,t),bl.one(e)}static one(t,e,s,i,r){return ne.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Yo()(this)}static registerData(t){Oo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ue([Oo(Zh)],t.UI.prototype,"__",void 0),ue([Oh()],t.UI.prototype,"zoomLayer",void 0),ue([no("")],t.UI.prototype,"id",void 0),ue([no("")],t.UI.prototype,"name",void 0),ue([no("")],t.UI.prototype,"className",void 0),ue([bo("pass-through")],t.UI.prototype,"blendMode",void 0),ue([ko(1)],t.UI.prototype,"opacity",void 0),ue([So(!0)],t.UI.prototype,"visible",void 0),ue([bo(!1)],t.UI.prototype,"locked",void 0),ue([Bo(!1)],t.UI.prototype,"dim",void 0),ue([Bo(!1)],t.UI.prototype,"dimskip",void 0),ue([To(0)],t.UI.prototype,"zIndex",void 0),ue([Po(!1)],t.UI.prototype,"mask",void 0),ue([Lo(!1)],t.UI.prototype,"eraser",void 0),ue([ao(0,!0)],t.UI.prototype,"x",void 0),ue([ao(0,!0)],t.UI.prototype,"y",void 0),ue([_o(100,!0)],t.UI.prototype,"width",void 0),ue([_o(100,!0)],t.UI.prototype,"height",void 0),ue([co(1,!0)],t.UI.prototype,"scaleX",void 0),ue([co(1,!0)],t.UI.prototype,"scaleY",void 0),ue([uo(0,!0)],t.UI.prototype,"rotation",void 0),ue([uo(0,!0)],t.UI.prototype,"skewX",void 0),ue([uo(0,!0)],t.UI.prototype,"skewY",void 0),ue([ao(0,!0)],t.UI.prototype,"offsetX",void 0),ue([ao(0,!0)],t.UI.prototype,"offsetY",void 0),ue([ho(0,!0)],t.UI.prototype,"scrollX",void 0),ue([ho(0,!0)],t.UI.prototype,"scrollY",void 0),ue([lo()],t.UI.prototype,"origin",void 0),ue([lo()],t.UI.prototype,"around",void 0),ue([no(!1)],t.UI.prototype,"lazy",void 0),ue([po(1)],t.UI.prototype,"pixelRatio",void 0),ue([vo(0)],t.UI.prototype,"renderSpread",void 0),ue([fo()],t.UI.prototype,"path",void 0),ue([yo()],t.UI.prototype,"windingRule",void 0),ue([yo(!0)],t.UI.prototype,"closed",void 0),ue([_o(0)],t.UI.prototype,"padding",void 0),ue([_o(!1)],t.UI.prototype,"lockRatio",void 0),ue([_o()],t.UI.prototype,"widthRange",void 0),ue([_o()],t.UI.prototype,"heightRange",void 0),ue([no(!1)],t.UI.prototype,"draggable",void 0),ue([no()],t.UI.prototype,"dragBounds",void 0),ue([no("auto")],t.UI.prototype,"dragBoundsType",void 0),ue([no(!1)],t.UI.prototype,"editable",void 0),ue([Io(!0)],t.UI.prototype,"hittable",void 0),ue([Io("path")],t.UI.prototype,"hitFill",void 0),ue([wo("path")],t.UI.prototype,"hitStroke",void 0),ue([Io(!1)],t.UI.prototype,"hitBox",void 0),ue([Io(!0)],t.UI.prototype,"hitChildren",void 0),ue([Io(!0)],t.UI.prototype,"hitSelf",void 0),ue([Io()],t.UI.prototype,"hitRadius",void 0),ue([Eo("")],t.UI.prototype,"cursor",void 0),ue([bo()],t.UI.prototype,"fill",void 0),ue([wo(void 0,!0)],t.UI.prototype,"stroke",void 0),ue([wo("inside")],t.UI.prototype,"strokeAlign",void 0),ue([wo(1,!0)],t.UI.prototype,"strokeWidth",void 0),ue([wo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ue([wo("none")],t.UI.prototype,"strokeCap",void 0),ue([wo("miter")],t.UI.prototype,"strokeJoin",void 0),ue([wo()],t.UI.prototype,"dashPattern",void 0),ue([wo(0)],t.UI.prototype,"dashOffset",void 0),ue([wo(10)],t.UI.prototype,"miterLimit",void 0),ue([yo(0)],t.UI.prototype,"cornerRadius",void 0),ue([yo()],t.UI.prototype,"cornerSmoothing",void 0),ue([Ih()],t.UI.prototype,"shadow",void 0),ue([Ih()],t.UI.prototype,"innerShadow",void 0),ue([Ih()],t.UI.prototype,"blur",void 0),ue([Ih()],t.UI.prototype,"backgroundBlur",void 0),ue([Ih()],t.UI.prototype,"grayscale",void 0),ue([Ih()],t.UI.prototype,"filter",void 0),ue([bo()],t.UI.prototype,"placeholderColor",void 0),ue([no(100)],t.UI.prototype,"placeholderDelay",void 0),ue([no({})],t.UI.prototype,"data",void 0),ue([Fo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=bl=ue([No(yl),No(xl),zo()],t.UI),t.Group=class extends t.UI{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);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),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(){}},ue([Oo(tl)],t.Group.prototype,"__",void 0),ue([_o(0)],t.Group.prototype,"width",void 0),ue([_o(0)],t.Group.prototype,"height",void 0),t.Group=ue([No(t.Branch),Yo()],t.Group);const kl=Jt.get("Leafer");t.Leafer=Bl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&jr.isComplete}get layoutLocked(){return!this.layouter.running}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),Bl.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,c.assign(i,t));const r=this.canvas=re.canvas(i);this.__controllers.push(this.renderer=re.renderer(this,r,i),this.watcher=re.watcher(this,i),this.layouter=re.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=re.selector(this),this.interaction=re.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.hitCanvasManager()),this.canvasManager=new ce,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))),yn.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(Hn.RESTART):this.emitLeafer(Hn.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(Hn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=c.copyAttrs({},t,Re);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Gt(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=c.copyAttrs({},this.canvas,Re);e.resize(t),this.updateLazyBounds(),this.__onResize(new Un(t,s))}__onResize(t){this.emitEvent(t),c.copyAttrs(this.__,t,Re),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&&(Re.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(Hn.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Re.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=c.copyAttrs({},i,Re);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(Hn.BEFORE_READY),this.emitLeafer(Hn.READY),this.emitLeafer(Hn.AFTER_READY),yn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Hn.VIEW_READY),yn.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){yn.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(Hn.VIEW_COMPLETED),yn.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 ie.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 Hn(t,this))}__listenEvents(){const t=te.start("FirstCreate "+this.innerName);this.once([[Hn.START,()=>te.end(t)],[Yn.START,this.updateLazyBounds,this],[Xn.START,this.__onCreated,this],[Xn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Nn.DATA,this.__onWatchData,this],[Yn.END,this.__onLayoutEnd,this],[Xn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Bl.list.remove(this);try{this.stop(),this.emitLeafer(Hn.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.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Qr.clearRecycled()},100)}catch(t){kl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new lh,ue([Oo(sl)],t.Leafer.prototype,"__",void 0),ue([_o()],t.Leafer.prototype,"pixelRatio",void 0),ue([no("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Bl=ue([Yo()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ue([Oo(ol)],t.Rect.prototype,"__",void 0),t.Rect=ue([No(vl),zo(),Yo()],t.Rect);const{add:Sl,includes:Rl,scroll:Cl}=Nt,Tl=t.Rect.prototype,Pl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}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.pathInputed){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.includes("scroll"))&&(Sl(a,o),Cl(a,s)),this.__updateRectRenderBounds(),t=!Rl(o,a),t&&"show"===n&&Sl(r,a)}else this.__updateRectRenderBounds();c.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))}},ue([Oo(el)],t.Box.prototype,"__",void 0),ue([_o(100)],t.Box.prototype,"width",void 0),ue([_o(100)],t.Box.prototype,"height",void 0),ue([no(!1)],t.Box.prototype,"resizeChildren",void 0),ue([vo("show")],t.Box.prototype,"overflow",void 0),ue([Fo(Tl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ue([Fo(Tl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ue([Fo(Tl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ue([Fo(Tl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ue([Fo(Tl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ue([Fo(Tl.__updateChange)],t.Box.prototype,"__updateRectChange",null),ue([Fo(Tl.__render)],t.Box.prototype,"__renderRect",null),ue([Fo(Pl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ue([zo(),Yo()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ue([Oo(il)],t.Frame.prototype,"__",void 0),ue([bo("#FFFFFF")],t.Frame.prototype,"fill",void 0),ue([vo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ue([Yo()],t.Frame);const{moveTo:Ll,closePath:Il,ellipse:El}=xi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?(i||r?(s<1&&El(a,o,n,o*s,n*s,0,i,r,!1),El(a,o,n,o,n,0,r,i,!0),s<1&&Il(a)):(s<1&&(El(a,o,n,o*s,n*s),Ll(a,t,n)),El(a,o,n,o,n,0,360,0,!0)),f.ellipseToCurve&&(this.__.path=this.getPath(!0))):i||r?(Ll(a,o,n),El(a,o,n,o,n,0,i,r,!1),Il(a)):El(a,o,n,o,n)}},ue([Oo(nl)],t.Ellipse.prototype,"__",void 0),ue([yo(0)],t.Ellipse.prototype,"innerRadius",void 0),ue([yo(0)],t.Ellipse.prototype,"startAngle",void 0),ue([yo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ue([Yo()],t.Ellipse);const{sin:Ol,cos:Al,PI:Ml}=Math,{moveTo:Wl,lineTo:Dl,closePath:Fl,drawPoints:zl}=xi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)zl(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Wl(e,o,0);for(let t=1;t<r;t++)Dl(e,o+o*Ol(2*t*Ml/r),n-n*Al(2*t*Ml/r));Fl(e)}}},ue([Oo(al)],t.Polygon.prototype,"__",void 0),ue([yo(3)],t.Polygon.prototype,"sides",void 0),ue([yo()],t.Polygon.prototype,"points",void 0),ue([yo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ue([zo(),Yo()],t.Polygon);const{sin:Ul,cos:Nl,PI:Yl}=Math,{moveTo:Xl,lineTo:Hl,closePath:Gl}=xi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Xl(n,r,0);for(let t=1;t<2*s;t++)Hl(n,r+(t%2==0?r:r*i)*Ul(t*Yl/s),o-(t%2==0?o:o*i)*Nl(t*Yl/s));Gl(n)}},ue([Oo(hl)],t.Star.prototype,"__",void 0),ue([yo(5)],t.Star.prototype,"corners",void 0),ue([yo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ue([Yo()],t.Star);const{moveTo:Vl,lineTo:jl,drawPoints:ql}=xi,{rotate:Ql,getAngle:Jl,getDistance:$l,defaultPoint:Zl}=at;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Ql(s,e),s}set toPoint(t){this.width=$l(Zl,t),this.rotation=Jl(Zl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ql(e,t.points,t.curve,t.closed):(Vl(e,0,0),jl(e,this.width,0))}},ue([Oo(rl)],t.Line.prototype,"__",void 0),ue([mo("center")],t.Line.prototype,"strokeAlign",void 0),ue([_o(0)],t.Line.prototype,"height",void 0),ue([yo()],t.Line.prototype,"points",void 0),ue([yo(0)],t.Line.prototype,"curve",void 0),ue([yo(!1)],t.Line.prototype,"closed",void 0),t.Line=ue([Yo()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return h(t)&&t[0].image}},ue([Oo(_l)],t.Image.prototype,"__",void 0),ue([_o("")],t.Image.prototype,"url",void 0),t.Image=ue([Yo()],t.Image);const Kl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Kr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new On(On.LOADED,{image:t}))})}draw(t,e,s,i){const r=new pt(t.worldTransform).invert(),o=new pt;e&&o.translate(e.x,e.y),s&&(n(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()}},ue([Oo(pl)],t.Canvas.prototype,"__",void 0),ue([Eh(100)],t.Canvas.prototype,"width",void 0),ue([Eh(100)],t.Canvas.prototype,"height",void 0),ue([Eh(1)],t.Canvas.prototype,"pixelRatio",void 0),ue([Eh(!0)],t.Canvas.prototype,"smooth",void 0),ue([no(!1)],t.Canvas.prototype,"safeResize",void 0),ue([Eh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ue([Yo()],t.Canvas);const{copyAndSpread:td,includes:ed,spread:sd,setList:id}=Nt,{stintSet:rd}=c;function od(t,e,s){t.__.__font?Fh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function nd(t,e,s,i,r){const o=s.__;l(t)?Fh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),i.stroke()),o.__useArrow&&Fh.strokeArrow(t,s,i,r)}function ad(t,e,s,i,r){const o=s.__;l(t)?Fh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),Fh.drawTextStroke(s,i,r))}function hd(t,e,s,i,r){const o=i.getSameCanvas(!0,!0);o.font=s.__.__font,ad(t,2,s,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",Fh.fillText(s,o,r),o.blendMode="normal",tn.copyCanvasByWorld(s,i,o),o.recycle(s.__nowWorld)}t.Text=class extends t.UI{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=Wh.number(e,r),t.__letterSpacing=Wh.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"}`,rd(t,"__padding",l&&M.fourNumber(l)),rd(t,"__clipText","show"!==h&&!t.__autoSize),rd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Ah.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,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&sd(a,s/2),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),c.stintSet(this,"isOverflow",!ed(h,a)),this.isOverflow?(id(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;td(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()}},ue([Oo(ul)],t.Text.prototype,"__",void 0),ue([_o(0)],t.Text.prototype,"width",void 0),ue([_o(0)],t.Text.prototype,"height",void 0),ue([bo()],t.Text.prototype,"boxStyle",void 0),ue([no(!1)],t.Text.prototype,"resizeFontSize",void 0),ue([bo("#000000")],t.Text.prototype,"fill",void 0),ue([mo("outside")],t.Text.prototype,"strokeAlign",void 0),ue([Io("all")],t.Text.prototype,"hitFill",void 0),ue([_o("")],t.Text.prototype,"text",void 0),ue([_o("")],t.Text.prototype,"placeholder",void 0),ue([_o("caption")],t.Text.prototype,"fontFamily",void 0),ue([_o(12)],t.Text.prototype,"fontSize",void 0),ue([_o("normal")],t.Text.prototype,"fontWeight",void 0),ue([_o(!1)],t.Text.prototype,"italic",void 0),ue([_o("none")],t.Text.prototype,"textCase",void 0),ue([_o("none")],t.Text.prototype,"textDecoration",void 0),ue([_o(0)],t.Text.prototype,"letterSpacing",void 0),ue([_o({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ue([_o(0)],t.Text.prototype,"paraIndent",void 0),ue([_o(0)],t.Text.prototype,"paraSpacing",void 0),ue([_o("x")],t.Text.prototype,"writingMode",void 0),ue([_o("left")],t.Text.prototype,"textAlign",void 0),ue([_o("top")],t.Text.prototype,"verticalAlign",void 0),ue([_o(!0)],t.Text.prototype,"autoSizeAlign",void 0),ue([_o("normal")],t.Text.prototype,"textWrap",void 0),ue([_o("show")],t.Text.prototype,"textOverflow",void 0),ue([bo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ue([Yo()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ue([Oo(ll)],t.Path.prototype,"__",void 0),ue([mo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ue([Yo()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),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(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ue([Oo(dl)],t.Pen.prototype,"__",void 0),ue([(t,e)=>{to(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ue([No(Wi,["set","path","paint"]),Yo()],t.Pen);const{getSpread:ld,copyAndSpread:dd,toOuterOf:cd,getOuterOf:ud,getByMove:_d,move:pd,getIntersectData:gd}=Nt,fd={};let yd;const{stintSet:md}=c,{hasTransparent:xd}=Mh;function wd(t,e,i){if(!l(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:n}=i.__layout;switch(e.type){case"image":o=zh.image(i,t,e,n,!yd||!yd[e.url]);break;case"linear":o=Uh.linearGradient(e,n);break;case"radial":o=Uh.radialGradient(e,n);break;case"angular":o=Uh.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;o={type:r,style:Mh.string(a,h)};break;default:s(e.r)||(o={type:"solid",style:Mh.string(e)})}if(o&&(o.originPaint=e,r(o.style)&&xd(o.style)&&(o.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}return o}const vd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];h(a)||(a=[a]),yd=zh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=wd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(md(s,"__isAlphaPixelFill",r),md(s,"__isTransparentFill",o)):(md(s,"__isAlphaPixelStroke",r),md(s,"__isTransparentStroke",o),md(s,"__hasMultiStrokeStyle",n))):s.__removePaint(t,!1)},fill:function(t,e,s,i){s.fillStyle=t,od(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,zh.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);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&i>1)&&s.scale(1/t,1/i)}o.blendMode&&(s.blendMode=o.blendMode),od(e,s,i),s.restore()}else o.blendMode?(s.saveBlendMode(o.blendMode),od(e,s,i),s.restoreBlendMode()):od(e,s,i)}},fillPathOrText:od,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)Fh.strokeText(t,e,s,i);else switch(r.strokeAlign){case"center":nd(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),nd(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)nd(t,2,e,s,i);else{const{renderBounds:o}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),nd(t,2,e,n,i),n.clipUI(r),n.clearWorld(o),tn.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){Fh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":ad(t,1,e,s,i);break;case"inside":hd(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?ad(t,2,e,s,i):hd(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||!zh.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?Fh.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):s?Fh.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,_;cd(n.strokeSpread?(dd(fd,n.boxBounds,n.strokeSpread),fd):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(f.fullImageShadow)i=a;else{const t=n.renderShapeSpread?ld(r,S.swapAndScale(n.renderShapeSpread,p,g)):r;i=gd(t,a)}c=r.getFitMatrix(i);let{a:y,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=y,g*=m),u=ud(a,c),h=_d(u,-c.e,-c.f),l=ud(o,c),pd(l,-c.e,-c.f);const x=s.matrix;x?(d=new pt(c),d.multiply(x),y*=x.scaleX,m*=x.scaleY):d=c,d.withScale(y,m),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 bd,Bd=new Gt;const{isSame:kd}=Nt;function Sd(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||zh.createData(r,i,s,o),!0}function Rd(t,e){Pd(t,On.LOAD,e)}function Cd(t,e){Pd(t,On.LOADED,e)}function Td(t,e,s){e.error=s,t.forceUpdate("surface"),Pd(t,On.ERROR,e)}function Pd(t,e,s){t.hasEvent(e)&&t.emitEvent(new On(e,s))}function Ld(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Id,translate:Ed}=J,Od=new Gt,Ad={},Md={};function Wd(t,e,s,i){const o=r(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&o<0?0:o}let Dd={},Fd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:zd,set:Ud,rotateOfOuter:Nd,translate:Yd,scaleOfOuter:Xd,multiplyParent:Hd,scale:Gd,rotate:Vd,skew:jd}=J;function qd(t,e,s,i,r,o,n,a){n&&Vd(t,n),a&&jd(t,a.x,a.y),r&&Gd(t,r,o),Yd(t,e.x+s,e.y+i)}const{get:Qd,scale:Jd,copy:$d}=J,{getFloorScale:Zd}=M,{abs:Kd}=Math;const tc={image:function(t,e,s,i,r){let o,n;const a=Qr.get(s);return bd&&s===bd.paint&&kd(i,bd.boxBounds)?o=bd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),bd=a.use>1?{leafPaint:o,paint:s,boxBounds:Bd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Sd(t,e,s,a,o,i),r&&(Rd(t,n),Cd(t,n))):a.error?r&&Td(t,n,a.error):(r&&(Ld(t,!0),Rd(t,n)),o.loadId=a.load(()=>{Ld(t,!1),t.destroyed||(Sd(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Cd(t,n)),o.loadId=void 0},e=>{Ld(t,!1),Td(t,n,e),o.loadId=void 0}),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}=zh.getImageRenderScaleData(t,s,i,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===o+"-"+n&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===f.name&&Un.isResizing(s)||d||(e=f.image.isLarge(a,o,n))),e?(s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),zh.drawImage(t,o,n,s,i,r),!0):(!t.style||l.sync||d?zh.createPattern(t,s,i,r):zh.createPatternTask(t,s,i,r),!1))},drawImage:function(t,e,s,i,r,o){const{data:n,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=n,c=a.getFull(n.filters),u=i.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(i),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(n.scaleX&&(p*=n.scaleX,g*=n.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(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(h(s)){let i,r,o,n,a;for(let l=0,d=s.length;l<d;l++)i=s[l],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Qr.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],h(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=Qr.patternTasker.add(()=>_e(this,void 0,void 0,function*(){t.patternTask=null,s.bounds.hit(e.__nowWorld)&&zh.createPattern(t,e,s,i),e.forceUpdate("surface")}),300))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:o}=zh.getImageRenderScaleData(t,e,s,i),n=r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!f.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:s,data:i}=t,{transform:a,gap:h}=i,l=zh.getPatternFixScale(t,r,o);let d,c,u,{width:_,height:p}=s;l&&(r*=l,o*=l),_*=r,p*=o,h&&(c=h.x*r/Kd(i.scaleX||1),u=h.y*o/Kd(i.scaleY||1)),(a||1!==r||1!==o)&&(r*=Zd(_+(c||0)),o*=Zd(p+(u||0)),d=Qd(),a&&$d(d,a),Jd(d,1/r,1/o));const g=s.getCanvas(_,p,i.opacity,i.filters,c,u,e.leafer&&e.leafer.config.smooth),y=s.getPattern(g,i.repeat||f.origin.noRepeat||"no-repeat",d,t);t.style=y,t.patternId=n}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,o=f.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=zh.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=Od.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:o}=s,{opacity:n,mode:a,align:h,offset:d,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===o,w={mode:a},v="center"!==h&&(_||0)%180==90;let b,B;switch(Nt.set(Md,0,0,v?o:i,v?i:o),a&&"cover"!==a&&"fit"!==a?((c||u)&&(M.getScaleData(c,u,s,Ad),b=Ad.scaleX,B=Ad.scaleY),(h||y||f)&&(b&&Nt.scale(Md,b,B,!0),h&&kt.toPoint(h,Md,e,Md,!0,!0))):x&&!_||(b=B=Nt.getFitScale(e,Md,"fit"!==a),Nt.put(e,s,h,b,!1,Md),Nt.scale(Md,b,B,!0)),d&&at.move(Md,d),a){case"stretch":x?b&&(b=B=void 0):(b=e.width/i,B=e.height/o,zh.stretchMode(w,e,b,B));break;case"normal":case"clip":if(Md.x||Md.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),zh.clipMode(w,e,Md.x,Md.y,b,B,_,p,t,s),t&&(b=b?b*t:t,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&zh.repeatMode(w,e,i,o,Md.x,Md.y,b,B,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=l(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;l(t)?(o=t.x,n=t.y):o=n=t;return{x:Wd(o,s,r.width,e&&e.x),y:Wd(n,i,r.height,e&&e.y)}}(y,s&&f,Md.width,Md.height,e));break;default:b&&zh.fillOrFitMode(w,e,Md.x,Md.y,b,B,_)}return w.transform||(e.x||e.y)&&Ed(w.transform=Id(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=B),n&&n<1&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,s,i){const r=zd(),{x:o,y:n}=e;o||n?Yd(r,o,n):r.onlyScale=!0,Gd(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,o,n){const a=zd();Yd(a,e.x+s,e.y+i),Gd(a,r,o),n&&Nd(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=zd();qd(d,e,s,i,r,o,n,a),h&&(n||a?(Ud(Fd),Xd(Fd,e,h,l),Hd(d,Fd)):Xd(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,o,n,a,h,l,d,c){const u=zd();if(c)qd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Nd(u,{x:s/2,y:i/2},h);else switch(Vd(u,h),h){case 90:Yd(u,i,0);break;case 180:Yd(u,s,i);break;case 270:Yd(u,0,s)}Dd.x=e.x+r,Dd.y=e.y+o,Yd(u,Dd.x,Dd.y),n&&Xd(u,Dd,n,a)}t.transform=u}},{toPoint:ec}=vt,{hasTransparent:sc}=Mh,ic={},rc={};function oc(t,e,s,i){if(s){let o,n,a,h;for(let t=0,l=s.length;t<l;t++)o=s[t],r(o)?(a=t/(l-1),n=Mh.string(o,i)):(a=o.offset,n=Mh.string(o.color,i)),e.addColorStop(a,n),!h&&sc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:nc,getDistance:ac}=at,{get:hc,rotateOfOuter:lc,scaleOfOuter:dc}=J,{toPoint:cc}=vt,uc={},_c={};function pc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=nc(e,s);o=hc(),r?(dc(o,e,n/a*(i||1),1),lc(o,e,t+90)):(dc(o,e,1,n/a*(i||1)),lc(o,e,t))}return o}const{getDistance:gc}=at,{toPoint:fc}=vt,yc={},mc={};const xc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:o}=t;ec(s||"top",e,ic),ec(i||"bottom",e,rc);const n=f.canvas.createLinearGradient(ic.x,ic.y,rc.x,rc.y),a={type:r,style:n};return oc(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;cc(s||"center",e,uc),cc(i||"bottom",e,_c);const a=f.canvas.createRadialGradient(uc.x,uc.y,0,uc.x,uc.y,ac(uc,_c)),h={type:r,style:a};oc(h,a,t.stops,o);const l=pc(e,uc,_c,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;fc(s||"center",e,yc),fc(i||"bottom",e,mc);const a=f.conicGradientSupport?f.canvas.createConicGradient(0,yc.x,yc.y):f.canvas.createRadialGradient(yc.x,yc.y,0,yc.x,yc.y,gc(yc,mc)),h={type:r,style:a};oc(h,a,t.stops,o);const l=pc(e,yc,mc,n||1,f.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:pc},{copy:wc,move:vc,toOffsetOutBounds:bc}=Nt,{max:Bc,abs:kc}=Math,Sc={},Rc=new pt,Cc={};function Tc(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=Bc(n,r+o-i),a=Bc(a,r+o+s),h=Bc(h,r+o+i),l=Bc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function Pc(t,e,s){const{shapeBounds:i}=s;let r,o;f.fullImageShadow?(wc(Sc,t.bounds),vc(Sc,e.x-i.x,e.y-i.y),r=t.bounds,o=Sc):(r=i,o=e),t.copyWorld(s.canvas,r,o)}const{toOffsetOutBounds:Lc}=Nt,Ic={};const Ec=Tc;const Oc={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;bc(h,Cc,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Cc.offsetX+(n.x||0)*c*f,Cc.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,Mh.string(n.color)),r=Nh.getShadowTransform(t,_,s,n,Cc,f),r&&_.setTransform(r),Pc(_,Cc,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")),tn.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;Lc(h,Ic,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Ic.offsetX+(n.x||0)*c*f,Ic.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=Nh.getShadowTransform(t,_,s,n,Ic,f,!0),r&&_.setTransform(r),Pc(_,Ic,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,Mh.string(n.color),"source-in"),tn.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:Tc,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 Rc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),Rc}},isTransformShadow(t){},getInnerShadowSpread:Ec},{excludeRenderBounds:Ac}=ln;let Mc;function Wc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":Mc||(Mc=!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);Fc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":Fc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function Dc(t){return t.getSameCanvas(!1,!0)}function Fc(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)}t.Group.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&&(Wc(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||Ac(s,e)||s.__render(t,e),o=s.__.opacity,Mc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Dc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=Dc(t)),r||(r=Dc(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&Wc(this,n,t,r,i,o,void 0,!1),Ac(s,e)||s.__render(r||t,e),d&&Wc(this,n,t,r,i,o,d,!1)}Wc(this,n,t,r,i,o,void 0,!0)};const zc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Uc=zc+"_#~&*+\\=|≮≯≈≠=…",Nc=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 Yc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Xc=Yc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Hc=Yc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Gc=Yc(zc),Vc=Yc(Uc),jc=Yc("- —/~|┆·");var qc;!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"}(qc||(qc={}));const{Letter:Qc,Single:Jc,Before:$c,After:Zc,Symbol:Kc,Break:tu}=qc;function eu(t){return Xc[t]?Qc:jc[t]?tu:Hc[t]?$c:Gc[t]?Zc:Vc[t]?Kc:Nc.test(t)?Jc:Qc}const su={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 iu(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:ru}=su,{Letter:ou,Single:nu,Before:au,After:hu,Symbol:lu,Break:du}=qc;let cu,uu,_u,pu,gu,fu,yu,mu,xu,wu,vu,bu,Bu,ku,Su,Ru,Cu,Tu=[];function Pu(t,e){xu&&!mu&&(mu=xu),cu.data.push({char:t,width:e}),_u+=e}function Lu(){pu+=_u,cu.width=_u,uu.words.push(cu),cu={data:[]},_u=0}function Iu(){ku&&(Su.paraNumber++,uu.paraStart=!0,ku=!1),xu&&(uu.startCharSize=mu,uu.endCharSize=xu,mu=0),uu.width=pu,Ru.width?ru(uu):Cu&&Eu(),Tu.push(uu),uu={words:[]},pu=0}function Eu(){pu>(Su.maxWidth||0)&&(Su.maxWidth=pu)}const{top:Ou,right:Au,bottom:Mu,left:Wu}=t.Direction4;function Du(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 Fu={getDrawData:function(t,e){r(t)||(t=String(t));let s=0,i=0,o=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(s=a[Wu],o-=a[Au]+a[Wu],!o&&(o=.01)):e.autoSizeAlign||(s=a[Wu]),n?(i=a[Ou],n-=a[Ou]+a[Mu],!n&&(n=.01)):e.autoSizeAlign||(i=a[Ou]));const h={bounds:{x:s,y:i,width:o,height:n},rows:[],paraNumber:0,font:f.canvas.font=e.__font};return function(t,e,s){Su=t,Tu=t.rows,Ru=t.bounds,Cu=!Ru.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=f,{width:a}=Ru;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;ku=!0,vu=null,mu=yu=xu=_u=pu=0,cu={data:[]},uu={words:[]},i&&(e=[...e]);for(let s=0,l=e.length;s<l;s++)fu=e[s],"\n"===fu?(_u&&Lu(),uu.paraEnd=!0,Iu(),ku=!0):(wu=eu(fu),wu===ou&&"none"!==o&&(fu=iu(fu,o,!_u)),yu=n.measureText(fu).width,i&&(i<0&&(xu=yu),yu+=i),bu=wu===nu&&(vu===nu||vu===ou)||vu===nu&&wu!==hu,Bu=!(wu!==au&&wu!==nu||vu!==lu&&vu!==hu),gu=ku&&r?a-r:a,t&&a&&pu+_u+yu>gu&&(h?(_u&&Lu(),pu&&Iu()):(Bu||(Bu=wu===ou&&vu==hu),bu||Bu||wu===du||wu===au||wu===nu||_u+yu>gu?(_u&&Lu(),pu&&Iu()):pu&&Iu()))," "===fu&&!0!==ku&&pu+_u===0||(wu===du?(" "===fu&&_u&&Lu(),Pu(fu,yu),Lu()):bu||Bu?(_u&&Lu(),Pu(fu,yu)):Pu(fu,yu)),vu=wu);_u&&Lu(),pu&&Iu(),Tu.length>0&&(Tu[Tu.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Su.paraNumber++,pu=n.measureText(t).width,Tu.push({x:r||0,text:t,width:pu,paraStart:!0}),Cu&&Eu()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":Du(e,"x",t[Wu]);break;case"right":Du(e,"x",-t[Au])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":Du(e,"y",t[Ou]);break;case"bottom":Du(e,"y",-t[Mu])}}(a,h,e,o,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(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,o),h.overflow&&function(t,e,s,i){if(!i)return;const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(r.splice(o),n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?f.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,o),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,l(o)?(s=o.type,o.color&&(t.decorationColor=Mh.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 zu={string:function(t,e){if(!t)return"#000";const i=n(e)&&e<1;if(r(t)){if(!i||!Mh.object)return t;t=Mh.object(t)}let o=s(t.a)?1:t.a;i&&(o*=e);const a=t.r+","+t.g+","+t.b;return 1===o?"rgb("+a+")":"rgba("+a+","+o+")"}};return Object.assign(Ah,Fu),Object.assign(Mh,zu),Object.assign(Fh,vd),Object.assign(zh,tc),Object.assign(Uh,xc),Object.assign(Nh,Oc),gh(),t.AlignHelper=kt,t.AroundHelper=vt,t.AutoBounds=jt,t.BezierHelper=is,t.Bounds=Gt,t.BoundsEvent=An,t.BoundsHelper=Nt,t.BoxData=el,t.BranchHelper=_n,t.BranchRender=Ta,t.CanvasData=pl,t.CanvasManager=ce,t.ChildEvent=Pn,t.ColorConvert=Mh,t.Creator=re,t.DataHelper=c,t.Debug=Jt,t.Effect=Nh,t.EllipseData=nl,t.EllipseHelper=us,t.Event=Tn,t.EventCreator=le,t.Eventer=$n,t.Export=Xh,t.FileHelper=Nr,t.Filter=Yh,t.FourNumberHelper=S,t.FrameData=il,t.GroupData=tl,t.ImageData=_l,t.ImageEvent=On,t.ImageManager=Qr,t.IncrementId=m,t.LayoutEvent=Yn,t.Layouter=Th,t.LeafBounds=Sa,t.LeafBoundsHelper=ln,t.LeafData=_,t.LeafDataProxy=da,t.LeafEventer=ha,t.LeafHelper=tn,t.LeafLayout=Cn,t.LeafLevelList=dh,t.LeafList=lh,t.LeafMatrix=ya,t.LeafRender=Ra,t.LeaferCanvas=uh,t.LeaferCanvasBase=Ce,t.LeaferData=sl,t.LeaferEvent=Hn,t.LeaferImage=Kr,t.LineData=rl,t.MathHelper=M,t.Matrix=pt,t.MatrixHelper=J,t.MyImage=Kl,t.NeedConvertToCanvasCommandMap=Ee,t.OneRadian=D,t.PI2=F,t.PI_2=z,t.Paint=Fh,t.PaintGradient=Uh,t.PaintImage=zh,t.PathArrow=Dh,t.PathBounds=Pr,t.PathCommandDataHelper=xi,t.PathCommandMap=Le,t.PathConvert=Js,t.PathCorner=Wr,t.PathCreator=Wi,t.PathData=ll,t.PathDrawer=$i,t.PathHelper=Te,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=dl,t.Platform=f,t.Plugin=ie,t.Point=ut,t.PointHelper=at,t.PolygonData=al,t.PropertyEvent=In,t.RectData=ol,t.RectHelper=De,t.RectRender=vl,t.RenderEvent=Xn,t.Renderer=Lh,t.ResizeEvent=Un,t.Resource=jr,t.Run=te,t.StarData=hl,t.State=Hh,t.StringNumberMap=qt,t.TaskItem=Hr,t.TaskProcessor=Gr,t.TextConvert=Ah,t.TextData=ul,t.Transition=Gh,t.TwoPointBoundsHelper=ft,t.UIBounds=yl,t.UICreator=ne,t.UIData=Zh,t.UIRender=xl,t.UnitConvert=Wh,t.WaitHelper=yn,t.WatchEvent=Nn,t.Watcher=yh,t.affectRenderBoundsType=vo,t.affectStrokeBoundsType=mo,t.attr=ro,t.autoLayoutType=lo,t.boundsType=_o,t.canvasPatch=Ur,t.canvasSizeAttrs=Re,t.createAttr=function(t){return(e,s)=>{to(e,s,so(s,t))}},t.createDescriptor=so,t.cursorType=Eo,t.dataProcessor=Oo,t.dataType=no,t.decorateLeafAttr=io,t.defineDataProcessor=Ao,t.defineKey=to,t.defineLeafAttr=oo,t.dimType=Bo,t.doBoundsType=go,t.doStrokeType=xo,t.effectType=Ih,t.emptyData={},t.eraserType=Lo,t.extraPropertyEventMap=En,t.getBoundsData=N,t.getDescriptor=eo,t.getMatrixData=Y,t.getPointData=U,t.hitType=Io,t.isArray=h,t.isData=function(t){return l(t)&&!h(t)},t.isEmptyData=d,t.isFinite=o,t.isNull=i,t.isNumber=n,t.isObject=l,t.isString=r,t.isUndefined=s,t.layoutProcessor=function(t){return(e,s)=>{to(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Qn,t.maskType=Po,t.naturalBoundsType=po,t.opacityType=ko,t.path=Dr,t.pathInputType=fo,t.pathType=yo,t.pen=Fr,t.positionType=ao,t.registerUI=Yo,t.registerUIEvent=function(){return t=>{le.register(t)}},t.resizeType=Eh,t.rewrite=Fo,t.rewriteAble=zo,t.rotationType=uo,t.scaleType=co,t.scrollType=ho,t.sortType=To,t.strokeType=wo,t.surfaceType=bo,t.tempBounds=Vt,t.tempMatrix=gt,t.tempPoint=_t,t.tryToNumber=function(t){return"string"==typeof t&&a.test(t)?+t:t},t.useCanvas=gh,t.useModule=No,t.version="1.10.1",t.visibleType=So,t.zoomLayerType=Oh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";function s(t){return void 0===t}function i(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function n(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;const{isArray:h}=Array;function l(t){return t&&"object"==typeof t}function d(t){return"{}"===JSON.stringify(t)}const c={default:(t,e)=>(u(e,t),u(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 u(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&u(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),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:u}=c;class _{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(h(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!s(t))){if("path"===o&&!this.__pathInputed)continue;e=r?r[o]:void 0,i[o]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:o,f:n}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:o,f:n}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:p,max:g}=Math,f={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,s,i)=>t.width*t.height*(e?e*s:1)>(i||y.maxCacheSize),isSuperLarge:(t,e,s)=>y.isLarge(t,e,s,y.maxPatternSize),getRealURL(t){const{prefix:e,suffix:s}=f.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,s,i,r,o,n,a,h){const l=f.origin.createCanvas(g(p(e+(i||0)),1),g(p(s+(r||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==n,o){const i=e/o.width,r=s/o.height;d.setTransform(i,0,0,r,-o.x*i,-o.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,s);return l},setPatternTransform(t,e,s){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}s&&c.stintSet(s,"transform",e)}}},{image:y}=f,m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=m;let w,v,b;const{max:B}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,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)=>R(k,t,e,s,i),toTempAB(t,e,s){b=s?n(t)?e:t:[],n(t)?(w=T(t),v=e):n(e)?(w=t,v=T(e)):(w=t,v=e),4!==w.length&&(w=C(w)),4!==v.length&&(v=C(v))},get(t,e){let i;if(!n(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,s)=>n(t)&&n(e)?B(t,e):(P(t,e,s),R(b,B(w[0],v[0]),B(w[1],v[1]),B(w[2],v[2]),B(w[3],v[3]))),add:(t,e,s)=>n(t)&&n(e)?t+e:(P(t,e,s),R(b,w[0]+v[0],w[1]+v[1],w[2]+v[2],w[3]+v[3])),swapAndScale(t,e,s,i){if(n(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,a,h,l]=4===t.length?t:C(t);return R(r,h*s,l*e,o*s,a*e)}},{set:R,get:C,setTemp:T,toTempAB:P}=S,{round:L,pow:I,max:E,floor:O,PI:A}=Math,M={within:(t,e,i)=>(l(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,s=0){let 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 i=s(e)?1e12:I(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(n(e)?e:e.width||0)/s.width,r=(n(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&M.assignScale(i,t);return i},assignScale(t,e){n(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>E(O(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const D=A/180,F=2*A,z=A/2;function U(){return{x:0,y:0}}function N(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:G,sqrt:V}=Math,{float:j}=M,q={};function Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),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:Y,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,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=H(e*=D),a=X(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,i,r,o){const{e:n,f:a}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:n,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=n*e.a+a*e.c,i.d=n*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=n*e.a+a*e.c+e.e,i.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,i,r,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(s(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:s,skewX:i,skewY:r}=e,o=s*D,n=H(o),a=X(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,(i=i||r)&&$.translateInner(t,-i.x,-i.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=V(r*r+o*o),c=t/d;const e=r/d;u=o>0?G(e):-G(e)}else{c=V(n*n+a*a),d=t/c;const e=n/c;u=z-(a>0?G(-e):-G(e))}const e=j(H(u)),s=X(u);d=j(d),c=j(c),_=e?j((n/c+s)/e/D,9):0,p=e?j((o/d-s)/e/D,9):0,u=j(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=V(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){$.set(t)}},$=J,{toInnerPoint:Z,toOuterPoint:K}=J,{sin:tt,cos:et,abs:st,sqrt:it,atan2:rt,min:ot,round:nt}=Math,at={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},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?nt(t.x-.5)+.5:nt(t.x),t.y=e?nt(t.y-.5)+.5:nt(t.y)},move(t,e,s){l(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=ht.defaultPoint);const i=et(e*=D),r=tt(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}=ht;return dt(s,t),Z(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=ht;return dt(s,t),K(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=ht;return dt(s,t),ht.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),Z(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){Z(e,t,s)},toOuterOf(t,e,s){K(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=st(s-t),o=st(i-e);return it(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>ot(lt(t,e,s,i),lt(s,i,r,o)),getAngle:(t,e)=>ct(t,e)/D,getRotation:(t,e,s,i)=>(i||(i=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/D),getRadianFrom(t,e,i,r,o,n,a,h){s(a)&&(a=i,h=r);const l=t-i,d=e-r,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i,r){const o=ct(t,e);return r&&(t=e),i||(e={}),e.x=t.x+et(o)*s,e.y=t.y+tt(o)*s,e},toNumberPoints(t){let e=t;return l(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){ht.reset(t)}},ht=at,{getDistanceFrom:lt,copy:dt,getAtan2:ct}=ht;class ut{constructor(t,e){this.set(t,e)}set(t,e){return l(t)?at.copy(this,t):at.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ut(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,s){return at.scaleOf(this,t,e,s),this}rotate(t,e){return at.rotate(this,t,e),this}rotateOf(t,e){return at.rotate(this,e,t),this}getRotation(t,e,s){return at.getRotation(this,t,e,s)}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}getCenter(t){return new ut(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,s,i){return new ut(at.getDistancePoint(this,t,e,s,i))}getAngle(t){return at.getAngle(this,t)}getAtan2(t){return at.getAtan2(this,t)}isSame(t){return at.isSame(this,t)}reset(){return at.reset(this),this}}const _t=new ut;class pt{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return l(t)?J.copy(this,t):J.set(this,t,e,s,i,r,o),this}setWith(t){return J.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 pt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,s){return J.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return J.scaleOfInner(this,t,e,s),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,s){return J.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return J.skewOfInner(this,t,e,s),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){J.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){J.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return J.setLayout(this,t,e,s),this}getLayout(t,e,s){return J.getLayout(this,t,e,s)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const gt=new pt,ft={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){yt(t,e,s),yt(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:yt}=ft;var mt,xt;t.Direction4=void 0,(mt=t.Direction4||(t.Direction4={}))[mt.top=0]="top",mt[mt.right=1]="right",mt[mt.bottom=2]="bottom",mt[mt.left=3]="left",t.Direction9=void 0,(xt=t.Direction9||(t.Direction9={}))[xt.topLeft=0]="topLeft",xt[xt.top=1]="top",xt[xt.topRight=2]="topRight",xt[xt.right=3]="right",xt[xt.bottomRight=4]="bottomRight",xt[xt.bottom=5]="bottom",xt[xt.bottomLeft=6]="bottomLeft",xt[xt.left=7]="left",xt[xt.center=8]="center",xt[xt["top-left"]=0]="top-left",xt[xt["top-right"]=2]="top-right",xt[xt["bottom-right"]=4]="bottom-right",xt[xt["bottom-left"]=6]="bottom-left";const wt=[{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}];wt.forEach(t=>t.type="percent");const vt={directionData:wt,tempPoint:{},get:bt,toPoint(t,e,s,i,r,o){const n=bt(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)=>(s||(s={}),vt.toPoint(t,e,s,!0),s)};function bt(e){return r(e)?wt[t.Direction9[e]]:e}const{toPoint:Bt}=vt,kt={toPoint(t,e,s,i,r,o){Bt(t,s,i,r,e,o)}},{tempPointBounds:St,setPoint:Rt,addPoint:Ct,toBounds:Tt}=ft,{toOuterPoint:Pt}=J,{float:Lt,fourNumber:It}=M,{floor:Et,ceil:Ot}=Math;let At,Mt,Wt,Dt;const Ft={},zt={},Ut={},Nt={tempBounds:Ut,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:l}=e;if(h(s)){const e=It(s);i?Yt.set(t,o+e[3],n+e[0],a-e[1]-e[3],l-e[2]-e[0]):Yt.set(t,o-e[3],n-e[0],a+e[1]+e[3],l+e[2]+e[0])}else i&&(s=-s),Yt.set(t,o-s,n-s,a+2*s,l+2*s);r&&("width"===r?(t.y=n,t.height=l):(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),Yt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Ht(e,t):e=t,s||(s=t),e.offsetX=Yt.maxX(s),e.offsetY=Yt.maxY(s),Yt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||at.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){at.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Yt.copy(Ut,t),Yt.toOuterOf(Ut,e),Ut),getOuterOf:(t,e)=>(t=Object.assign({},t),Yt.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 Ft.x=t.x,Ft.y=t.y,Pt(e,Ft,zt),Rt(St,zt.x,zt.y),Ft.x=t.x+t.width,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Ft.y=t.y+t.height,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Ft.x=t.x,Pt(e,Ft,zt),Ct(St,zt.x,zt.y),Tt(St,s)},toInnerOf(t,e,s){s||(s=t),Yt.move(s,-e.e,-e.f),Yt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Yt.getFitScale(t,e));return new pt(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,o=!0,n){n||(n=e),r(i)&&(i=Yt.getFitScale(t,e,"cover"===i)),Ut.width=o?e.width*=i:e.width*i,Ut.height=o?e.height*=i:e.height*i,kt.toPoint(s,Ut,t,n,!0,!0)},getSpread(t,e,s){const i={};return Yt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Yt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Yt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Et(t.x),t.y=Et(t.y),t.width=e>t.x?Ot(t.width+e-t.x):Ot(t.width),t.height=s>t.y?Ot(t.height+s-t.y):Ot(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,s){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Dt=e.y,s||(Wt+=e.width,Dt+=e.height),At=At>Wt?At:Wt,Mt=Mt>Dt?Mt:Dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Yt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Yt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Yt.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||Ht(t,r)):Xt(t,r));o&&Yt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(St,t.x,t.y):Ct(St,t.x,t.y)),Tt(St,t)},setPoint(t,e){Yt.set(t,e.x,e.y)},addPoint(t,e){Xt(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}]},hitRadiusPoint:(t,e,s)=>(s&&(e=at.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=at.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Yt.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=Yt.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=Yt.tempToOuterOf(e,s)),!Yt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return At=i+o,Mt=r+n,Wt=t.x+t.width,Dt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Dt?Mt:Dt,o=At-i,n=Mt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Yt.copy(t,Yt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Yt.set(t)}},Yt=Nt,{add:Xt,copy:Ht}=Yt;class Gt{get minX(){return Nt.minX(this)}get minY(){return Nt.minY(this)}get maxX(){return Nt.maxX(this)}get maxY(){return Nt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return l(t)?Nt.copy(this,t):Nt.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 Gt(this)}move(t,e){return Nt.move(this,t,e),this}scale(t,e,s){return Nt.scale(this,t,e,s),this}scaleOf(t,e,s){return Nt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Nt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Nt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Nt.getFitMatrix(this,t,e)}put(t,e,s){Nt.put(this,t,e,s)}spread(t,e){return Nt.spread(this,t,e),this}shrink(t,e){return Nt.shrink(this,t,e),this}ceil(){return Nt.ceil(this),this}unsign(){return Nt.unsign(this),this}float(t){return Nt.float(this,t),this}add(t){return Nt.add(this,t),this}addList(t){return Nt.setList(this,t,!0),this}setList(t){return Nt.setList(this,t),this}addListWithFn(t,e){return Nt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Nt.setListWithFn(this,t,e),this}setPoint(t){return Nt.setPoint(this,t),this}setPoints(t){return Nt.setPoints(this,t),this}addPoint(t){return Nt.addPoint(this,t),this}getPoints(){return Nt.getPoints(this)}hitPoint(t,e){return Nt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Nt.hitRadiusPoint(this,t,e)}hit(t,e){return Nt.hit(this,t,e)}includes(t,e){return Nt.includes(this,t,e)}intersect(t,e){return Nt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Nt.getIntersectData(this,t,e))}isSame(t){return Nt.isSame(this,t)}isEmpty(){return Nt.isEmpty(this)}reset(){Nt.reset(this)}}const Vt=new Gt;class jt{constructor(t,e,s,i,r,o){l(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 Gt(r,e,o||t.width-r-s,n||t.height-e-i)}}const qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Qt}=M;class Jt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Jt(t)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const s=Qt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Jt.showBounds,r=t.__nowWorld,o=Qt();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(Zt.enable){if(Zt.filterList.length&&Zt.filterList.every(t=>t!==this.name))return;if(Zt.excludeList.length&&Zt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Zt.enable&&this.warn(...t)}warn(...t){Zt.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 $t(t){return t?r(t)&&(t=[t]):t=[],t}Jt.filterList=[],Jt.excludeList=[],Jt.showWarn=!0;const Zt=Jt,Kt=Jt.get("RunTime"),te={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=m.create(m.RUNTIME);return ee.currentId=ee.idMap[s]=e?performance.now():Date.now(),ee.currentName=ee.nameMap[s]=t,ee.nameToIdMap[t]=s,s},end(t,e){const s=ee.idMap[t],i=ee.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;ee.idMap[t]=ee.nameMap[t]=ee.nameToIdMap[i]=void 0,Kt.log(i,r,"ms")},endOfName(t,e){const i=ee.nameToIdMap[t];s(i)||ee.end(i,e)}},ee=te,se=[],ie={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>ie.has(t,!0)));const re={editor:t=>ie.need("editor")},oe=Jt.get("UICreator"),ne={list:{},register(t){const{__tag:e}=t.prototype;ae[e]&&oe.repeat(e),ae[e]=t},get(t,e,i,r,o,n){ae[t]||oe.error("not register "+t);const a=new ae[t](e);return s(i)||(a.x=i,r&&(a.y=r),o&&(a.width=o),n&&(a.height=n)),a}},{list:ae}=ne,he=Jt.get("EventCreator"),le={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],r(e)&&(de[e]&&he.repeat(e),de[e]=t)})},changeName(t,e){const s=de[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,de[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new de[t](...e)},{nameList:de}=le;class ce{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=re.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 ue(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 _e(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 pe(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 ge=[];function fe(){return(t,e)=>{ge.push(e)}}const ye=[];class me{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ye)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ge.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){l(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}}ue([pe("imageSmoothingEnabled")],me.prototype,"smooth",void 0),ue([pe("imageSmoothingQuality")],me.prototype,"smoothLevel",void 0),ue([pe("globalAlpha")],me.prototype,"opacity",void 0),ue([pe()],me.prototype,"fillStyle",void 0),ue([pe()],me.prototype,"strokeStyle",void 0),ue([pe("lineWidth")],me.prototype,"strokeWidth",void 0),ue([pe("lineCap")],me.prototype,"strokeCap",void 0),ue([pe("lineJoin")],me.prototype,"strokeJoin",void 0),ue([pe("lineDashOffset")],me.prototype,"dashOffset",void 0),ue([pe()],me.prototype,"miterLimit",void 0),ue([pe()],me.prototype,"shadowBlur",void 0),ue([pe()],me.prototype,"shadowColor",void 0),ue([pe()],me.prototype,"shadowOffsetX",void 0),ue([pe()],me.prototype,"shadowOffsetY",void 0),ue([pe()],me.prototype,"filter",void 0),ue([pe()],me.prototype,"font",void 0),ue([pe()],me.prototype,"fontKerning",void 0),ue([pe()],me.prototype,"fontStretch",void 0),ue([pe()],me.prototype,"fontVariantCaps",void 0),ue([pe()],me.prototype,"textAlign",void 0),ue([pe()],me.prototype,"textBaseline",void 0),ue([pe()],me.prototype,"textRendering",void 0),ue([pe()],me.prototype,"wordSpacing",void 0),ue([pe()],me.prototype,"letterSpacing",void 0),ue([pe()],me.prototype,"direction",void 0),ue([fe()],me.prototype,"setTransform",null),ue([fe()],me.prototype,"resetTransform",null),ue([fe()],me.prototype,"getTransform",null),ue([fe()],me.prototype,"save",null),ue([fe()],me.prototype,"restore",null),ue([fe()],me.prototype,"translate",null),ue([fe()],me.prototype,"scale",null),ue([fe()],me.prototype,"rotate",null),ue([fe()],me.prototype,"fill",null),ue([fe()],me.prototype,"stroke",null),ue([fe()],me.prototype,"clip",null),ue([fe()],me.prototype,"fillRect",null),ue([fe()],me.prototype,"strokeRect",null),ue([fe()],me.prototype,"clearRect",null),ue([fe()],me.prototype,"beginPath",null),ue([fe()],me.prototype,"moveTo",null),ue([fe()],me.prototype,"lineTo",null),ue([fe()],me.prototype,"bezierCurveTo",null),ue([fe()],me.prototype,"quadraticCurveTo",null),ue([fe()],me.prototype,"closePath",null),ue([fe()],me.prototype,"arc",null),ue([fe()],me.prototype,"arcTo",null),ue([fe()],me.prototype,"ellipse",null),ue([fe()],me.prototype,"rect",null),ue([fe()],me.prototype,"roundRect",null),ue([fe()],me.prototype,"createConicGradient",null),ue([fe()],me.prototype,"createLinearGradient",null),ue([fe()],me.prototype,"createPattern",null),ue([fe()],me.prototype,"createRadialGradient",null),ue([fe()],me.prototype,"fillText",null),ue([fe()],me.prototype,"measureText",null),ue([fe()],me.prototype,"strokeText",null);const{copy:xe,multiplyParent:we,pixelScale:ve}=J,{round:be}=Math,Be=new Gt,ke=new Gt,Se={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Ce extends me{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=Se),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.size.pixelRatio=r||f.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;c.copyAttrs(i,t,Re),Re.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Gt(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&&we(t,e,r),ve(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=be(r.e-.5)+.5,r.f=be(r.f-.5)+.5):(r.e=be(r.e),r.f=be(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:i,strokeJoin:r,dashPattern:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(o=e.dashPattern),s(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,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=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=ke):s=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Nt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){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(Be.x,Be.y,Be.width,Be.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,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(Be.x,Be.y,Be.width,Be.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(Be,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(ke,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):re.canvas(Object.assign({},s));return r.save(),t&&(xe(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 Te={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Pe),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ee={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Oe=Object.assign(Object.assign({},Ee),Pe),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Ie[t];const De={drawRoundRect(t,e,s,i,r,o){const n=M.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:Fe,cos:ze,hypot:Ue,atan2:Ne,ceil:Ye,abs:Xe,PI:He,sqrt:Ge,pow:Ve}=Math,{setPoint:je,addPoint:qe}=ft,{set:Qe,toNumberPoints:Je}=at,{M:$e,L:Ze,C:Ke,Q:ts,Z:es}=Le,ss={},is={points(t,e,s,i){let r=Je(e);if(t.push($e,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-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=Ge(Ve(n-e,2)+Ve(a-o,2)),g=Ge(Ve(h-n,2)+Ve(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(ts,d,c,n,a):t.push(Ke,u,_,d,c,n,a),u=n+g*h,_=a+g*l);i||t.push(ts,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ze,r[e],r[e+1]);i&&t.push(es)},rect(t,e,s,i,r){Te.creator.path=t,Te.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){Te.creator.path=[],De.drawRoundRect(Te.creator,e,s,i,r,o),t.push(...Te.convertToCanvasData(Te.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=Ne(u,c),f=Ne(p,_);const y=Ue(c,u),m=Ue(_,p);let x=f-g;if(x<0&&(x+=F),y<1e-12||m<1e-12||x<1e-12||Xe(x-He)<1e-12)return t&&t.push(Ze,i,r),h&&(je(h,e,s),qe(h,i,r)),d&&Qe(d,e,s),void(l&&Qe(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/ze(x/2),B=i+b*ze(g+x/2+z*v),k=r+b*Fe(g+x/2+z*v);return g-=z*v,f-=z*v,ns(t,B,k,a,a,0,g/D,f/D,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>ns(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,_=Fe(u),p=ze(u);let g=n*D,f=a*D;g>He&&(g-=F),f<0&&(f+=F);let y=f-g;y<0?y+=F:y>F&&(y-=F),h&&(y-=F);const m=Ye(Xe(y/z)),x=y/m,w=Fe(x/4),v=8/3*w*w/Fe(x/2);f=g+x;let b,B,k,S,R,C,T,P,L=ze(g),I=Fe(g),E=k=p*i*L-_*r*I,O=S=_*i*L+p*r*I,A=e+k,M=s+S;t&&t.push(t.length?Ze:$e,A,M),l&&je(l,A,M),c&&Qe(c,A,M);for(let o=0;o<m;o++)b=ze(f),B=Fe(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+E-v*(p*i*I+_*r*L),C=s+O-v*(_*i*I-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(Ke,R,C,T,P,e+k,s+S),l&&os(e+E,s+O,R,C,T,P,e+k,s+S,l,!0),E=k,O=S,L=b,I=B,g=f,f+=x;d&&Qe(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Ke,(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){os(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?qe(h,t,e):je(h,t,e),qe(h,n,a);for(let l=0,c=d.length;l<c;l++)rs(d[l],t,e,s,i,r,o,n,a,ss),qe(h,ss.x,ss.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 rs(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)}},{getPointAndSet:rs,toTwoPointBounds:os,ellipse:ns}=is,{sin:as,cos:hs,sqrt:ls,atan2:ds}=Math,{ellipse:cs}=is,us={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*D,p=as(_),g=hs(_),y=-g*c-p*u,m=-g*u+p*c,x=i*i,w=r*r,v=m*m,b=y*y,B=x*w-x*v-w*b;let k=0;if(B<0){const t=ls(1-B/(x*w));i*=t,r*=t}else k=(n===a?-1:1)*ls(B/(x*v+w*b));const S=k*i*m/r,R=-k*r*y/i,C=ds((m-R)/r,(y-S)/i),T=ds((-m-R)/r,(-y-S)/i);let P=T-C;0===a&&P>0?P-=F:1===a&&P<0&&(P+=F);const L=e+c+g*S-p*R,I=s+u+p*S+g*R,E=P<0?1:0;d||f.ellipseToCurve?cs(t,L,I,i,r,o,C/D,T/D,E):i!==r||o?t.push(Le.G,L,I,i,r,o,C/D,T/D,E):t.push(Le.O,L,I,i,C/D,T/D,E)}},_s={toCommand:t=>[],toNode:t=>[]},{M:ps,m:gs,L:fs,l:ys,H:ms,h:xs,V:ws,v:vs,C:bs,c:Bs,S:ks,s:Ss,Q:Rs,q:Cs,T:Ts,t:Ps,A:Ls,a:Is,Z:Es,z:Os,N:As,D:Ms,X:Ws,G:Ds,F:Fs,O:zs,P:Us,U:Ns}=Le,{rect:Ys,roundRect:Xs,arcTo:Hs,arc:Gs,ellipse:Vs,quadraticCurveTo:js}=is,{ellipticalArc:qs}=us,Qs=Jt.get("PathConvert"),Js={},$s={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=We[i],a+=i===r?" ":Me[i];for(let i=1;i<s;i++)a+=M.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?Oe:Ee;for(let e=0,h=t.length;e<h;e++)i=t[e],qt[i]?("."===i&&(Zs.dot&&(Ks(n,o),o=""),Zs.dot++),"0"===o&&"."!==i&&(Ks(n,o),o=""),o+=i):Le[i]?(o&&(Ks(n,o),o=""),Zs.name=Le[i],Zs.length=Ie[i],Zs.index=0,Ks(n,Zs.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Ks(n,o),o=i):o&&(Ks(n,o),o=""),r=i;return o&&Ks(n,o),s?$s.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 gs:t[c+1]+=a,t[c+2]+=h;case ps:a=t[c+1],h=t[c+2],_.push(ps,a,h),c+=3;break;case xs:t[c+1]+=a;case ms:a=t[c+1],_.push(fs,a,h),c+=2;break;case vs:t[c+1]+=h;case ws:h=t[c+1],_.push(fs,a,h),c+=2;break;case ys:t[c+1]+=a,t[c+2]+=h;case fs:a=t[c+1],h=t[c+2],_.push(fs,a,h),c+=3;break;case Ss:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ks;case ks:n=o===bs||o===ks,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(bs,l,d,s,i,a,h),c+=5;break;case Bs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=bs;case bs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(bs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ps:t[c+1]+=a,t[c+2]+=h,r=Ts;case Ts:n=o===Rs||o===Ts,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?js(_,a,h,s,i,t[c+1],t[c+2]):_.push(Rs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Cs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Rs;case Rs:s=t[c+1],i=t[c+2],e?js(_,a,h,s,i,t[c+3],t[c+4]):_.push(Rs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Is:t[c+6]+=a,t[c+7]+=h;case Ls:qs(_,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 Os:case Es:_.push(Es),c++;break;case As:a=t[c+1],h=t[c+2],e?Ys(_,a,h,t[c+3],t[c+4]):ti(_,t,c,5),c+=5;break;case Ms:a=t[c+1],h=t[c+2],e?Xs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ti(_,t,c,9),c+=9;break;case Ws:a=t[c+1],h=t[c+2],e?Xs(_,a,h,t[c+3],t[c+4],t[c+5]):ti(_,t,c,6),c+=6;break;case Ds:Vs(e?_:ti(_,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,Js),a=Js.x,h=Js.y,c+=9;break;case Fs:e?Vs(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ti(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case zs:Gs(e?_:ti(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Js),a=Js.x,h=Js.y,c+=7;break;case Us:e?Gs(_,t[c+1],t[c+2],t[c+3],0,360,!1):ti(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ns:Hs(e?_:ti(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Js),a=Js.x,h=Js.y,c+=6;break;default:return Qs.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return _s.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ps,t.x,t.y);break;case"L":e.push(fs,t.x,t.y);break;case"C":e.push(bs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Rs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Es)}}),e}},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Zs.index===Zs.length&&(Zs.index=1,t.push(Zs.name)),t.push(Number(e)),Zs.index++,Zs.dot=0}},{current:Zs,pushData:Ks,copyData:ti}=$s,{M:ei,L:si,C:ii,Q:ri,Z:oi,N:ni,D:ai,X:hi,G:li,F:di,O:ci,P:ui,U:_i}=Le,{getMinDistanceFrom:pi,getRadianFrom:gi}=at,{tan:fi,min:yi,abs:mi}=Math,xi={},wi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ei,e,s)},lineTo(t,e,s){t.push(si,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(ii,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(ri,e,s,i,r)},closePath(t){t.push(oi)},rect(t,e,s,i,r){t.push(ni,e,s,i,r)},roundRect(t,e,s,i,r,o){if(n(o))t.push(hi,e,s,i,r,o);else{const n=M.fourNumber(o);n?t.push(ai,e,s,i,r,...n):t.push(ni,e,s,i,r)}},ellipse(t,e,s,r,o,n,a,h,l){i(n)?t.push(di,e,s,r,o):(i(a)&&(a=0),i(h)&&(h=360),t.push(li,e,s,r,o,n,a,h,l?1:0))},arc(t,e,s,r,o,n,a){i(o)?t.push(ui,e,s,r):(i(n)&&(n=360),t.push(ci,e,s,r,o,n,a?1:0))},arcTo(t,e,i,r,o,n,a,h){if(!s(a)){const t=pi(a,h,e,i,r,o);n=yi(n,yi(t/2,t/2*mi(fi(gi(a,h,e,i,r,o)/2))))}t.push(_i,e,i,r,o,n)},drawEllipse(t,e,s,r,o,n,a,h,l){is.ellipse(null,e,s,r,o,i(n)?0:n,i(a)?0:a,i(h)?360:h,l,null,null,xi),t.push(ei,xi.x,xi.y),vi(t,e,s,r,o,n,a,h,l)},drawArc(t,e,s,r,o,n,a){is.arc(null,e,s,r,i(o)?0:o,i(n)?360:n,a,null,null,xi),t.push(ei,xi.x,xi.y),bi(t,e,s,r,o,n,a)},drawPoints(t,e,s,i){is.points(t,e,s,i)}},{ellipse:vi,arc:bi}=wi,{moveTo:Bi,lineTo:ki,quadraticCurveTo:Si,bezierCurveTo:Ri,closePath:Ci,beginPath:Ti,rect:Pi,roundRect:Li,ellipse:Ii,arc:Ei,arcTo:Oi,drawEllipse:Ai,drawArc:Mi,drawPoints:Wi}=wi;class Di{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Te.parse(t):t:[],this}beginPath(){return Ti(this.__path),this.paint(),this}moveTo(t,e){return Bi(this.__path,t,e),this.paint(),this}lineTo(t,e){return ki(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return Ri(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return Si(this.__path,t,e,s,i),this.paint(),this}closePath(){return Ci(this.__path),this.paint(),this}rect(t,e,s,i){return Pi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Li(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Ii(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Ei(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Oi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Ai(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Mi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Wi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Fi,L:zi,C:Ui,Q:Ni,Z:Yi,N:Xi,D:Hi,X:Gi,G:Vi,F:ji,O:qi,P:Qi,U:Ji}=Le,$i=Jt.get("PathDrawer"),Zi={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Fi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case zi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ui:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ni:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Yi:t.closePath(),i+=1;break;case Xi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Hi: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 Gi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Vi: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 ji:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,F,!1),i+=5;break;case qi: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 Qi:t.arc(e[i+1],e[i+2],e[i+3],0,F,!1),i+=4;break;case Ji:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void $i.error(`command: ${s} [index:${i}]`,e)}}},{M:Ki,L:tr,C:er,Q:sr,Z:ir,N:rr,D:or,X:nr,G:ar,F:hr,O:lr,P:dr,U:cr}=Le,{toTwoPointBounds:ur,toTwoPointBoundsByQuadraticCurve:_r,arcTo:pr,arc:gr,ellipse:fr}=is,{addPointBounds:yr,copy:mr,addPoint:xr,setPoint:wr,addBounds:vr,toBounds:br}=ft,Br=Jt.get("PathBounds");let kr,Sr,Rr;const Cr={},Tr={},Pr={},Lr={toBounds(t,e){Lr.toTwoPointBounds(t,Tr),br(Tr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return wr(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===ir||n===er||n===sr?wr(e,h,l):wr(e,t[a+1],t[a+2])),n){case Ki:case tr:h=t[a+1],l=t[a+2],xr(e,h,l),a+=3;break;case er:r=t[a+5],o=t[a+6],ur(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Cr),yr(e,Cr),h=r,l=o,a+=7;break;case sr:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],_r(h,l,s,i,r,o,Cr),yr(e,Cr),h=r,l=o,a+=5;break;case ir:a+=1;break;case rr:h=t[a+1],l=t[a+2],vr(e,h,l,t[a+3],t[a+4]),a+=5;break;case or:case nr:h=t[a+1],l=t[a+2],vr(e,h,l,t[a+3],t[a+4]),a+=n===or?9:6;break;case ar:fr(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],Cr,Pr),0===a?mr(e,Cr):yr(e,Cr),h=Pr.x,l=Pr.y,a+=9;break;case hr:h=t[a+1],l=t[a+2],Sr=t[a+3],Rr=t[a+4],vr(e,h-Sr,l-Rr,2*Sr,2*Rr),h+=Sr,a+=5;break;case lr:gr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Cr,Pr),0===a?mr(e,Cr):yr(e,Cr),h=Pr.x,l=Pr.y,a+=7;break;case dr:h=t[a+1],l=t[a+2],kr=t[a+3],vr(e,h-kr,l-kr,2*kr,2*kr),h+=kr,a+=4;break;case cr:pr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Cr,Pr),0===a?mr(e,Cr):yr(e,Cr),h=Pr.x,l=Pr.y,a+=6;break;default:return void Br.error(`command: ${n} [index:${a}]`,t)}}},{M:Ir,L:Er,Z:Or}=Le,{getCenterX:Ar,getCenterY:Mr}=at,{arcTo:Wr}=wi,Dr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;n<g;){switch(i=t[n],i){case Ir:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===Er?(c=t[n+1],u=t[n+2],f.push(Ir,Ar(l,c),Mr(d,u))):f.push(Ir,l,d);break;case Er:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Er:Wr(f,a,h,t[n+1],t[n+2],e,_,p);break;case Or:Wr(f,a,h,l,d,e,_,p);break;default:f.push(Er,a,h)}_=a,p=h;break;case Or:r!==Or&&(Wr(f,l,d,c,u,e,_,p),f.push(Or)),n+=1;break;default:o=We[i];for(let e=0;e<o;e++)f.push(t[n+e]);n+=o}r=i}return i!==Or&&(f[1]=l,f[2]=d),f}};function Fr(t){return new Di(t)}const zr=Fr();Te.creator=Fr(),Te.parse=$s.parse,Te.convertToCanvasData=$s.toCanvasData;const{drawRoundRect:Ur}=De;function Nr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Ur(this,t,e,s,i,r)})}(t)}const Yr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Xr.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{}}}},Xr=Yr;Xr.alphaPixelTypes.forEach(t=>Xr.upperCaseTypeMap[t]=t.toUpperCase());const Hr=Jt.get("TaskProcessor");class Gr{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return _e(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Hr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Vr{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&&c.assign(this.config,t),this.empty()}add(t,e,i){let r,o,a,h;const l=new Gr(t);return l.parent=this,n(e)?h=e:e&&(o=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===o&&(l.parallel=!1),i&&(l.canUse=i),s(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.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:s,index: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 jr=Jt.get("Resource"),qr={tasker:new Vr,map:{},get isComplete(){return Qr.tasker.isComplete},set(t,e){Qr.map[t]&&jr.repeat(t),Qr.map[t]=e},get:t=>Qr.map[t],remove(t){const e=Qr.map[t];e&&(e.destroy&&e.destroy(),delete Qr.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 r(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=re.image(i)),Qr.set(t,e),e},destroy(){Qr.map={}}},Qr=qr,Jr={maxRecycled:10,recycledList:[],patternTasker:new Vr,get(t){let e=qr.get(t.url);return e||qr.set(t.url,e=re.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||$r.recycledList.push(t)})},clearRecycled(){const t=$r.recycledList;t.length>$r.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&qr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Yr.alphaPixelTypes.some(e=>$r.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:"+Yr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Yr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){$r.recycledList=[]}},$r=Jr,{IMAGE:Zr,create:Kr}=m;class to{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Kr(Zr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Jr.isFormat("svg",t)&&(this.isSVG=!0),Jr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;qr.tasker.add(()=>_e(this,void 0,void 0,function*(){return yield f.origin.loadImage(this.url,s(t)?f.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return 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=t.naturalWidth||t.width,this.height=t.naturalHeight||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){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 a=f.image.resize(this.view,t,e,r,o,void 0,n,s,i);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,s,i){const r=f.canvas.createPattern(t,e);return f.image.setPatternTransform(r,s,i),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function eo(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function so(t,e){return Object.getOwnPropertyDescriptor(t,e)}function io(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function ro(t,e){return(s,i)=>no(s,i,t,e&&e(i))}function oo(t){return t}function no(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};eo(t,e,Object.assign(r,i||{})),Mo(t,e,s)}function ao(t){return ro(t)}function ho(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function lo(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function co(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),fo(this))}}))}function uo(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function _o(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function po(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s,e)&&fo(this)}}))}function go(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(fo(this),this.__.__removeNaturalSize())}}))}function fo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function yo(t){return ro(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),fo(this)}}))}const mo=po;function xo(t,e){return ro(t,t=>({set(s){this.__setAttr(t,s)&&(wo(this),e&&(this.__.__useStroke=!0))}}))}function wo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&fo(t)}const vo=xo;function bo(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Bo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function ko(t){return ro(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;c.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function So(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Co(this)}}))}function Ro(t){return ro(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>To(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");To(this,t,e,s),this.mask&&Co(this)}}))}function Co(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function To(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||fo(t))}function Po(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Lo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Io(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Eo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Jt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Oo(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ao(t){return(e,s)=>{eo(e,"__DataProcessor",{get:()=>t})}}function Mo(t,e,i){const r=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=io(e,i);if(s(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(l(i)){const t=d(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:c.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let u,_=r;for(;!u&&_;)u=so(_,e),_=_.__proto__;u&&u.set&&(a.set=u.set),r[n]&&(a.set=r[n],delete r[n]),eo(r,e,a)}const Wo=new Jt("rewrite"),Do=[],Fo=["destroy","constructor"];function zo(t){return(e,s)=>{Do.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Uo(){return t=>{No()}}function No(t){Do.length&&(Do.forEach(e=>{t&&Wo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Do.length=0)}function Yo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(Fo.includes(i)||e&&e.includes(i)))if(t.prototype){so(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Xo(){return t=>{ne.register(t)}}setTimeout(()=>No(!0));const{copy:Ho,toInnerPoint:Go,toOuterPoint:Vo,scaleOfOuter:jo,rotateOfOuter:qo,skewOfOuter:Qo,multiplyParent:Jo,divideParent:$o,getLayout:Zo}=J,Ko={},{round:tn}=Math,en={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),on(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)rn(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++)nn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&nn(t),t.__updateChange()},updateAllChange(t){if(hn(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)an(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||f.fullImageShadow?e.copyWorldByReset(s,i,t.__nowWorld,r,o):e.copyWorldToInner(s,i,t.__layout.renderBounds,r)},moveWorld(t,e,s=0,i,r){const o=l(e)?Object.assign({},e):{x:e,y:s};i?Vo(t.localTransform,o,o,!0):t.parent&&Go(t.parent.scrollWorldTransform,o,o,!0),sn.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){l(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=tn(e),s=tn(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){sn.zoomOfLocal(t,ln(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const a=t.__localMatrix;if(n(i)||(i&&(o=i),i=s),Ho(Ko,a),jo(Ko,e,s,i),sn.hasHighPosition(t))sn.setTransform(t,Ko,r,o);else{const e=t.x+Ko.e-a.e,n=t.y+Ko.f-a.f;o&&!r?t.animate({x:e,y:n,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=n,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){sn.rotateOfLocal(t,ln(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Ho(Ko,r),qo(Ko,e,s),sn.hasHighPosition(t)?sn.setTransform(t,Ko,!1,i):t.set({x:t.x+Ko.e-r.e,y:t.y+Ko.f-r.f,rotation:M.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){sn.skewOfLocal(t,ln(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Ho(Ko,t.__localMatrix),Qo(Ko,e,s,i),sn.setTransform(t,Ko,r,o)},transformWorld(t,e,s,i){Ho(Ko,t.worldTransform),Jo(Ko,e),t.parent&&$o(Ko,t.parent.scrollWorldTransform),sn.setTransform(t,Ko,s,i)},transform(t,e,s,i){Ho(Ko,t.localTransform),Jo(Ko,e),sn.setTransform(t,Ko,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&sn.getInnerOrigin(t,r.origin),n=Zo(e,o,r.around&&sn.getInnerOrigin(t,r.around));if(sn.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){Nt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=sn.getInnerOrigin(t,r.origin);at.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 jo(s,sn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>at.tempToOuterOf(sn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return vt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Ho(Ko,t.worldTransform),$o(Ko,e.scrollWorldTransform),s?Ko:Object.assign({},Ko)),drop(t,e,s,i){t.setTransform(sn.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||sn.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),f.requestRender(()=>sn.animateMove(t,e,s))}}},sn=en,{updateAllMatrix:rn,updateMatrix:on,updateAllWorldOpacity:nn,updateAllChange:an,updateChange:hn}=sn;function ln(t,e){return t.updateLayout(),t.parent?at.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const dn={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=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>un(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>un(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>un(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let cn;function un(t,e){return e||(cn=0),t.__.mask&&(cn=1),cn<0?null:(cn&&(cn=-1),!0)}const{updateBounds:_n}=en,pn={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),gn(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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++)fn(e[t],e)},updateBounds(t,e){const s=[t];fn(t,s),yn(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++)_n(i[t]);e&&e===s||_n(s)}}},{pushAllChildBranch:gn,pushAllBranchStack:fn,updateBoundsByBranchStack:yn}=pn,mn={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:xn,updateBounds:wn}=en,{toOuterOf:vn,getPoints:bn,copy:Bn}=Nt,kn="_localContentBounds",Sn="_worldContentBounds",Rn="_worldBoxBounds",Cn="_worldStrokeBounds";class Tn{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 vn(this.contentBounds,this.leaf.__localMatrix,this[kn]||(this[kn]={})),this[kn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return vn(this.contentBounds,this.leaf.__world,this[Sn]||(this[Sn]={})),this[Sn]}get worldBoxBounds(){return vn(this.boxBounds,this.leaf.__world,this[Rn]||(this[Rn]={})),this[Rn]}get worldStrokeBounds(){return vn(this.strokeBounds,this.leaf.__world,this[Cn]||(this[Cn]={})),this[Cn]}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 wn(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,f.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 J.defaultMatrix;case"page":t=e.zoomLayer;default:return xn(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 Gt(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=J.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=xn(i,e,!0)}if(n||(n=J.getLayout(o)),Bn(n,a),at.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:i}=this,r=bn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return s(o)||r.forEach(t=>i.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,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Pn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&f.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&f.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&f.event.stop(this.origin)}}class Ln extends Pn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Ln.ADD="child.add",Ln.REMOVE="child.remove",Ln.CREATED="created",Ln.MOUNTED="mounted",Ln.UNMOUNTED="unmounted",Ln.DESTROY="destroy";const In="property.scroll";class En extends Pn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}En.CHANGE="property.change",En.LEAFER_CHANGE="property.leafer_change",En.SCROLL=In;const On={scrollX:In,scrollY:In};class An extends Pn{constructor(t,e){super(t),Object.assign(this,e)}}An.LOAD="image.load",An.LOADED="image.loaded",An.ERROR="image.error";class Mn extends Pn{static checkHas(t,e,s){"on"===s?e===zn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Wn)||t.hasEvent(Dn)||t.hasEvent(Fn),t.__hasWorldEvent=t.hasEvent(zn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Wn,t),"inner"===e&&t.emit(Dn,t)),t.emit(Fn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zn,this)}}Mn.RESIZE="bounds.resize",Mn.INNER="bounds.inner",Mn.LOCAL="bounds.local",Mn.WORLD="bounds.world";const{RESIZE:Wn,INNER:Dn,LOCAL:Fn,WORLD:zn}=Mn,Un={};[Wn,Dn,Fn,zn].forEach(t=>Un[t]=1);class Nn extends Pn{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){l(t)?(super(Nn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Nn.RESIZE="resize";class Yn extends Pn{constructor(t,e){super(t),this.data=e}}Yn.REQUEST="watch.request",Yn.DATA="watch.data";class Xn extends Pn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Xn.REQUEST="layout.request",Xn.START="layout.start",Xn.BEFORE="layout.before",Xn.LAYOUT="layout",Xn.AFTER="layout.after",Xn.AGAIN="layout.again",Xn.END="layout.end";class Hn extends Pn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Hn.REQUEST="render.request",Hn.CHILD_START="render.child_start",Hn.CHILD_END="render.child_end",Hn.START="render.start",Hn.BEFORE="render.before",Hn.RENDER="render",Hn.AFTER="render.after",Hn.AGAIN="render.again",Hn.END="render.end",Hn.NEXT="render.next";class Gn extends Pn{}Gn.START="leafer.start",Gn.BEFORE_READY="leafer.before_ready",Gn.READY="leafer.ready",Gn.AFTER_READY="leafer.after_ready",Gn.VIEW_READY="leafer.view_ready",Gn.VIEW_COMPLETED="leafer.view_completed",Gn.STOP="leafer.stop",Gn.RESTART="leafer.restart",Gn.END="leafer.end",Gn.UPDATE_MODE="leafer.update_mode",Gn.TRANSFORM="leafer.transform",Gn.MOVE="leafer.move",Gn.SCALE="leafer.scale",Gn.ROTATE="leafer.rotate",Gn.SKEW="leafer.skew";const{MOVE:Vn,SCALE:jn,ROTATE:qn,SKEW:Qn}=Gn,Jn={x:Vn,y:Vn,scaleX:jn,scaleY:jn,rotation:qn,skewX:Qn,skewY:Qn},$n={};class Zn{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(h(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)h(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,o,n;s&&("once"===s?o=!0:"boolean"==typeof s?i=s:(i=s.capture,o=s.once));const a=Kn(this,i,!0),l=r(t)?t.split(" "):t,d=o?{listener:e,once:o}:{listener:e};l.forEach(t=>{t&&(n=a[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(d):a[t]=[d],Un[t]&&Mn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=r(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Kn(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],Un[t]&&Mn.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):h(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=h(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):h(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 h(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));l(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&le.has(t)&&(e=le.get(t,{type:t,target:this,current:this}));const i=Kn(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:i,__captureMap:r}=this,o=i&&i[t],n=r&&r[t];return!!(s(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Kn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:$n)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:$n)}}const{on:ta,on_:ea,off:sa,off_:ia,once:ra,emit:oa,emitEvent:na,hasEvent:aa,destroy:ha}=Zn.prototype,la={on:ta,on_:ea,off:sa,off_:ia,once:ra,emit:oa,emitEvent:na,hasEvent:aa,destroyEventer:ha},da=Jt.get("setAttr"),ca={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||o(e)||s(e)||(da.warn(this.innerName,t,e),e=void 0),l(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new En(En.LEAFER_CHANGE,this,t,r,e));const s=Jn[t];s&&(this.emitEvent(new Gn(s,this)),this.emitEvent(new Gn(Gn.TRANSFORM,this)))}this.emitPropertyEvent(En.CHANGE,t,r,e);const s=On[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 En(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ua,multiplyParent:_a,translateInner:pa,defaultWorld:ga}=J,{toPoint:fa,tempPoint:ya}=vt,ma={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;_a(this.__local||e,t?t.__scrollWorld||t.__world:ga,s,!!e.affectScaleOrRotation,r),i&&pa(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ua(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)&&(fa(s.around||s.origin,t.boxBounds,ya),pa(e,-ya.x,-ya.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:xa,updateAllMatrix:wa}=en,{updateBounds:va}=pn,{toOuterOf:ba,copyAndSpread:Ba,copy:ka}=Nt,{toBounds:Sa}=Lr,Ra={__updateWorldBounds(){const{__layout:t,__world:e}=this;ba(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Mn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Mn.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),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"),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.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Sa(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(),wa(this),va(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wa(this),va(this,this))):xa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;n(s)&&s<=0?ka(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,s)}},Ca={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(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.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),en.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Jt.showBounds&&Jt.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:Ta}=dn,Pa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ta(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ta(s[i],e)||s[i].__clip(t,e)}}},La={},{LEAF:Ia,create:Ea}=m,{stintSet:Oa}=c,{toInnerPoint:Aa,toOuterPoint:Ma,multiplyParent:Wa}=J,{toOuterOf:Da}=Nt,{copy:Fa,move:za}=at,{moveLocal:Ua,zoomOfLocal:Na,rotateOfLocal:Ya,skewOfLocal:Xa,moveWorld:Ha,zoomOfWorld:Ga,rotateOfWorld:Va,skewOfWorld:ja,transform:qa,transformWorld:Qa,setTransform:Ja,getFlipTransform:$a,getLocalOrigin:Za,getRelativeWorld:Ka,drop:th}=en;t.Leaf=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 _}get __LayoutProcessor(){return Tn}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=Ea(Ia),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ln.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(Ln.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ln.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(Ln.MOUNTED)):this.__emitLifeEvent(Ln.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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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 Wa(s,t.matrix,e,void 0,s),Da(this.__layout.renderBounds,e,e),Oa(e,"half",s.half),Oa(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){let{scaleX:s,scaleY:i}=Jr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),La.scaleX=s,La.scaleY=i,La}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?Ka(this,e):this.worldTransform,r=s?t:{};return Da(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Fa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Fa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Aa(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Ma(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),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){Ja(this,t,e,s)}transform(t,e,s){qa(this,t,e,s)}move(t,e,s){Ua(this,t,e,s)}moveInner(t,e,s){Ha(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Na(this,Za(this,t),e,s,i,r)}rotateOf(t,e,s){Ya(this,Za(this,t),e,s)}skewOf(t,e,s,i,r){Xa(this,Za(this,t),e,s,i,r)}transformWorld(t,e,s){Qa(this,t,e,s)}moveWorld(t,e,s){Ha(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Ga(this,t,e,s,i,r)}rotateOfWorld(t,e){Va(this,t,e)}skewOfWorld(t,e,s,i,r){ja(this,t,e,s,i,r)}flip(t,e){qa(this,$a(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){return!0}__hit(t){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(){}getMotionPathData(){return ie.need("path")}getMotionPoint(t){return ie.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){th(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):Mo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=po),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ln(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ln.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ue([Yo(ca),Yo(ma),Yo(Ra),Yo(la),Yo(Ca)],t.Leaf);const{setListWithFn:eh}=Nt,{sort:sh}=pn,{localBoxBounds:ih,localStrokeBounds:rh,localRenderBounds:oh,maskLocalBoxBounds:nh,maskLocalStrokeBounds:ah,maskLocalRenderBounds:hh}=dn,lh=new Jt("Branch");t.Branch=class extends t.Leaf{__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(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){eh(e||this.__layout.boxBounds,this.children,this.__hasMask?nh:ih)}__updateStrokeBounds(t){eh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ah:rh)}__updateRenderBounds(t){eh(t||this.__layout.renderBounds,this.children,this.__hasMask?hh:oh)}__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(sh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return lh.warn("add self or destroyed");const i=s(e);if(!t.__){if(h(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ne.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?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(Ln.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ln.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)):s(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(Ln.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ln.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Ln(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=ue([Yo(Pa)],t.Branch);class dh{get length(){return this.list.length}constructor(t){this.reset(),t&&(h(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,o=e.length;r<o;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 dh;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&&(h(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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 uh=Jt.get("LeaferCanvas");class _h extends Ce{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}f.syncDomFont&&!this.parentView&&(s.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=r(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else uh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:r}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:i}=this;t.width?(s(e)&&(this.autoWidthStr=r.width||""),r.width=t.width+"px"):s(e)||(r.width=e),t.height?(s(i)&&(this.autoHeightStr=r.height||""),r.height=t.height+"px"):s(i)||(r.height=i)}else r.width=t+"px",r.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),uh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),f.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=f.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t),n={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:f.devicePixelRatio};if(!this.isSameSize(n)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=i+"px",this.emitResize(n)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};c.copyAttrs(e,this,Re),this.resize(t),this.resizeListener&&!s(this.width)&&this.resizeListener(new Nn(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Nr(CanvasRenderingContext2D.prototype),Nr(Path2D.prototype);const{mineType:ph,fileType:gh}=Yr;function fh(t,e){f.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=ph(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,ph(e),s)),canvasSaveAs:(t,e,s)=>{const i=t.toDataURL(ph(gh(e)),s);return f.origin.download(i,e)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((e,s)=>{const i=new f.origin.Image,{crossOrigin:r}=f.image;r&&(i.setAttribute("crossOrigin",r),i.crossOrigin=r),i.onload=()=>{e(i)},i.onerror=t=>{s(t)},i.src=f.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},f.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},f.canvas=re.canvas(),f.conicGradientSupport=!!f.canvas.context.createConicGradient}Object.assign(re,{canvas:(t,e)=>new _h(t,e),image:t=>new to(t)}),f.name="web",f.isMobile="ontouchstart"in window,f.requestRender=function(t){window.requestAnimationFrame(t)},eo(f,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:yh}=navigator;yh.indexOf("Firefox")>-1?(f.conicGradientRotate90=!0,f.intWheelDeltaY=!0,f.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(f.fullImageShadow=!0),yh.indexOf("Windows")>-1?(f.os="Windows",f.intWheelDeltaY=!0):yh.indexOf("Mac")>-1?f.os="Mac":yh.indexOf("Linux")>-1&&(f.os="Linux");class mh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new dh;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 dh,this.target=t,e&&(this.config=c.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(Hn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Ln.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 Yn(Yn.DATA,{updatedList:this.updatedList})),this.__updatedList=new dh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[En.CHANGE,this.__onAttrChange,this],[[Ln.ADD,Ln.REMOVE],this.__onChildEvent,this],[Yn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:xh,updateBounds:wh,updateChange:vh}=en,{pushAllChildBranch:bh,pushAllParent:Bh}=pn;const{worldBounds:kh}=dn;class Sh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,h(t)&&(t=new dh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,kh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,kh),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:Rh,updateAllChange:Ch}=en,Th=Jt.get("Layouter");class Ph{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ch,this.target=t,e&&(this.config=c.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(Xn.START),this.layoutOnce(),t.emitEvent(new Xn(Xn.END,this.layoutedBlocks,this.times))}catch(t){Th.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Th.warn("layouting"):this.times>3?Th.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Yn.REQUEST),this.totalTimes>1?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=te.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Xn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Xn(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?(xh(t,!0),e.add(t),t.isBranch&&bh(t,e),Bh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Bh(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||wh(i[t])}wh(s)}})}(this.__levelList),function(t){t.list.forEach(vh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Xn(o,a,this.times)),s.emitEvent(new Xn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,te.end(e)}fullLayout(){const t=te.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Xn,o=this.getBlocks(new dh(e));e.emitEvent(new Xn(s,o,this.times)),Ph.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Xn(i,o,this.times)),e.emitEvent(new Xn(r,o,this.times)),this.addBlocks(o),te.end(t)}static fullLayout(t){Rh(t,!0),t.isBranch?pn.updateBounds(t):en.updateBounds(t),Ch(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Sh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Sh(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_([[Xn.REQUEST,this.layout,this],[Xn.AGAIN,this.layoutAgain,this],[Yn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Lh=Jt.get("Renderer");class Ih{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,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=c.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.__requestRender()}requestLayout(){this.target.emit(Xn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Hn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Hn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Hn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Lh.log(e.innerName,"---\x3e");try{this.emitRender(Hn.START),this.renderOnce(t),this.emitRender(Hn.END,this.totalBounds),Jr.clearRecycled()}catch(t){this.rendering=!1,Lh.error(t)}Lh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Lh.warn("rendering");if(this.times>3)return Lh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Hn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Hn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Hn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Hn.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=te.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Gt(i);s.save(),i.spread(Ih.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),te.end(e)}fullRender(){const t=te.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),te.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Jt.showRepaint&&Jt.drawRepaint(s,t),f.render(this.target,s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;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 f.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()};f.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Gt(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 Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Lh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Hn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Hn.REQUEST,this.update,this],[Xn.END,this.__onLayoutEnd,this],[Hn.AGAIN,this.renderAgain,this],[Nn.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 Eh(t){return ro(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Oh(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Ah(){return(t,e)=>{const s="_"+e;eo(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}})}}Ih.clipSpread=10,Object.assign(re,{watcher:(t,e)=>new mh(t,e),layouter:(t,e)=>new Ph(t,e),renderer:(t,e,s)=>new Ih(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),f.layout=Ph.fullLayout,f.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new dh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Mh={},Wh={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}},Dh={number:(t,e)=>l(t)?"percent"===t.type?t.value*e:t.value:t},Fh={},zh={},Uh={},Nh={},Yh={},Xh={apply(){ie.need("filter")}},Hh={},Gh={setStyleName:()=>ie.need("state"),set:()=>ie.need("state")},Vh={list:{},register(t,e){Vh.list[t]=e},get:t=>Vh.list[t]},{parse:jh,objectToCanvasData:qh}=$s,{stintSet:Qh}=c,{hasTransparent:Jh}=Wh,$h={originPaint:{}},Zh=Jt.get("UIData");class Kh extends _{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;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}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!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!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,Zh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Zh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(Qh(this,"__isTransparentFill",Jh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(Qh(this,"__isTransparentStroke",Jh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?jh(t):qh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){tl(this,"shadow",t)}setInnerShadow(t){tl(this,"innerShadow",t)}setFilter(t){tl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&zh.compute("fill",this.__leaf),e&&zh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),h(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=$h)):(this.__isStrokes=!0,this._stroke||(this._stroke=$h))}__removePaint(t,e){e&&this.__removeInput(t),Uh.recycleImage(t,this),"fill"===t?(Qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Qh(this,"__isAlphaPixelStroke",void 0),Qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function tl(t,e,s){t.__setInput(e,s),h(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 el extends Kh{}class sl extends el{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 il extends el{__getInputData(t,e){const s=super.__getInputData(t,e);return Re.forEach(t=>delete s[t]),s}}class rl extends sl{}class ol extends Kh{get __usePathBox(){return this.points||this.__pathInputed}}class nl extends Kh{get __boxStroke(){return!this.__pathInputed}}class al extends Kh{get __boxStroke(){return!this.__pathInputed}}class hl extends ol{}class ll extends Kh{}class dl extends Kh{get __pathInputed(){return 2}}class cl extends el{}const ul={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class _l extends Kh{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=ul[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=ne.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}}class pl extends nl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",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 gl extends nl{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:fl,add:yl}=S,ml={__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)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=fl(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=Yh.getShadowRenderSpread(this,e)),i&&(t=fl(t,i)),o&&(t=yl(t,Xh.getSpread(o))),n&&(t=yl(t,n)),a&&(t=yl(t,a));let l=t;return s&&(l=fl(l,Yh.getInnerShadowSpread(this,s))),r&&(l=fl(l,r)),this.__layout.renderShapeSpread=l,h?fl(h.__updateRenderSpread(),t):t}},{stintSet:xl}=c,wl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);xl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),xl(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;xl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Yh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(h(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),xl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){vl(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=zh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Yh.shadow(this,t,h),a&&(i.__isStrokes?zh.strokes(o,this,t,e):zh.stroke(o,this,t,e)),r&&(i.__isFills?zh.fills(r,this,t,e):zh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&Yh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?zh.strokes(o,this,t,e):zh.stroke(o,this,t,e)),c&&Xh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?zh.strokes(o,this,t,e):zh.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,Wh.string(e.color))}r&&(i.__isFills?zh.fills(r,this,t,e):zh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?zh.strokes(o,this,t,e):zh.stroke(o,this,t,e))}}else i.__pathInputed?vl(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?zh.fills(i,this,t,e):zh.fill("#000000",this,t,e)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?zh.strokes(r,this,t,e):zh.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 vl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&zh.stroke(r,t,e,s),i&&zh.fill(i,t,e,s),o&&t.__drawAfterFill(e,s),r&&!n&&zh.stroke(r,t,e,s)}const bl={__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 Bl,kl;t.UI=Bl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.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 zr.set(this.path=t||[]),t||this.__drawPathByBox(zr),zr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return r(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ie.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ie.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(zr.set(s=[]),this.__drawPathByBox(zr)),t?$s.toCanvasData(s,!0):s}getPathString(t,e,s){return $s.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Hh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Dr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Fh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Zi.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,n(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e,s){zh.fill(this.__.placeholderColor,this,e,s)}animate(t,e,s,i){return this.set(t),ie.need("animate")}killAnimate(t,e){}export(t,e){return ie.need("export")}syncExport(t,e){return ie.need("export")}clone(t){const e=c.clone(this.toJSON());return t&&Object.assign(e,t),Bl.one(e)}static one(t,e,s,i,r){return ne.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Xo()(this)}static registerData(t){Ao(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ue([Ao(Kh)],t.UI.prototype,"__",void 0),ue([Ah()],t.UI.prototype,"zoomLayer",void 0),ue([ao("")],t.UI.prototype,"id",void 0),ue([ao("")],t.UI.prototype,"name",void 0),ue([ao("")],t.UI.prototype,"className",void 0),ue([Bo("pass-through")],t.UI.prototype,"blendMode",void 0),ue([So(1)],t.UI.prototype,"opacity",void 0),ue([Ro(!0)],t.UI.prototype,"visible",void 0),ue([Bo(!1)],t.UI.prototype,"locked",void 0),ue([ko(!1)],t.UI.prototype,"dim",void 0),ue([ko(!1)],t.UI.prototype,"dimskip",void 0),ue([Po(0)],t.UI.prototype,"zIndex",void 0),ue([Lo(!1)],t.UI.prototype,"mask",void 0),ue([Io(!1)],t.UI.prototype,"eraser",void 0),ue([ho(0,!0)],t.UI.prototype,"x",void 0),ue([ho(0,!0)],t.UI.prototype,"y",void 0),ue([po(100,!0)],t.UI.prototype,"width",void 0),ue([po(100,!0)],t.UI.prototype,"height",void 0),ue([uo(1,!0)],t.UI.prototype,"scaleX",void 0),ue([uo(1,!0)],t.UI.prototype,"scaleY",void 0),ue([_o(0,!0)],t.UI.prototype,"rotation",void 0),ue([_o(0,!0)],t.UI.prototype,"skewX",void 0),ue([_o(0,!0)],t.UI.prototype,"skewY",void 0),ue([ho(0,!0)],t.UI.prototype,"offsetX",void 0),ue([ho(0,!0)],t.UI.prototype,"offsetY",void 0),ue([lo(0,!0)],t.UI.prototype,"scrollX",void 0),ue([lo(0,!0)],t.UI.prototype,"scrollY",void 0),ue([co()],t.UI.prototype,"origin",void 0),ue([co()],t.UI.prototype,"around",void 0),ue([ao(!1)],t.UI.prototype,"lazy",void 0),ue([go(1)],t.UI.prototype,"pixelRatio",void 0),ue([bo(0)],t.UI.prototype,"renderSpread",void 0),ue([yo()],t.UI.prototype,"path",void 0),ue([mo()],t.UI.prototype,"windingRule",void 0),ue([mo(!0)],t.UI.prototype,"closed",void 0),ue([po(0)],t.UI.prototype,"padding",void 0),ue([po(!1)],t.UI.prototype,"lockRatio",void 0),ue([po()],t.UI.prototype,"widthRange",void 0),ue([po()],t.UI.prototype,"heightRange",void 0),ue([ao(!1)],t.UI.prototype,"draggable",void 0),ue([ao()],t.UI.prototype,"dragBounds",void 0),ue([ao("auto")],t.UI.prototype,"dragBoundsType",void 0),ue([ao(!1)],t.UI.prototype,"editable",void 0),ue([Eo(!0)],t.UI.prototype,"hittable",void 0),ue([Eo("path")],t.UI.prototype,"hitFill",void 0),ue([vo("path")],t.UI.prototype,"hitStroke",void 0),ue([Eo(!1)],t.UI.prototype,"hitBox",void 0),ue([Eo(!0)],t.UI.prototype,"hitChildren",void 0),ue([Eo(!0)],t.UI.prototype,"hitSelf",void 0),ue([Eo()],t.UI.prototype,"hitRadius",void 0),ue([Oo("")],t.UI.prototype,"cursor",void 0),ue([Bo()],t.UI.prototype,"fill",void 0),ue([vo(void 0,!0)],t.UI.prototype,"stroke",void 0),ue([vo("inside")],t.UI.prototype,"strokeAlign",void 0),ue([vo(1,!0)],t.UI.prototype,"strokeWidth",void 0),ue([vo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ue([vo("none")],t.UI.prototype,"strokeCap",void 0),ue([vo("miter")],t.UI.prototype,"strokeJoin",void 0),ue([vo()],t.UI.prototype,"dashPattern",void 0),ue([vo(0)],t.UI.prototype,"dashOffset",void 0),ue([vo(10)],t.UI.prototype,"miterLimit",void 0),ue([mo(0)],t.UI.prototype,"cornerRadius",void 0),ue([mo()],t.UI.prototype,"cornerSmoothing",void 0),ue([Eh()],t.UI.prototype,"shadow",void 0),ue([Eh()],t.UI.prototype,"innerShadow",void 0),ue([Eh()],t.UI.prototype,"blur",void 0),ue([Eh()],t.UI.prototype,"backgroundBlur",void 0),ue([Eh()],t.UI.prototype,"grayscale",void 0),ue([Eh()],t.UI.prototype,"filter",void 0),ue([Bo()],t.UI.prototype,"placeholderColor",void 0),ue([ao(100)],t.UI.prototype,"placeholderDelay",void 0),ue([ao({})],t.UI.prototype,"data",void 0),ue([zo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Bl=ue([Yo(ml),Yo(wl),Uo()],t.UI),t.Group=class extends t.UI{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);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),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(){}},ue([Ao(el)],t.Group.prototype,"__",void 0),ue([po(0)],t.Group.prototype,"width",void 0),ue([po(0)],t.Group.prototype,"height",void 0),t.Group=ue([Yo(t.Branch),Xo()],t.Group);const Sl=Jt.get("Leafer");t.Leafer=kl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&qr.isComplete}get layoutLocked(){return!this.layouter.running}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),kl.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,c.assign(i,t));const r=this.canvas=re.canvas(i);this.__controllers.push(this.renderer=re.renderer(this,r,i),this.watcher=re.watcher(this,i),this.layouter=re.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=re.selector(this),this.interaction=re.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.hitCanvasManager()),this.canvasManager=new ce,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))),mn.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(Gn.RESTART):this.emitLeafer(Gn.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(Gn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=c.copyAttrs({},t,Re);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Gt(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=c.copyAttrs({},this.canvas,Re);e.resize(t),this.updateLazyBounds(),this.__onResize(new Nn(t,s))}__onResize(t){this.emitEvent(t),c.copyAttrs(this.__,t,Re),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&&(Re.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(Gn.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Re.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=c.copyAttrs({},i,Re);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(Gn.BEFORE_READY),this.emitLeafer(Gn.READY),this.emitLeafer(Gn.AFTER_READY),mn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Gn.VIEW_READY),mn.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){mn.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(Gn.VIEW_COMPLETED),mn.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 ie.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 Gn(t,this))}__listenEvents(){const t=te.start("FirstCreate "+this.innerName);this.once([[Gn.START,()=>te.end(t)],[Xn.START,this.updateLazyBounds,this],[Hn.START,this.__onCreated,this],[Hn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Yn.DATA,this.__onWatchData,this],[Xn.END,this.__onLayoutEnd,this],[Hn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){kl.list.remove(this);try{this.stop(),this.emitLeafer(Gn.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.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Jr.clearRecycled()},100)}catch(t){Sl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new dh,ue([Ao(il)],t.Leafer.prototype,"__",void 0),ue([po()],t.Leafer.prototype,"pixelRatio",void 0),ue([ao("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=kl=ue([Xo()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ue([Ao(nl)],t.Rect.prototype,"__",void 0),t.Rect=ue([Yo(bl),Uo(),Xo()],t.Rect);const{add:Rl,includes:Cl,scroll:Tl}=Nt,Pl=t.Rect.prototype,Ll=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}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.pathInputed){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"))&&(Rl(a,o),Tl(a,s)),this.__updateRectRenderBounds(),t=!Cl(o,a),t&&"show"===n&&Rl(r,a)}else this.__updateRectRenderBounds();c.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))}},ue([Ao(sl)],t.Box.prototype,"__",void 0),ue([po(100)],t.Box.prototype,"width",void 0),ue([po(100)],t.Box.prototype,"height",void 0),ue([ao(!1)],t.Box.prototype,"resizeChildren",void 0),ue([bo("show")],t.Box.prototype,"overflow",void 0),ue([zo(Pl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ue([zo(Pl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ue([zo(Pl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ue([zo(Pl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ue([zo(Pl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ue([zo(Pl.__updateChange)],t.Box.prototype,"__updateRectChange",null),ue([zo(Pl.__render)],t.Box.prototype,"__renderRect",null),ue([zo(Ll.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ue([Uo(),Xo()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ue([Ao(rl)],t.Frame.prototype,"__",void 0),ue([Bo("#FFFFFF")],t.Frame.prototype,"fill",void 0),ue([bo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ue([Xo()],t.Frame);const{moveTo:Il,closePath:El,ellipse:Ol}=wi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?(i||r?(s<1&&Ol(a,o,n,o*s,n*s,0,i,r,!1),Ol(a,o,n,o,n,0,r,i,!0),s<1&&El(a)):(s<1&&(Ol(a,o,n,o*s,n*s),Il(a,t,n)),Ol(a,o,n,o,n,0,360,0,!0)),f.ellipseToCurve&&(this.__.path=this.getPath(!0))):i||r?(Il(a,o,n),Ol(a,o,n,o,n,0,i,r,!1),El(a)):Ol(a,o,n,o,n)}},ue([Ao(al)],t.Ellipse.prototype,"__",void 0),ue([mo(0)],t.Ellipse.prototype,"innerRadius",void 0),ue([mo(0)],t.Ellipse.prototype,"startAngle",void 0),ue([mo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ue([Xo()],t.Ellipse);const{sin:Al,cos:Ml,PI:Wl}=Math,{moveTo:Dl,lineTo:Fl,closePath:zl,drawPoints:Ul}=wi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ul(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Dl(e,o,0);for(let t=1;t<r;t++)Fl(e,o+o*Al(2*t*Wl/r),n-n*Ml(2*t*Wl/r));zl(e)}}},ue([Ao(hl)],t.Polygon.prototype,"__",void 0),ue([mo(3)],t.Polygon.prototype,"sides",void 0),ue([mo()],t.Polygon.prototype,"points",void 0),ue([mo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ue([Uo(),Xo()],t.Polygon);const{sin:Nl,cos:Yl,PI:Xl}=Math,{moveTo:Hl,lineTo:Gl,closePath:Vl}=wi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Hl(n,r,0);for(let t=1;t<2*s;t++)Gl(n,r+(t%2==0?r:r*i)*Nl(t*Xl/s),o-(t%2==0?o:o*i)*Yl(t*Xl/s));Vl(n)}},ue([Ao(ll)],t.Star.prototype,"__",void 0),ue([mo(5)],t.Star.prototype,"corners",void 0),ue([mo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ue([Xo()],t.Star);const{moveTo:jl,lineTo:ql,drawPoints:Ql}=wi,{rotate:Jl,getAngle:$l,getDistance:Zl,defaultPoint:Kl}=at;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Jl(s,e),s}set toPoint(t){this.width=Zl(Kl,t),this.rotation=$l(Kl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ql(e,t.points,t.curve,t.closed):(jl(e,0,0),ql(e,this.width,0))}},ue([Ao(ol)],t.Line.prototype,"__",void 0),ue([xo("center")],t.Line.prototype,"strokeAlign",void 0),ue([po(0)],t.Line.prototype,"height",void 0),ue([mo()],t.Line.prototype,"points",void 0),ue([mo(0)],t.Line.prototype,"curve",void 0),ue([mo(!1)],t.Line.prototype,"closed",void 0),t.Line=ue([Xo()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return h(t)&&t[0].image}},ue([Ao(pl)],t.Image.prototype,"__",void 0),ue([po("")],t.Image.prototype,"url",void 0),t.Image=ue([Xo()],t.Image);const td=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new to({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new An(An.LOADED,{image:t}))})}draw(t,e,s,i){const r=new pt(t.worldTransform).invert(),o=new pt;e&&o.translate(e.x,e.y),s&&(n(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()}},ue([Ao(gl)],t.Canvas.prototype,"__",void 0),ue([Oh(100)],t.Canvas.prototype,"width",void 0),ue([Oh(100)],t.Canvas.prototype,"height",void 0),ue([Oh(1)],t.Canvas.prototype,"pixelRatio",void 0),ue([Oh(!0)],t.Canvas.prototype,"smooth",void 0),ue([ao(!1)],t.Canvas.prototype,"safeResize",void 0),ue([Oh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ue([Xo()],t.Canvas);const{copyAndSpread:ed,includes:sd,spread:id,setList:rd}=Nt,{stintSet:od}=c;function nd(t,e,s){t.__.__font?zh.fillText(t,e,s):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ad(t,e,s,i,r){const o=s.__;l(t)?zh.drawStrokesStyle(t,e,!1,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),i.stroke()),o.__useArrow&&zh.strokeArrow(t,s,i,r)}function hd(t,e,s,i,r){const o=s.__;l(t)?zh.drawStrokesStyle(t,e,!0,s,i,r):(i.setStroke(t,o.__strokeWidth*e,o),zh.drawTextStroke(s,i,r))}function ld(t,e,s,i,r){const o=i.getSameCanvas(!0,!0);o.font=s.__.__font,hd(t,2,s,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",zh.fillText(s,o,r),o.blendMode="normal",en.copyCanvasByWorld(s,i,o),o.recycle(s.__nowWorld)}t.Text=class extends t.UI{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=Dh.number(e,r),t.__letterSpacing=Dh.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"}`,od(t,"__padding",l&&M.fourNumber(l)),od(t,"__clipText","show"!==h&&!t.__autoSize),od(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Mh.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,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&id(a,s/2),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),c.stintSet(this,"isOverflow",!sd(h,a)),this.isOverflow?(rd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;ed(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()}},ue([Ao(_l)],t.Text.prototype,"__",void 0),ue([po(0)],t.Text.prototype,"width",void 0),ue([po(0)],t.Text.prototype,"height",void 0),ue([Bo()],t.Text.prototype,"boxStyle",void 0),ue([ao(!1)],t.Text.prototype,"resizeFontSize",void 0),ue([Bo("#000000")],t.Text.prototype,"fill",void 0),ue([xo("outside")],t.Text.prototype,"strokeAlign",void 0),ue([Eo("all")],t.Text.prototype,"hitFill",void 0),ue([po("")],t.Text.prototype,"text",void 0),ue([po("")],t.Text.prototype,"placeholder",void 0),ue([po("caption")],t.Text.prototype,"fontFamily",void 0),ue([po(12)],t.Text.prototype,"fontSize",void 0),ue([po("normal")],t.Text.prototype,"fontWeight",void 0),ue([po(!1)],t.Text.prototype,"italic",void 0),ue([po("none")],t.Text.prototype,"textCase",void 0),ue([po("none")],t.Text.prototype,"textDecoration",void 0),ue([po(0)],t.Text.prototype,"letterSpacing",void 0),ue([po({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ue([po(0)],t.Text.prototype,"paraIndent",void 0),ue([po(0)],t.Text.prototype,"paraSpacing",void 0),ue([po("x")],t.Text.prototype,"writingMode",void 0),ue([po("left")],t.Text.prototype,"textAlign",void 0),ue([po("top")],t.Text.prototype,"verticalAlign",void 0),ue([po(!0)],t.Text.prototype,"autoSizeAlign",void 0),ue([po("normal")],t.Text.prototype,"textWrap",void 0),ue([po("show")],t.Text.prototype,"textOverflow",void 0),ue([Bo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ue([Xo()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ue([Ao(dl)],t.Path.prototype,"__",void 0),ue([xo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ue([Xo()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),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(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ue([Ao(cl)],t.Pen.prototype,"__",void 0),ue([(t,e)=>{eo(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ue([Yo(Di,["set","path","paint"]),Xo()],t.Pen);const{getSpread:dd,copyAndSpread:cd,toOuterOf:ud,getOuterOf:_d,getByMove:pd,move:gd,getIntersectData:fd}=Nt,yd={};let md;const{stintSet:xd}=c,{hasTransparent:wd}=Wh;function vd(t,e,i){if(!l(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:n}=i.__layout;switch(e.type){case"image":o=Uh.image(i,t,e,n,!md||!md[e.url]);break;case"linear":o=Nh.linearGradient(e,n);break;case"radial":o=Nh.radialGradient(e,n);break;case"angular":o=Nh.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;o={type:r,style:Wh.string(a,h)};break;default:s(e.r)||(o={type:"solid",style:Wh.string(e)})}if(o&&(o.originPaint=e,r(o.style)&&wd(o.style)&&(o.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}return o}const bd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];h(a)||(a=[a]),md=Uh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=vd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length?(i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(xd(s,"__isAlphaPixelFill",r),xd(s,"__isTransparentFill",o)):(xd(s,"__isAlphaPixelStroke",r),xd(s,"__isTransparentStroke",o),xd(s,"__hasMultiStrokeStyle",n))):s.__removePaint(t,!1)},fill:function(t,e,s,i){s.fillStyle=t,nd(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,Uh.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);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&i>1)&&s.scale(1/t,1/i)}o.blendMode&&(s.blendMode=o.blendMode),nd(e,s,i),s.restore()}else o.blendMode?(s.saveBlendMode(o.blendMode),nd(e,s,i),s.restoreBlendMode()):nd(e,s,i)}},fillPathOrText:nd,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)zh.strokeText(t,e,s,i);else switch(r.strokeAlign){case"center":ad(t,1,e,s,i);break;case"inside":!function(t,e,s,i){s.save(),s.clipUI(e),ad(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)ad(t,2,e,s,i);else{const{renderBounds:o}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),ad(t,2,e,n,i),n.clipUI(r),n.clearWorld(o),en.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s,i)}},strokes:function(t,e,s,i){zh.stroke(t,e,s,i)},strokeText:function(t,e,s,i){switch(e.__.strokeAlign){case"center":hd(t,1,e,s,i);break;case"inside":ld(t,"inside",e,s,i);break;case"outside":e.__.__fillAfterStroke?hd(t,2,e,s,i):ld(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||!Uh.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?zh.drawTextStroke(i,r,o):r.stroke(),r.restoreBlendMode()):s?zh.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,_;ud(n.strokeSpread?(cd(yd,n.boxBounds,n.strokeSpread),yd):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(f.fullImageShadow)i=a;else{const t=n.renderShapeSpread?dd(r,S.swapAndScale(n.renderShapeSpread,p,g)):r;i=fd(t,a)}c=r.getFitMatrix(i);let{a:y,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,s),p*=y,g*=m),u=_d(a,c),h=pd(u,-c.e,-c.f),l=_d(o,c),gd(l,-c.e,-c.f);const x=s.matrix;x?(d=new pt(c),d.multiply(x),y*=x.scaleX,m*=x.scaleY):d=c,d.withScale(y,m),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 Bd,kd=new Gt;const{isSame:Sd}=Nt;function Rd(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Uh.createData(r,i,s,o),!0}function Cd(t,e){Ld(t,An.LOAD,e)}function Td(t,e){Ld(t,An.LOADED,e)}function Pd(t,e,s){e.error=s,t.forceUpdate("surface"),Ld(t,An.ERROR,e)}function Ld(t,e,s){t.hasEvent(e)&&t.emitEvent(new An(e,s))}function Id(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Ed,translate:Od}=J,Ad=new Gt,Md={},Wd={};function Dd(t,e,s,i){const o=r(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&o<0?0:o}let Fd={},zd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Ud,set:Nd,rotateOfOuter:Yd,translate:Xd,scaleOfOuter:Hd,multiplyParent:Gd,scale:Vd,rotate:jd,skew:qd}=J;function Qd(t,e,s,i,r,o,n,a){n&&jd(t,n),a&&qd(t,a.x,a.y),r&&Vd(t,r,o),Xd(t,e.x+s,e.y+i)}const{get:Jd,scale:$d,copy:Zd}=J,{getFloorScale:Kd}=M,{abs:tc}=Math;const ec={image:function(t,e,s,i,r){let o,n;const a=Jr.get(s);return Bd&&s===Bd.paint&&Sd(i,Bd.boxBounds)?o=Bd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Bd=a.use>1?{leafPaint:o,paint:s,boxBounds:kd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Rd(t,e,s,a,o,i),r&&(Cd(t,n),Td(t,n))):a.error?r&&Pd(t,n,a.error):(r&&(Id(t,!0),Cd(t,n)),o.loadId=a.load(()=>{Id(t,!1),t.destroyed||(Rd(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Td(t,n)),o.loadId=void 0},e=>{Id(t,!1),Pd(t,n,e),o.loadId=void 0}),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}=Uh.getImageRenderScaleData(t,s,i,r),{image:a,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===o+"-"+n&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===f.name&&Nn.isResizing(s)||d||(e=f.image.isLarge(a,o,n))),e?(s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),Uh.drawImage(t,o,n,s,i,r),!0):(!t.style||l.sync||d?Uh.createPattern(t,s,i,r):Uh.createPatternTask(t,s,i,r),!1))},drawImage:function(t,e,s,i,r,o){const{data:n,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=n,c=a.getFull(n.filters),u=i.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(i),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(n.scaleX&&(p*=n.scaleX,g*=n.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,s,i){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(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(h(s)){let i,r,o,n,a;for(let l=0,d=s.length;l<d;l++)i=s[l],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Jr.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],h(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=Jr.patternTasker.add(()=>_e(this,void 0,void 0,function*(){t.patternTask=null,s.bounds.hit(e.__nowWorld)&&Uh.createPattern(t,e,s,i),e.forceUpdate("surface")}),300))},createPattern:function(t,e,s,i){let{scaleX:r,scaleY:o}=Uh.getImageRenderScaleData(t,e,s,i),n=r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!f.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:s,data:i}=t,{transform:a,gap:h}=i,l=Uh.getPatternFixScale(t,r,o);let d,c,u,{width:_,height:p}=s;l&&(r*=l,o*=l),_*=r,p*=o,h&&(c=h.x*r/tc(i.scaleX||1),u=h.y*o/tc(i.scaleY||1)),(a||1!==r||1!==o)&&(r*=Kd(_+(c||0)),o*=Kd(p+(u||0)),d=Jd(),a&&Zd(d,a),$d(d,1/r,1/o));const g=s.getCanvas(_,p,i.opacity,i.filters,c,u,e.leafer&&e.leafer.config.smooth),y=s.getPattern(g,i.repeat||f.origin.noRepeat||"no-repeat",d,t);t.style=y,t.patternId=n}},getPatternFixScale:function(t,e,s){const{image:i}=t;let r,o=f.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=Uh.getPatternData(s,i,e)},getPatternData:function(t,e,s){t.padding&&(e=Ad.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:i,height:o}=s,{opacity:n,mode:a,align:h,offset:d,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===o,w={mode:a},v="center"!==h&&(_||0)%180==90;let b,B;switch(Nt.set(Wd,0,0,v?o:i,v?i:o),a&&"cover"!==a&&"fit"!==a?((c||u)&&(M.getScaleData(c,u,s,Md),b=Md.scaleX,B=Md.scaleY),(h||y||f)&&(b&&Nt.scale(Wd,b,B,!0),h&&kt.toPoint(h,Wd,e,Wd,!0,!0))):x&&!_||(b=B=Nt.getFitScale(e,Wd,"fit"!==a),Nt.put(e,s,h,b,!1,Wd),Nt.scale(Wd,b,B,!0)),d&&at.move(Wd,d),a){case"stretch":x?b&&(b=B=void 0):(b=e.width/i,B=e.height/o,Uh.stretchMode(w,e,b,B));break;case"normal":case"clip":if(Wd.x||Wd.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),Uh.clipMode(w,e,Wd.x,Wd.y,b,B,_,p,t,s),t&&(b=b?b*t:t,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&Uh.repeatMode(w,e,i,o,Wd.x,Wd.y,b,B,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=l(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;l(t)?(o=t.x,n=t.y):o=n=t;return{x:Dd(o,s,r.width,e&&e.x),y:Dd(n,i,r.height,e&&e.y)}}(y,s&&f,Wd.width,Wd.height,e));break;default:b&&Uh.fillOrFitMode(w,e,Wd.x,Wd.y,b,B,_)}return w.transform||(e.x||e.y)&&Od(w.transform=Ed(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=B),n&&n<1&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,s,i){const r=Ud(),{x:o,y:n}=e;o||n?Xd(r,o,n):r.onlyScale=!0,Vd(r,s,i),t.transform=r},fillOrFitMode:function(t,e,s,i,r,o,n){const a=Ud();Xd(a,e.x+s,e.y+i),Vd(a,r,o),n&&Yd(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=Ud();Qd(d,e,s,i,r,o,n,a),h&&(n||a?(Nd(zd),Hd(zd,e,h,l),Gd(d,zd)):Hd(d,e,h,l)),t.transform=d},repeatMode:function(t,e,s,i,r,o,n,a,h,l,d,c){const u=Ud();if(c)Qd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Yd(u,{x:s/2,y:i/2},h);else switch(jd(u,h),h){case 90:Xd(u,i,0);break;case 180:Xd(u,s,i);break;case 270:Xd(u,0,s)}Fd.x=e.x+r,Fd.y=e.y+o,Xd(u,Fd.x,Fd.y),n&&Hd(u,Fd,n,a)}t.transform=u}},{toPoint:sc}=vt,{hasTransparent:ic}=Wh,rc={},oc={};function nc(t,e,s,i){if(s){let o,n,a,h;for(let t=0,l=s.length;t<l;t++)o=s[t],r(o)?(a=t/(l-1),n=Wh.string(o,i)):(a=o.offset,n=Wh.string(o.color,i)),e.addColorStop(a,n),!h&&ic(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:ac,getDistance:hc}=at,{get:lc,rotateOfOuter:dc,scaleOfOuter:cc}=J,{toPoint:uc}=vt,_c={},pc={};function gc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=ac(e,s);o=lc(),r?(cc(o,e,n/a*(i||1),1),dc(o,e,t+90)):(cc(o,e,1,n/a*(i||1)),dc(o,e,t))}return o}const{getDistance:fc}=at,{toPoint:yc}=vt,mc={},xc={};const wc={linearGradient:function(t,e){let{from:s,to:i,type:r,opacity:o}=t;sc(s||"top",e,rc),sc(i||"bottom",e,oc);const n=f.canvas.createLinearGradient(rc.x,rc.y,oc.x,oc.y),a={type:r,style:n};return nc(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;uc(s||"center",e,_c),uc(i||"bottom",e,pc);const a=f.canvas.createRadialGradient(_c.x,_c.y,0,_c.x,_c.y,hc(_c,pc)),h={type:r,style:a};nc(h,a,t.stops,o);const l=gc(e,_c,pc,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:s,to:i,type:r,opacity:o,stretch:n}=t;yc(s||"center",e,mc),yc(i||"bottom",e,xc);const a=f.conicGradientSupport?f.canvas.createConicGradient(0,mc.x,mc.y):f.canvas.createRadialGradient(mc.x,mc.y,0,mc.x,mc.y,fc(mc,xc)),h={type:r,style:a};nc(h,a,t.stops,o);const l=gc(e,mc,xc,n||1,f.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:gc},{copy:vc,move:bc,toOffsetOutBounds:Bc}=Nt,{max:kc,abs:Sc}=Math,Rc={},Cc=new pt,Tc={};function Pc(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=Sc(t.spread||0),n=kc(n,r+o-i),a=kc(a,r+o+s),h=kc(h,r+o+i),l=kc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function Lc(t,e,s){const{shapeBounds:i}=s;let r,o;f.fullImageShadow?(vc(Rc,t.bounds),bc(Rc,e.x-i.x,e.y-i.y),r=t.bounds,o=Rc):(r=i,o=e),t.copyWorld(s.canvas,r,o)}const{toOffsetOutBounds:Ic}=Nt,Ec={};const Oc=Pc;const Ac={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;Bc(h,Tc,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Tc.offsetX+(n.x||0)*c*f,Tc.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,Wh.string(n.color)),r=Yh.getShadowTransform(t,_,s,n,Tc,f),r&&_.setTransform(r),Lc(_,Tc,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")),en.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;Ic(h,Ec,l),n.forEach((n,g)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Ec.offsetX+(n.x||0)*c*f,Ec.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=Yh.getShadowTransform(t,_,s,n,Ec,f,!0),r&&_.setTransform(r),Lc(_,Ec,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,Wh.string(n.color),"source-in"),en.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:Pc,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 Cc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+s/a,1+s/h),Cc}},isTransformShadow(t){},getInnerShadowSpread:Oc},{excludeRenderBounds:Mc}=dn;let Wc;function Dc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":Wc||(Wc=!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);zc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":zc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function Fc(t){return t.getSameCanvas(!1,!0)}function zc(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)}t.Group.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&&(Dc(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||Mc(s,e)||s.__render(t,e),o=s.__.opacity,Wc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Fc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=Fc(t)),r||(r=Fc(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&Dc(this,n,t,r,i,o,void 0,!1),Mc(s,e)||s.__render(r||t,e),d&&Dc(this,n,t,r,i,o,d,!1)}Dc(this,n,t,r,i,o,void 0,!0)};const Uc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Nc=Uc+"_#~&*+\\=|≮≯≈≠=…",Yc=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 Xc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Hc=Xc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Gc=Xc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Vc=Xc(Uc),jc=Xc(Nc),qc=Xc("- —/~|┆·");var Qc;!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"}(Qc||(Qc={}));const{Letter:Jc,Single:$c,Before:Zc,After:Kc,Symbol:tu,Break:eu}=Qc;function su(t){return Hc[t]?Jc:qc[t]?eu:Gc[t]?Zc:Vc[t]?Kc:jc[t]?tu:Yc.test(t)?$c:Jc}const iu={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 ru(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:ou}=iu,{Letter:nu,Single:au,Before:hu,After:lu,Symbol:du,Break:cu}=Qc;let uu,_u,pu,gu,fu,yu,mu,xu,wu,vu,bu,Bu,ku,Su,Ru,Cu,Tu,Pu=[];function Lu(t,e){wu&&!xu&&(xu=wu),uu.data.push({char:t,width:e}),pu+=e}function Iu(){gu+=pu,uu.width=pu,_u.words.push(uu),uu={data:[]},pu=0}function Eu(){Su&&(Ru.paraNumber++,_u.paraStart=!0,Su=!1),wu&&(_u.startCharSize=xu,_u.endCharSize=wu,xu=0),_u.width=gu,Cu.width?ou(_u):Tu&&Ou(),Pu.push(_u),_u={words:[]},gu=0}function Ou(){gu>(Ru.maxWidth||0)&&(Ru.maxWidth=gu)}const{top:Au,right:Mu,bottom:Wu,left:Du}=t.Direction4;function Fu(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 zu={getDrawData:function(t,e){r(t)||(t=String(t));let s=0,i=0,o=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(s=a[Du],o-=a[Mu]+a[Du],!o&&(o=.01)):e.autoSizeAlign||(s=a[Du]),n?(i=a[Au],n-=a[Au]+a[Wu],!n&&(n=.01)):e.autoSizeAlign||(i=a[Au]));const h={bounds:{x:s,y:i,width:o,height:n},rows:[],paraNumber:0,font:f.canvas.font=e.__font};return function(t,e,s){Ru=t,Pu=t.rows,Cu=t.bounds,Tu=!Cu.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=f,{width:a}=Cu;if(s.__isCharMode){const t="none"!==s.textWrap,h="break"===s.textWrap;Su=!0,bu=null,xu=mu=wu=pu=gu=0,uu={data:[]},_u={words:[]},i&&(e=[...e]);for(let s=0,l=e.length;s<l;s++)yu=e[s],"\n"===yu?(pu&&Iu(),_u.paraEnd=!0,Eu(),Su=!0):(vu=su(yu),vu===nu&&"none"!==o&&(yu=ru(yu,o,!pu)),mu=n.measureText(yu).width,i&&(i<0&&(wu=mu),mu+=i),Bu=vu===au&&(bu===au||bu===nu)||bu===au&&vu!==lu,ku=!(vu!==hu&&vu!==au||bu!==du&&bu!==lu),fu=Su&&r?a-r:a,t&&a&&gu+pu+mu>fu&&(h?(pu&&Iu(),gu&&Eu()):(ku||(ku=vu===nu&&bu==lu),Bu||ku||vu===cu||vu===hu||vu===au||pu+mu>fu?(pu&&Iu(),gu&&Eu()):gu&&Eu()))," "===yu&&!0!==Su&&gu+pu===0||(vu===cu?(" "===yu&&pu&&Iu(),Lu(yu,mu),Iu()):Bu||ku?(pu&&Iu(),Lu(yu,mu)):Lu(yu,mu)),bu=vu);pu&&Iu(),gu&&Eu(),Pu.length>0&&(Pu[Pu.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Ru.paraNumber++,gu=n.measureText(t).width,Pu.push({x:r||0,text:t,width:gu,paraStart:!0}),Tu&&Ou()})}(h,t,e),a&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":Fu(e,"x",t[Du]);break;case"right":Fu(e,"x",-t[Mu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":Fu(e,"y",t[Au]);break;case"bottom":Fu(e,"y",-t[Wu])}}(a,h,e,o,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(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,o),h.overflow&&function(t,e,s,i){if(!i)return;const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(r.splice(o),n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?f.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,o),"none"!==e.textDecoration&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,l(o)?(s=o.type,o.color&&(t.decorationColor=Wh.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 Uu={string:function(t,e){if(!t)return"#000";const i=n(e)&&e<1;if(r(t)){if(!i||!Wh.object)return t;t=Wh.object(t)}let o=s(t.a)?1:t.a;i&&(o*=e);const a=t.r+","+t.g+","+t.b;return 1===o?"rgb("+a+")":"rgba("+a+","+o+")"}};return Object.assign(Mh,zu),Object.assign(Wh,Uu),Object.assign(zh,bd),Object.assign(Uh,ec),Object.assign(Nh,wc),Object.assign(Yh,Ac),fh(),t.AlignHelper=kt,t.AroundHelper=vt,t.AutoBounds=jt,t.BezierHelper=is,t.Bounds=Gt,t.BoundsEvent=Mn,t.BoundsHelper=Nt,t.BoxData=sl,t.BranchHelper=pn,t.BranchRender=Pa,t.CanvasData=gl,t.CanvasManager=ce,t.ChildEvent=Ln,t.ColorConvert=Wh,t.Creator=re,t.DataHelper=c,t.Debug=Jt,t.Effect=Yh,t.EllipseData=al,t.EllipseHelper=us,t.Event=Pn,t.EventCreator=le,t.Eventer=Zn,t.Export=Hh,t.FileHelper=Yr,t.Filter=Xh,t.FourNumberHelper=S,t.FrameData=rl,t.GroupData=el,t.ImageData=pl,t.ImageEvent=An,t.ImageManager=Jr,t.IncrementId=m,t.LayoutEvent=Xn,t.Layouter=Ph,t.LeafBounds=Ra,t.LeafBoundsHelper=dn,t.LeafData=_,t.LeafDataProxy=ca,t.LeafEventer=la,t.LeafHelper=en,t.LeafLayout=Tn,t.LeafLevelList=ch,t.LeafList=dh,t.LeafMatrix=ma,t.LeafRender=Ca,t.LeaferCanvas=_h,t.LeaferCanvasBase=Ce,t.LeaferData=il,t.LeaferEvent=Gn,t.LeaferImage=to,t.LineData=ol,t.MathHelper=M,t.Matrix=pt,t.MatrixHelper=J,t.MyImage=td,t.NeedConvertToCanvasCommandMap=Ee,t.OneRadian=D,t.PI2=F,t.PI_2=z,t.Paint=zh,t.PaintGradient=Nh,t.PaintImage=Uh,t.PathArrow=Fh,t.PathBounds=Lr,t.PathCommandDataHelper=wi,t.PathCommandMap=Le,t.PathCommandNodeHelper=_s,t.PathConvert=$s,t.PathCorner=Dr,t.PathCreator=Di,t.PathData=dl,t.PathDrawer=Zi,t.PathHelper=Te,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=cl,t.Platform=f,t.Plugin=ie,t.Point=ut,t.PointHelper=at,t.PolygonData=hl,t.PropertyEvent=En,t.RectData=nl,t.RectHelper=De,t.RectRender=bl,t.RenderEvent=Hn,t.Renderer=Ih,t.ResizeEvent=Nn,t.Resource=qr,t.Run=te,t.StarData=ll,t.State=Gh,t.StringNumberMap=qt,t.TaskItem=Gr,t.TaskProcessor=Vr,t.TextConvert=Mh,t.TextData=_l,t.Transition=Vh,t.TwoPointBoundsHelper=ft,t.UIBounds=ml,t.UICreator=ne,t.UIData=Kh,t.UIRender=wl,t.UnitConvert=Dh,t.WaitHelper=mn,t.WatchEvent=Yn,t.Watcher=mh,t.affectRenderBoundsType=bo,t.affectStrokeBoundsType=xo,t.attr=oo,t.autoLayoutType=co,t.boundsType=po,t.canvasPatch=Nr,t.canvasSizeAttrs=Re,t.createAttr=function(t){return(e,s)=>{eo(e,s,io(s,t))}},t.createDescriptor=io,t.cursorType=Oo,t.dataProcessor=Ao,t.dataType=ao,t.decorateLeafAttr=ro,t.defineDataProcessor=Mo,t.defineKey=eo,t.defineLeafAttr=no,t.dimType=ko,t.doBoundsType=fo,t.doStrokeType=wo,t.effectType=Eh,t.emptyData={},t.eraserType=Io,t.extraPropertyEventMap=On,t.getBoundsData=N,t.getDescriptor=so,t.getMatrixData=Y,t.getPointData=U,t.hitType=Eo,t.isArray=h,t.isData=function(t){return l(t)&&!h(t)},t.isEmptyData=d,t.isFinite=o,t.isNull=i,t.isNumber=n,t.isObject=l,t.isString=r,t.isUndefined=s,t.layoutProcessor=function(t){return(e,s)=>{eo(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Jn,t.maskType=Lo,t.naturalBoundsType=go,t.opacityType=So,t.path=Fr,t.pathInputType=yo,t.pathType=mo,t.pen=zr,t.positionType=ho,t.registerUI=Xo,t.registerUIEvent=function(){return t=>{le.register(t)}},t.resizeType=Oh,t.rewrite=zo,t.rewriteAble=Uo,t.rotationType=_o,t.scaleType=uo,t.scrollType=lo,t.sortType=Po,t.strokeType=vo,t.surfaceType=Bo,t.tempBounds=Vt,t.tempMatrix=gt,t.tempPoint=_t,t.tryToNumber=function(t){return"string"==typeof t&&a.test(t)?+t:t},t.useCanvas=fh,t.useModule=Yo,t.version="1.11.1",t.visibleType=Ro,t.zoomLayerType=Ah,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=web.min.js.map
|