@leafer-game/worker 2.0.1 → 2.0.2

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.
@@ -1,2 +1,2 @@
1
- var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,o;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return g(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&g(t[r]={},e[r],i[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 i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!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(d(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 n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:o}}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 y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let v,w,x;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>B(S,t,e,i,s),toTempAB(t,e,i){x=i?a(t)?e:t:[],a(t)?(v=R(t),w=e):a(e)?(v=t,w=R(e)):(v=t,w=e),4!==v.length&&(v=P(v)),4!==w.length&&(w=P(w))},get(t,e){let i;if(!a(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,i)=>a(t)&&a(e)?b(t,e):(E(t,e,i),B(x,b(v[0],w[0]),b(v[1],w[1]),b(v[2],w[2]),b(v[3],w[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(E(t,e,i),B(x,v[0]+w[0],v[1]+w[1],v[2]+w[2],v[3]+w[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,o,h,l]=4===t.length?t:P(t);return B(r,h*i,l*e,n*i,o*e)}},{set:B,get:P,setTemp:R,toTempAB:E}=k,{round:C,pow:T,max:L,floor:A,PI:O}=Math,D={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),D.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:T(10,e);return-0===(t=C(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,r=(a(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&D.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const M=O/180,I=2*O,W=O/2;function N(){return{x:0,y:0}}function z(){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:U,sqrt:j}=Math,{float:q}=D,V={};function G(){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 K={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:G(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,o=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=o},get:Y,getWorld:G,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,V),Q.scaleOfInner(t,V,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=H(e*=M),a=X(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,V),Q.rotateOfInner(t,V,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=M,t.a=s+n*i,t.b=r+o*i),e&&(e*=M,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,V),Q.skewOfInner(t,V,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:o,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+o,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,r,n){const{e:o,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:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:o}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*r-o*s)*a,t.f=-(o*e-n*i)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*M,o=H(n),a=X(n);if(s||r){const e=s*M,i=r*M;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||r)&&Q.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!s){d=j(r*r+n*n),c=t/d;const e=r/d;u=n>0?U(e):-U(e)}else{c=j(o*o+a*a),d=t/c;const e=o/c;u=W-(a>0?U(-e):-U(e))}const e=q(H(u)),i=X(u);d=q(d),c=q(c),_=e?q((o/c+i)/e/M,9):0,p=e?q((n/d-i)/e/M,9):0,u=q(u/M)}else d=r,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:o}=t;r||n?i=(s*o-r*n)/(e=j(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=K,{float:J}=D,{toInnerPoint:Z,toOuterPoint:$}=K,{sin:tt,cos:et,abs:it,sqrt:st,atan2:rt,min:nt,round:ot}=Math,at={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},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,i){t.x=e,t.y=i},round(t,e){t.x=e?ot(t.x-.5)+.5:ot(t.x),t.y=e?ot(t.y-.5)+.5:ot(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ht.defaultPoint);const s=et(e*=M),r=tt(e),n=t.x-i.x,o=t.y-i.y;t.x=i.x+n*s-o*r,t.y=i.y+n*r+o*s},tempToInnerOf(t,e){const{tempPoint:i}=ht;return dt(i,t),Z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ht;return dt(i,t),$(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ht;return dt(i,t),ht.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(dt(t,e),ct(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),Z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){Z(e,t,i)},toOuterOf(t,e,i){$(e,t,i)},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,i,s){const r=it(i-t),n=it(s-e);return st(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>nt(lt(t,e,i,s),lt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/M,getRotation:(t,e,i,s)=>(s||(s=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/M),getRadianFrom(t,e,i,r,n,o,a,h){s(a)&&(a=i,h=r);const l=t-i,d=e-r,c=n-a,u=o-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,i,s,r){const n=ut(t,e);return r&&(t=e),s||(e={}),e.x=t.x+et(n)*i,e.y=t.y+tt(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){ht.reset(t)}},ht=at,{getDistanceFrom:lt,copy:dt,setRadius:ct,getAtan2:ut}=ht;class _t{constructor(t,e){this.set(t,e)}set(t,e){return c(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 _t(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,i){return at.scaleOf(this,t,e,i),this}rotate(t,e){return at.rotate(this,t,e),this}rotateOf(t,e){return at.rotate(this,e,t),this}getRotation(t,e,i){return at.getRotation(this,t,e,i)}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}getCenter(t){return new _t(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(at.getDistancePoint(this,t,e,i,s))}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 pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?K.copy(this,t):K.set(this,t,e,i,s,r,n),this}setWith(t){return K.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return K.translate(this,t,e),this}translateInner(t,e){return K.translateInner(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleWith(t,e){return K.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return K.pixelScale(this,t),this}scaleOfOuter(t,e,i){return K.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return K.scaleOfInner(this,t,e,i),this}rotate(t){return K.rotate(this,t),this}rotateOfOuter(t,e){return K.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return K.rotateOfInner(this,t,e),this}skew(t,e){return K.skew(this,t,e),this}skewOfOuter(t,e,i){return K.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return K.skewOfInner(this,t,e,i),this}multiply(t){return K.multiply(this,t),this}multiplyParent(t){return K.multiplyParent(this,t),this}divide(t){return K.divide(this,t),this}divideParent(t){return K.divideParent(this,t),this}invert(){return K.invert(this),this}invertWith(){return K.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){K.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){K.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return K.setLayout(this,t,e,i),this}getLayout(t,e,i){return K.getLayout(this,t,e,i)}withScale(t,e){return K.withScale(this,t,e)}reset(){K.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){mt(t,e,i),mt(t,e+s,i+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:mt}=yt;var vt,wt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(vt||(vt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(wt||(wt={}));const xt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];xt.forEach(t=>t.type="percent");const bt={directionData:xt,tempPoint:{},get:St,toPoint(t,e,i,s,r,n){const o=St(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),o.x&&(i.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(i.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function St(t){return n(t)?xt[wt[t]]:t}const{toPoint:kt}=bt,Bt={toPoint(t,e,i,s,r,n){kt(t,i,s,r,e,n)}},{tempPointBounds:Pt,setPoint:Rt,addPoint:Et,toBounds:Ct}=yt,{toOuterPoint:Tt}=K,{float:Lt,fourNumber:At}=D,{floor:Ot,ceil:Dt}=Math;let Ft,Mt,It,Wt;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,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,i,s,r){const{x:n,y:o,width:a,height:h}=e;if(d(i)){const e=At(i);s?Ht.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,n-i,o-i,a+2*i,h+2*i);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||at.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){at.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:o}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=o+t.y*r):(i.height=t.height*-r,i.y=o+t.y*r-i.height)}else Nt.x=t.x,Nt.y=t.y,Tt(e,Nt,zt),Rt(Pt,zt.x,zt.y),Nt.x=t.x+t.width,Tt(e,Nt,zt),Et(Pt,zt.x,zt.y),Nt.y=t.y+t.height,Tt(e,Nt,zt),Et(Pt,zt.x,zt.y),Nt.x=t.x,Tt(e,Nt,zt),Et(Pt,zt.x,zt.y),Ct(Pt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,o){o||(o=e),n(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=r?e.width*=s:e.width*s,Yt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,Yt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ot(t.x),t.y=Ot(t.y),t.width=e>t.x?Dt(t.width+e-t.x):Dt(t.width),t.height=i>t.y?Dt(t.height+i-t.y):Dt(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,i){Ft=t.x+t.width,Mt=t.y+t.height,It=e.x,Wt=e.y,i||(It+=e.width,Wt+=e.height),Ft=Ft>It?Ft:It,Mt=Mt>Wt?Mt:Wt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Mt-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=i?i(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||jt(t,r)):Ut(t,r));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Pt,t.x,t.y):Et(Pt,t.x,t.y)),Ct(Pt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Ut(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=at.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=at.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),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,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:o}=e;return Ft=s+n,Mt=r+o,It=t.x+t.width,Wt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Ft=Ft<It?Ft:It,Mt=Mt<Wt?Mt:Wt,n=Ft-s,o=Mt-r,{x:s,y:r,width:n,height:o}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:Ut,copy:jt}=Ht;class qt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new qt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Vt=new qt;class Gt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=t;this.set(e,i,s,r,n,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=this;return new qt(r,e,n||t.width-r-i,o||t.height-e-s)}}const Kt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},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},{floor:Jt,max:Zt}=Math,$t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||te.maxCacheSize),isSuperLarge:(t,e,i)=>te.isLarge(t,e,i,te.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=te;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,o,a,h,l){const d=Zt(Jt(e+(s||0)),1),c=Zt(Jt(i+(r||0)),1);let u,_,p;l&&(p=Kt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=$t.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,te.canUse(t)){if(n){const s=e/n.width,r=i/n.height;f.setTransform(s,0,0,r,-n.x*s,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:te}=$t,{randColor:ee}=D;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=se(t)}static set exclude(t){this.excludeList=se(t)}static drawRepaint(t,e){const i=ee();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ie.showBounds,r=t.__nowWorld,n=ee();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.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 se(t){return t?n(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const re=ie,ne=ie.get("RunTime"),oe={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=y.create(y.RUNTIME);return ae.currentId=ae.idMap[i]=e?performance.now():Date.now(),ae.currentName=ae.nameMap[i]=t,ae.nameToIdMap[t]=i,i},end(t,e){const i=ae.idMap[t],s=ae.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ae.idMap[t]=ae.nameMap[t]=ae.nameToIdMap[s]=void 0,ne.log(s,r,"ms")},endOfName(t,e){const i=ae.nameToIdMap[t];s(i)||ae.end(i,e)}},ae=oe,he=[],le={list:{},add(t,...e){this.list[t]=!0,he.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>he.forEach(t=>le.has(t,!0)));const de={editor:t=>le.need("editor")},ce=ie.get("UICreator"),ue={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ce.repeat(e),_e[e]=t},get(t,e,i,r,n,o){_e[t]||ce.error("not register "+t);const a=new _e[t](e);return s(i)||(a.x=i,r&&(a.y=r),n&&(a.width=n),o&&(a.height=o)),a}},{list:_e}=ue,pe=ie.get("EventCreator"),ge={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(fe[e]&&pe.repeat(e),fe[e]=t)})},changeName(t,e){const i=fe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,fe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new fe[t](...e)},{nameList:fe}=ge;class ye{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=de.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 me(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function ve(t,e,i,s){return new(i||(i=Promise))(function(r,n){function o(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}function we(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const xe=[];function be(){return(t,e)=>{xe.push(e)}}const Se=[];let ke=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};me([we("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),me([we("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),me([we("globalAlpha")],ke.prototype,"opacity",void 0),me([we()],ke.prototype,"fillStyle",void 0),me([we()],ke.prototype,"strokeStyle",void 0),me([we("lineWidth")],ke.prototype,"strokeWidth",void 0),me([we("lineCap")],ke.prototype,"strokeCap",void 0),me([we("lineJoin")],ke.prototype,"strokeJoin",void 0),me([we("lineDashOffset")],ke.prototype,"dashOffset",void 0),me([we()],ke.prototype,"miterLimit",void 0),me([we()],ke.prototype,"shadowBlur",void 0),me([we()],ke.prototype,"shadowColor",void 0),me([we()],ke.prototype,"shadowOffsetX",void 0),me([we()],ke.prototype,"shadowOffsetY",void 0),me([we()],ke.prototype,"filter",void 0),me([we()],ke.prototype,"font",void 0),me([we()],ke.prototype,"fontKerning",void 0),me([we()],ke.prototype,"fontStretch",void 0),me([we()],ke.prototype,"fontVariantCaps",void 0),me([we()],ke.prototype,"textAlign",void 0),me([we()],ke.prototype,"textBaseline",void 0),me([we()],ke.prototype,"textRendering",void 0),me([we()],ke.prototype,"wordSpacing",void 0),me([we()],ke.prototype,"letterSpacing",void 0),me([we()],ke.prototype,"direction",void 0),me([be()],ke.prototype,"setTransform",null),me([be()],ke.prototype,"resetTransform",null),me([be()],ke.prototype,"getTransform",null),me([be()],ke.prototype,"save",null),me([be()],ke.prototype,"restore",null),me([be()],ke.prototype,"translate",null),me([be()],ke.prototype,"scale",null),me([be()],ke.prototype,"rotate",null),me([be()],ke.prototype,"fill",null),me([be()],ke.prototype,"stroke",null),me([be()],ke.prototype,"clip",null),me([be()],ke.prototype,"fillRect",null),me([be()],ke.prototype,"strokeRect",null),me([be()],ke.prototype,"clearRect",null),me([be()],ke.prototype,"beginPath",null),me([be()],ke.prototype,"moveTo",null),me([be()],ke.prototype,"lineTo",null),me([be()],ke.prototype,"bezierCurveTo",null),me([be()],ke.prototype,"quadraticCurveTo",null),me([be()],ke.prototype,"closePath",null),me([be()],ke.prototype,"arc",null),me([be()],ke.prototype,"arcTo",null),me([be()],ke.prototype,"ellipse",null),me([be()],ke.prototype,"rect",null),me([be()],ke.prototype,"roundRect",null),me([be()],ke.prototype,"createConicGradient",null),me([be()],ke.prototype,"createLinearGradient",null),me([be()],ke.prototype,"createPattern",null),me([be()],ke.prototype,"createRadialGradient",null),me([be()],ke.prototype,"fillText",null),me([be()],ke.prototype,"measureText",null),me([be()],ke.prototype,"strokeText",null);const{copy:Be,multiplyParent:Pe,pixelScale:Re}=K,{round:Ee}=Math,Ce=new qt,Te=new qt,Le={width:1,height:1,pixelRatio:1},Ae=["width","height","pixelRatio"];class Oe extends ke{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=Le),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||$t.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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;p.copyAttrs(s,t,Ae),Ae.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&Pe(t,e,r),Re(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(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,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Te):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Ce.x,Ce.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):de.canvas(Object.assign({},i));return r.save(),t&&(Be(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),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 De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=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},Fe),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},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ne=Object.assign(Object.assign({},We),Fe),ze=Me,Ye={};for(let t in ze)Ye[ze[t]]=t;const Xe={};for(let t in ze)Xe[ze[t]]=Ie[t];const He={drawRoundRect(t,e,i,s,r,n){const o=D.fourNumber(n,Math.min(s/2,r/2)),a=e+s,h=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ue,cos:je,hypot:qe,atan2:Ve,ceil:Ge,abs:Ke,PI:Qe,sqrt:Je,pow:Ze}=Math,{setPoint:$e,addPoint:ti}=yt,{set:ei,toNumberPoints:ii}=at,{M:si,L:ri,C:ni,Q:oi,Z:ai}=Me,hi={},li={points(t,e,i,s){let r=ii(e);if(t.push(si,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y,m,v=r.length;const w=!0===i?.5:i;s&&(r=[r[v-2],r[v-1],...r,r[0],r[1],r[2],r[3]],v=r.length);for(let i=2;i<v-2;i+=2)e=r[i-2],n=r[i-1],o=r[i],a=r[i+1],h=r[i+2],l=r[i+3],p=o-e,g=a-n,f=Je(Ze(p,2)+Ze(g,2)),y=Je(Ze(h-o,2)+Ze(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=n,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(p||g)&&t.push(ni,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(oi,u,_,r[v-2],r[v-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ri,r[e],r[e+1]);s&&t.push(ai)},rect(t,e,i,s,r){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){De.creator.path=[],He.drawRoundRect(De.creator,e,i,s,r,n),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,l,d){const c=s-e,u=r-i,_=n-s,p=o-r;let g=Ve(u,c),f=Ve(p,_);const y=qe(c,u),m=qe(_,p);let v=f-g;if(v<0&&(v+=I),y<1e-12||m<1e-12||v<1e-12||Ke(v-Qe)<1e-12)return t&&t.push(ri,s,r),h&&($e(h,e,i),ti(h,s,r)),d&&ei(d,e,i),void(l&&ei(l,s,r));const w=c*p-_*u<0,x=w?-1:1,b=a/je(v/2),S=s+b*je(g+v/2+W*x),k=r+b*Ue(g+v/2+W*x);return g-=W*x,f-=W*x,ui(t,S,k,a,a,0,g/M,f/M,w,h,l,d)},arc:(t,e,i,s,r,n,o,a,h,l)=>ui(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,l,d,c){const u=n*M,_=Ue(u),p=je(u);let g=o*M,f=a*M;g>Qe&&(g-=I),f<0&&(f+=I);let y=f-g;y<0?y+=I:y>I&&(y-=I),h&&(y-=I);const m=Ge(Ke(y/W)),v=y/m,w=Ue(v/4),x=8/3*w*w/Ue(v/2);f=g+v;let b,S,k,B,P,R,E,C,T=je(g),L=Ue(g),A=k=p*s*T-_*r*L,O=B=_*s*T+p*r*L,D=e+k,F=i+B;t&&t.push(t.length?ri:si,D,F),l&&$e(l,D,F),c&&ei(c,D,F);for(let n=0;n<m;n++)b=je(f),S=Ue(f),k=p*s*b-_*r*S,B=_*s*b+p*r*S,P=e+A-x*(p*s*L+_*r*T),R=i+O-x*(_*s*L-p*r*T),E=e+k+x*(p*s*S+_*r*b),C=i+B+x*(_*s*S-p*r*b),t&&t.push(ni,P,R,E,C,e+k,i+B),l&&ci(e+A,i+O,P,R,E,C,e+k,i+B,l,!0),A=k,O=B,T=b,L=S,g=f,f+=v;d&&ei(d,e+k,i+B)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(ni,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,o,a)},toTwoPointBounds(t,e,i,s,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,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?ti(h,t,e):$e(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,r,n,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*r+_*o+p*h},getPoint(t,e,i,s,r,n,o,a,h){const l={};return di(t,e,i,s,r,n,o,a,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:_i,cos:pi,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*M,p=_i(_),g=pi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,v=r*r,w=y*y,x=f*f,b=m*v-m*w-v*x;let S=0;if(b<0){const t=gi(1-b/(m*v));s*=t,r*=t}else S=(o===a?-1:1)*gi(b/(m*w+v*x));const k=S*s*y/r,B=-S*r*f/s,P=fi((y-B)/r,(f-k)/s),R=fi((-y-B)/r,(-f-k)/s);let E=R-P;0===a&&E>0?E-=I:1===a&&E<0&&(E+=I);const C=e+c+g*k-p*B,T=i+u+p*k+g*B,L=E<0?1:0;d||$t.ellipseToCurve?yi(t,C,T,s,r,n,P/M,R/M,L):s!==r||n?t.push(Me.G,C,T,s,r,n,P/M,R/M,L):t.push(Me.O,C,T,s,P/M,R/M,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:xi,L:bi,l:Si,H:ki,h:Bi,V:Pi,v:Ri,C:Ei,c:Ci,S:Ti,s:Li,Q:Ai,q:Oi,T:Di,t:Fi,A:Mi,a:Ii,Z:Wi,z:Ni,N:zi,D:Yi,X:Xi,G:Hi,F:Ui,O:ji,P:qi,U:Vi}=Me,{rect:Gi,roundRect:Ki,arcTo:Qi,arc:Ji,ellipse:Zi,quadraticCurveTo:$i}=li,{ellipticalArc:ts}=mi,es=ie.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,a="";for(;n<o;){s=t[n],i=Xe[s],a+=s===r?" ":Ye[s];for(let s=1;s<i;s++)a+=D.float(t[n+s],e),s===i-1||(a+=" ");r=s,n+=i}return a},parse(t,e){let i,s,r,n="";const o=[],a=e?Ne:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(rs.dot&&(ns(o,n),n=""),rs.dot++),"0"===n&&"."!==s&&(ns(o,n),n=""),n+=s):Me[s]?(n&&(ns(o,n),n=""),rs.name=Me[s],rs.length=Ie[s],rs.index=0,ns(o,rs.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ns(o,n),n=s):n&&(ns(o,n),n=""),r=s;return n&&ns(o,n),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case xi:t[c+1]+=a,t[c+2]+=h;case wi:a=t[c+1],h=t[c+2],_.push(wi,a,h),c+=3;break;case Bi:t[c+1]+=a;case ki:a=t[c+1],_.push(bi,a,h),c+=2;break;case Ri:t[c+1]+=h;case Pi:h=t[c+1],_.push(bi,a,h),c+=2;break;case Si:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],_.push(bi,a,h),c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ti;case Ti:o=n===Ei||n===Ti,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ei,l,d,i,s,a,h),c+=5;break;case Ci: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=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Fi:t[c+1]+=a,t[c+2]+=h,r=Di;case Di:o=n===Ai||n===Di,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?$i(_,a,h,i,s,t[c+1],t[c+2]):_.push(Ai,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ai;case Ai:i=t[c+1],s=t[c+2],e?$i(_,a,h,i,s,t[c+3],t[c+4]):_.push(Ai,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=a,t[c+7]+=h;case Mi:ts(_,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 Ni:case Wi:_.push(Wi),c++;break;case zi:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4]):os(_,t,c,5),c+=5;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):os(_,t,c,9),c+=9;break;case Xi:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],t[c+5]):os(_,t,c,6),c+=6;break;case Hi:Zi(e?_:os(_,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,is),a=is.x,h=is.y,c+=9;break;case Ui:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):os(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ji:Ji(e?_:os(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),a=is.x,h=is.y,c+=7;break;case qi:e?Ji(_,t[c+1],t[c+2],t[c+3],0,360,!1):os(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Qi(e?_:os(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ai,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:ns,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:_s,X:ps,G:gs,F:fs,O:ys,P:ms,U:vs}=Me,{getMinDistanceFrom:ws,getRadianFrom:xs}=at,{tan:bs,min:Ss,abs:ks}=Math,Bs={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(ls,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(ds,e,i,s,r)},closePath(t){t.push(cs)},rect(t,e,i,s,r){t.push(us,e,i,s,r)},roundRect(t,e,i,s,r,n){if(a(n))t.push(ps,e,i,s,r,n);else{const o=D.fourNumber(n);o?t.push(_s,e,i,s,r,...o):t.push(us,e,i,s,r)}},ellipse(t,e,i,s,n,o,a,h,l){if(s===n)return Es(t,e,i,s,a,h,l);r(o)?t.push(fs,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(gs,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(ms,e,i,s):(r(n)&&(n=0),r(o)&&(o=360),t.push(ys,e,i,s,n,o,a?1:0))},arcTo(t,e,i,r,n,o,a,h,l){if(!s(a)){const t=ws(a,h,e,i,r,n)/(l?1:2);o=Ss(o,Ss(t,t*ks(bs(xs(a,h,e,i,r,n)/2))))}t.push(vs,e,i,r,n,o)},drawEllipse(t,e,i,s,n,o,a,h,l){li.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Bs),t.push(as,Bs.x,Bs.y),Rs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){li.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Bs),t.push(as,Bs.x,Bs.y),Es(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Rs,arc:Es}=Ps,{moveTo:Cs,lineTo:Ts,quadraticCurveTo:Ls,bezierCurveTo:As,closePath:Os,beginPath:Ds,rect:Fs,roundRect:Ms,ellipse:Is,arc:Ws,arcTo:Ns,drawEllipse:zs,drawArc:Ys,drawPoints:Xs}=Ps;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Cs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return As(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return Os(this.__path),this.paint(),this}rect(t,e,i,s){return Fs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Ms(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return Is(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return Ws(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ns(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return zs(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return Ys(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:js,C:qs,Q:Vs,Z:Gs,N:Ks,D:Qs,X:Js,G:Zs,F:$s,O:tr,P:er,U:ir}=Me,sr=ie.get("PathDrawer"),rr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case js:t.lineTo(e[s+1],e[s+2]),s+=3;break;case qs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*M,e[s+6]*M,e[s+7]*M,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,I,!1),s+=5;break;case tr:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*M,e[s+5]*M,e[s+6]),s+=7;break;case er:t.arc(e[s+1],e[s+2],e[s+3],0,I,!1),s+=4;break;case ir:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sr.error(`command: ${i} [index:${s}]`,e)}}},{M:nr,L:or,C:ar,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:gr,P:fr,U:yr}=Me,{toTwoPointBounds:mr,toTwoPointBoundsByQuadraticCurve:vr,arcTo:wr,arc:xr,ellipse:br}=li,{addPointBounds:Sr,copy:kr,addPoint:Br,setPoint:Pr,addBounds:Rr,toBounds:Er}=yt,Cr=ie.get("PathBounds");let Tr,Lr,Ar;const Or={},Dr={},Fr={},Mr={toBounds(t,e){Mr.toTwoPointBounds(t,Dr),Er(Dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Pr(e,0,0);let i,s,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===lr||o===ar||o===hr?Pr(e,h,l):Pr(e,t[a+1],t[a+2])),o){case nr:case or:h=t[a+1],l=t[a+2],Br(e,h,l),a+=3;break;case ar:r=t[a+5],n=t[a+6],mr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Or),Sr(e,Or),h=r,l=n,a+=7;break;case hr:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],vr(h,l,i,s,r,n,Or),Sr(e,Or),h=r,l=n,a+=5;break;case lr:a+=1;break;case dr:h=t[a+1],l=t[a+2],Rr(e,h,l,t[a+3],t[a+4]),a+=5;break;case cr:case ur:h=t[a+1],l=t[a+2],Rr(e,h,l,t[a+3],t[a+4]),a+=o===cr?9:6;break;case _r:br(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],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=9;break;case pr:h=t[a+1],l=t[a+2],Lr=t[a+3],Ar=t[a+4],Rr(e,h-Lr,l-Ar,2*Lr,2*Ar),h+=Lr,a+=5;break;case gr:xr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=7;break;case fr:h=t[a+1],l=t[a+2],Tr=t[a+3],Rr(e,h-Tr,l-Tr,2*Tr,2*Tr),h+=Tr,a+=4;break;case yr:wr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=6;break;default:return void Cr.error(`command: ${o} [index:${a}]`,t)}}},{M:Ir,L:Wr,Z:Nr}=Me,{getCenterX:zr,getCenterY:Yr}=at,{arcTo:Xr}=Ps,Hr={smooth(t,e,i){let s,r,n,o=0,a=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;o<f;){switch(s=t[o],s){case Ir:l=p=t[o+1],c=g=t[o+2],o+=3,t[o]===Wr?(u=t[o+1],_=t[o+2],y?m.push(Ir,l,c):m.push(Ir,zr(l,u),Yr(c,_))):m.push(Ir,l,c);break;case Wr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Wr:Xr(m,a,h,t[o+1],t[o+2],e,p,g,y);break;case Nr:Xr(m,a,h,l,c,e,p,g,y);break;default:m.push(Wr,a,h)}p=a,g=h;break;case Nr:r!==Nr&&(Xr(m,l,c,u,_,e,p,g,y),m.push(Nr)),o+=1;break;default:n=Xe[s];for(let e=0;e<n;e++)m.push(t[o+e]);o+=n}r=s}return s!==Nr&&(m[1]=l,m[2]=c),m}};function Ur(t){return new Hs(t)}const jr=Ur();De.creator=Ur(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:qr}=He;function Vr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){qr(this,t,e,i,s,r)})}(t)}const Gr={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=Kr.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{}}}},Kr=Gr;Kr.alphaPixelTypes.forEach(t=>Kr.upperCaseTypeMap[t]=t.toUpperCase());const Qr=ie.get("TaskProcessor");class Jr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return ve(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Qr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e,i){let r,n,o,h;const l=new Jr(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,r=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===n&&(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.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 $r=ie.get("Resource"),tn={tasker:new Zr,map:{},get isComplete(){return en.tasker.isComplete},set(t,e){en.map[t]&&$r.repeat(t),en.map[t]=e},get:t=>en.map[t],remove(t){const e=en.map[t];e&&(e.destroy&&e.destroy(),delete en.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=de.image(s)),en.set(t,e),e},destroy(){en.map={}}},en=tn,sn={maxRecycled:10,recycledList:[],patternTasker:new Zr({parallel:1}),get(t){let e=tn.get(t.url);return e||tn.set(t.url,e=de.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||($t.image.isLarge(t)?t.url&&tn.remove(t.url):(t.clearLevels(),rn.recycledList.push(t)))})},recyclePaint(t){rn.recycle(t.image)},clearRecycled(t){const e=rn.recycledList;(e.length>rn.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tn.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Gr.alphaPixelTypes.some(e=>rn.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Gr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Gr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},rn=sn,{IMAGE:nn,create:on}=y;class an{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?$t.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=on(nn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sn.isFormat("svg",t)&&(this.isSVG=!0),sn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tn.tasker.add(()=>ve(this,void 0,void 0,function*(){return yield $t.origin.loadImage(this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=$t.image.resize(this.view,t,e,r,n,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const r=$t.canvas.createPattern(t,e);return $t.image.setPatternTransform(r,i,s),r}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function hn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ln(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function cn(t,e){return(i,s)=>_n(i,s,t,e&&e(s))}function un(t){return t}function _n(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};hn(t,e,Object.assign(r,s||{})),Xn(t,e,i)}function pn(t){return cn(t)}function gn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function yn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),bn(this))}}))}function mn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function vn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function wn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&bn(this)}}))}function xn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(bn(this),this.__.__removeNaturalSize())}}))}function bn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Sn(t){return cn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),bn(this)}}))}const kn=wn;function Bn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i)&&(Pn(this),e&&(this.__.__useStroke=!0))}}))}function Pn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&bn(t)}const Rn=Bn;function En(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Cn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tn(t){return cn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Ln(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&On(this)}}))}function An(t){return cn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Dn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Dn(this,t,e,i),this.mask&&On(this)}}))}function On(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Dn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||bn(t))}function Fn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Mn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function In(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Wn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ie.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Nn(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function zn(t){return(e,i)=>{hn(e,"__DataProcessor",{get:()=>t})}}function Yn(t){return(e,i)=>{hn(e,"__LayoutProcessor",{get:()=>t})}}function Xn(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=dn(e,i);if(s(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];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[n];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 l,d=r;for(;!l&&d;)l=ln(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),r[o]&&(a.set=r[o],delete r[o]),hn(r,e,a)}const Hn=new ie("rewrite"),Un=[],jn=["destroy","constructor"];function qn(t){return(e,i)=>{Un.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Vn(){return t=>{Gn()}}function Gn(t){Un.length&&(Un.forEach(e=>{t&&Hn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Un.length=0)}function Kn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(jn.includes(s)||e&&e.includes(s)))if(t.prototype){ln(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Qn(){return t=>{ue.register(t)}}function Jn(){return t=>{ge.register(t)}}setTimeout(()=>Gn(!0));const{copy:Zn,toInnerPoint:$n,toOuterPoint:to,scaleOfOuter:eo,rotateOfOuter:io,skewOfOuter:so,multiplyParent:ro,divideParent:no,getLayout:oo}=K,ao={},{round:ho}=Math,lo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),_o(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)uo(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)po(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&po(t),t.__updateChange()},updateAllChange(t){if(fo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)go(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,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||$t.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?to(t.localTransform,n,n,!0):t.parent&&$n(t.parent.scrollWorldTransform,n,n,!0),co.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ho(e),i=ho(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){co.zoomOfLocal(t,yo(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const o=t.__localMatrix;if(a(s)||(s&&(n=s),s=i),Zn(ao,o),eo(ao,e,i,s),co.hasHighPosition(t))co.setTransform(t,ao,r,n);else{const e=t.x+ao.e-o.e,a=t.y+ao.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){co.rotateOfLocal(t,yo(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Zn(ao,r),io(ao,e,i),co.hasHighPosition(t)?co.setTransform(t,ao,!1,s):t.set({x:t.x+ao.e-r.e,y:t.y+ao.f-r.f,rotation:D.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){co.skewOfLocal(t,yo(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Zn(ao,t.__localMatrix),so(ao,e,i,s),co.setTransform(t,ao,r,n)},transformWorld(t,e,i,s){Zn(ao,t.worldTransform),ro(ao,e),t.parent&&no(ao,t.parent.scrollWorldTransform),co.setTransform(t,ao,i,s)},transform(t,e,i,s){Zn(ao,t.localTransform),ro(ao,e),co.setTransform(t,ao,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&co.getInnerOrigin(t,r.origin),o=oo(e,n,r.around&&co.getInnerOrigin(t,r.around));if(co.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=co.getInnerOrigin(t,r.origin);at.move(o,n.x-s.x,n.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return eo(i,co.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>at.tempToOuterOf(co.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zn(ao,t.worldTransform),no(ao,e.scrollWorldTransform),i?ao:Object.assign({},ao)),drop(t,e,i,s){t.setTransform(co.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||co.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,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),$t.requestRender(()=>co.animateMove(t,e,i))}}},co=lo,{updateAllMatrix:uo,updateMatrix:_o,updateAllWorldOpacity:po,updateAllChange:go,updateChange:fo}=co;function yo(t,e){return t.updateLayout(),t.parent?at.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const mo={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)=>wo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>wo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>wo(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 vo;function wo(t,e){return e||(vo=0),t.__.mask&&(vo=1),vo<0?null:(vo&&(vo=-1),!0)}const{updateBounds:xo}=lo,bo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),So(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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ko(e[t],e)},updateBounds(t,e){const i=[t];ko(t,i),Bo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)xo(s[t]);e&&e===i||xo(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,o=r.length;n<o;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Po(t,e,i)},scale(t,e,i,s,r,n,o){let a;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=r,(a.b||a.c)&&(a.b*=s,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-n)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-n)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-n)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=r,a.scaleX*=s,a.scaleY*=r,t.isBranch&&Ro(t,e,i,s,r,n,o)}},{pushAllChildBranch:So,pushAllBranchStack:ko,updateBoundsByBranchStack:Bo,move:Po,scale:Ro}=bo,Eo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Co,updateBounds:To}=lo,{toOuterOf:Lo,getPoints:Ao,copy:Oo}=Xt,Do="_localContentBounds",Fo="_worldContentBounds",Mo="_worldBoxBounds",Io="_worldStrokeBounds";class Wo{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 Lo(this.contentBounds,this.leaf.__localMatrix,this[Do]||(this[Do]={})),this[Do]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Lo(this.contentBounds,this.leaf.__world,this[Fo]||(this[Fo]={})),this[Fo]}get worldBoxBounds(){return Lo(this.boxBounds,this.leaf.__world,this[Mo]||(this[Mo]={})),this[Mo]}get worldStrokeBounds(){return Lo(this.strokeBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}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 To(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 i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,$t.layout(i),delete i.__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 K.defaultMatrix;case"page":t=e.zoomLayer;default:return Co(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,n=K.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),n=Co(s,e,!0)}if(o||(o=K.getLayout(n)),Oo(o,a),at.copy(o,r),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=Ao(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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 No{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&$t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&$t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&$t.event.stop(this.origin)}}class zo extends No{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}zo.ADD="child.add",zo.REMOVE="child.remove",zo.CREATED="created",zo.MOUNTED="mounted",zo.UNMOUNTED="unmounted",zo.DESTROY="destroy";const Yo="property.scroll";class Xo extends No{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Xo.CHANGE="property.change",Xo.LEAFER_CHANGE="property.leafer_change",Xo.SCROLL=Yo;const Ho={scrollX:Yo,scrollY:Yo};class Uo extends No{constructor(t,e){super(t),Object.assign(this,e)}}Uo.LOAD="image.load",Uo.LOADED="image.loaded",Uo.ERROR="image.error";class jo extends No{static checkHas(t,e,i){"on"===i?e===Ko?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(qo)||t.hasEvent(Vo)||t.hasEvent(Go),t.__hasWorldEvent=t.hasEvent(Ko))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(qo,t),"inner"===e&&t.emit(Vo,t)),t.emit(Go,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Ko,this)}}jo.RESIZE="bounds.resize",jo.INNER="bounds.inner",jo.LOCAL="bounds.local",jo.WORLD="bounds.world";const{RESIZE:qo,INNER:Vo,LOCAL:Go,WORLD:Ko}=jo,Qo={};[qo,Vo,Go,Ko].forEach(t=>Qo[t]=1);class Jo extends No{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Jo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Jo.RESIZE="resize";class Zo extends No{constructor(t,e){super(t),this.data=e}}Zo.REQUEST="watch.request",Zo.DATA="watch.data";class $o extends No{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}$o.REQUEST="layout.request",$o.START="layout.start",$o.BEFORE="layout.before",$o.LAYOUT="layout",$o.AFTER="layout.after",$o.AGAIN="layout.again",$o.END="layout.end";class ta extends No{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ta.REQUEST="render.request",ta.CHILD_START="render.child_start",ta.CHILD_END="render.child_end",ta.START="render.start",ta.BEFORE="render.before",ta.RENDER="render",ta.AFTER="render.after",ta.AGAIN="render.again",ta.END="render.end",ta.NEXT="render.next";class ea extends No{}ea.START="leafer.start",ea.BEFORE_READY="leafer.before_ready",ea.READY="leafer.ready",ea.AFTER_READY="leafer.after_ready",ea.VIEW_READY="leafer.view_ready",ea.VIEW_COMPLETED="leafer.view_completed",ea.STOP="leafer.stop",ea.RESTART="leafer.restart",ea.END="leafer.end",ea.UPDATE_MODE="leafer.update_mode",ea.TRANSFORM="leafer.transform",ea.MOVE="leafer.move",ea.SCALE="leafer.scale",ea.ROTATE="leafer.rotate",ea.SKEW="leafer.skew";const{MOVE:ia,SCALE:sa,ROTATE:ra,SKEW:na}=ea,oa={x:ia,y:ia,scaleX:sa,scaleY:sa,rotation:ra,skewX:na,skewY:na},aa={};class ha{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,o;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const a=la(this,s,!0),h=n(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):a[t]=[l],Qo[t]&&jo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=la(this,t);s.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],Qo[t]&&jo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ge.has(t)&&(e=ge.get(t,{type:t,target:this,current:this}));const s=la(this,i)[t];if(s){let r;for(let n=0,o=s.length;n<o&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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,n=i&&i[t],o=r&&r[t];return!!(s(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function la(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:aa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:aa)}}const{on:da,on_:ca,off:ua,off_:_a,once:pa,emit:ga,emitEvent:fa,hasEvent:ya,destroy:ma}=ha.prototype,va={on:da,on_:ca,off:ua,off_:_a,once:pa,emit:ga,emitEvent:fa,hasEvent:ya,destroyEventer:ma},wa=ie.get("setAttr"),xa={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||o(e)||s(e)||(wa.warn(this.innerName,t,e),e=void 0),c(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Xo(Xo.LEAFER_CHANGE,this,t,r,e));const i=oa[t];i&&(this.emitEvent(new ea(i,this)),this.emitEvent(new ea(ea.TRANSFORM,this)))}this.emitPropertyEvent(Xo.CHANGE,t,r,e);const i=Ho[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Xo(t,this,e,i,s);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:ba,multiplyParent:Sa,translateInner:ka,defaultWorld:Ba}=K,{toPoint:Pa,tempPoint:Ra}=bt,Ea={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;Sa(this.__local||e,t?t.__scrollWorld||t.__world:Ba,i,!!e.affectScaleOrRotation,r),s&&ka(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ba(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Pa(i.around||i.origin,t.boxBounds,Ra),ka(e,-Ra.x,-Ra.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ca,updateAllMatrix:Ta}=lo,{updateBounds:La}=bo,{toOuterOf:Aa,copyAndSpread:Oa,copy:Da}=Xt,{toBounds:Fa}=Mr,Ma={__updateWorldBounds(){const{__layout:t,__world:e}=this;Aa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&jo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&jo.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(),Aa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Aa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Aa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Fa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ta(this),La(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ta(this),La(this,this))):Ca(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Oa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Da(e.renderBounds,e.strokeBounds):Oa(e.renderBounds,e.boxBounds,i)}},Ia={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),lo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Wa}=mo,{hasSize:Na}=Xt,za={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Na(i)){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 r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Wa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Wa(i[s],e)||i[s].__clip(t,e)}}},Ya={},{LEAF:Xa,create:Ha}=y,{stintSet:Ua}=p,{toInnerPoint:ja,toOuterPoint:qa,multiplyParent:Va}=K,{toOuterOf:Ga}=Xt,{copy:Ka,move:Qa}=at,{moveLocal:Ja,zoomOfLocal:Za,rotateOfLocal:$a,skewOfLocal:th,moveWorld:eh,zoomOfWorld:ih,rotateOfWorld:sh,skewOfWorld:rh,transform:nh,transformWorld:oh,setTransform:ah,getFlipTransform:hh,getLocalOrigin:lh,getRelativeWorld:dh,drop:ch}=lo;let uh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Wo}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=Ha(Xa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(zo.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(zo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(zo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(zo.MOUNTED)):this.__emitLifeEvent(zo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Va(i,t.matrix,e,void 0,i),Ga(this.__layout.renderBounds,e,e),Ua(e,"half",i.half),Ua(e,"ignorePixelSnap",i.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:i,scaleY:s}=sn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ya.scaleX=i,Ya.scaleY=s,Ya}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?dh(this,e):this.worldTransform,r=i?t:{};return Ga(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ka(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ka(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),ja(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){qa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Qa(r,-n,-o),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Qa(r,n,o),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){ah(this,t,e,i)}transform(t,e,i){nh(this,t,e,i)}move(t,e,i){Ja(this,t,e,i)}moveInner(t,e,i){eh(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Za(this,lh(this,t),e,i,s,r)}rotateOf(t,e,i){$a(this,lh(this,t),e,i)}skewOf(t,e,i,s,r){th(this,lh(this,t),e,i,s,r)}transformWorld(t,e,i){oh(this,t,e,i)}moveWorld(t,e,i){eh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){ih(this,t,e,i,s,r)}rotateOfWorld(t,e){sh(this,t,e)}skewOfWorld(t,e,i,s,r){rh(this,t,e,i,s,r)}flip(t,e){nh(this,hh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return le.need("path")}getMotionPoint(t){return le.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,i){ch(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Xn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=wn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new zo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(zo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};uh=me([Kn(xa),Kn(Ea),Kn(Ma),Kn(va),Kn(Ia)],uh);const{setListWithFn:_h}=Xt,{sort:ph}=bo,{localBoxBounds:gh,localStrokeBounds:fh,localRenderBounds:yh,maskLocalBoxBounds:mh,maskLocalStrokeBounds:vh,maskLocalRenderBounds:wh}=mo,xh=new ie("Branch");let bh=class extends uh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){_h(e||this.__layout.boxBounds,this.children,this.__hasMask?mh:gh)}__updateStrokeBounds(t){_h(t||this.__layout.strokeBounds,this.children,this.__hasMask?vh:fh)}__updateRenderBounds(t){_h(t||this.__layout.renderBounds,this.children,this.__hasMask?wh:yh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(ph),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return xh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ue.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(zo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(zo.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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(zo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(zo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new zo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};bh=me([Kn(za)],bh);class Sh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(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,n=e.length;r<n;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 Sh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class kh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Bh="2.0.1";class Ph extends Oe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=$t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Vr(OffscreenCanvasRenderingContext2D.prototype),Vr(Path2D.prototype);const{mineType:Rh}=Gr;function Eh(t,e){$t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:Rh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Rh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",$t.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},$t.canvas=de.canvas(),$t.conicGradientSupport=!!$t.canvas.context.createConicGradient}Object.assign(de,{canvas:(t,e)=>new Ph(t,e),image:t=>new an(t)}),$t.name="web",$t.isWorker=!0,$t.backgrounder=!0,$t.requestRender=function(t){requestAnimationFrame(t)},hn($t,"devicePixelRatio",{get:()=>1});const{userAgent:Ch}=navigator;Ch.indexOf("Firefox")>-1?($t.conicGradientRotate90=!0,$t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&($t.fullImageShadow=!0),Ch.indexOf("Windows")>-1?($t.os="Windows",$t.intWheelDeltaY=!0):Ch.indexOf("Mac")>-1?$t.os="Mac":Ch.indexOf("Linux")>-1&&($t.os="Linux");class Th{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Sh;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 Sh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ta.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===zo.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Zo(Zo.DATA,{updatedList:this.updatedList})),this.__updatedList=new Sh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Xo.CHANGE,this.__onAttrChange,this],[[zo.ADD,zo.REMOVE],this.__onChildEvent,this],[Zo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Ah,updateChange:Oh}=lo,{pushAllChildBranch:Dh,pushAllParent:Fh}=bo;const{worldBounds:Mh}=mo;class Ih{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new Sh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Mh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Mh),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:Wh,updateAllChange:Nh}=lo,zh=ie.get("Layouter");class Yh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new kh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit($o.START),this.layoutOnce(),t.emitEvent(new $o($o.END,this.layoutedBlocks,this.times))}catch(t){zh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?zh.warn("layouting"):this.times>3?zh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Zo.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=oe.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=$o,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new $o(r,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Lh(t,!0),e.add(t),t.isBranch&&Dh(t,e),Fh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Fh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ah(s[t])}Ah(i)}})}(this.__levelList),function(t){t.list.forEach(Oh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new $o(n,a,this.times)),i.emitEvent(new $o(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,oe.end(e)}fullLayout(){const t=oe.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=$o,n=this.getBlocks(new Sh(e));e.emitEvent(new $o(i,n,this.times)),Yh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new $o(s,n,this.times)),e.emitEvent(new $o(r,n,this.times)),this.addBlocks(n),oe.end(t)}static fullLayout(t){Wh(t,!0),t.isBranch?bo.updateBounds(t):lo.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ih([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ih(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_([[$o.REQUEST,this.layout,this],[$o.AGAIN,this.layoutAgain,this],[Zo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Xh=ie.get("Renderer");class Hh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit($o.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ta.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ta.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ta.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Xh.log(e.innerName,"---\x3e");try{this.emitRender(ta.START),this.renderOnce(t),this.emitRender(ta.END,this.totalBounds),sn.clearRecycled()}catch(t){this.rendering=!1,Xh.error(t)}Xh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Xh.warn("rendering");if(this.times>3)return Xh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(ta.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ta.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ta.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ta.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=oe.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new qt(s);i.save(),s.spread(Hh.clipSpread).ceil();const{ceilPartPixel:n}=this.config;i.clipWorld(s,n),i.clearWorld(s,n),this.__render(s,r),i.restore(),oe.end(e)}fullRender(){const t=oe.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),oe.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),$t.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return $t.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};$t.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Xh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new ta(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ta.REQUEST,this.update,this],[$o.END,this.__onLayoutEnd,this],[ta.AGAIN,this.renderAgain,this],[Jo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Hh.clipSpread=10;const Uh={},{copyRadiusPoint:jh}=at,{hitRadiusPoint:qh}=Xt;class Vh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Sh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new Sh;if(t.length){let e;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||lo.worldHittable(e))&&(this.hitChild(e,o),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&lo.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>lo.worldHittable(t))}getPath(t){const e=new Sh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Sh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new Sh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,o=i.length;t<o;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],r=i.__,r.visible&&(!e||r.mask))if(s=qh(i.__world,r.hitRadius?jh(Uh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,o=n.length;s<o;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Gh{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new Vh(this.target=t,this),this.finder=de.finder&&de.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return $t.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):le.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Kh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Qh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Jh(){return(t,e)=>{const i="_"+e;hn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Zh(t){return(e,i)=>{hn(e,i,dn(i,t))}}Object.assign(de,{watcher:(t,e)=>new Th(t,e),layouter:(t,e)=>new Yh(t,e),renderer:(t,e,i)=>new Hh(t,e,i),selector:(t,e)=>new Gh(t,e)}),$t.layout=Yh.fullLayout,$t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Sh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const $h={},tl={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}},el=Kt,il={},sl={},rl={},nl={},ol={},al={apply(){le.need("filter")}},hl={},ll={setStyleName:()=>le.need("state"),set:()=>le.need("state")},dl={list:{},register(t,e){dl.list[t]=e},get:t=>dl.list[t]},{parse:cl,objectToCanvasData:ul}=ss,{stintSet:_l}=p,{hasTransparent:pl}=tl,gl={originPaint:{}},fl=ie.get("UIData");class yl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,fl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,fl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(_l(this,"__isTransparentFill",pl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(_l(this,"__isTransparentStroke",pl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?cl(t):ul(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ml(this,"shadow",t)}setInnerShadow(t){ml(this,"innerShadow",t)}setFilter(t){ml(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&sl.compute("fill",this.__leaf),e&&sl.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 i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gl)):(this.__isStrokes=!0,this._stroke||(this._stroke=gl))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ml(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class vl extends yl{}class wl extends vl{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 xl extends vl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ae.forEach(t=>delete i[t]),i}}class bl extends wl{}class Sl extends yl{get __usePathBox(){return this.points||this.__pathInputed}}class kl extends yl{get __boxStroke(){return!this.__pathInputed}}class Bl extends yl{get __boxStroke(){return!this.__pathInputed}}class Pl extends Sl{}class Rl extends yl{}class El extends yl{get __pathInputed(){return 2}}class Cl extends vl{}const Tl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ll extends yl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=Tl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ue.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Al extends kl{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 i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Ol extends kl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Dl,add:Fl}=k,Ml={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Dl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=ol.getShadowRenderSpread(this,e)),s&&(t=Dl(t,s)),n&&(t=Fl(t,al.getSpread(n))),o&&(t=Fl(t,o)),a&&(t=Fl(t,a));let l=t;return i&&(l=Dl(l,ol.getInnerShadowSpread(this,i))),r&&(l=Dl(l,r)),this.__layout.renderShapeSpread=l,h?Dl(h.__updateRenderSpread(),t):t}},{stintSet:Il}=p,Wl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Il(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Il(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Il(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!ol.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Il(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=sl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&ol.shadow(this,t,h),a&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),o&&this.__drawAfterFill(t,e),d&&ol.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),c&&al.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,tl.string(e.color))}r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e))}}else s.__pathForRender?Nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?sl.fills(s,this,t,e):sl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?sl.strokes(r,this,t,e):sl.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 Nl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&sl.stroke(r,t,e,i),s&&sl.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!o&&sl.stroke(r,t,e,i)}const zl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Yl;let Xl=Yl=class extends uh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){D.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 jr.set(this.path=t||[]),t||this.__drawPathByBox(jr),jr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return le.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return le.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jr.set(i=[]),this.__drawPathByBox(jr,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||hl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&il.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,!0)}__drawPathByData(t,e,i){e?rr.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,a(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){sl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),le.need("animate")}killAnimate(t,e){}export(t,e){return le.need("export")}syncExport(t,e){return le.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Yl.one(e)}static one(t,e,i,s,r){return ue.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Qn()(this)}static registerData(t){zn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([zn(yl)],Xl.prototype,"__",void 0),me([Jh()],Xl.prototype,"zoomLayer",void 0),me([pn("")],Xl.prototype,"id",void 0),me([pn("")],Xl.prototype,"name",void 0),me([pn("")],Xl.prototype,"className",void 0),me([Cn("pass-through")],Xl.prototype,"blendMode",void 0),me([Ln(1)],Xl.prototype,"opacity",void 0),me([An(!0)],Xl.prototype,"visible",void 0),me([Cn(!1)],Xl.prototype,"locked",void 0),me([Tn(!1)],Xl.prototype,"dim",void 0),me([Tn(!1)],Xl.prototype,"dimskip",void 0),me([Fn(0)],Xl.prototype,"zIndex",void 0),me([Mn(!1)],Xl.prototype,"mask",void 0),me([In(!1)],Xl.prototype,"eraser",void 0),me([gn(0,!0)],Xl.prototype,"x",void 0),me([gn(0,!0)],Xl.prototype,"y",void 0),me([wn(100,!0)],Xl.prototype,"width",void 0),me([wn(100,!0)],Xl.prototype,"height",void 0),me([mn(1,!0)],Xl.prototype,"scaleX",void 0),me([mn(1,!0)],Xl.prototype,"scaleY",void 0),me([vn(0,!0)],Xl.prototype,"rotation",void 0),me([vn(0,!0)],Xl.prototype,"skewX",void 0),me([vn(0,!0)],Xl.prototype,"skewY",void 0),me([gn(0,!0)],Xl.prototype,"offsetX",void 0),me([gn(0,!0)],Xl.prototype,"offsetY",void 0),me([fn(0,!0)],Xl.prototype,"scrollX",void 0),me([fn(0,!0)],Xl.prototype,"scrollY",void 0),me([yn()],Xl.prototype,"origin",void 0),me([yn()],Xl.prototype,"around",void 0),me([pn(!1)],Xl.prototype,"lazy",void 0),me([xn(1)],Xl.prototype,"pixelRatio",void 0),me([En(0)],Xl.prototype,"renderSpread",void 0),me([Sn()],Xl.prototype,"path",void 0),me([kn()],Xl.prototype,"windingRule",void 0),me([kn(!0)],Xl.prototype,"closed",void 0),me([wn(0)],Xl.prototype,"padding",void 0),me([wn(!1)],Xl.prototype,"lockRatio",void 0),me([wn()],Xl.prototype,"widthRange",void 0),me([wn()],Xl.prototype,"heightRange",void 0),me([pn(!1)],Xl.prototype,"draggable",void 0),me([pn()],Xl.prototype,"dragBounds",void 0),me([pn("auto")],Xl.prototype,"dragBoundsType",void 0),me([pn(!1)],Xl.prototype,"editable",void 0),me([Wn(!0)],Xl.prototype,"hittable",void 0),me([Wn("path")],Xl.prototype,"hitFill",void 0),me([Rn("path")],Xl.prototype,"hitStroke",void 0),me([Wn(!1)],Xl.prototype,"hitBox",void 0),me([Wn(!0)],Xl.prototype,"hitChildren",void 0),me([Wn(!0)],Xl.prototype,"hitSelf",void 0),me([Wn()],Xl.prototype,"hitRadius",void 0),me([Nn("")],Xl.prototype,"cursor",void 0),me([Cn()],Xl.prototype,"fill",void 0),me([Rn(void 0,!0)],Xl.prototype,"stroke",void 0),me([Rn("inside")],Xl.prototype,"strokeAlign",void 0),me([Rn(1,!0)],Xl.prototype,"strokeWidth",void 0),me([Rn(!1)],Xl.prototype,"strokeWidthFixed",void 0),me([Rn("none")],Xl.prototype,"strokeCap",void 0),me([Rn("miter")],Xl.prototype,"strokeJoin",void 0),me([Rn()],Xl.prototype,"dashPattern",void 0),me([Rn(0)],Xl.prototype,"dashOffset",void 0),me([Rn(10)],Xl.prototype,"miterLimit",void 0),me([kn(0)],Xl.prototype,"cornerRadius",void 0),me([kn()],Xl.prototype,"cornerSmoothing",void 0),me([Kh()],Xl.prototype,"shadow",void 0),me([Kh()],Xl.prototype,"innerShadow",void 0),me([Kh()],Xl.prototype,"blur",void 0),me([Kh()],Xl.prototype,"backgroundBlur",void 0),me([Kh()],Xl.prototype,"grayscale",void 0),me([Kh()],Xl.prototype,"filter",void 0),me([Cn()],Xl.prototype,"placeholderColor",void 0),me([pn(100)],Xl.prototype,"placeholderDelay",void 0),me([pn({})],Xl.prototype,"data",void 0),me([qn(uh.prototype.reset)],Xl.prototype,"reset",null),Xl=Yl=me([Kn(Ml),Kn(Wl),Vn()],Xl);let Hl=class extends Xl{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:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}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(){}};var Ul;me([zn(vl)],Hl.prototype,"__",void 0),me([wn(0)],Hl.prototype,"width",void 0),me([wn(0)],Hl.prototype,"height",void 0),Hl=me([Kn(bh),Qn()],Hl);const jl=ie.get("Leafer");let ql=Ul=class extends Hl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tn.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const r=this.canvas=de.canvas(s);this.__controllers.push(this.renderer=de.renderer(this,r,s),this.watcher=de.watcher(this,s),this.layouter=de.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=de.selector(this),this.interaction=de.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=de.hitCanvasManager()),this.canvasManager=new ye,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Eo.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(ea.RESTART):this.emitLeafer(ea.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(ea.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Ae);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.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 i=p.copyAttrs({},this.canvas,Ae);e.resize(t),this.updateLazyBounds(),this.__onResize(new Jo(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Ae),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 Gt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ae.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(ea.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ae.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=p.copyAttrs({},s,Ae);r[t]=i[t]=e,i.width&&i.height?s.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(ea.BEFORE_READY),this.emitLeafer(ea.READY),this.emitLeafer(ea.AFTER_READY),Eo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ea.VIEW_READY),Eo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(r=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Eo.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(ea.VIEW_COMPLETED),Eo.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,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return le.need("view")}getValidMove(t,e,i){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:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ea(t,this))}__listenEvents(){const t=oe.start("FirstCreate "+this.innerName);this.once([[ea.START,()=>oe.end(t)],[$o.START,this.updateLazyBounds,this],[ta.START,this.__onCreated,this],[ta.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Zo.DATA,this.__onWatchData,this],[$o.END,this.__onLayoutEnd,this],[ta.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(ea.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sn.clearRecycled()},100)}catch(t){jl.error(t)}}};t?e():setTimeout(e)}};ql.list=new Sh,me([zn(xl)],ql.prototype,"__",void 0),me([wn()],ql.prototype,"pixelRatio",void 0),me([pn("normal")],ql.prototype,"mode",void 0),ql=Ul=me([Qn()],ql);let Vl=class extends Xl{get __tag(){return"Rect"}};me([zn(kl)],Vl.prototype,"__",void 0),Vl=me([Kn(zl),Vn(),Qn()],Vl);const{add:Gl,includes:Kl,scroll:Ql}=Xt,Jl=Vl.prototype,Zl=Hl.prototype;let $l=class extends Hl{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 i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Gl(a,n),Ql(a,i)),this.__updateRectRenderBounds(),t=!Kl(n,a),t&&"show"===o&&Gl(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([zn(wl)],$l.prototype,"__",void 0),me([wn(100)],$l.prototype,"width",void 0),me([wn(100)],$l.prototype,"height",void 0),me([pn(!1)],$l.prototype,"resizeChildren",void 0),me([En("show")],$l.prototype,"overflow",void 0),me([qn(Jl.__updateStrokeSpread)],$l.prototype,"__updateStrokeSpread",null),me([qn(Jl.__updateRenderSpread)],$l.prototype,"__updateRectRenderSpread",null),me([qn(Jl.__updateBoxBounds)],$l.prototype,"__updateRectBoxBounds",null),me([qn(Jl.__updateStrokeBounds)],$l.prototype,"__updateStrokeBounds",null),me([qn(Jl.__updateRenderBounds)],$l.prototype,"__updateRectRenderBounds",null),me([qn(Jl.__updateChange)],$l.prototype,"__updateRectChange",null),me([qn(Jl.__render)],$l.prototype,"__renderRect",null),me([qn(Zl.__render)],$l.prototype,"__renderGroup",null),$l=me([Vn(),Qn()],$l);let td=class extends $l{get __tag(){return"Frame"}get isFrame(){return!0}};me([zn(bl)],td.prototype,"__",void 0),me([Cn("#FFFFFF")],td.prototype,"fill",void 0),me([En("hide")],td.prototype,"overflow",void 0),td=me([Qn()],td);const{moveTo:ed,closePath:id,ellipse:sd}=Ps;let rd=class extends Xl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];let h;i?s||r?(i<1?sd(a,n,o,n*i,o*i,0,s,r,!1):h=!0,sd(a,n,o,n,o,0,r,s,!0)):(i<1&&(sd(a,n,o,n*i,o*i),ed(a,t,o)),sd(a,n,o,n,o,0,360,0,!0)):s||r?(ed(a,n,o),sd(a,n,o,n,o,0,s,r,!1)):sd(a,n,o,n,o),h||id(a),$t.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([zn(Bl)],rd.prototype,"__",void 0),me([kn(0)],rd.prototype,"innerRadius",void 0),me([kn(0)],rd.prototype,"startAngle",void 0),me([kn(0)],rd.prototype,"endAngle",void 0),rd=me([Qn()],rd);const{sin:nd,cos:od,PI:ad}=Math,{moveTo:hd,lineTo:ld,closePath:dd,drawPoints:cd}=Ps;let ud=class extends Xl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)cd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,o=s/2;hd(e,n,0);for(let t=1;t<r;t++)ld(e,n+n*nd(2*t*ad/r),o-o*od(2*t*ad/r));dd(e)}}};me([zn(Pl)],ud.prototype,"__",void 0),me([kn(3)],ud.prototype,"sides",void 0),me([kn()],ud.prototype,"points",void 0),me([kn(0)],ud.prototype,"curve",void 0),ud=me([Vn(),Qn()],ud);const{sin:_d,cos:pd,PI:gd}=Math,{moveTo:fd,lineTo:yd,closePath:md}=Ps;let vd=class extends Xl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,o=this.__.path=[];fd(o,r,0);for(let t=1;t<2*i;t++)yd(o,r+(t%2==0?r:r*s)*_d(t*gd/i),n-(t%2==0?n:n*s)*pd(t*gd/i));md(o)}};me([zn(Rl)],vd.prototype,"__",void 0),me([kn(5)],vd.prototype,"corners",void 0),me([kn(.382)],vd.prototype,"innerRadius",void 0),vd=me([Qn()],vd);const{moveTo:wd,lineTo:xd,drawPoints:bd}=Ps,{rotate:Sd,getAngle:kd,getDistance:Bd,defaultPoint:Pd}=at;let Rd=class extends Xl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Sd(i,e),i}set toPoint(t){this.width=Bd(Pd,t),this.rotation=kd(Pd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?bd(e,t.points,t.curve,t.closed):(wd(e,0,0),xd(e,this.width,0))}};me([zn(Sl)],Rd.prototype,"__",void 0),me([Bn("center")],Rd.prototype,"strokeAlign",void 0),me([wn(0)],Rd.prototype,"height",void 0),me([kn()],Rd.prototype,"points",void 0),me([kn(0)],Rd.prototype,"curve",void 0),me([kn(!1)],Rd.prototype,"closed",void 0),Rd=me([Qn()],Rd);let Ed=class extends Vl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([zn(Al)],Ed.prototype,"__",void 0),me([wn("")],Ed.prototype,"url",void 0),Ed=me([Qn()],Ed);const Cd=Ed;let Td=class extends Vl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=de.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new an({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Uo(Uo.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(a(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};me([zn(Ol)],Td.prototype,"__",void 0),me([Qh(100)],Td.prototype,"width",void 0),me([Qh(100)],Td.prototype,"height",void 0),me([Qh(1)],Td.prototype,"pixelRatio",void 0),me([Qh(!0)],Td.prototype,"smooth",void 0),me([pn(!1)],Td.prototype,"safeResize",void 0),me([Qh()],Td.prototype,"contextSettings",void 0),Td=me([Qn()],Td);const{copyAndSpread:Ld,includes:Ad,spread:Od,setList:Dd}=Xt,{stintSet:Fd}=p;let Md=class extends Xl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=el.number(e,r),t.__letterSpacing=el.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,Fd(t,"__padding",l&&D.fourNumber(l)),Fd(t,"__clipText","show"!==h&&!t.__autoSize),Fd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=$h.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Od(a,i/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),p.stintSet(this,"isOverflow",!Ad(h,a)),this.isOverflow?(Dd(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;Ld(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,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([zn(Ll)],Md.prototype,"__",void 0),me([wn(0)],Md.prototype,"width",void 0),me([wn(0)],Md.prototype,"height",void 0),me([Cn()],Md.prototype,"boxStyle",void 0),me([pn(!1)],Md.prototype,"resizeFontSize",void 0),me([Cn("#000000")],Md.prototype,"fill",void 0),me([Bn("outside")],Md.prototype,"strokeAlign",void 0),me([Wn("all")],Md.prototype,"hitFill",void 0),me([wn("")],Md.prototype,"text",void 0),me([wn("")],Md.prototype,"placeholder",void 0),me([wn("caption")],Md.prototype,"fontFamily",void 0),me([wn(12)],Md.prototype,"fontSize",void 0),me([wn("normal")],Md.prototype,"fontWeight",void 0),me([wn(!1)],Md.prototype,"italic",void 0),me([wn("none")],Md.prototype,"textCase",void 0),me([wn("none")],Md.prototype,"textDecoration",void 0),me([wn(0)],Md.prototype,"letterSpacing",void 0),me([wn({type:"percent",value:1.5})],Md.prototype,"lineHeight",void 0),me([wn(0)],Md.prototype,"paraIndent",void 0),me([wn(0)],Md.prototype,"paraSpacing",void 0),me([wn("x")],Md.prototype,"writingMode",void 0),me([wn("left")],Md.prototype,"textAlign",void 0),me([wn("top")],Md.prototype,"verticalAlign",void 0),me([wn(!0)],Md.prototype,"autoSizeAlign",void 0),me([wn("normal")],Md.prototype,"textWrap",void 0),me([wn("show")],Md.prototype,"textOverflow",void 0),me([Cn(!1)],Md.prototype,"textEditing",void 0),Md=me([Qn()],Md);let Id=class extends Xl{get __tag(){return"Path"}};me([zn(El)],Id.prototype,"__",void 0),me([Bn("center")],Id.prototype,"strokeAlign",void 0),Id=me([Qn()],Id);let Wd=class extends Hl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Id(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,o,a){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,o,a){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};me([zn(Cl)],Wd.prototype,"__",void 0),me([(t,e)=>{hn(t,e,{get(){return this.__path}})}],Wd.prototype,"path",void 0),Wd=me([Kn(Hs,["set","path","paint"]),Qn()],Wd);let Nd=class extends ql{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&de.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new ql(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Ae),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[$o.END,this.__onReady,this],[ta.START,this.__onCreated,this],[ta.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ta.END,this.__onChildRenderEnd,this))}};Nd=me([Qn()],Nd);const zd={},Yd={isHoldSpaceKey:()=>Yd.isHold("Space"),isHold:t=>zd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){zd[t]||(zd[t]=!0)},setUpCode(t){zd[t]=!1}},Xd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Hd extends No{get spaceKey(){return Yd.isHoldSpaceKey()}get left(){return Xd.left(this)}get right(){return Xd.right(this)}get middle(){return Xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Yd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ge.changeName(t,e)}}const{min:Ud,max:jd,abs:qd}=Math,{float:Vd,sign:Gd}=D,{minX:Kd,maxX:Qd,minY:Jd,maxY:Zd}=Xt,$d=new qt,tc=new qt,ec={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ic.getValidMove(t.__localBoxBounds,ic.getDragBounds(t),s,e,!0),ic.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&ic.getValidScaleOf(t.__localBoxBounds,ic.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,o=t.y+s.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),ic.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),ic.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Vd(s.x),s.y=Vd(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),tc.set(e),$d.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return ic.isInnerMode(t,e,i,"width")?(r.x<0&&$d.scaleOf(s,f=1/r.x,1),p=Vd($d.minX-tc.minX),g=Vd(tc.maxX-$d.maxX),u=h&&p>0?1+p/(h*$d.width):1,_=l&&g>0?1+g/(l*$d.width):1,f*=jd(u,_)):(r.x<0&&((Vd(Kd(t)-Kd(e))<=0||Vd(Qd(e)-Qd(t))<=0)&&$d.scaleOf(s,f=1/r.x,1),$d.unsign()),p=Vd(tc.minX-$d.minX),g=Vd($d.maxX-tc.maxX),u=h&&p>0?1-p/(h*$d.width):1,_=l&&g>0?1-g/(l*$d.width):1,f*=Ud(u,_)),ic.isInnerMode(t,e,i,"height")?(r.y<0&&$d.scaleOf(s,1,y=1/r.y),p=Vd($d.minY-tc.minY),g=Vd(tc.maxY-$d.maxY),u=d&&p>0?1+p/(d*$d.height):1,_=c&&g>0?1+g/(c*$d.height):1,y*=jd(u,_),n&&(u=jd(qd(f),qd(y)),f=Gd(f)*u,y=Gd(y)*u)):(r.y<0&&((Vd(Jd(t)-Jd(e))<=0||Vd(Zd(e)-Zd(t))<=0)&&$d.scaleOf(s,1,y=1/r.y),$d.unsign()),p=Vd(tc.minY-$d.minY),g=Vd($d.maxY-tc.maxY),u=d&&p>0?1-p/(d*$d.height):1,_=c&&g>0?1-g/(c*$d.height):1,y*=Ud(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},ic=ec;let sc=class extends Hd{};sc.POINTER="pointer",sc.BEFORE_DOWN="pointer.before_down",sc.BEFORE_MOVE="pointer.before_move",sc.BEFORE_UP="pointer.before_up",sc.DOWN="pointer.down",sc.MOVE="pointer.move",sc.UP="pointer.up",sc.OVER="pointer.over",sc.OUT="pointer.out",sc.ENTER="pointer.enter",sc.LEAVE="pointer.leave",sc.TAP="tap",sc.DOUBLE_TAP="double_tap",sc.CLICK="click",sc.DOUBLE_CLICK="double_click",sc.LONG_PRESS="long_press",sc.LONG_TAP="long_tap",sc.MENU="pointer.menu",sc.MENU_TAP="pointer.menu_tap",sc=me([Jn()],sc);const rc=sc,nc={};let oc=class extends sc{static setList(t){this.list=t instanceof Sh?t:new Sh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return at.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),ec.axisMove(t,r),r}static limitMove(t,e){ec.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(nc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(nc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(nc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){nc.x=t?this.totalX:this.moveX,nc.y=t?this.totalY:this.moveY}};oc.BEFORE_DRAG="drag.before_drag",oc.START="drag.start",oc.DRAG="drag",oc.END="drag.end",oc.OVER="drag.over",oc.OUT="drag.out",oc.ENTER="drag.enter",oc.LEAVE="drag.leave",oc=me([Jn()],oc);const ac=oc;let hc=class extends sc{static setList(t){oc.setList(t)}static setData(t){oc.setData(t)}};hc.DROP="drop",hc=me([Jn()],hc);let lc=class extends oc{};lc.BEFORE_MOVE="move.before_move",lc.START="move.start",lc.MOVE="move",lc.DRAG_ANIMATE="move.drag_animate",lc.END="move.end",lc.PULL_DOWN="move.pull_down",lc.REACH_BOTTOM="move.reach_bottom",lc=me([Jn()],lc);let dc=class extends Hd{};dc=me([Jn()],dc);const cc=dc;let uc=class extends sc{};uc.BEFORE_ROTATE="rotate.before_rotate",uc.START="rotate.start",uc.ROTATE="rotate",uc.END="rotate.end",uc=me([Jn()],uc);let _c=class extends oc{};_c.SWIPE="swipe",_c.LEFT="swipe.left",_c.RIGHT="swipe.right",_c.UP="swipe.up",_c.DOWN="swipe.down",_c=me([Jn()],_c);let pc=class extends sc{};pc.BEFORE_ZOOM="zoom.before_zoom",pc.START="zoom.start",pc.ZOOM="zoom",pc.END="zoom.end",pc=me([Jn()],pc);let gc=class extends Hd{};gc.BEFORE_DOWN="key.before_down",gc.BEFORE_UP="key.before_up",gc.DOWN="key.down",gc.HOLD="key.hold",gc.UP="key.up",gc=me([Jn()],gc);const fc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?_c.UP:t>45&&t<135?_c.DOWN:t<=45&&t>=-45?_c.RIGHT:_c.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:yc.getSwipeDirection(at.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Sh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>lo.draggable(t)||!t.isLeafer&&t.hasEvent(oc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},yc=fc,mc=new Sh,{getDragEventData:vc,getDropEventData:wc,getSwipeEventData:xc}=fc;class bc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=vc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,r=oc.list||this.draggableList||mc;return this.dragging&&(s?t?mc:new Sh(e?[...i.list,...i.dragHoverExclude]:i.list):r)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(lc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Xd.left(t),this.dragging&&(this.interaction.emit(oc.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],lo.draggable(e)){this.draggableList=new Sh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:n}=s;this.dragData=vc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(lc.BEFORE_MOVE,this.dragData),e.emit(lc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(oc.BEFORE_DRAG,this.dragData),e.emit(oc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:r}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=oc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:r},h||s);o&&!s&&t?lo.animateMove(e,l,a(o)?o:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(oc.OUT,t,i),e.emit(oc.OVER,t,s)):e.emit(oc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(oc.LEAVE,t,i,s),e.emit(oc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:n}=i,o=vc(i,t,t);if(n&&(o.throughPath=n),o.path=r,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(lc.END,o)),this.dragging){const r=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(oc.END,o),this.swipe(t,i,s,o),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(at.getDistance(e,t)>r.config.pointer.swipeDistance){const t=xc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=wc(t,e,oc.data);s.path=i,this.interaction.emit(hc.DROP,s),this.interaction.emit(oc.LEAVE,t,i)}dragReset(){oc.list=oc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Sc=ie.get("emit");const kc=["move","zoom","rotate","key"];function Bc(t,e,i,s,r){if(kc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Rc(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!i.path.has(n)&&n.__.hittable&&Pc(n,e,i,s,r)}}function Pc(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Rc(t,r)&&(ll.updateEventStyle&&!s&&ll.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ge.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Rc(t,e){return e&&e.has(t)}const Ec={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Cc,pathCanDrag:Tc,pathHasOutside:Lc}=fc;class Ac{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Yd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=p.clone(Ec),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Sh(t),this.createTransformer(),this.dragger=new bc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Xd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(sc.BEFORE_DOWN,t),this.emit(sc.DOWN,t),Xd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Xd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(sc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=at.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(sc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Xd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(sc.BEFORE_UP,t),this.emit(sc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(sc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(sc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Yd.setDownCode(e),this.emit(gc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(gc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Yd.setUpCode(e),this.emit(gc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Sh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(sc.OUT,t,i),this.emit(sc.OVER,t,e)):this.emit(sc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(sc.LEAVE,t,i,e),this.emit(sc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(sc.LEAVE,t),this.dragger.dragging&&this.emit(hc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[sc.DOUBLE_TAP,sc.DOUBLE_CLICK].some(e=>Cc(t.path,e));s<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;$t.backgrounder||t.origin||n&&n.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Tc(t.path))&&!Lc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:sc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&at.round(s),s}emitTap(t){this.emit(sc.TAP,t),this.emit(sc.CLICK,t)}emitDoubleTap(t){this.emit(sc.DOUBLE_TAP,t),this.emit(sc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(sc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(sc.LONG_TAP,t),(Cc(t.path,sc.LONG_TAP)||Cc(t.path,sc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Jo.RESIZE,this.__onResize,this)],t.once(ea.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Pc(r,t,e,!0,s))return;r.isApp&&Bc(r,t,e,!0,s)}for(let n=0,o=i.length;n<o;n++)if(r=i.list[n],r.isApp&&Bc(r,t,e,!1,s),Pc(r,t,e,!1,s))return}catch(t){Sc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Oc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Oc.custom={};class Dc extends ye{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Sh,this.pixelList=new Sh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),de.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),de.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}$t.getSelector=function(t){return t.leafer?t.leafer.selector:$t.selector||($t.selector=de.selector())};const{toInnerRadiusPointOf:Fc,copyRadiusPoint:Mc}=at,{hitRadiusPoint:Ic,hitPoint:Wc}=Xt,Nc={},zc={},Yc=uh.prototype;Yc.hit=function(t,e=0){this.updateLayout(),Mc(zc,t,e);const i=this.__world;return!!(e?Ic(i,zc):Wc(i,zc))&&(this.isBranch?$t.getSelector(this).hitPoint(Object.assign({},zc),e,{target:this}):this.__hitWorld(zc))},Yc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(Mc(Nc,t,i.hitRadius),t=Nc),Fc(t,s,Nc),i.hitBox||n){if(Xt.hitRadiusPoint(r.boxBounds,Nc))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(Nc,e)},Yc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Yc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Yc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Yc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Xc=new gt,Hc=Xl.prototype;Hc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=$t.image.hitCanvasSize,o=n.hitScale=Vt.set(0,0,r,r).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Vt.set(t).scale(o);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),sn.patternLocked=!0,this.__renderShape(n,{matrix:Xc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Hc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Xl.prototype,jc=Vl.prototype,qc=$l.prototype;jc.__updateHitCanvas=qc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},jc.__hitFill=qc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},Md.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},Hl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),$t.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Vc=Oe.prototype;function Gc(t,e,i){t.__.__font?sl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Kc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&sl.strokeArrow(t,i,s,r)}function Qc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),sl.drawTextStroke(i,s,r))}function Jc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Qc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",sl.fillText(i,n,r),n.blendMode="normal",lo.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}Vc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Vc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Vc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:o}=t;e&&(s-=e.x,r-=e.y),Vt.set(s-n,r-o,2*n,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Vt.x,Vt.y,Vt.width||1,Vt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Zc,copyAndSpread:$c,toOuterOf:tu,getOuterOf:eu,getByMove:iu,move:su,getIntersectData:ru}=Xt,nu={};let ou;const{stintSet:au}=p,{hasTransparent:hu}=tl;function lu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:o}=i.__layout;switch(e.type){case"image":if(!e.url)return;r=rl.image(i,t,e,o,!ou||!ou[e.url]);break;case"linear":r=nl.linearGradient(e,o);break;case"radial":r=nl.radialGradient(e,o);break;case"angular":r=nl.conicGradient(e,o);break;case"solid":const{type:n,color:a,opacity:h}=e;r={type:n,style:tl.string(a,h)};break;default:s(e.r)||(r={type:"solid",style:tl.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&hu(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const du={compute:function(t,e){const i=e.__,s=[];let r,n,o,a=i.__input[t];d(a)||(a=[a]),ou=rl.recycleImage(t,i);for(let i,r=0,n=a.length;r<n;r++)(i=lu(t,a[r],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(au(i,"__isAlphaPixelFill",r),au(i,"__isTransparentFill",n)):(au(i,"__isAlphaPixelStroke",r),au(i,"__isTransparentStroke",n),au(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Gc(e,i,s)},fills:function(t,e,i,s){let r,n,o;for(let a=0,h=t.length;a<h;a++){if(r=t[a],n=r.originPaint,r.image){if(o?o++:o=1,rl.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),Gc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),Gc(e,i,s),i.restoreBlendMode()):Gc(e,i,s)}},fillPathOrText:Gc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)o=r[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)sl.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Kc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)Kc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Kc(t,2,e,o,s),o.clipUI(r),o.clearWorld(n),lo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){sl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Qc(t,1,e,i,s);break;case"inside":Jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Qc(t,2,e,i,s):Jc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:o}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=r;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!rl.checkImage(o,!1,s,r,n))&&o.style){if(h){const{strokeStyle:t}=o;t?r.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(o.style,a.__strokeWidth*e,a)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),i?sl.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?sl.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;tu(o.strokeSpread?($c(nu,o.boxBounds,o.strokeSpread),nu):o.boxBounds,n,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=s,h=u=a,l=n;else{let s;if($t.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Zc(r,k.swapAndScale(o.renderShapeSpread,p,g)):r;s=ru(t,a)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=eu(a,c),h=iu(u,-c.e,-c.f),l=eu(n,c),su(l,-c.e,-c.f);const m=i.matrix;m?(d=new gt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let cu,uu=new qt;const{isSame:_u}=Xt;function pu(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.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||rl.createData(r,s,i,n),!0}function gu(t,e){mu(t,Uo.LOAD,e)}function fu(t,e){mu(t,Uo.LOADED,e)}function yu(t,e,i){e.error=i,t.forceUpdate("surface"),mu(t,Uo.ERROR,e)}function mu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Uo(e,i))}function vu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:xu}=K,bu=new qt,Su={},ku={};function Bu(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Pu={},Ru={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Eu,set:Cu,rotateOfOuter:Tu,translate:Lu,scaleOfOuter:Au,multiplyParent:Ou,scale:Du,rotate:Fu,skew:Mu}=K;function Iu(t,e,i,s,r,n,o,a){o&&Fu(t,o),a&&Mu(t,a.x,a.y),r&&Du(t,r,n),Lu(t,e.x+i,e.y+s)}const{get:Wu,scale:Nu,copy:zu}=K,{getFloorScale:Yu}=D,{abs:Xu}=Math;const Hu={image:function(t,e,i,s,r){let n,o;const a=sn.get(i);return cu&&i===cu.paint&&_u(s,cu.boxBounds)?n=cu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),cu=a.use>1?{leafPaint:n,paint:i,boxBounds:uu.set(s)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(pu(t,e,i,a,n,s),r&&(gu(t,o),fu(t,o))):a.error?r&&yu(t,o,a.error):(r&&(vu(t,!0),gu(t,o)),n.loadId=a.load(()=>{vu(t,!1),t.destroyed||(pu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),fu(t,o)),n.loadId=void 0},e=>{vu(t,!1),yu(t,o,e),n.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:o}=rl.getImageRenderScaleData(t,i,s,r),{image:a,data:h,originPaint:l}=t,{exporting:d,snapshot:c}=r;return!(!h||t.patternId===n+"-"+o&&!d||c)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===$t.name&&Jo.isResizing(i)||d||(e=$t.image.isLarge(a,n,o)||a.width*n>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),rl.drawImage(t,n,o,i,s,r),!0):(!t.style||l.sync||d?rl.createPattern(t,i,s,r):rl.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let _,{width:p,height:g}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(o.scaleX&&(p*=o.scaleX,g*=o.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,sn.recyclePaint(s),r.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),r.unload(i[h].loadId,!o.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=sn.patternTasker.add(()=>ve(this,void 0,void 0,function*(){rl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=rl.getImageRenderScaleData(t,e,i,s),o=r+"-"+n;if(t.patternId!==o&&!e.destroyed&&(!$t.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=rl.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/Xu(s.scaleX||1),u=h.y*n/Xu(s.scaleY||1)),(a||1!==r||1!==n)&&(r*=Yu(_+(c||0)),n*=Yu(p+(u||0)),d=Wu(),a&&zu(d,a),Nu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth,s.interlace),f=i.getPattern(g,s.repeat||$t.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=$t.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>o&&(n=o),(o*=e*i)>n&&(r=Math.sqrt(n/o)),r},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=bu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:o,mode:h,align:l,offset:d,scale:u,size:_,rotation:p,skew:g,clipSize:f,repeat:y,gap:m,filters:v,interlace:w}=t,x=e.width===s&&e.height===r,b={mode:h},S="center"!==l&&(p||0)%180==90;let k,B;switch(Xt.set(ku,0,0,S?r:s,S?s:r),h&&"cover"!==h&&"fit"!==h?((u||_)&&(D.getScaleData(u,_,i,Su),k=Su.scaleX,B=Su.scaleY),(l||m||y)&&(k&&Xt.scale(ku,k,B,!0),l&&Bt.toPoint(l,ku,e,ku,!0,!0))):x&&!p||(k=B=Xt.getFitScale(e,ku,"fit"!==h),Xt.put(e,i,l,k,!1,ku),Xt.scale(ku,k,B,!0)),d&&at.move(ku,d),h){case"stretch":x?k&&(k=B=void 0):(k=e.width/s,B=e.height/r,rl.stretchMode(b,e,k,B));break;case"normal":case"clip":if(ku.x||ku.y||k||f||p||g){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),rl.clipMode(b,e,ku.x,ku.y,k,B,p,g,t,i),t&&(k=k?k*t:t,B=B?B*i:i)}break;case"repeat":(!x||k||p||g)&&rl.repeatMode(b,e,s,r,ku.x,ku.y,k,B,p,g,l,t.freeTransform),y||(b.repeat="repeat");const i=c(y);(m||i)&&(b.gap=function(t,e,i,s,r){let n,o;c(t)?(n=t.x,o=t.y):n=o=t;return{x:Bu(n,i,r.width,e&&e.x),y:Bu(o,s,r.height,e&&e.y)}}(m,i&&y,ku.width,ku.height,e));break;default:k&&rl.fillOrFitMode(b,e,ku.x,ku.y,k,B,p)}return b.transform||(e.x||e.y)&&xu(b.transform=wu(),e.x,e.y),k&&(b.scaleX=k,b.scaleY=B),o&&o<1&&(b.opacity=o),v&&(b.filters=v),y&&(b.repeat=n(y)?"x"===y?"repeat-x":"repeat-y":"repeat"),w&&(b.interlace=a(w)||"percent"===w.type?{type:"x",offset:w}:w),b},stretchMode:function(t,e,i,s){const r=Eu(),{x:n,y:o}=e;n||o?Lu(r,n,o):r.onlyScale=!0,Du(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,o){const a=Eu();Lu(a,e.x+i,e.y+s),Du(a,r,n),o&&Tu(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,r,n,o,a,h,l){const d=Eu();Iu(d,e,i,s,r,n,o,a),h&&(o||a?(Cu(Ru),Au(Ru,e,h,l),Ou(d,Ru)):Au(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,o,a,h,l,d,c){const u=Eu();if(c)Iu(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)Tu(u,{x:i/2,y:s/2},h);else switch(Fu(u,h),h){case 90:Lu(u,s,0);break;case 180:Lu(u,i,s);break;case 270:Lu(u,0,i)}Pu.x=e.x+r,Pu.y=e.y+n,Lu(u,Pu.x,Pu.y),o&&Au(u,Pu,o,a)}t.transform=u}},{toPoint:Uu}=bt,{hasTransparent:ju}=tl,qu={},Vu={};function Gu(t,e,i,s){if(i){let r,o,a,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(a=t/(l-1),o=tl.string(r,s)):(a=r.offset,o=tl.string(r.color,s)),e.addColorStop(a,o),!h&&ju(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ku,getDistance:Qu}=at,{get:Ju,rotateOfOuter:Zu,scaleOfOuter:$u}=K,{toPoint:t_}=bt,e_={},i_={};function s_(t,e,i,s,r){let n;const{width:o,height:a}=t;if(o!==a||s){const t=Ku(e,i);n=Ju(),r?($u(n,e,o/a*(s||1),1),Zu(n,e,t+90)):($u(n,e,1,o/a*(s||1)),Zu(n,e,t))}return n}const{getDistance:r_}=at,{toPoint:n_}=bt,o_={},a_={};const h_={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;Uu(i||"top",e,qu),Uu(s||"bottom",e,Vu);const o=$t.canvas.createLinearGradient(qu.x,qu.y,Vu.x,Vu.y),a={type:r,style:o};return Gu(a,o,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;t_(i||"center",e,e_),t_(s||"bottom",e,i_);const a=$t.canvas.createRadialGradient(e_.x,e_.y,0,e_.x,e_.y,Qu(e_,i_)),h={type:r,style:a};Gu(h,a,t.stops,n);const l=s_(e,e_,i_,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;n_(i||"center",e,o_),n_(s||"bottom",e,a_);const a=$t.conicGradientSupport?$t.canvas.createConicGradient(0,o_.x,o_.y):$t.canvas.createRadialGradient(o_.x,o_.y,0,o_.x,o_.y,r_(o_,a_)),h={type:r,style:a};Gu(h,a,t.stops,n);const l=s_(e,o_,a_,o||1,$t.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:s_},{copy:l_,move:d_,toOffsetOutBounds:c_}=Xt,{max:u_,abs:__}=Math,p_={},g_=new gt,f_={};function y_(t,e){let i,s,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=__(t.spread||0),o=u_(o,r+n-s),a=u_(a,r+n+i),h=u_(h,r+n+s),l=u_(l,r+n-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function m_(t,e,i){const{shapeBounds:s}=i;let r,n;$t.fullImageShadow?(l_(p_,t.bounds),d_(p_,e.x-s.x,e.y-s.y),r=t.bounds,n=p_):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:v_}=Xt,w_={};const x_=y_;const b_={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;c_(h,f_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(f_.offsetX+(o.x||0)*c*f,f_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,tl.string(o.color)),r=ol.getShadowTransform(t,_,i,o,f_,f),r&&_.setTransform(r),m_(_,f_,i),r&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),s=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),lo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;v_(h,w_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(w_.offsetX+(o.x||0)*c*f,w_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),r=ol.getShadowTransform(t,_,i,o,w_,f,!0),r&&_.setTransform(r),m_(_,w_,i),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,tl.string(o.color),"source-in"),lo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:y_,getShadowTransform:function(t,e,i,s,r,n,o){if(s.spread){const i=2*s.spread*n*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return g_.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/a,1+i/h),g_}},isTransformShadow(t){},getInnerShadowSpread:x_},{excludeRenderBounds:S_}=mo;let k_;function B_(t,e,i,s,r,n,o,a){switch(e){case"grayscale":k_||(k_=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),n&&s.recycle(o);R_(t,e,i,1,r,n)}(t,i,s,r,o,a);break;case"opacity-path":R_(t,i,s,n,o,a);break;case"path":a&&i.restore()}}function P_(t){return t.getSameCanvas(!1,!0)}function R_(t,e,i,s,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,r),n?i.recycle(o):i.clearWorld(o)}Hl.prototype.__renderMask=function(t,e){let i,s,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(B_(this,o,t,r,s,n,void 0,!0),s=r=null),"clipping"!==a&&"clipping-path"!==a||S_(i,e)||i.__render(t,e),n=i.__.opacity,k_=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=P_(t))):(o="path",t.save()),i.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=P_(t)),r||(r=P_(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&B_(this,o,t,r,s,n,void 0,!1),S_(i,e)||i.__render(r||t,e),d&&B_(this,o,t,r,s,n,d,!1)}B_(this,o,t,r,s,n,void 0,!0)};const E_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",C_=E_+"_#~&*+\\=|≮≯≈≠=…",T_=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 L_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const A_=L_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),O_=L_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),D_=L_(E_),F_=L_(C_),M_=L_("- —/~|┆·");var I_;!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"}(I_||(I_={}));const{Letter:W_,Single:N_,Before:z_,After:Y_,Symbol:X_,Break:H_}=I_;function U_(t){return A_[t]?W_:M_[t]?H_:O_[t]?z_:D_[t]?Y_:F_[t]?X_:T_.test(t)?N_:W_}const j_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function q_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:V_}=j_,{Letter:G_,Single:K_,Before:Q_,After:J_,Symbol:Z_,Break:$_}=I_;let tp,ep,ip,sp,rp,np,op,ap,hp,lp,dp,cp,up,_p,pp,gp,fp,yp=[];function mp(t,e){hp&&!ap&&(ap=hp),tp.data.push({char:t,width:e}),ip+=e}function vp(){sp+=ip,tp.width=ip,ep.words.push(tp),tp={data:[]},ip=0}function wp(){_p&&(pp.paraNumber++,ep.paraStart=!0,_p=!1),hp&&(ep.startCharSize=ap,ep.endCharSize=hp,ap=0),ep.width=sp,gp.width?V_(ep):fp&&xp(),yp.push(ep),ep={words:[]},sp=0}function xp(){sp>(pp.maxWidth||0)&&(pp.maxWidth=sp)}const{top:bp,right:Sp,bottom:kp,left:Bp}=vt;function Pp(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const Rp={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(i=a[Bp],r-=a[Sp]+a[Bp],!r&&(r=.01)):e.autoSizeAlign||(i=a[Bp]),o?(s=a[bp],o-=a[bp]+a[kp],!o&&(o=.01)):e.autoSizeAlign||(s=a[bp]));const h={bounds:{x:i,y:s,width:r,height:o},rows:[],paraNumber:0,font:$t.canvas.font=e.__font};return function(t,e,i){pp=t,yp=t.rows,gp=t.bounds,fp=!gp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:o}=$t,{width:a}=gp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;_p=!0,dp=null,ap=op=hp=ip=sp=0,tp={data:[]},ep={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)np=e[i],"\n"===np?(ip&&vp(),ep.paraEnd=!0,wp(),_p=!0):(lp=U_(np),lp===G_&&"none"!==n&&(np=q_(np,n,!ip)),op=o.measureText(np).width,s&&(s<0&&(hp=op),op+=s),cp=lp===K_&&(dp===K_||dp===G_)||dp===K_&&lp!==J_,up=!(lp!==Q_&&lp!==K_||dp!==Z_&&dp!==J_),rp=_p&&r?a-r:a,t&&a&&sp+ip+op>rp&&(h?(ip&&vp(),sp&&wp()):(up||(up=lp===G_&&dp==J_),cp||up||lp===$_||lp===Q_||lp===K_||ip+op>rp?(ip&&vp(),sp&&wp()):sp&&wp()))," "===np&&!0!==_p&&sp+ip===0||(lp===$_?(" "===np&&ip&&vp(),mp(np,op),vp()):cp||up?(ip&&vp(),mp(np,op)):mp(np,op)),dp=lp);ip&&vp(),sp&&wp(),yp.length>0&&(yp[yp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{pp.paraNumber++,sp=o.measureText(t).width,yp.push({x:r||0,text:t,width:sp,paraStart:!0}),fp&&xp()})}(h,t,e),a&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Pp(e,"x",t[Bp]);break;case"right":Pp(e,"x",-t[Sp])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Pp(e,"y",t[bp]);break;case"bottom":Pp(e,"y",-t[kp])}}(a,h,e,r,o),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=n,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,__letterSpacing:o}=e,a=i&&r.includes("both"),h=a||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){const{rows:r,overflow:n}=t;let{textOverflow:o}=e;if(n&&r.splice(n),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?$t.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=tl.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const Ep={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(n(t)){if(!i||!tl.object)return t;t=tl.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const o=t.r+","+t.g+","+t.b;return 1===r?"rgb("+o+")":"rgba("+o+","+r+")"}};Object.assign($h,Rp),Object.assign(tl,Ep),Object.assign(sl,du),Object.assign(rl,Hu),Object.assign(nl,h_),Object.assign(ol,b_),Object.assign(de,{interaction:(t,e,i,s)=>new Ac(t,e,i,s),hitCanvas:(t,e)=>new Ph(t,e),hitCanvasManager:()=>new Dc}),Eh();class Cp extends yl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Tp=class extends Xl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=sn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:r,size:n,total:o}=e,{width:h,height:l}=n&&(a(n)?{width:n,height:n}:n)||(o>1?this:t);let d=r?r.x:0,c=r?r.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Uo(Uo.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:r,__action:n}=this;n&&(n.FPS&&(i=n.FPS),s(n.loop)||(r=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!r)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:r}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,r)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};function Lp(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?ll.setStyleName(this,e,i):ll.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Ap(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Op(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Dp(t,e){c(e)||(e=void 0),Ip(t,e,"in")}function Fp(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),Ip(t,e,"out"))}me([zn(Cp)],Tp.prototype,"__",void 0),me([wn()],Tp.prototype,"robot",void 0),me([pn()],Tp.prototype,"actions",void 0),me([pn("")],Tp.prototype,"action",void 0),me([Cn(0)],Tp.prototype,"now",void 0),me([pn(12)],Tp.prototype,"FPS",void 0),me([pn(!0)],Tp.prototype,"loop",void 0),Tp=me([Qn()],Tp),le.add("robot");const Mp={};function Ip(t,e,i){const{normalStyle:s}=t;e||(e=Mp),e.scale&&(D.assignScale(e,e.scale),delete e.scale),e!==Mp&&ll.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=zp(e,t),s=t.animate();s&&zp(i,t,s.fromStyle);return i}(t,e):void 0;ll.canAnimate&&Wp(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Wp(t);if(a){const{animation:s}=a;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(a,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete a.animation}t.normalStyle=Np(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=Np(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Wp(t){let e;const i={},s=Op(t),r=s?t.state||s.state:t.state,n=r&&t.states[r];n&&ll.isState(r,t,s)&&(e=Yp(i,n));const o=i.selectedStyle||t.selectedStyle;o&&ll.isSelected(t,s)&&(e=Yp(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&ll.isPlacehold(t,s)&&(e=Yp(i,a)),ll.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Yp(i,s))}else{const r=i.focusStyle||t.focusStyle;r&&ll.isFocus(t,s)&&(e=Yp(i,r));const n=i.hoverStyle||t.hoverStyle;n&&ll.isHover(t,s)&&(e=Yp(i,n));const o=i.pressStyle||t.pressStyle;o&&ll.isPress(t,s)&&(e=Yp(i,o))}return e?i:void 0}function Np(t,e,i,s){const r=i?t:{},n=i||t;for(let t in n)s&&ll.animateExcludes[t]||(r[t]=e[t]);return r}function zp(t,e,i){return Np(t,e,i,!0)}function Yp(t,e){return Object.assign(t,e),!0}function Xp(t,e){const i=t[e];i&&Dp(t,i),t.button&&Up(t.children,e)}function Hp(t,e,i){i||(i=t.states[e]),Dp(t,i),t.button&&Up(t.children,null,e)}function Up(t,e,i){if(!t)return;let r,n;for(let o=0,a=t.length;o<a;o++){if(r=t[o],e){switch(n=!0,e){case"hoverStyle":ll.isHover(r)&&(n=!1);break;case"pressStyle":ll.isPress(r)&&(n=!1);break;case"focusStyle":ll.isFocus(r)&&(n=!1)}n&&Xp(r,e)}else s(i)||Hp(r,i);r.isBranch&&Up(r.children,e,i)}}function jp(t,e){const i=t[e];i&&Fp(t,i),t.button&&Vp(t.children,e)}function qp(t,e,i){Fp(t,i),t.button&&Vp(t.children,null,e)}function Vp(t,e,i){if(!t)return;let r;for(let n=0,o=t.length;n<o;n++)r=t[n],e?jp(r,e):s(i)||qp(r,i),r.isBranch&&Vp(r.children,e,i)}function Gp(t,e,i){let s;const r=e.leafer?e.leafer.interaction:null;if(r&&(s=r[t](e),!s&&i)){const n=Op(e,i);n&&(s=r[t](n))}return s}function Kp(t,e,i){let s=e[t];if(!s&&i){const r=Op(e,i);r&&(s=r[t])}return s}le.add("state"),ll.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},ll.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const r=Op(e,i);r&&(s=r.states[t])}return!!s}(t,e,i)},ll.isSelected=function(t,e){return Kp("selected",t,e)},ll.isDisabled=function(t,e){return Kp("disabled",t,e)},ll.isFocus=function(t,e){return Gp("isFocus",t,e)},ll.isHover=function(t,e){return Gp("isHover",t,e)},ll.isPress=function(t,e){return Gp("isPress",t,e)},ll.isPlacehold=function(t,e){return t.__.__isPlacehold},ll.isDrag=function(t,e){return Gp("isDrag",t,e)},ll.setStyleName=function(t,e,i){i?Hp(t,e,t[e]):qp(t,e,t[e])},ll.set=function(t,e){const i=t.states[e];i?Hp(t,e,i):qp(t,e,i)},ll.getStyle=Wp,ll.updateStyle=Ip,ll.updateEventStyle=function(t,e){switch(e){case sc.ENTER:Xp(t,"hoverStyle");break;case sc.LEAVE:jp(t,"hoverStyle");break;case sc.DOWN:Xp(t,"pressStyle");break;case sc.UP:jp(t,"pressStyle")}};const Qp=Xl.prototype;Xl.addAttr("selected",!1,Lp,"selectedStyle"),Xl.addAttr("disabled",!1,Lp,"disabledStyle"),Xl.addAttr("states",{},Ap),Xl.addAttr("state","",Lp),Xl.addAttr("normalStyle",void 0,pn),Xl.addAttr("hoverStyle",void 0,Ap),Xl.addAttr("pressStyle",void 0,Ap),Xl.addAttr("focusStyle",void 0,Ap),Xl.addAttr("selectedStyle",void 0,Ap),Xl.addAttr("disabledStyle",void 0,Ap),Xl.addAttr("placeholderStyle",void 0,Ap),Xl.addAttr("button",!1,pn),Qp.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Qp.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Xp(this,"focusStyle"):jp(this,"focusStyle")})},Qp.updateState=function(){ll.updateStyle(this,void 0,"in")};const Jp=Md.prototype,Zp="text";hn(Jp,Zp,Object.assign(Object.assign({},ln(Jp,Zp)),{set(t){const e=this,i=e.text;e.__setAttr(Zp,t)&&(bn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:$p,sin:tg,pow:eg,sqrt:ig,abs:sg,ceil:rg,floor:ng,round:og,PI:ag}=Math,hg=5*ag,lg=1.70158,dg=2.5949095,cg=7.5625,ug=2.75;function _g(t){return e=>eg(e,t)}function pg(t){return e=>1-eg(1-e,t)}function gg(t){return e=>e<.5?.5*eg(2*e,t):1-.5*eg(2-2*e,t)}function fg(t){return t<1/ug?cg*t*t:t<2/ug?cg*(t-=1.5/ug)*t+.75:t<2.5/ug?cg*(t-=2.25/ug)*t+.9375:cg*(t-=2.625/ug)*t+.984375}function yg(t,e,i,s){const r={};return n=>{const o=~~(1e4*n),a=r[o];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=mg(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(sg(l)<1e-6));e++)c-=d/l;return r[o]=mg(c,e,s)}}function mg(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const vg={get(t){const{list:e}=vg;return n(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){vg.list[t]=e},list:{linear:t=>t,ease:yg(.25,.1,.25,1),"ease-in":yg(.42,0,1,1),"ease-out":yg(0,0,.58,1),"ease-in-out":yg(.42,0,.58,1),"sine-in":t=>1-$p(t*ag*.5),"sine-out":t=>tg(t*ag*.5),"sine-in-out":t=>.5*(1-$p(t*ag)),"quad-in":_g(2),"quad-out":pg(2),"quad-in-out":gg(2),"cubic-in":_g(3),"cubic-out":pg(3),"cubic-in-out":gg(3),"quart-in":_g(4),"quart-out":pg(4),"quart-in-out":gg(4),"quint-in":_g(5),"quint-out":pg(5),"quint-in-out":gg(5),"expo-in":t=>t?eg(2,10*t-10):0,"expo-out":t=>1===t?1:1-eg(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*eg(2,2*t*10-10):.5*(2-eg(2,10-2*t*10)),"circ-in":t=>1-ig(1-eg(t,2)),"circ-out":t=>ig(1-eg(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-ig(1-eg(2*t,2))):.5*(ig(1-eg(2-2*t,2))+1),"back-in":t=>((lg+1)*t-lg)*t*t,"back-out":t=>(t-=1)*t*((lg+1)*t+lg)+1,"back-in-out":t=>t<.5?(t*=2)*t*((dg+1)*t-dg)*.5:.5*((t=2*t-2)*t*((dg+1)*t+dg)+2),"elastic-in":t=>0===t||1===t?t:-eg(2,10*(t-1))*tg((t-1.1)*hg),"elastic-out":t=>0===t||1===t?t:eg(2,-10*t)*tg((t-.1)*hg)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-eg(2,10*((t*=2)-1))*tg((t-1.1)*hg)*.5:eg(2,10*(1-(t*=2)))*tg((t-1.1)*hg)*.5+1,"bounce-in":t=>1-fg(1-t),"bounce-out":fg,"bounce-in-out":t=>t<.5?.5*(1-fg(1-2*t)):.5*(1+fg(2*t-1)),"cubic-bezier":yg,steps:function(t,e="floor"){return i=>("floor"===e?ng(i*t):"ceil"===e?rg(i*t):og(i*t))/t}}};function wg(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class xg{}xg.CREATED="created",xg.PLAY="play",xg.PAUSE="pause",xg.STOP="stop",xg.SEEK="seek",xg.UPDATE="update",xg.COMPLETED="completed";let bg=class extends ha{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:r}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&r&&a(r)&&(t+=r-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:r,attrs:n}=this;this.easingFn=vg.get(r),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(xg.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(xg.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(xg.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=el.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(xg.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:r}=this,{length:n}=i,o=!(n>1)||this.join;let h,l,d,c,u,_=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let r=0;r<n;r++){if(l=i[r],c=l.style||l,h||(h=o?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:r,swing:n,loop:o}=l;n&&(d.swing=a(n)?n:2,u=2*d.swing-1),o&&(d.loop=u=a(o)?o:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),r&&(d.easingFn=vg.get(r))}if(!d.autoDuration&&s(d.duration)&&(n>1?r>0||o?p+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=_||!r||!r.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(xg.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:r,toStyle:n,target:o}=this;for(let a in e)s(r[a])&&(r[a]=n[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=s(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:r}=i;for(let n=0;n<r;n++)e=i[n],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,$t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(xg.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,r=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(r);else{const{attrsMap:i,target:n}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),dl.setBetweenStyle(o,s,r,e,t,n,i),this.setStyle(o)}this.emitType(xg.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return a(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};me([wg("ease")],bg.prototype,"easing",void 0),me([wg(0)],bg.prototype,"delay",void 0),me([wg(.2)],bg.prototype,"duration",void 0),me([wg("auto")],bg.prototype,"ending",void 0),me([wg(!1)],bg.prototype,"reverse",void 0),me([wg(!1)],bg.prototype,"swing",void 0),me([wg(!1)],bg.prototype,"loop",void 0),me([wg(0)],bg.prototype,"loopDelay",void 0),me([wg(1)],bg.prototype,"speed",void 0),me([wg(!0)],bg.prototype,"autoplay",void 0),me([wg()],bg.prototype,"join",void 0),me([wg()],bg.prototype,"jump",void 0),me([wg()],bg.prototype,"attrs",void 0),bg=me([Kn(va)],bg);let Sg=class extends bg{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new bg(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(xg.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(xg.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(xg.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(xg.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case xg.COMPLETED:this.completed&&this.emitType(t);break;case xg.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};Sg=me([Kn(va)],Sg);const kg={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Bg=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Pg=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Rg=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Eg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Cg=parseInt,Tg=parseFloat,{round:Lg}=Math;let Ag={},Og=0;function Dg(t){let e,i,s,r=1;switch(t.length){case 9:e=Cg(t.slice(1,3),16),i=Cg(t.slice(3,5),16),s=Cg(t.slice(5,7),16),r=Cg(t.slice(7,9),16)/255;break;case 7:e=Cg(t.slice(1,3),16),i=Cg(t.slice(3,5),16),s=Cg(t.slice(5,7),16);break;case 5:e=Cg(t[1]+t[1],16),i=Cg(t[2]+t[2],16),s=Cg(t[3]+t[3],16),r=Cg(t[4]+t[4],16)/255;break;case 4:e=Cg(t[1]+t[1],16),i=Cg(t[2]+t[2],16),s=Cg(t[3]+t[3],16);break;case 3:e=i=s=Cg(t[1]+t[2],16);break;case 2:e=i=s=Cg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:r}}const Fg=1/6,Mg=.5,Ig=2/3,Wg=1/3;function Ng(t,e,i){return i<0?i++:i>1&&i--,i<Fg?t+6*(e-t)*i:i<Mg?e:i<Ig?t+(e-t)*(Ig-i)*6:t}function zg(t,e,i,s=1){let r,n,o;if(t/=360,i/=100,0===(e/=100))r=n=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;r=Ng(a,s,t+Wg),n=Ng(a,s,t),o=Ng(a,s,t-Wg)}return{r:Lg(255*r),g:Lg(255*n),b:Lg(255*o),a:s}}le.add("color"),tl.object=function(t,e){let i,r=!s(e)&&e<1;if(n(t)){const e=Ag[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Dg(t);break;case"R":case"r":"("===t[4]&&Pg.test(t)?i=function(t){const e=Pg.exec(t);return{r:Cg(e[1]),g:Cg(e[2]),b:Cg(e[3]),a:Tg(e[4])}}(t):"("===t[3]&&Bg.test(t)&&(i=function(t){const e=Bg.exec(t);return{r:Cg(e[1]),g:Cg(e[2]),b:Cg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Eg.test(t)?i=function(t){const e=Eg.exec(t);return zg(Tg(e[1]),Tg(e[2]),Tg(e[3]),Tg(e[4]))}(t):"("===t[3]&&Rg.test(t)&&(i=function(t){const e=Rg.exec(t);return zg(Tg(e[1]),Tg(e[2]),Tg(e[3]),1)}(t))}if(!i){const e=kg[t.toLowerCase()];e&&(i=Dg("#"+e))}i&&(Og++,Og>1e4&&(Ag={},Og=0),Ag[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),r&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),r&&(i.a*=e),i};const{round:Yg}=Math,{fourNumber:Xg}=D,Hg={fill:Gg,stroke:Gg,cornerRadius:(t,e,i)=>a(t)&&a(e)?qg(t,e,i):(t=Xg(t),e=Xg(e),t.map((t,s)=>qg(t,e[s],i))),text(t,e,i){if(n(t)&&n(e)){const s=t.length,r=e.length,n=qg(s,r,i,1);return s<r?e.substring(0,n):t.substring(0,n)}return a(t)||a(e)?D.float(qg(t,e,i),Math.max(jg(t),jg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const r=Object.assign(Object.assign({},t),e);return dl.setBetweenStyle(r,t,e,r,i,s),r},shadow:Kg,innerShadow:Kg},Ug={value:function(t,e,i){const s=a(t),r=a(e);return s&&r?t+(e-t)*i:r||s?qg(t,e,i):t},number:qg,color:Vg,setBetweenStyle:function(t,e,i,s,r,n,o){let a,h,l;const{list:d,value:c}=dl;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,r,n)))}};function jg(t){const e=String(t).split(".")[1];return e?e.length:0}function qg(t,e,i,s){t||(t=0),e||(e=0);const r=t+(e-t)*i;return s?Yg(r):r}function Vg(t,e,i){t=tl.object(t),e=tl.object(e);const s=qg(t.r,e.r,i,1)+","+qg(t.g,e.g,i,1)+","+qg(t.b,e.b,i,1),r=qg(t.a,e.a,i);return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}function Gg(t,e,i){return n(t)&&n(e)?Vg(t,e,i):e}function Kg(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:qg((t=t||{}).x,e.x,i),y:qg(t.y,e.y,i),blur:qg(t.blur,e.blur,i),spread:qg(t.spread,e.spread,i),color:Vg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}le.add("animate","color"),ll.canAnimate=!0,Object.assign(dl.list,Hg),Object.assign(dl,Ug);const Qg=Xl.prototype;Xl.addAttr("animation",void 0,function(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Xl.addAttr("animationOut",void 0,pn),Xl.addAttr("transition",!0,pn),Xl.addAttr("transitionOut",void 0,pn),Qg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Qg.animate=function(t,e,i,r){if(s(t))return this.__animate;let n=d(t)&&!e&&i?new Sg(this,t,r):new bg(this,t,e,r);this.killAnimate(i,n.toStyle);const o=this.__animate;return o&&(n instanceof Sg?n.list.unshift(o):n=new Sg(this,[o,n])),this.__animate=n},Qg.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Sg&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Qg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(xg.COMPLETED,e)};const Jg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Zg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:$g}=Math,{getDerivative:tf}=li,ef={getDistance(t,e,i,s,r,n,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<Jg.length;h++)l=f*(1+Jg[h]),d=f*(1-Jg[h]),c=tf(l,t,i,r,o),u=tf(l,e,s,n,a),_=tf(d,t,i,r,o),p=tf(d,e,s,n,a),g+=Zg[h]*($g(c*c+u*u)+$g(_*_+p*p));return g*f},getRotation(t,e,i,s,r,n,o,a,h){const l=tf(t,e,s,n,a),d=tf(t,i,r,o,h);return Math.atan2(d,l)/M},getT(t,e,i,s,r,n,o,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)sf(i,s,r,n,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,r,n,o,a,h,l){const d=1-e,c=d*i+e*r,u=d*s+e*n,_=d*r+e*o,p=d*n+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*o+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(Me.C,c,u,g,f,y,m)}},{getDistance:sf}=ef,{M:rf,L:nf,C:of,Z:af}=Me,{float:hf}=D,lf={},df={},cf={transform(t,e){let i,s=0;const r=t.length;for(;s<r;)switch(i=t[s],i){case rf:case nf:cf.transformPoints(t,e,s,1),s+=3;break;case of:cf.transformPoints(t,e,s,3),s+=7;break;case af:s+=1}},transformPoints(t,e,i,s){for(let r=i+1,n=r+2*s;r<n;r+=2)lf.x=t[r],lf.y=t[r+1],K.toOuterPoint(e,lf),t[r]=lf.x,t[r+1]=lf.y},getMotionPathData(t){let e,i,s,r,n=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(r=t[a],r){case rf:case nf:i=t[a+1],s=t[a+2],e=r===nf&&a>0?at.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case of:i=t[a+5],s=t[a+6],e=ef.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case af:a+=1;default:e=0}o.push(e),n+=e}return{total:n,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:r}=t;e=el.number(e,t.total);let n,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=r.length;for(;f<w;){switch(h=r[f],h){case rf:case nf:if(o=r[f+1],a=r[f+2],n=s[y],p+n>=e||!t.total)return f||(m=o,v=a),df.x=m,df.y=v,g.x=o,g.y=a,at.getDistancePoint(df,g,e-p,!0),g.rotation=at.getAngle(df,g),g;m=o,v=a,f+=3;break;case of:if(o=r[f+5],a=r[f+6],n=s[y],p+n>=e)return l=r[f+1],d=r[f+2],c=r[f+3],u=r[f+4],_=ef.getT(e-p,n,m,v,l,d,c,u,o,a,i),li.getPointAndSet(_,m,v,l,d,c,u,o,a,g),g.rotation=ef.getRotation(_,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case af:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:r}=t,n=[];e=el.number(e,t.total);let o,a,h,l,d,c,u,_,p,g,f=0,y={},m=0,v=0,w=0,x=0;const b=r.length;for(;m<b;){switch(d=r[m],d){case rf:case nf:if(h=r[m+1],l=r[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),df.x=w,df.y=x,y.x=h,y.y=l,a=hf(e-f),a&&(at.getDistancePoint(df,y,a,!0),n.push(d,y.x,y.y)),n;w=h,x=l,m+=3,n.push(d,w,x);break;case of:if(c=r[m+1],u=r[m+2],_=r[m+3],p=r[m+4],h=r[m+5],l=r[m+6],o=s[v],f+o>e)return a=hf(e-f),a&&(g=ef.getT(a,o,w,x,c,u,_,p,h,l,i),ef.cut(n,g,w,x,c,u,_,p,h,l)),n;w=h,x=l,m+=7,n.push(d,c,u,_,p,h,l);break;case af:m+=1,n.push(d);default:o=0}v++,f+=o}return n}};function uf(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}le.add("motion-path"),dl.register("motion",function(t,e,i,s){return c(t)&&(t=el.number(t,s.getMotionTotal())),c(e)&&(e=el.number(e,s.getMotionTotal())),dl.number(t||0,e||0,i)}),dl.register("motionRotation",function(t,e,i){return dl.number(t,e,i)});const _f=Xl.prototype,{updateMatrix:pf,updateAllMatrix:gf}=lo,{updateBounds:ff}=bo;function yf(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=vf(t);i.total&&(t.__.__pathForRender=cf.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(gf(t),ff(t,t)):pf(t));i&&(t.leafer.created=!0)}}function mf(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function vf(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=cf.getMotionPathData(t.getPath(!0,!0))}Xl.addAttr("motionPath",void 0,uf),Xl.addAttr("motionPrecision",1,uf),Xl.addAttr("motion",void 0,uf),Xl.addAttr("motionRotation",!0,uf),_f.getMotionPathData=function(){return vf(mf(this))},_f.getMotionPoint=function(t){const e=mf(this),i=vf(e);if(!i.total)return{};const s=cf.getDistancePoint(i,t,e.motionPrecision);K.toOuterPoint(e.localTransform,s);const{motionRotation:r}=this;return!1===r?delete s.rotation:a(r)&&(s.rotation+=r),s},_f.getMotionTotal=function(){return this.getMotionPathData().total},_f.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),yf(t))}else yf(this)};const{Yes:wf,NoAndSkip:xf,YesAndSkip:bf}=e,Sf={},kf={},Bf={};class Pf{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,r){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Sf.id=t.substring(1),t=Sf;break;case".":kf.className=t.substring(1),t=kf;break;default:Bf.tag=t,t=Bf}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,r=d(s);return this.getByMethod(r?this.methods.tags:this.methods.tag,e,i,r?p.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,r)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&lo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const r=i?null:[];return this.eachFind(this.toChildren(e),t,r,s),r||this.findLeaf}eachFind(t,e,i,s){let r,n;for(let o=0,a=t.length;o<a;o++){if(r=t[o],n=e(r,s),"boolean"==typeof n&&(n=n?1:0),n===wf||n===bf){if(!i)return void(this.findLeaf=r);i.push(r)}r.isBranch&&n<xf&&this.eachFind(r.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(zo.REMOVE,this.__onRemoveChild,this),this.target.on_(Xo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Rf=Xl.prototype;function Ef(t){return t.leafer?t.leafer.selector:$t.selector||($t.selector=de.selector())}Rf.find=function(t,e){return Ef(this).getBy(t,this,!1,e)},Rf.findOne=function(t,e){return Ef(this).getBy(t,this,!0,e)},le.add("find"),de.finder=function(t){return new Pf(t)};export{Bt as AlignHelper,bg as Animate,vg as AnimateEasing,xg as AnimateEvent,Sg as AnimateList,e as Answer,Nd as App,bt as AroundHelper,Gt as AutoBounds,li as BezierHelper,qt as Bounds,jo as BoundsEvent,Xt as BoundsHelper,$l as Box,wl as BoxData,bh as Branch,bo as BranchHelper,za as BranchRender,Td as Canvas,Ol as CanvasData,ye as CanvasManager,zo as ChildEvent,tl as ColorConvert,de as Creator,Oc as Cursor,p as DataHelper,ie as Debug,vt as Direction4,wt as Direction9,ec as DragBoundsHelper,oc as DragEvent,bc as Dragger,hc as DropEvent,ol as Effect,rd as Ellipse,Bl as EllipseData,mi as EllipseHelper,No as Event,ge as EventCreator,ha as Eventer,hl as Export,Gr as FileHelper,al as Filter,Pf as Finder,k as FourNumberHelper,td as Frame,bl as FrameData,Hl as Group,vl as GroupData,ef as HighBezierHelper,cf as HighCurveHelper,Dc as HitCanvasManager,Ed as Image,Al as ImageData,Uo as ImageEvent,sn as ImageManager,y as IncrementId,Ac as InteractionBase,fc as InteractionHelper,gc as KeyEvent,Yd as Keyboard,$o as LayoutEvent,Yh as Layouter,uh as Leaf,Ma as LeafBounds,mo as LeafBoundsHelper,f as LeafData,xa as LeafDataProxy,va as LeafEventer,lo as LeafHelper,Wo as LeafLayout,kh as LeafLevelList,Sh as LeafList,Ea as LeafMatrix,Ia as LeafRender,ql as Leafer,Ph as LeaferCanvas,Oe as LeaferCanvasBase,xl as LeaferData,ea as LeaferEvent,an as LeaferImage,Rd as Line,Sl as LineData,D as MathHelper,gt as Matrix,K as MatrixHelper,lc as MoveEvent,ac as MyDragEvent,Cd as MyImage,rc as MyPointerEvent,cc as MyTouchEvent,We as NeedConvertToCanvasCommandMap,M as OneRadian,I as PI2,W as PI_2,sl as Paint,nl as PaintGradient,rl as PaintImage,Id as Path,il as PathArrow,Mr as PathBounds,Ps as PathCommandDataHelper,Me as PathCommandMap,vi as PathCommandNodeHelper,ss as PathConvert,Hr as PathCorner,Hs as PathCreator,El as PathData,rr as PathDrawer,De as PathHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Wd as Pen,Cl as PenData,Vh as Picker,$t as Platform,le as Plugin,_t as Point,at as PointHelper,Xd as PointerButton,sc as PointerEvent,ud as Polygon,Pl as PolygonData,Xo as PropertyEvent,Vl as Rect,kl as RectData,He as RectHelper,zl as RectRender,ta as RenderEvent,Hh as Renderer,Jo as ResizeEvent,tn as Resource,Tp as Robot,Cp as RobotData,uc as RotateEvent,oe as Run,Gh as Selector,vd as Star,Rl as StarData,ll as State,Qt as StringNumberMap,_c as SwipeEvent,Jr as TaskItem,Zr as TaskProcessor,Md as Text,$h as TextConvert,Ll as TextData,dc as TouchEvent,dl as Transition,yt as TwoPointBoundsHelper,Xl as UI,Ml as UIBounds,ue as UICreator,yl as UIData,Hd as UIEvent,Wl as UIRender,el as UnitConvert,Kt as UnitConvertHelper,Eo as WaitHelper,Zo as WatchEvent,Th as Watcher,pc as ZoomEvent,En as affectRenderBoundsType,Bn as affectStrokeBoundsType,un as attr,yn as autoLayoutType,wn as boundsType,Vr as canvasPatch,Ae as canvasSizeAttrs,Zh as createAttr,dn as createDescriptor,Nn as cursorType,zn as dataProcessor,pn as dataType,cn as decorateLeafAttr,Xn as defineDataProcessor,hn as defineKey,_n as defineLeafAttr,Tn as dimType,bn as doBoundsType,Pn as doStrokeType,Kh as effectType,i as emptyData,In as eraserType,Ho as extraPropertyEventMap,z as getBoundsData,ln as getDescriptor,Y as getMatrixData,N as getPointData,Wn as hitType,d as isArray,u as isData,_ as isEmptyData,o as isFinite,r as isNull,a as isNumber,c as isObject,n as isString,s as isUndefined,Yn as layoutProcessor,oa as leaferTransformAttrMap,Mn as maskType,uf as motionPathType,xn as naturalBoundsType,Ln as opacityType,Ur as path,Sn as pathInputType,kn as pathType,jr as pen,gn as positionType,Qn as registerUI,Jn as registerUIEvent,Qh as resizeType,qn as rewrite,Vn as rewriteAble,vn as rotationType,mn as scaleType,fn as scrollType,Fn as sortType,Ap as stateStyleType,Lp as stateType,Rn as strokeType,Cn as surfaceType,Vt as tempBounds,ft as tempMatrix,pt as tempPoint,l as tryToNumber,Eh as useCanvas,Kn as useModule,Bh as version,An as visibleType,Jh as zoomLayerType};
1
+ var t,e;function i(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function s(t,e,i,s){return new(i||(i=Promise))(function(r,n){function o(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const r={};function n(t){return void 0===t}function o(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,o;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return y(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&y(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=f;class m{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(!n(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=n(i)?this[s]: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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(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:s}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!n(t))){if("path"===r&&!this.__pathInputed)continue;e=s?s[r]:void 0,i[r]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:o}}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 x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=x;let w,b,S;const{max:k}=Math,B=[0,0,0,0],P={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>R(B,t,e,i,s),toTempAB(t,e,i){S=i?l(t)?e:t:[],l(t)?(w=C(t),b=e):l(e)?(w=t,b=C(e)):(w=t,b=e),4!==w.length&&(w=E(w)),4!==b.length&&(b=E(b))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=n(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]),!n(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?k(t,e):(T(t,e,i),R(S,k(w[0],b[0]),k(w[1],b[1]),k(w[2],b[2]),k(w[3],b[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(T(t,e,i),R(S,w[0]+b[0],w[1]+b[1],w[2]+b[2],w[3]+b[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,o,a,h]=4===t.length?t:E(t);return R(r,a*i,h*e,n*i,o*e)}},{set:R,get:E,setTemp:C,toTempAB:T}=P,{round:L,pow:A,max:O,floor:D,PI:F}=Math,M={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber:P.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,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=n(e)?1e12:A(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,r=(l(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(D(t),e)/t,randInt:I,randColor:t=>`rgba(${I(255)},${I(255)},${I(255)},${t||1})`};function I(t){return Math.round(Math.random()*t)}const W=F/180,N=2*F,z=F/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:j,acos:q,sqrt:V}=Math,{float:G}=M,K={};function J(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,o=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=o},get:H,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Z.toInnerPoint(t,e,K),Z.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){Z.translateInner(t,e.x,e.y),Z.scale(t,i,s),Z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=j(e*=W),a=U(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,i){Z.toInnerPoint(t,e,K),Z.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){Z.translateInner(t,e.x,e.y),Z.rotate(t,i),Z.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=W,t.a=s+n*i,t.b=r+o*i),e&&(e*=W,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){Z.toInnerPoint(t,e,K),Z.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){Z.translateInner(t,e.x,e.y),Z.skew(t,i,s),Z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:o,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+o,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,r){const{e:o,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Z.multiply(t,Z.tempInvert(e))},divideParent(t,e){Z.multiplyParent(t,Z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Z;return Z.copy(e,t),Z.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:o}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*r-o*s)*a,t.f=-(o*e-n*i)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(n(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:r}=e,n=i*W,o=j(n),a=U(n);if(s||r){const e=s*W,i=r*W;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&Z.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?q(e):-q(e)}else{c=V(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?q(-e):-q(e))}const e=G(j(u)),i=U(u);d=G(d),c=G(c),_=e?G((o/c+i)/e/W,9):0,p=e?G((n/d-i)/e/W,9):0,u=G(u/W)}else d=r,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:o}=t;r||n?i=(s*o-r*n)/(e=V(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){Z.set(t)}},Z=Q,{float:$}=M,{toInnerPoint:tt,toOuterPoint:et}=Q,{sin:it,cos:st,abs:rt,sqrt:nt,atan2:ot,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=n(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=W),r=it(e),n=t.x-i.x,o=t.y-i.y;t.x=i.x+n*s-o*r,t.y=i.y+n*r+o*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),_t(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},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)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=rt(i-t),n=rt(s-e);return nt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>at(ct(t,e,i,s),ct(i,s,r,n)),getAngle:(t,e)=>pt(t,e)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,r,o,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=pt(t,e);return r&&(t=e),s||(e={}),e.x=t.x+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return _(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){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:_t,getAtan2:pt}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new gt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const ft=new gt;class yt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return _(t)?Q.copy(this,t):Q.set(this,t,e,i,s,r,n),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new yt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const mt=new yt,xt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){vt(t,e,i),vt(t,e+s,i+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:vt}=xt;var wt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(bt||(bt={}));const St=[{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}];St.forEach(t=>t.type="percent");const kt={directionData:St,tempPoint:{},get:Bt,toPoint(t,e,i,s,r,n){const o=Bt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),o.x&&(i.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(i.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),kt.toPoint(t,e,i,!0),i)};function Bt(t){return a(t)?St[bt[t]]:t}const{toPoint:Pt}=kt,Rt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:Et,setPoint:Ct,addPoint:Tt,toBounds:Lt}=xt,{toOuterPoint:At}=Q,{float:Ot,fourNumber:Dt}=M,{floor:Ft,ceil:Mt}=Math;let It,Wt,Nt,zt;const Yt={},Xt={},Ht={},Ut={tempBounds:Ht,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,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,i,s,r){const{x:n,y:o,width:a,height:h}=e;if(u(i)){const e=Dt(i);s?jt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,n-i,o-i,a+2*i,h+2*i);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Ht,t),jt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:o}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=o+t.y*r):(i.height=t.height*-r,i.y=o+t.y*r-i.height)}else Yt.x=t.x,Yt.y=t.y,At(e,Yt,Xt),Ct(Et,Xt.x,Xt.y),Yt.x=t.x+t.width,At(e,Yt,Xt),Tt(Et,Xt.x,Xt.y),Yt.y=t.y+t.height,At(e,Yt,Xt),Tt(Et,Xt.x,Xt.y),Yt.x=t.x,At(e,Yt,Xt),Tt(Et,Xt.x,Xt.y),Lt(Et,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),a(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Ht.width=r?e.width*=s:e.width*s,Ht.height=r?e.height*=s:e.height*s,Rt.toPoint(i,Ht,t,n,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ft(t.x),t.y=Ft(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Ot(t.x,e),t.y=Ot(t.y,e),t.width=Ot(t.width,e),t.height=Ot(t.height,e)},add(t,e,i){It=t.x+t.width,Wt=t.y+t.height,Nt=e.x,zt=e.y,i||(Nt+=e.width,zt+=e.height),It=It>Nt?It:Nt,Wt=Wt>zt?Wt:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=It-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=i?i(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||Vt(t,r)):qt(t,r));n&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Et,t.x,t.y):Tt(Et,t.x,t.y)),Lt(Et,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){qt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=jt.tempToOuterOf(e,i)),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,i){if(i&&(e=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:o}=e;return It=s+n,Wt=r+o,Nt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,It=It<Nt?It:Nt,Wt=Wt<zt?Wt:zt,n=It-s,o=Wt-r,{x:s,y:r,width:n,height:o}},intersect(t,e,i){jt.copy(t,jt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Ut,{add:qt,copy:Vt}=jt;class Gt{get minX(){return Ut.minX(this)}get minY(){return Ut.minY(this)}get maxX(){return Ut.maxX(this)}get maxY(){return Ut.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Ut.copy(this,t):Ut.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Ut.move(this,t,e),this}scale(t,e,i){return Ut.scale(this,t,e,i),this}scaleOf(t,e,i){return Ut.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ut.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ut.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ut.getFitMatrix(this,t,e)}put(t,e,i){Ut.put(this,t,e,i)}spread(t,e){return Ut.spread(this,t,e),this}shrink(t,e){return Ut.shrink(this,t,e),this}ceil(){return Ut.ceil(this),this}unsign(){return Ut.unsign(this),this}float(t){return Ut.float(this,t),this}add(t){return Ut.add(this,t),this}addList(t){return Ut.setList(this,t,!0),this}setList(t){return Ut.setList(this,t),this}addListWithFn(t,e){return Ut.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ut.setListWithFn(this,t,e),this}setPoint(t){return Ut.setPoint(this,t),this}setPoints(t){return Ut.setPoints(this,t),this}addPoint(t){return Ut.addPoint(this,t),this}getPoints(){return Ut.getPoints(this)}hitPoint(t,e){return Ut.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ut.hitRadiusPoint(this,t,e)}hit(t,e){return Ut.hit(this,t,e)}includes(t,e){return Ut.includes(this,t,e)}intersect(t,e){return Ut.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Ut.getIntersectData(this,t,e))}isSame(t){return Ut.isSame(this,t)}isEmpty(){return Ut.isEmpty(this)}reset(){Ut.reset(this)}}const Kt=new Gt;class Jt{constructor(t,e,i,s,r,n){_(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=t;this.set(e,i,s,r,n,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=this;return new Gt(r,e,n||t.width-r-i,o||t.height-e-s)}}const Qt={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Zt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:$t,max:te}=Math,ee={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,o,a,h,l){const d=te($t(e+(s||0)),1),c=te($t(i+(r||0)),1);let u,_,p;l&&(p=Qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=ee.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(n){const s=e/n.width,r=i/n.height;f.setTransform(s,0,0,r,-n.x*s,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&f.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=M;class re{constructor(t){this.repeatMap={},this.name=t}static get(t){return new re(t)}static set filter(t){this.filterList=ne(t)}static set exclude(t){this.excludeList=ne(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===re.showBounds,r=t.__nowWorld,n=se();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ne(t){return t?a(t)&&(t=[t]):t=[],t}re.filterList=[],re.excludeList=[],re.showWarn=!0;const oe=re,ae=re.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,r,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];n(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},_e=re.get("UICreator"),pe={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&_e.repeat(e),ge[e]=t},get(t,e,i,s,r,o){if(!ge[t])return void _e.warn("not register "+t);const a=new ge[t](e);return n(i)||(a.x=i,s&&(a.y=s),r&&(a.width=r),o&&(a.height=o)),a}},{list:ge}=pe,fe=re.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(me[e]&&fe.repeat(e),me[e]=t)})},changeName(t,e){const i=me[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,me[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new me[t](...e)},{nameList:me}=ye;class xe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const we=[];function be(){return(t,e)=>{we.push(e)}}const Se=[];let ke=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};i([ve("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),i([ve("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),i([ve("globalAlpha")],ke.prototype,"opacity",void 0),i([ve()],ke.prototype,"fillStyle",void 0),i([ve()],ke.prototype,"strokeStyle",void 0),i([ve("lineWidth")],ke.prototype,"strokeWidth",void 0),i([ve("lineCap")],ke.prototype,"strokeCap",void 0),i([ve("lineJoin")],ke.prototype,"strokeJoin",void 0),i([ve("lineDashOffset")],ke.prototype,"dashOffset",void 0),i([ve()],ke.prototype,"miterLimit",void 0),i([ve()],ke.prototype,"shadowBlur",void 0),i([ve()],ke.prototype,"shadowColor",void 0),i([ve()],ke.prototype,"shadowOffsetX",void 0),i([ve()],ke.prototype,"shadowOffsetY",void 0),i([ve()],ke.prototype,"filter",void 0),i([ve()],ke.prototype,"font",void 0),i([ve()],ke.prototype,"fontKerning",void 0),i([ve()],ke.prototype,"fontStretch",void 0),i([ve()],ke.prototype,"fontVariantCaps",void 0),i([ve()],ke.prototype,"textAlign",void 0),i([ve()],ke.prototype,"textBaseline",void 0),i([ve()],ke.prototype,"textRendering",void 0),i([ve()],ke.prototype,"wordSpacing",void 0),i([ve()],ke.prototype,"letterSpacing",void 0),i([ve()],ke.prototype,"direction",void 0),i([be()],ke.prototype,"setTransform",null),i([be()],ke.prototype,"resetTransform",null),i([be()],ke.prototype,"getTransform",null),i([be()],ke.prototype,"save",null),i([be()],ke.prototype,"restore",null),i([be()],ke.prototype,"translate",null),i([be()],ke.prototype,"scale",null),i([be()],ke.prototype,"rotate",null),i([be()],ke.prototype,"fill",null),i([be()],ke.prototype,"stroke",null),i([be()],ke.prototype,"clip",null),i([be()],ke.prototype,"fillRect",null),i([be()],ke.prototype,"strokeRect",null),i([be()],ke.prototype,"clearRect",null),i([be()],ke.prototype,"beginPath",null),i([be()],ke.prototype,"moveTo",null),i([be()],ke.prototype,"lineTo",null),i([be()],ke.prototype,"bezierCurveTo",null),i([be()],ke.prototype,"quadraticCurveTo",null),i([be()],ke.prototype,"closePath",null),i([be()],ke.prototype,"arc",null),i([be()],ke.prototype,"arcTo",null),i([be()],ke.prototype,"ellipse",null),i([be()],ke.prototype,"rect",null),i([be()],ke.prototype,"roundRect",null),i([be()],ke.prototype,"createConicGradient",null),i([be()],ke.prototype,"createLinearGradient",null),i([be()],ke.prototype,"createPattern",null),i([be()],ke.prototype,"createRadialGradient",null),i([be()],ke.prototype,"fillText",null),i([be()],ke.prototype,"measureText",null),i([be()],ke.prototype,"strokeText",null);const{copy:Be,multiplyParent:Pe,pixelScale:Re}=Q,{round:Ee}=Math,Ce=new Gt,Te=new Gt,Le={width:1,height:1,pixelRatio:1},Ae=["width","height","pixelRatio"];class Oe extends ke{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=Le),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||ee.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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,Ae),Ae.forEach(t=>s[t]||(s[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&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&Pe(t,e,r),Re(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(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,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(r=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Te):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ut.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Ce.x,Ce.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return r.save(),t&&(Be(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),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 De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=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},Fe),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},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ne=Object.assign(Object.assign({},We),Fe),ze=Me,Ye={};for(let t in ze)Ye[ze[t]]=t;const Xe={};for(let t in ze)Xe[ze[t]]=Ie[t];const He={drawRoundRect(t,e,i,s,r,n){const o=M.fourNumber(n,Math.min(s/2,r/2)),a=e+s,h=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ue,cos:je,hypot:qe,atan2:Ve,ceil:Ge,abs:Ke,PI:Je,sqrt:Qe,pow:Ze}=Math,{setPoint:$e,addPoint:ti}=xt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ri,C:ni,Q:oi,Z:ai}=Me,hi={},li={points(t,e,i,s){let r=ii(e);if(t.push(si,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y,m,x=r.length;const v=!0===i?.5:i;s&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let i=2;i<x-2;i+=2)e=r[i-2],n=r[i-1],o=r[i],a=r[i+1],h=r[i+2],l=r[i+3],p=o-e,g=a-n,f=Qe(Ze(p,2)+Ze(g,2)),y=Qe(Ze(h-o,2)+Ze(l-a,2)),(f||y)&&(m=f+y,f=v*f/m,y=v*y/m,h-=e,l-=n,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(p||g)&&t.push(ni,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(oi,u,_,r[x-2],r[x-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ri,r[e],r[e+1]);s&&t.push(ai)},rect(t,e,i,s,r){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){De.creator.path=[],He.drawRoundRect(De.creator,e,i,s,r,n),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,l,d){const c=s-e,u=r-i,_=n-s,p=o-r;let g=Ve(u,c),f=Ve(p,_);const y=qe(c,u),m=qe(_,p);let x=f-g;if(x<0&&(x+=N),y<1e-12||m<1e-12||x<1e-12||Ke(x-Je)<1e-12)return t&&t.push(ri,s,r),h&&($e(h,e,i),ti(h,s,r)),d&&ei(d,e,i),void(l&&ei(l,s,r));const v=c*p-_*u<0,w=v?-1:1,b=a/je(x/2),S=s+b*je(g+x/2+z*w),k=r+b*Ue(g+x/2+z*w);return g-=z*w,f-=z*w,ui(t,S,k,a,a,0,g/W,f/W,v,h,l,d)},arc:(t,e,i,s,r,n,o,a,h,l)=>ui(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,l,d,c){const u=n*W,_=Ue(u),p=je(u);let g=o*W,f=a*W;g>Je&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=Ge(Ke(y/z)),x=y/m,v=Ue(x/4),w=8/3*v*v/Ue(x/2);f=g+x;let b,S,k,B,P,R,E,C,T=je(g),L=Ue(g),A=k=p*s*T-_*r*L,O=B=_*s*T+p*r*L,D=e+k,F=i+B;t&&t.push(t.length?ri:si,D,F),l&&$e(l,D,F),c&&ei(c,D,F);for(let n=0;n<m;n++)b=je(f),S=Ue(f),k=p*s*b-_*r*S,B=_*s*b+p*r*S,P=e+A-w*(p*s*L+_*r*T),R=i+O-w*(_*s*L-p*r*T),E=e+k+w*(p*s*S+_*r*b),C=i+B+w*(_*s*S-p*r*b),t&&t.push(ni,P,R,E,C,e+k,i+B),l&&ci(e+A,i+O,P,R,E,C,e+k,i+B,l,!0),A=k,O=B,T=b,L=S,g=f,f+=x;d&&ei(d,e+k,i+B)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(ni,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,o,a)},toTwoPointBounds(t,e,i,s,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,v=i,w=r,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,v=s,w=n,b=a),c=-3*x+9*v-9*w+3*b,u=6*x-12*v+6*w,_=3*v-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?ti(h,t,e):$e(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,r,n,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*r+_*o+p*h},getPoint(t,e,i,s,r,n,o,a,h){const l={};return di(t,e,i,s,r,n,o,a,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:_i,cos:pi,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*W,p=_i(_),g=pi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,x=r*r,v=y*y,w=f*f,b=m*x-m*v-x*w;let S=0;if(b<0){const t=gi(1-b/(m*x));s*=t,r*=t}else S=(o===a?-1:1)*gi(b/(m*v+x*w));const k=S*s*y/r,B=-S*r*f/s,P=fi((y-B)/r,(f-k)/s),R=fi((-y-B)/r,(-f-k)/s);let E=R-P;0===a&&E>0?E-=N:1===a&&E<0&&(E+=N);const C=e+c+g*k-p*B,T=i+u+p*k+g*B,L=E<0?1:0;d||ee.ellipseToCurve?yi(t,C,T,s,r,n,P/W,R/W,L):s!==r||n?t.push(Me.G,C,T,s,r,n,P/W,R/W,L):t.push(Me.O,C,T,s,P/W,R/W,L)}},xi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:wi,L:bi,l:Si,H:ki,h:Bi,V:Pi,v:Ri,C:Ei,c:Ci,S:Ti,s:Li,Q:Ai,q:Oi,T:Di,t:Fi,A:Mi,a:Ii,Z:Wi,z:Ni,N:zi,D:Yi,X:Xi,G:Hi,F:Ui,O:ji,P:qi,U:Vi}=Me,{rect:Gi,roundRect:Ki,arcTo:Ji,arc:Qi,ellipse:Zi,quadraticCurveTo:$i}=li,{ellipticalArc:ts}=mi,es=re.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,a="";for(;n<o;){s=t[n],i=Xe[s],a+=s===r?" ":Ye[s];for(let s=1;s<i;s++)a+=M.float(t[n+s],e),s===i-1||(a+=" ");r=s,n+=i}return a},parse(t,e){let i,s,r,n="";const o=[],a=e?Ne:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(rs.dot&&(ns(o,n),n=""),rs.dot++),"0"===n&&"."!==s&&(ns(o,n),n=""),n+=s):Me[s]?(n&&(ns(o,n),n=""),rs.name=Me[s],rs.length=Ie[s],rs.index=0,ns(o,rs.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ns(o,n),n=s):n&&(ns(o,n),n=""),r=s;return n&&ns(o,n),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],_.push(vi,a,h),c+=3;break;case Bi:t[c+1]+=a;case ki:a=t[c+1],_.push(bi,a,h),c+=2;break;case Ri:t[c+1]+=h;case Pi:h=t[c+1],_.push(bi,a,h),c+=2;break;case Si:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],_.push(bi,a,h),c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ti;case Ti:o=n===Ei||n===Ti,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ei,l,d,i,s,a,h),c+=5;break;case Ci: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=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Fi:t[c+1]+=a,t[c+2]+=h,r=Di;case Di:o=n===Ai||n===Di,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?$i(_,a,h,i,s,t[c+1],t[c+2]):_.push(Ai,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ai;case Ai:i=t[c+1],s=t[c+2],e?$i(_,a,h,i,s,t[c+3],t[c+4]):_.push(Ai,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=a,t[c+7]+=h;case Mi:ts(_,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 Ni:case Wi:_.push(Wi),c++;break;case zi:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4]):os(_,t,c,5),c+=5;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):os(_,t,c,9),c+=9;break;case Xi:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],t[c+5]):os(_,t,c,6),c+=6;break;case Hi:Zi(e?_:os(_,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,is),a=is.x,h=is.y,c+=9;break;case Ui:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):os(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ji:Qi(e?_:os(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),a=is.x,h=is.y,c+=7;break;case qi:e?Qi(_,t[c+1],t[c+2],t[c+3],0,360,!1):os(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Ji(e?_:os(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return xi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ai,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:ns,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:_s,X:ps,G:gs,F:fs,O:ys,P:ms,U:xs}=Me,{getMinDistanceFrom:vs,getRadianFrom:ws}=lt,{tan:bs,min:Ss,abs:ks}=Math,Bs={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(ls,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(ds,e,i,s,r)},closePath(t){t.push(cs)},rect(t,e,i,s,r){t.push(us,e,i,s,r)},roundRect(t,e,i,s,r,n){if(l(n))t.push(ps,e,i,s,r,n);else{const o=M.fourNumber(n);o?t.push(_s,e,i,s,r,...o):t.push(us,e,i,s,r)}},ellipse(t,e,i,s,r,n,a,h,l){if(s===r)return Es(t,e,i,s,a,h,l);o(n)?t.push(fs,e,i,s,r):(o(a)&&(a=0),o(h)&&(h=360),t.push(gs,e,i,s,r,n,a,h,l?1:0))},arc(t,e,i,s,r,n,a){o(r)?t.push(ms,e,i,s):(o(r)&&(r=0),o(n)&&(n=360),t.push(ys,e,i,s,r,n,a?1:0))},arcTo(t,e,i,s,r,o,a,h,l){if(!n(a)){const t=vs(a,h,e,i,s,r)/(l?1:2);o=Ss(o,Ss(t,t*ks(bs(ws(a,h,e,i,s,r)/2))))}t.push(xs,e,i,s,r,o)},drawEllipse(t,e,i,s,r,n,a,h,l){li.ellipse(null,e,i,s,r,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,Bs),t.push(as,Bs.x,Bs.y),Rs(t,e,i,s,r,n,a,h,l)},drawArc(t,e,i,s,r,n,a){li.arc(null,e,i,s,o(r)?0:r,o(n)?360:n,a,null,null,Bs),t.push(as,Bs.x,Bs.y),Es(t,e,i,s,r,n,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Rs,arc:Es}=Ps,{moveTo:Cs,lineTo:Ts,quadraticCurveTo:Ls,bezierCurveTo:As,closePath:Os,beginPath:Ds,rect:Fs,roundRect:Ms,ellipse:Is,arc:Ws,arcTo:Ns,drawEllipse:zs,drawArc:Ys,drawPoints:Xs}=Ps;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Cs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return As(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return Os(this.__path),this.paint(),this}rect(t,e,i,s){return Fs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Ms(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return Is(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return Ws(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ns(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return zs(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return Ys(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:js,C:qs,Q:Vs,Z:Gs,N:Ks,D:Js,X:Qs,G:Zs,F:$s,O:tr,P:er,U:ir}=Me,sr=re.get("PathDrawer"),rr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case js:t.lineTo(e[s+1],e[s+2]),s+=3;break;case qs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case tr:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case er:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case ir:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sr.error(`command: ${i} [index:${s}]`,e)}}},{M:nr,L:or,C:ar,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:gr,P:fr,U:yr}=Me,{toTwoPointBounds:mr,toTwoPointBoundsByQuadraticCurve:xr,arcTo:vr,arc:wr,ellipse:br}=li,{addPointBounds:Sr,copy:kr,addPoint:Br,setPoint:Pr,addBounds:Rr,toBounds:Er}=xt,Cr=re.get("PathBounds");let Tr,Lr,Ar;const Or={},Dr={},Fr={},Mr={toBounds(t,e){Mr.toTwoPointBounds(t,Dr),Er(Dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Pr(e,0,0);let i,s,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===lr||o===ar||o===hr?Pr(e,h,l):Pr(e,t[a+1],t[a+2])),o){case nr:case or:h=t[a+1],l=t[a+2],Br(e,h,l),a+=3;break;case ar:r=t[a+5],n=t[a+6],mr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Or),Sr(e,Or),h=r,l=n,a+=7;break;case hr:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],xr(h,l,i,s,r,n,Or),Sr(e,Or),h=r,l=n,a+=5;break;case lr:a+=1;break;case dr:h=t[a+1],l=t[a+2],Rr(e,h,l,t[a+3],t[a+4]),a+=5;break;case cr:case ur:h=t[a+1],l=t[a+2],Rr(e,h,l,t[a+3],t[a+4]),a+=o===cr?9:6;break;case _r:br(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],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=9;break;case pr:h=t[a+1],l=t[a+2],Lr=t[a+3],Ar=t[a+4],Rr(e,h-Lr,l-Ar,2*Lr,2*Ar),h+=Lr,a+=5;break;case gr:wr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=7;break;case fr:h=t[a+1],l=t[a+2],Tr=t[a+3],Rr(e,h-Tr,l-Tr,2*Tr,2*Tr),h+=Tr,a+=4;break;case yr:vr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Or,Fr),0===a?kr(e,Or):Sr(e,Or),h=Fr.x,l=Fr.y,a+=6;break;default:return void Cr.error(`command: ${o} [index:${a}]`,t)}}},{M:Ir,L:Wr,Z:Nr}=Me,{getCenterX:zr,getCenterY:Yr}=lt,{arcTo:Xr}=Ps,Hr={smooth(t,e,i){let s,r,n,o=0,a=0,h=0,l=0,d=0,c=0,_=0,p=0,g=0;u(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;o<f;){switch(s=t[o],s){case Ir:l=p=t[o+1],d=g=t[o+2],o+=3,t[o]===Wr?(c=t[o+1],_=t[o+2],y?m.push(Ir,l,d):m.push(Ir,zr(l,c),Yr(d,_))):m.push(Ir,l,d);break;case Wr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Wr:Xr(m,a,h,t[o+1],t[o+2],e,p,g,y);break;case Nr:Xr(m,a,h,l,d,e,p,g,y);break;default:m.push(Wr,a,h)}p=a,g=h;break;case Nr:r!==Nr&&(Xr(m,l,d,c,_,e,p,g,y),m.push(Nr)),o+=1;break;default:n=Xe[s];for(let e=0;e<n;e++)m.push(t[o+e]);o+=n}r=s}return s!==Nr&&(m[1]=l,m[2]=d),m}};function Ur(t){return new Hs(t)}const jr=Ur();De.creator=Ur(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:qr}=He;function Vr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){qr(this,t,e,i,s,r)})}(t)}const Gr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Kr.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{}}}},Kr=Gr;Kr.mineType=Kr.mimeType,Kr.alphaPixelTypes.forEach(t=>Kr.upperCaseTypeMap[t]=t.toUpperCase());const Jr=re.get("TaskProcessor");class Qr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return s(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Jr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e,i){let s,r,o,a;const h=new Qr(t);return h.parent=this,l(e)?a=e:e&&(r=e.parallel,s=e.start,o=e.time,a=e.delay,i||(i=e.canUse)),o&&(h.time=o),!1===r&&(h.parallel=!1),i&&(h.canUse=i),n(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 $r=re.get("Resource"),tn={tasker:new Zr,queue:new Zr({parallel:1}),map:{},get isComplete(){return en.tasker.isComplete},set(t,e){en.map[t]&&$r.repeat(t),en.map[t]=e},get:t=>en.map[t],remove(t){const e=en.map[t];e&&(e.destroy&&e.destroy(),delete en.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),en.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){en.map={}}},en=tn,sn={maxRecycled:10,recycledList:[],patternTasker:tn.queue,get(t,e){let i=tn.get(t.url);return i||tn.set(t.url,i="film"===e?ue.film(t):ue.image(t)),i.use++,i},recycle(t){t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&tn.remove(t.url):(t.clearLevels(),rn.recycledList.push(t)))})},recyclePaint(t){rn.recycle(t.image)},clearRecycled(t){const e=rn.recycledList;(e.length>rn.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tn.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Gr.alphaPixelTypes.some(e=>rn.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Gr.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Gr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},rn=sn,{IMAGE:nn,create:on}=x;class an{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return n(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=on(nn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sn.isFormat("svg",t)&&(this.isSVG=!0),sn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tn.tasker.add(()=>s(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=ee.image.resize(this.view,t,e,r,n,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const r=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(r,i,s),r}render(t,e,i,s,r,n,o,a,h){t.drawImage(this.view,e,i,s,r)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class hn extends an{get tag(){return"Film"}}class ln extends an{get tag(){return"Video"}}function dn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function cn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function un(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function _n(t,e){return(i,s)=>gn(i,s,t,e&&e(s))}function pn(t){return t}function gn(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};dn(t,e,Object.assign(r,s||{})),Un(t,e,i)}function fn(t){return _n(t)}function yn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function mn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function xn(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),kn(this))}}))}function vn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function wn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function bn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i,e)&&kn(this)}}))}function Sn(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(kn(this),this.__.__removeNaturalSize())}}))}function kn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Bn(t){return _n(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),kn(this)}}))}const Pn=bn;function Rn(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i)&&(En(this),e&&(this.__.__useStroke=!0))}}))}function En(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&kn(t)}const Cn=Rn;function Tn(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ln(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function An(t){return _n(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function On(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Fn(this)}}))}function Dn(t){return _n(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Mn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Mn(this,t,e,i),this.mask&&Fn(this)}}))}function Fn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Mn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||kn(t))}function In(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Wn(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Nn(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function zn(t){return _n(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===re.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Yn(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Xn(t){return(e,i)=>{dn(e,"__DataProcessor",{get:()=>t})}}function Hn(t){return(e,i)=>{dn(e,"__LayoutProcessor",{get:()=>t})}}function Un(t,e,i){const s=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=un(e,i);if(n(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(_(i)){const t=g(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];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[r];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 l,d=s;for(;!l&&d;)l=cn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),dn(s,e,a)}const jn=new re("rewrite"),qn=[],Vn=["destroy","constructor"];function Gn(t){return(e,i)=>{qn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Kn(){return t=>{Jn()}}function Jn(t){qn.length&&(qn.forEach(e=>{t&&jn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),qn.length=0)}function Qn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Vn.includes(s)||e&&e.includes(s)))if(t.prototype){cn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Zn(){return t=>{pe.register(t)}}function $n(){return t=>{ye.register(t)}}setTimeout(()=>Jn(!0));const{copy:to,toInnerPoint:eo,toOuterPoint:io,scaleOfOuter:so,rotateOfOuter:ro,skewOfOuter:no,multiplyParent:oo,divideParent:ao,getLayout:ho}=Q,lo={},{round:co}=Math,uo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),go(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)po(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)fo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&fo(t),t.__updateChange()},updateAllChange(t){if(mo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)yo(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,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=_(e)?Object.assign({},e):{x:e,y:i};s?io(t.localTransform,n,n,!0):t.parent&&eo(t.parent.scrollWorldTransform,n,n,!0),_o.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=co(e),i=co(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){_o.zoomOfLocal(t,xo(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const o=t.__localMatrix;if(l(s)||(s&&(n=s),s=i),to(lo,o),so(lo,e,i,s),_o.hasHighPosition(t))_o.setTransform(t,lo,r,n);else{const e=t.x+lo.e-o.e,a=t.y+lo.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){_o.rotateOfLocal(t,xo(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;to(lo,r),ro(lo,e,i),_o.hasHighPosition(t)?_o.setTransform(t,lo,!1,s):t.set({x:t.x+lo.e-r.e,y:t.y+lo.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){_o.skewOfLocal(t,xo(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){to(lo,t.__localMatrix),no(lo,e,i,s),_o.setTransform(t,lo,r,n)},transformWorld(t,e,i,s){to(lo,t.worldTransform),oo(lo,e),t.parent&&ao(lo,t.parent.scrollWorldTransform),_o.setTransform(t,lo,i,s)},transform(t,e,i,s){to(lo,t.localTransform),oo(lo,e),_o.setTransform(t,lo,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&_o.getInnerOrigin(t,r.origin),o=ho(e,n,r.around&&_o.getInnerOrigin(t,r.around));if(_o.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Ut.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=_o.getInnerOrigin(t,r.origin);lt.move(o,n.x-s.x,n.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return so(i,_o.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(_o.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return kt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(to(lo,t.worldTransform),ao(lo,e.scrollWorldTransform),i?lo:Object.assign({},lo)),drop(t,e,i,s){t.setTransform(_o.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||_o.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,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),ee.requestRender(()=>_o.animateMove(t,e,i))}}},_o=uo,{updateAllMatrix:po,updateMatrix:go,updateAllWorldOpacity:fo,updateAllChange:yo,updateChange:mo}=_o;function xo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const vo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>bo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>bo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>bo(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 wo;function bo(t,e){return e||(wo=0),t.__.mask&&(wo=1),wo<0?null:(wo&&(wo=-1),!0)}const{updateBounds:So}=uo,ko={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:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Bo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&n(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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Po(e[t],e)},updateBounds(t,e){const i=[t];Po(t,i),Ro(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)So(s[t]);e&&e===i||So(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,o=r.length;n<o;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Eo(t,e,i)},scale(t,e,i,s,r,n,o){let a;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=r,(a.b||a.c)&&(a.b*=s,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-n)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-n)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-n)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=r,a.scaleX*=s,a.scaleY*=r,t.isBranch&&Co(t,e,i,s,r,n,o)}},{pushAllChildBranch:Bo,pushAllBranchStack:Po,updateBoundsByBranchStack:Ro,move:Eo,scale:Co}=ko,To={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Lo,updateBounds:Ao}=uo,{toOuterOf:Oo,getPoints:Do,copy:Fo}=Ut,Mo="_localContentBounds",Io="_worldContentBounds",Wo="_worldBoxBounds",No="_worldStrokeBounds";class zo{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 Oo(this.contentBounds,this.leaf.__localMatrix,this[Mo]||(this[Mo]={})),this[Mo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Oo(this.contentBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}get worldBoxBounds(){return Oo(this.boxBounds,this.leaf.__world,this[Wo]||(this[Wo]={})),this[Wo]}get worldStrokeBounds(){return Oo(this.strokeBounds,this.leaf.__world,this[No]||(this[No]={})),this[No]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Ao(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 i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,ee.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Lo(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",i){const{leaf:s}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,n=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),n=Lo(s,e,!0)}if(o||(o=Q.getLayout(n)),Fo(o,a),lt.copy(o,r),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Do(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return n(r)||s.forEach(t=>i.innerToWorld(t,null,!1,r)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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 Yo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Xo extends Yo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Xo.ADD="child.add",Xo.REMOVE="child.remove",Xo.CREATED="created",Xo.MOUNTED="mounted",Xo.UNMOUNTED="unmounted",Xo.DESTROY="destroy";const Ho="property.scroll";class Uo extends Yo{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Uo.CHANGE="property.change",Uo.LEAFER_CHANGE="property.leafer_change",Uo.SCROLL=Ho;const jo={scrollX:Ho,scrollY:Ho};class qo extends Yo{constructor(t,e){super(t),Object.assign(this,e)}}qo.LOAD="image.load",qo.LOADED="image.loaded",qo.ERROR="image.error";class Vo extends Yo{static checkHas(t,e,i){"on"===i?e===Qo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Go)||t.hasEvent(Ko)||t.hasEvent(Jo),t.__hasWorldEvent=t.hasEvent(Qo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Go,t),"inner"===e&&t.emit(Ko,t)),t.emit(Jo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Qo,this)}}Vo.RESIZE="bounds.resize",Vo.INNER="bounds.inner",Vo.LOCAL="bounds.local",Vo.WORLD="bounds.world";const{RESIZE:Go,INNER:Ko,LOCAL:Jo,WORLD:Qo}=Vo,Zo={};[Go,Ko,Jo,Qo].forEach(t=>Zo[t]=1);class $o extends Yo{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){_(t)?(super($o.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}$o.RESIZE="resize";class ta extends Yo{constructor(t,e){super(t),this.data=e}}ta.REQUEST="watch.request",ta.DATA="watch.data";class ea extends Yo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ea.REQUEST="layout.request",ea.START="layout.start",ea.BEFORE="layout.before",ea.LAYOUT="layout",ea.AFTER="layout.after",ea.AGAIN="layout.again",ea.END="layout.end";class ia extends Yo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ia.REQUEST="render.request",ia.CHILD_START="render.child_start",ia.CHILD_END="render.child_end",ia.START="render.start",ia.BEFORE="render.before",ia.RENDER="render",ia.AFTER="render.after",ia.AGAIN="render.again",ia.END="render.end",ia.NEXT="render.next";class sa extends Yo{}sa.START="leafer.start",sa.BEFORE_READY="leafer.before_ready",sa.READY="leafer.ready",sa.AFTER_READY="leafer.after_ready",sa.VIEW_READY="leafer.view_ready",sa.VIEW_COMPLETED="leafer.view_completed",sa.STOP="leafer.stop",sa.RESTART="leafer.restart",sa.END="leafer.end",sa.UPDATE_MODE="leafer.update_mode",sa.TRANSFORM="leafer.transform",sa.MOVE="leafer.move",sa.SCALE="leafer.scale",sa.ROTATE="leafer.rotate",sa.SKEW="leafer.skew";const{MOVE:ra,SCALE:na,ROTATE:oa,SKEW:aa}=sa,ha={x:ra,y:ra,scaleX:na,scaleY:na,rotation:oa,skewX:aa,skewY:aa},la={};class da{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=ca(this,s,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],Zo[t]&&Vo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ca(this,t);s.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],Zo[t]&&Vo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(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:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ye.has(t)&&(e=ye.get(t,{type:t,target:this,current:this}));const s=ca(this,i)[t];if(s){let r;for(let n=0,o=s.length;n<o&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:s}=this,r=i&&i[t],o=s&&s[t];return!!(n(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ca(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:la)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:la)}}const{on:ua,on_:_a,off:pa,off_:ga,once:fa,emit:ya,emitEvent:ma,hasEvent:xa,destroy:va}=da.prototype,wa={on:ua,on_:_a,off:pa,off_:ga,once:fa,emit:ya,emitEvent:ma,hasEvent:xa,destroyEventer:va},ba=re.get("setAttr"),Sa={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||n(e)||(ba.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Uo(Uo.LEAFER_CHANGE,this,t,s,e));const i=ha[t];i&&(this.emitEvent(new sa(i,this)),this.emitEvent(new sa(sa.TRANSFORM,this)))}this.emitPropertyEvent(Uo.CHANGE,t,s,e);const i=jo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Uo(t,this,e,i,s);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||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ka,multiplyParent:Ba,translateInner:Pa,defaultWorld:Ra}=Q,{toPoint:Ea,tempPoint:Ca}=kt,Ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;Ba(this.__local||e,t?t.__scrollWorld||t.__world:Ra,i,!!e.affectScaleOrRotation,r),s&&Pa(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ka(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Ea(i.around||i.origin,t.boxBounds,Ca),Pa(e,-Ca.x,-Ca.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:La,updateAllMatrix:Aa}=uo,{updateBounds:Oa}=ko,{toOuterOf:Da,copyAndSpread:Fa,copy:Ma}=Ut,{toBounds:Ia}=Mr,Wa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Da(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Vo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Vo.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(),Da(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Da(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Da(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ia(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Aa(this),Oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Aa(this),Oa(this,this))):La(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Fa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Ma(e.renderBounds,e.strokeBounds):Fa(e.renderBounds,e.boxBounds,i)}},Na={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),uo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);re.showBounds&&re.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:za}=vo,{hasSize:Ya}=Ut,Xa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ya(i)){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 r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let r=0,n=s.length;r<n;r++)i=s[r],za(i,e)||(i.__.complex?i.__renderComplex(t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)za(i[s],e)||i[s].__clip(t,e)}}},Ha={},{LEAF:Ua,create:ja}=x,{stintSet:qa}=f,{toInnerPoint:Va,toOuterPoint:Ga,multiplyParent:Ka}=Q,{toOuterOf:Ja}=Ut,{copy:Qa,move:Za}=lt,{moveLocal:$a,zoomOfLocal:th,rotateOfLocal:eh,skewOfLocal:ih,moveWorld:sh,zoomOfWorld:rh,rotateOfWorld:nh,skewOfWorld:oh,transform:ah,transformWorld:hh,setTransform:lh,getFlipTransform:dh,getLocalOrigin:ch,getRelativeWorld:uh,drop:_h}=uo;let ph=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 m}get __LayoutProcessor(){return zo}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=ja(Ua),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Xo.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(Xo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Xo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(Xo.MOUNTED)):this.__emitLifeEvent(Xo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Ka(i,t.matrix,e,void 0,i),Ja(this.__layout.renderBounds,e,e),qa(e,"half",i.half),qa(e,"ignorePixelSnap",i.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:i,scaleY:s}=sn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ha.scaleX=i,Ha.scaleY=s,Ha}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?uh(this,e):this.worldTransform,r=i?t:{};return Ja(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Qa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Qa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Va(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ga(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Za(r,-n,-o),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Za(r,n,o),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){lh(this,t,e,i)}transform(t,e,i){ah(this,t,e,i)}move(t,e,i){$a(this,t,e,i)}moveInner(t,e,i){sh(this,t,e,!0,i)}scaleOf(t,e,i,s,r){th(this,ch(this,t),e,i,s,r)}rotateOf(t,e,i){eh(this,ch(this,t),e,i)}skewOf(t,e,i,s,r){ih(this,ch(this,t),e,i,s,r)}transformWorld(t,e,i){hh(this,t,e,i)}moveWorld(t,e,i){sh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){rh(this,t,e,i,s,r)}rotateOfWorld(t,e){nh(this,t,e)}skewOfWorld(t,e,i,s,r){oh(this,t,e,i,s,r)}flip(t,e){ah(this,dh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__renderComplex(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ce.need("path")}getMotionPoint(t){return ce.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,i){_h(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Un(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=bn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Xo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Xo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ph=i([Qn(Sa),Qn(Ta),Qn(Wa),Qn(wa),Qn(Na)],ph);const{setListWithFn:gh}=Ut,{sort:fh}=ko,{localBoxBounds:yh,localStrokeBounds:mh,localRenderBounds:xh,maskLocalBoxBounds:vh,maskLocalStrokeBounds:wh,maskLocalRenderBounds:bh}=vo,Sh=new re("Branch");let kh=class extends ph{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){gh(e||this.__layout.boxBounds,this.children,this.__hasMask?vh:yh)}__updateStrokeBounds(t){gh(t||this.__layout.strokeBounds,this.children,this.__hasMask?wh:mh)}__updateRenderBounds(t){gh(t||this.__layout.renderBounds,this.children,this.__hasMask?bh:xh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(fh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Sh.warn("add self or destroyed");const i=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=pe.get(t.tag,t)))return}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 s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Xo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Xo.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)):n(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(Xo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Xo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Xo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};kh=i([Qn(Xa)],kh);class Bh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(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 s=0,r=e.length;s<r;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(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 Bh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ph{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Rh="2.0.2";class Eh extends Oe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=ee.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}function Ch(t,e){ee.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:Gr.mimeType(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Gr.mimeType(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:(t,e,i)=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",ee.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()}),loadContent(t){return s(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}Vr(OffscreenCanvasRenderingContext2D.prototype),Vr(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Eh(t,e),image:t=>new an(t)}),ee.name="web",ee.isWorker=!0,ee.backgrounder=!0,ee.requestRender=function(t){requestAnimationFrame(t)},dn(ee,"devicePixelRatio",{get:()=>1});const{userAgent:Th}=navigator;Th.indexOf("Firefox")>-1?(ee.conicGradientRotate90=!0,ee.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Th.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Th.indexOf("Mac")>-1?ee.os="Mac":Th.indexOf("Linux")>-1&&(ee.os="Linux");class Lh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Bh;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 Bh,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ia.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Xo.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ta(ta.DATA,{updatedList:this.updatedList})),this.__updatedList=new Bh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Uo.CHANGE,this.__onAttrChange,this],[[Xo.ADD,Xo.REMOVE],this.__onChildEvent,this],[ta.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ah,updateBounds:Oh,updateChange:Dh}=uo,{pushAllChildBranch:Fh,pushAllParent:Mh}=ko;const{worldBounds:Ih}=vo;class Wh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,u(t)&&(t=new Bh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ih),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:Nh,updateAllChange:zh}=uo,Yh=re.get("Layouter");class Xh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Ph,this.target=t,e&&(this.config=f.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(ea.START),this.layoutOnce(),t.emitEvent(new ea(ea.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ta.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=ea,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ea(r,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ah(t,!0),e.add(t),t.isBranch&&Fh(t,e),Mh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Oh(s[t])}Oh(i)}})}(this.__levelList),function(t){t.list.forEach(Dh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ea(n,a,this.times)),i.emitEvent(new ea(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=ea,n=this.getBlocks(new Bh(e));e.emitEvent(new ea(i,n,this.times)),Xh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new ea(s,n,this.times)),e.emitEvent(new ea(r,n,this.times)),this.addBlocks(n),he.end(t)}static fullLayout(t){Nh(t,!0),t.isBranch?ko.updateBounds(t):uo.updateBounds(t),zh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Wh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Wh(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_([[ea.REQUEST,this.layout,this],[ea.AGAIN,this.layoutAgain,this],[ta.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Hh=re.get("Renderer");class Uh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ea.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ia.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ia.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ia.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Hh.log(e.innerName,"---\x3e");try{this.emitRender(ia.START),this.renderOnce(t),this.emitRender(ia.END,this.totalBounds),sn.clearRecycled()}catch(t){this.rendering=!1,Hh.error(t)}Hh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Hh.warn("rendering");if(this.times>3)return Hh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(ia.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ia.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ia.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ia.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Gt(s);i.save(),s.spread(Uh.clipSpread).ceil();const{ceilPartPixel:n}=this.config;i.clipWorld(s,n),i.clearWorld(s,n),this.__render(s,r),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),re.showRepaint&&re.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),ee.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){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:i}=this.config;if(i&&t>i)return ee.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).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;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Hh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new ia(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ia.REQUEST,this.update,this],[ea.END,this.__onLayoutEnd,this],[ia.AGAIN,this.renderAgain,this],[$o.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Uh.clipSpread=10;const jh={},{copyRadiusPoint:qh}=lt,{hitRadiusPoint:Vh}=Ut;class Gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Bh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new Bh;if(t.length){let e;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||uo.worldHittable(e))&&(this.hitChild(e,o),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&uo.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>uo.worldHittable(t))}getPath(t){const e=new Bh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Bh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new Bh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,o=i.length;t<o;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],r=i.__,r.visible&&(!e||r.mask))if(s=Vh(i.__world,r.hitRadius?qh(jh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,o=n.length;s<o;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Kh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new Gh(this.target=t,this),this.finder=ue.finder&&ue.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return ee.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Jh(t){return _n(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Qh(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Zh(){return(t,e)=>{const i="_"+e;dn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function $h(t){return(e,i)=>{dn(e,i,un(i,t))}}Object.assign(ue,{watcher:(t,e)=>new Lh(t,e),layouter:(t,e)=>new Xh(t,e),renderer:(t,e,i)=>new Uh(t,e,i),selector:(t,e)=>new Kh(t,e)}),ee.layout=Xh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Bh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const tl={},el={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}},il=Qt,sl={},rl={},nl={},ol={},al={},hl={apply(){ce.need("filter")}},ll={},dl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},cl={list:{},register(t,e){cl.list[t]=e},get:t=>cl.list[t]},{parse:ul,objectToCanvasData:_l}=ss,{stintSet:pl}=f,{hasTransparent:gl}=el,fl={originPaint:{}},yl=re.get("UIData");class ml extends m{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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,yl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,yl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(pl(this,"__isTransparentFill",gl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(pl(this,"__isTransparentStroke",gl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?ul(t):_l(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){xl(this,"shadow",t)}setInnerShadow(t){xl(this,"innerShadow",t)}setFilter(t){xl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&rl.compute("fill",this.__leaf),e&&rl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(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 i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=fl)):(this.__isStrokes=!0,this._stroke||(this._stroke=fl))}__removePaint(t,e){e&&this.__removeInput(t),nl.recycleImage(t,this),"fill"===t?(pl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(pl(this,"__isAlphaPixelStroke",void 0),pl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function xl(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class vl extends ml{}class wl extends vl{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 bl extends vl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ae.forEach(t=>delete i[t]),i}}class Sl extends wl{}class kl extends ml{get __usePathBox(){return this.points||this.__pathInputed}}class Bl extends ml{get __boxStroke(){return!this.__pathInputed}}class Pl extends ml{get __boxStroke(){return!this.__pathInputed}}class Rl extends kl{}class El extends ml{}class Cl extends ml{get __pathInputed(){return 2}}class Tl extends vl{}const Ll={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Al extends ml{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Ll[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=pe.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ol extends Bl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Dl extends Bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Fl,add:Ml}=P,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Fl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Fl(t,s)),n&&(t=Ml(t,hl.getSpread(n))),o&&(t=Ml(t,o)),a&&(t=Ml(t,a));let l=t;return i&&(l=Fl(l,al.getInnerShadowSpread(this,i))),r&&(l=Fl(l,r)),this.__layout.renderShapeSpread=l,h?Fl(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=f,Nl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){zl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=rl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),a&&(s.__isStrokes?rl.strokes(n,this,t,e):rl.stroke(n,this,t,e)),r&&(s.__isFills?rl.fills(r,this,t,e):rl.fill(r,this,t,e)),o&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?rl.strokes(n,this,t,e):rl.stroke(n,this,t,e)),c&&hl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?rl.strokes(n,this,t,e):rl.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,el.string(e.color))}r&&(s.__isFills?rl.fills(r,this,t,e):rl.fill(r,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?rl.strokes(n,this,t,e):rl.stroke(n,this,t,e))}}else s.__pathForRender?zl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?rl.fills(s,this,t,e):rl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?rl.strokes(r,this,t,e):rl.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 zl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&rl.stroke(r,t,e,i),s&&rl.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!o&&rl.stroke(r,t,e,i)}const Yl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Xl;let Hl=Xl=class extends ph{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 jr.set(this.path=t||[]),t||this.__drawPathByBox(jr),jr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jr.set(i=[]),this.__drawPathByBox(jr,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ll.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&sl.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,!0)}__drawPathByData(t,e,i){e?rr.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,l(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){rl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Xl.one(e)}static one(t,e,i,s,r){return pe.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Zn()(this)}static registerData(t){Xn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};i([Xn(ml)],Hl.prototype,"__",void 0),i([Zh()],Hl.prototype,"zoomLayer",void 0),i([fn("")],Hl.prototype,"id",void 0),i([fn("")],Hl.prototype,"name",void 0),i([fn("")],Hl.prototype,"className",void 0),i([Ln("pass-through")],Hl.prototype,"blendMode",void 0),i([On(1)],Hl.prototype,"opacity",void 0),i([Dn(!0)],Hl.prototype,"visible",void 0),i([Ln(!1)],Hl.prototype,"locked",void 0),i([An(!1)],Hl.prototype,"dim",void 0),i([An(!1)],Hl.prototype,"dimskip",void 0),i([In(0)],Hl.prototype,"zIndex",void 0),i([Wn(!1)],Hl.prototype,"mask",void 0),i([Nn(!1)],Hl.prototype,"eraser",void 0),i([yn(0,!0)],Hl.prototype,"x",void 0),i([yn(0,!0)],Hl.prototype,"y",void 0),i([bn(100,!0)],Hl.prototype,"width",void 0),i([bn(100,!0)],Hl.prototype,"height",void 0),i([vn(1,!0)],Hl.prototype,"scaleX",void 0),i([vn(1,!0)],Hl.prototype,"scaleY",void 0),i([wn(0,!0)],Hl.prototype,"rotation",void 0),i([wn(0,!0)],Hl.prototype,"skewX",void 0),i([wn(0,!0)],Hl.prototype,"skewY",void 0),i([yn(0,!0)],Hl.prototype,"offsetX",void 0),i([yn(0,!0)],Hl.prototype,"offsetY",void 0),i([mn(0,!0)],Hl.prototype,"scrollX",void 0),i([mn(0,!0)],Hl.prototype,"scrollY",void 0),i([xn()],Hl.prototype,"origin",void 0),i([xn()],Hl.prototype,"around",void 0),i([fn(!1)],Hl.prototype,"lazy",void 0),i([Sn(1)],Hl.prototype,"pixelRatio",void 0),i([Tn(0)],Hl.prototype,"renderSpread",void 0),i([Bn()],Hl.prototype,"path",void 0),i([Pn()],Hl.prototype,"windingRule",void 0),i([Pn(!0)],Hl.prototype,"closed",void 0),i([bn(0)],Hl.prototype,"padding",void 0),i([bn(!1)],Hl.prototype,"lockRatio",void 0),i([bn()],Hl.prototype,"widthRange",void 0),i([bn()],Hl.prototype,"heightRange",void 0),i([fn(!1)],Hl.prototype,"draggable",void 0),i([fn()],Hl.prototype,"dragBounds",void 0),i([fn("auto")],Hl.prototype,"dragBoundsType",void 0),i([fn(!1)],Hl.prototype,"editable",void 0),i([zn(!0)],Hl.prototype,"hittable",void 0),i([zn("path")],Hl.prototype,"hitFill",void 0),i([Cn("path")],Hl.prototype,"hitStroke",void 0),i([zn(!1)],Hl.prototype,"hitBox",void 0),i([zn(!0)],Hl.prototype,"hitChildren",void 0),i([zn(!0)],Hl.prototype,"hitSelf",void 0),i([zn()],Hl.prototype,"hitRadius",void 0),i([Yn("")],Hl.prototype,"cursor",void 0),i([Ln()],Hl.prototype,"fill",void 0),i([Cn(void 0,!0)],Hl.prototype,"stroke",void 0),i([Cn("inside")],Hl.prototype,"strokeAlign",void 0),i([Cn(1,!0)],Hl.prototype,"strokeWidth",void 0),i([Cn(!1)],Hl.prototype,"strokeWidthFixed",void 0),i([Cn("none")],Hl.prototype,"strokeCap",void 0),i([Cn("miter")],Hl.prototype,"strokeJoin",void 0),i([Cn()],Hl.prototype,"dashPattern",void 0),i([Cn(0)],Hl.prototype,"dashOffset",void 0),i([Cn(10)],Hl.prototype,"miterLimit",void 0),i([Pn(0)],Hl.prototype,"cornerRadius",void 0),i([Pn()],Hl.prototype,"cornerSmoothing",void 0),i([Jh()],Hl.prototype,"shadow",void 0),i([Jh()],Hl.prototype,"innerShadow",void 0),i([Jh()],Hl.prototype,"blur",void 0),i([Jh()],Hl.prototype,"backgroundBlur",void 0),i([Jh()],Hl.prototype,"grayscale",void 0),i([Jh()],Hl.prototype,"filter",void 0),i([Ln()],Hl.prototype,"placeholderColor",void 0),i([fn(100)],Hl.prototype,"placeholderDelay",void 0),i([fn({})],Hl.prototype,"data",void 0),i([Gn(ph.prototype.reset)],Hl.prototype,"reset",null),Hl=Xl=i([Qn(Il),Qn(Nl),Kn()],Hl);let Ul=class extends Hl{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:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var jl;i([Xn(vl)],Ul.prototype,"__",void 0),i([bn(0)],Ul.prototype,"width",void 0),i([bn(0)],Ul.prototype,"height",void 0),Ul=i([Qn(kh),Zn()],Ul);const ql=re.get("Leafer");let Vl=jl=class extends Ul{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tn.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),jl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const r=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,r,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new xe,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),To.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(sa.RESTART):this.emitLeafer(sa.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(sa.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,Ae);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.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 i=f.copyAttrs({},this.canvas,Ae);e.resize(t),this.updateLazyBounds(),this.__onResize(new $o(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,Ae),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&&(Ae.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(sa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ae.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=f.copyAttrs({},s,Ae);r[t]=i[t]=e,i.width&&i.height?s.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(sa.BEFORE_READY),this.emitLeafer(sa.READY),this.emitLeafer(sa.AFTER_READY),To.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(sa.VIEW_READY),To.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(r=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){To.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(sa.VIEW_COMPLETED),To.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,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return ce.need("view")}getValidMove(t,e,i){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:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new sa(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[sa.START,()=>he.end(t)],[ea.START,this.updateLazyBounds,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ta.DATA,this.__onWatchData,this],[ea.END,this.__onLayoutEnd,this],[ia.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){jl.list.remove(this);try{this.stop(),this.emitLeafer(sa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sn.clearRecycled()},100)}catch(t){ql.error(t)}}};t?e():setTimeout(e)}};Vl.list=new Bh,i([Xn(bl)],Vl.prototype,"__",void 0),i([bn()],Vl.prototype,"pixelRatio",void 0),i([fn("normal")],Vl.prototype,"mode",void 0),Vl=jl=i([Zn()],Vl);let Gl=class extends Hl{get __tag(){return"Rect"}};i([Xn(Bl)],Gl.prototype,"__",void 0),Gl=i([Qn(Yl),Kn(),Zn()],Gl);const{add:Kl,includes:Jl,scroll:Ql}=Ut,Zl=Gl.prototype,$l=Ul.prototype;let td=class extends Ul{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 i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Kl(a,n),Ql(a,i)),this.__updateRectRenderBounds(),t=!Jl(n,a),t&&"show"===o&&Kl(r,a)}else this.__updateRectRenderBounds();f.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))}};i([Xn(wl)],td.prototype,"__",void 0),i([bn(100)],td.prototype,"width",void 0),i([bn(100)],td.prototype,"height",void 0),i([fn(!1)],td.prototype,"resizeChildren",void 0),i([Tn("show")],td.prototype,"overflow",void 0),i([Gn(Zl.__updateStrokeSpread)],td.prototype,"__updateStrokeSpread",null),i([Gn(Zl.__updateRenderSpread)],td.prototype,"__updateRectRenderSpread",null),i([Gn(Zl.__updateBoxBounds)],td.prototype,"__updateRectBoxBounds",null),i([Gn(Zl.__updateStrokeBounds)],td.prototype,"__updateStrokeBounds",null),i([Gn(Zl.__updateRenderBounds)],td.prototype,"__updateRectRenderBounds",null),i([Gn(Zl.__updateChange)],td.prototype,"__updateRectChange",null),i([Gn(Zl.__render)],td.prototype,"__renderRect",null),i([Gn($l.__render)],td.prototype,"__renderGroup",null),td=i([Kn(),Zn()],td);let ed=class extends td{get __tag(){return"Frame"}get isFrame(){return!0}};i([Xn(Sl)],ed.prototype,"__",void 0),i([Ln("#FFFFFF")],ed.prototype,"fill",void 0),i([Tn("hide")],ed.prototype,"overflow",void 0),ed=i([Zn()],ed);const{moveTo:id,closePath:sd,ellipse:rd}=Ps;let nd=class extends Hl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];let h;i?s||r?(i<1?rd(a,n,o,n*i,o*i,0,s,r,!1):h=!0,rd(a,n,o,n,o,0,r,s,!0)):(i<1&&(rd(a,n,o,n*i,o*i),id(a,t,o)),rd(a,n,o,n,o,0,360,0,!0)):s||r?(id(a,n,o),rd(a,n,o,n,o,0,s,r,!1)):rd(a,n,o,n,o),h||sd(a),ee.ellipseToCurve&&(this.__.path=this.getPath(!0))}};i([Xn(Pl)],nd.prototype,"__",void 0),i([Pn(0)],nd.prototype,"innerRadius",void 0),i([Pn(0)],nd.prototype,"startAngle",void 0),i([Pn(0)],nd.prototype,"endAngle",void 0),nd=i([Zn()],nd);const{sin:od,cos:ad,PI:hd}=Math,{moveTo:ld,lineTo:dd,closePath:cd,drawPoints:ud}=Ps;let _d=class extends Hl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ud(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,o=s/2;ld(e,n,0);for(let t=1;t<r;t++)dd(e,n+n*od(2*t*hd/r),o-o*ad(2*t*hd/r));cd(e)}}};i([Xn(Rl)],_d.prototype,"__",void 0),i([Pn(3)],_d.prototype,"sides",void 0),i([Pn()],_d.prototype,"points",void 0),i([Pn(0)],_d.prototype,"curve",void 0),_d=i([Kn(),Zn()],_d);const{sin:pd,cos:gd,PI:fd}=Math,{moveTo:yd,lineTo:md,closePath:xd}=Ps;let vd=class extends Hl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,o=this.__.path=[];yd(o,r,0);for(let t=1;t<2*i;t++)md(o,r+(t%2==0?r:r*s)*pd(t*fd/i),n-(t%2==0?n:n*s)*gd(t*fd/i));xd(o)}};i([Xn(El)],vd.prototype,"__",void 0),i([Pn(5)],vd.prototype,"corners",void 0),i([Pn(.382)],vd.prototype,"innerRadius",void 0),vd=i([Zn()],vd);const{moveTo:wd,lineTo:bd,drawPoints:Sd}=Ps,{rotate:kd,getAngle:Bd,getDistance:Pd,defaultPoint:Rd}=lt;let Ed=class extends Hl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&kd(i,e),i}set toPoint(t){this.width=Pd(Rd,t),this.rotation=Bd(Rd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Sd(e,t.points,t.curve,t.closed):(wd(e,0,0),bd(e,this.width,0))}};i([Xn(kl)],Ed.prototype,"__",void 0),i([Rn("center")],Ed.prototype,"strokeAlign",void 0),i([bn(0)],Ed.prototype,"height",void 0),i([Pn()],Ed.prototype,"points",void 0),i([Pn(0)],Ed.prototype,"curve",void 0),i([Pn(!1)],Ed.prototype,"closed",void 0),Ed=i([Zn()],Ed);let Cd=class extends Gl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};i([Xn(Ol)],Cd.prototype,"__",void 0),i([bn("")],Cd.prototype,"url",void 0),Cd=i([Zn()],Cd);const Td=Cd;let Ld=class extends Gl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new an({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new qo(qo.LOADED,{image:t}))})}draw(t,e,i,s){const r=new yt(t.worldTransform).invert(),n=new yt;e&&n.translate(e.x,e.y),i&&(l(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};i([Xn(Dl)],Ld.prototype,"__",void 0),i([Qh(100)],Ld.prototype,"width",void 0),i([Qh(100)],Ld.prototype,"height",void 0),i([Qh(1)],Ld.prototype,"pixelRatio",void 0),i([Qh(!0)],Ld.prototype,"smooth",void 0),i([fn(!1)],Ld.prototype,"safeResize",void 0),i([Qh()],Ld.prototype,"contextSettings",void 0),Ld=i([Zn()],Ld);const{copyAndSpread:Ad,includes:Od,spread:Dd,setList:Fd}=Ut,{stintSet:Md}=f;let Id=class extends Hl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=il.number(e,r),t.__letterSpacing=il.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,Md(t,"__padding",l&&M.fourNumber(l)),Md(t,"__clipText","show"!==h&&!t.__autoSize),Md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=tl.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Dd(a,i/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Od(h,a)),this.isOverflow?(Fd(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;Ad(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,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};i([Xn(Al)],Id.prototype,"__",void 0),i([bn(0)],Id.prototype,"width",void 0),i([bn(0)],Id.prototype,"height",void 0),i([Ln()],Id.prototype,"boxStyle",void 0),i([fn(!1)],Id.prototype,"resizeFontSize",void 0),i([Ln("#000000")],Id.prototype,"fill",void 0),i([Rn("outside")],Id.prototype,"strokeAlign",void 0),i([zn("all")],Id.prototype,"hitFill",void 0),i([bn("")],Id.prototype,"text",void 0),i([bn("")],Id.prototype,"placeholder",void 0),i([bn("caption")],Id.prototype,"fontFamily",void 0),i([bn(12)],Id.prototype,"fontSize",void 0),i([bn("normal")],Id.prototype,"fontWeight",void 0),i([bn(!1)],Id.prototype,"italic",void 0),i([bn("none")],Id.prototype,"textCase",void 0),i([bn("none")],Id.prototype,"textDecoration",void 0),i([bn(0)],Id.prototype,"letterSpacing",void 0),i([bn({type:"percent",value:1.5})],Id.prototype,"lineHeight",void 0),i([bn(0)],Id.prototype,"paraIndent",void 0),i([bn(0)],Id.prototype,"paraSpacing",void 0),i([bn("x")],Id.prototype,"writingMode",void 0),i([bn("left")],Id.prototype,"textAlign",void 0),i([bn("top")],Id.prototype,"verticalAlign",void 0),i([bn(!0)],Id.prototype,"autoSizeAlign",void 0),i([bn("normal")],Id.prototype,"textWrap",void 0),i([bn("show")],Id.prototype,"textOverflow",void 0),i([Ln(!1)],Id.prototype,"textEditing",void 0),Id=i([Zn()],Id);let Wd=class extends Hl{get __tag(){return"Path"}};i([Xn(Cl)],Wd.prototype,"__",void 0),i([Rn("center")],Wd.prototype,"strokeAlign",void 0),Wd=i([Zn()],Wd);let Nd=class extends Ul{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Wd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,o,a){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,o,a){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};i([Xn(Tl)],Nd.prototype,"__",void 0),i([(t,e)=>{dn(t,e,{get(){return this.__path}})}],Nd.prototype,"path",void 0),Nd=i([Qn(Hs,["set","path","paint"]),Zn()],Nd);let zd=class extends Vl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ue.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Vl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),n(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,Ae),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ea.END,this.__onReady,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ia.END,this.__onChildRenderEnd,this))}};zd=i([Zn()],zd);const Yd={},Xd={isHoldSpaceKey:()=>Xd.isHold("Space"),isHold:t=>Yd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Yd[t]||(Yd[t]=!0)},setUpCode(t){Yd[t]=!1}},Hd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Ud extends Yo{get spaceKey(){return Xd.isHoldSpaceKey()}get left(){return Hd.left(this)}get right(){return Hd.right(this)}get middle(){return Hd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Xd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ye.changeName(t,e)}}const{min:jd,max:qd,abs:Vd}=Math,{float:Gd,sign:Kd}=M,{minX:Jd,maxX:Qd,minY:Zd,maxY:$d}=Ut,tc=new Gt,ec=new Gt,ic={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&sc.getValidMove(t.__localBoxBounds,sc.getDragBounds(t),s,e,!0),sc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&sc.getValidScaleOf(t.__localBoxBounds,sc.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,o=t.y+s.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),sc.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),sc.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Gd(s.x),s.y=Gd(s.y),s},getValidScaleOf(t,e,i,s,r,n,o){o||(r=Object.assign({},r)),ec.set(e),tc.set(t).scaleOf(s,r.x,r.y);const a=(s.x-t.x)/t.width,l=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return sc.isInnerMode(t,e,i,"width")?(r.x<0&&tc.scaleOf(s,f=1/r.x,1),p=Gd(tc.minX-ec.minX),g=Gd(ec.maxX-tc.maxX),u=a&&p>0?1+p/(a*tc.width):1,_=l&&g>0?1+g/(l*tc.width):1,f*=qd(u,_)):(r.x<0&&((Gd(Jd(t)-Jd(e))<=0||Gd(Qd(e)-Qd(t))<=0)&&tc.scaleOf(s,f=1/r.x,1),tc.unsign()),p=Gd(ec.minX-tc.minX),g=Gd(tc.maxX-ec.maxX),u=a&&p>0?1-p/(a*tc.width):1,_=l&&g>0?1-g/(l*tc.width):1,f*=jd(u,_)),sc.isInnerMode(t,e,i,"height")?(r.y<0&&tc.scaleOf(s,1,y=1/r.y),p=Gd(tc.minY-ec.minY),g=Gd(ec.maxY-tc.maxY),u=d&&p>0?1+p/(d*tc.height):1,_=c&&g>0?1+g/(c*tc.height):1,y*=qd(u,_),n&&(u=qd(Vd(f),Vd(y)),f=Kd(f)*u,y=Kd(y)*u)):(r.y<0&&((Gd(Zd(t)-Zd(e))<=0||Gd($d(e)-$d(t))<=0)&&tc.scaleOf(s,1,y=1/r.y),tc.unsign()),p=Gd(ec.minY-tc.minY),g=Gd(tc.maxY-ec.maxY),u=d&&p>0?1-p/(d*tc.height):1,_=c&&g>0?1-g/(c*tc.height):1,y*=jd(u,_)),r.x*=h(f)?f:1,r.y*=h(y)?y:1,r}},sc=ic;let rc=class extends Ud{};rc.POINTER="pointer",rc.BEFORE_DOWN="pointer.before_down",rc.BEFORE_MOVE="pointer.before_move",rc.BEFORE_UP="pointer.before_up",rc.DOWN="pointer.down",rc.MOVE="pointer.move",rc.UP="pointer.up",rc.OVER="pointer.over",rc.OUT="pointer.out",rc.ENTER="pointer.enter",rc.LEAVE="pointer.leave",rc.TAP="tap",rc.DOUBLE_TAP="double_tap",rc.CLICK="click",rc.DOUBLE_CLICK="double_click",rc.LONG_PRESS="long_press",rc.LONG_TAP="long_tap",rc.MENU="pointer.menu",rc.MENU_TAP="pointer.menu_tap",rc=i([$n()],rc);const nc=rc,oc={};let ac=class extends rc{static setList(t){this.list=t instanceof Bh?t:new Bh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return lt.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),ic.axisMove(t,r),r}static limitMove(t,e){ic.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(oc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(oc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(oc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Ut.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ut.unsign(i),i}assignMove(t){oc.x=t?this.totalX:this.moveX,oc.y=t?this.totalY:this.moveY}};ac.BEFORE_DRAG="drag.before_drag",ac.START="drag.start",ac.DRAG="drag",ac.END="drag.end",ac.OVER="drag.over",ac.OUT="drag.out",ac.ENTER="drag.enter",ac.LEAVE="drag.leave",ac=i([$n()],ac);const hc=ac;let lc=class extends rc{static setList(t){ac.setList(t)}static setData(t){ac.setData(t)}};lc.DROP="drop",lc=i([$n()],lc);let dc=class extends ac{};dc.BEFORE_MOVE="move.before_move",dc.START="move.start",dc.MOVE="move",dc.DRAG_ANIMATE="move.drag_animate",dc.END="move.end",dc.PULL_DOWN="move.pull_down",dc.REACH_BOTTOM="move.reach_bottom",dc=i([$n()],dc);let cc=class extends Ud{};cc=i([$n()],cc);const uc=cc;let _c=class extends rc{};_c.BEFORE_ROTATE="rotate.before_rotate",_c.START="rotate.start",_c.ROTATE="rotate",_c.END="rotate.end",_c=i([$n()],_c);let pc=class extends ac{};pc.SWIPE="swipe",pc.LEFT="swipe.left",pc.RIGHT="swipe.right",pc.UP="swipe.up",pc.DOWN="swipe.down",pc=i([$n()],pc);let gc=class extends rc{};gc.BEFORE_ZOOM="zoom.before_zoom",gc.START="zoom.start",gc.ZOOM="zoom",gc.END="zoom.end",gc=i([$n()],gc);let fc=class extends Ud{};fc.BEFORE_DOWN="key.before_down",fc.BEFORE_UP="key.before_up",fc.DOWN="key.down",fc.HOLD="key.hold",fc.UP="key.up",fc=i([$n()],fc);const yc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?pc.UP:t>45&&t<135?pc.DOWN:t<=45&&t>=-45?pc.RIGHT:pc.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:mc.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:n(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Bh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>uo.draggable(t)||!t.isLeafer&&t.hasEvent(ac.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},mc=yc,xc=new Bh,{getDragEventData:vc,getDropEventData:wc,getSwipeEventData:bc}=yc;class Sc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=vc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,r=ac.list||this.draggableList||xc;return this.dragging&&(s?t?xc:new Bh(e?[...i.list,...i.dragHoverExclude]:i.list):r)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(dc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Hd.left(t),this.dragging&&(this.interaction.emit(ac.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],uo.draggable(e)){this.draggableList=new Bh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:n}=s;this.dragData=vc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(dc.BEFORE_MOVE,this.dragData),e.emit(dc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(ac.BEFORE_DRAG,this.dragData),e.emit(ac.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:r}=this.dragData,{dragLimitAnimate:n}=e.p,o=!n||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=ac.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:r},o||s);n&&!s&&t?uo.animateMove(e,h,l(n)?n:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(ac.OUT,t,i),e.emit(ac.OVER,t,s)):e.emit(ac.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(ac.LEAVE,t,i,s),e.emit(ac.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:n}=i,o=vc(i,t,t);if(n&&(o.throughPath=n),o.path=r,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(dc.END,o)),this.dragging){const r=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(ac.END,o),this.swipe(t,i,s,o),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(lt.getDistance(e,t)>r.config.pointer.swipeDistance){const t=bc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=wc(t,e,ac.data);s.path=i,this.interaction.emit(lc.DROP,s),this.interaction.emit(ac.LEAVE,t,i)}dragReset(){ac.list=ac.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const kc=re.get("emit");const Bc=["move","zoom","rotate","key"];function Pc(t,e,i,s,r){if(Bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Ec(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!i.path.has(n)&&n.__.hittable&&Rc(n,e,i,s,r)}}function Rc(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Ec(t,r)&&(dl.updateEventStyle&&!s&&dl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ye.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Ec(t,e){return e&&e.has(t)}const Cc={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Tc,pathCanDrag:Lc,pathHasOutside:Ac}=yc;class Oc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Hd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Hd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Xd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Cc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Bh(t),this.createTransformer(),this.dragger=new Sc(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Hd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(rc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(rc.DOWN,t),Hd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Hd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Hd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(rc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(rc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Hd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(rc.BEFORE_UP,t),this.emit(rc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(rc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(rc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(fc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Xd.setDownCode(e),this.emit(fc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(fc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(fc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Xd.setUpCode(e),this.emit(fc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Bh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(rc.OUT,t,i),this.emit(rc.OVER,t,e)):this.emit(rc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(rc.LEAVE,t,i,e),this.emit(rc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(rc.LEAVE,t),this.dragger.dragging&&this.emit(lc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[rc.DOUBLE_TAP,rc.DOUBLE_CLICK].some(e=>Tc(t.path,e));s<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;ee.backgrounder||t.origin||n&&n.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Ac(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Lc(t.path))&&!Ac(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:rc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&lt.round(s),s}emitTap(t){this.emit(rc.TAP,t),this.emit(rc.CLICK,t)}emitDoubleTap(t){this.emit(rc.DOUBLE_TAP,t),this.emit(rc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(rc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(rc.LONG_TAP,t),(Tc(t.path,rc.LONG_TAP)||Tc(t.path,rc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($o.RESIZE,this.__onResize,this)],t.once(sa.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Rc(r,t,e,!0,s))return;r.isApp&&Pc(r,t,e,!0,s)}for(let n=0,o=i.length;n<o;n++)if(r=i.list[n],r.isApp&&Pc(r,t,e,!1,s),Rc(r,t,e,!1,s))return}catch(t){kc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Dc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Dc.custom={};class Fc extends xe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Bh,this.pixelList=new Bh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:Mc,copyRadiusPoint:Ic}=lt,{hitRadiusPoint:Wc,hitPoint:Nc}=Ut,zc={},Yc={},Xc=ph.prototype;Xc.hit=function(t,e=0){this.updateLayout(),Ic(Yc,t,e);const i=this.__world;return!!(e?Wc(i,Yc):Nc(i,Yc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},Yc),e,{target:this}):this.__hitWorld(Yc))},Xc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(Ic(zc,t,i.hitRadius),t=zc),Mc(t,s,zc),i.hitBox||n){if(Ut.hitRadiusPoint(r.boxBounds,zc))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(zc,e)},Xc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Xc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Xc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Xc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Hc=new yt,Uc=Hl.prototype;Uc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=ee.image.hitCanvasSize,o=n.hitScale=Kt.set(0,0,r,r).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(o);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),sn.patternLocked=!0,this.__renderShape(n,{matrix:Hc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Uc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const jc=Hl.prototype,qc=Gl.prototype,Vc=td.prototype;qc.__updateHitCanvas=Vc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?jc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},qc.__hitFill=Vc.__hitFill=function(t){return this.__hitCanvas?jc.__hitFill.call(this,t):Ut.hitRadiusPoint(this.__layout.boxBounds,t)},Id.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},Ul.prototype.pick=function(t,e){return e||(e=r),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Gc=Oe.prototype;function Kc(t,e,i){t.__.__font?rl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Jc(t,e,i,s,r){const n=i.__;_(t)?rl.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&rl.strokeArrow(t,i,s,r)}function Qc(t,e,i,s,r){const n=i.__;_(t)?rl.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),rl.drawTextStroke(i,s,r))}function Zc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Qc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",rl.fillText(i,n,r),n.blendMode="normal",uo.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}Gc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Gc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Gc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:o}=t;e&&(s-=e.x,r-=e.y),Kt.set(s-n,r-o,2*n,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:$c,copyAndSpread:tu,toOuterOf:eu,getOuterOf:iu,getByMove:su,move:ru,getIntersectData:nu}=Ut,ou={};let au;const{stintSet:hu}=f,{hasTransparent:lu}=el;function du(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:r}=i.__layout,{type:o}=e;switch(o){case"image":case"film":case"video":if(!e.url)return;s=nl.image(i,t,e,r,!au||!au[e.url]),"image"!==o&&nl[o](s);break;case"linear":s=ol.linearGradient(e,r);break;case"radial":s=ol.radialGradient(e,r);break;case"angular":s=ol.conicGradient(e,r);break;case"solid":const{color:a,opacity:h}=e;s={type:o,style:el.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:el.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&lu(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const cu={compute:function(t,e){const i=e.__,s=[];let r,n,o,a=i.__input[t];u(a)||(a=[a]),au=nl.recycleImage(t,i);for(let i,r=0,n=a.length;r<n;r++)(i=du(t,a[r],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(hu(i,"__isAlphaPixelFill",r),hu(i,"__isTransparentFill",n)):(hu(i,"__isAlphaPixelStroke",r),hu(i,"__isTransparentStroke",n),hu(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Kc(e,i,s)},fills:function(t,e,i,s){let r,n,o;for(let a=0,h=t.length;a<h;a++){if(r=t[a],n=r.originPaint,r.image){if(o?o++:o=1,nl.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),Kc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),Kc(e,i,s),i.restoreBlendMode()):Kc(e,i,s)}},fillPathOrText:Kc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)o=r[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)rl.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":Jc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Jc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)Jc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Jc(t,2,e,o,s),o.clipUI(r),o.clearWorld(n),uo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){rl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Qc(t,1,e,i,s);break;case"inside":Zc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Qc(t,2,e,i,s):Zc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:o}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=r;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!nl.checkImage(o,!1,s,r,n))&&o.style){if(h){const{strokeStyle:t}=o;t?r.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(o.style,a.__strokeWidth*e,a)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),i?rl.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?rl.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;eu(o.strokeSpread?(tu(ou,o.boxBounds,o.strokeSpread),ou):o.boxBounds,n,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(a))_=s,h=u=a,l=n;else{let s;if(ee.fullImageShadow)s=a;else{const t=o.renderShapeSpread?$c(r,P.swapAndScale(o.renderShapeSpread,p,g)):r;s=nu(t,a)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=iu(a,c),h=su(u,-c.e,-c.f),l=iu(n,c),ru(l,-c.e,-c.f);const m=i.matrix;m?(d=new yt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let uu,_u=new Gt;const{isSame:pu}=Ut;function gu(t,e,i,s,r,n){const o=t.__;if("fill"===e&&!o.__naturalWidth&&(o.__naturalWidth=s.width/o.pixelRatio,o.__naturalHeight=s.height/o.pixelRatio,o.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",o.width),t.setProxyAttr("height",o.height)),!1;if(!r.data){nl.createData(r,s,i,n);const{transform:t}=r.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||o.path||o.cornerRadius;(h||e&&e<1||a)&&(r.complex=!h||2)}return!0}function fu(t,e){xu(t,qo.LOAD,e)}function yu(t,e){xu(t,qo.LOADED,e)}function mu(t,e,i){e.error=i,t.forceUpdate("surface"),xu(t,qo.ERROR,e)}function xu(t,e,i){t.hasEvent(e)&&t.emitEvent(new qo(e,i))}function vu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:bu}=Q,Su=new Gt,ku={},Bu={};function Pu(t,e,i,s){const r=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Ru={},Eu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Cu,set:Tu,rotateOfOuter:Lu,translate:Au,scaleOfOuter:Ou,multiplyParent:Du,scale:Fu,rotate:Mu,skew:Iu}=Q;function Wu(t,e,i,s,r,n,o,a){o&&Mu(t,o),a&&Iu(t,a.x,a.y),r&&Fu(t,r,n),Au(t,e.x+i,e.y+s)}const{get:Nu,scale:zu,copy:Yu}=Q,{getFloorScale:Xu}=M,{abs:Hu}=Math;const Uu={image:function(t,e,i,s,r){let n,o;const a=sn.get(i,i.type);return uu&&i===uu.paint&&pu(s,uu.boxBounds)?n=uu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),uu=a.use>1?{leafPaint:n,paint:i,boxBounds:_u.set(s)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(gu(t,e,i,a,n,s),r&&(fu(t,o),yu(t,o))):a.error?r&&mu(t,o,a.error):(r&&(vu(t,!0),fu(t,o)),n.loadId=a.load(()=>{vu(t,!1),t.destroyed||(gu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),yu(t,o)),n.loadId=void 0},e=>{vu(t,!1),mu(t,o,e),n.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:o}=nl.getImageRenderScaleData(t,i,s,r),a=t.film?t.nowIndex:n+"-"+o,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=r;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===ee.name&&$o.isResizing(i)||c||(e=ee.image.isLarge(h,n,o)||h.width*n>8096||h.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),nl.drawImage(t,n,o,i,s,r),!0):(!t.style||d.sync||c?nl.createPattern(t,i,s,r):nl.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:o,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:n,opacity:c}=t.originPaint,{transform:u}=o;r.save(),2===h&&r.clipUI(s),n&&(r.blendMode=n),c&&(r.opacity*=c),u&&r.transform(u),a.render(r,0,0,l,d,s,t,e,i),r.restore()}else o.scaleX&&(l*=o.scaleX,d*=o.scaleY),a.render(r,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,r,n,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,sn.recyclePaint(s),r.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),r.unload(i[h].loadId,!o.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,r){t.patternTask||(t.patternTask=sn.patternTasker.add(()=>s(this,void 0,void 0,function*(){nl.createPattern(t,e,i,r),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=nl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:r+"-"+n;if(t.patternId!==o&&!e.destroyed&&(!ee.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a,filters:h}=t.originPaint,{transform:l,gap:d}=s,c=nl.getPatternFixScale(t,r,n);let u,_,p,{width:g,height:f}=i;c&&(r*=c,n*=c),g*=r,f*=n,d&&(_=d.x*r/Hu(s.scaleX||1),p=d.y*n/Hu(s.scaleY||1)),(l||1!==r||1!==n)&&(r*=Xu(g+(_||0)),n*=Xu(f+(p||0)),u=Nu(),l&&Yu(u,l),zu(u,1/r,1/n));const y=i.getCanvas(g,f,a,h,_,p,e.leafer&&e.leafer.config.smooth,s.interlace),m=i.getPattern(y,s.repeat||ee.origin.noRepeat||"no-repeat",u,t);t.style=m,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=ee.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>o&&(n=o),(o*=e*i)>n&&(r=Math.sqrt(n/o)),r},createData:function(t,e,i,s){t.data=nl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Su.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{mode:n,align:o,offset:h,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,interlace:m}=t,x=e.width===s&&e.height===r,v={mode:n},w="center"!==o&&(u||0)%180==90;let b,S;switch(Ut.set(Bu,0,0,w?r:s,w?s:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(M.getScaleData(d,c,i,ku),b=ku.scaleX,S=ku.scaleY),(o||y||f)&&(b&&Ut.scale(Bu,b,S,!0),o&&Rt.toPoint(o,Bu,e,Bu,!0,!0))):x&&!u||(b=S=Ut.getFitScale(e,Bu,"fit"!==n),Ut.put(e,i,o,b,!1,Bu),Ut.scale(Bu,b,S,!0)),h&&lt.move(Bu,h),n){case"stretch":x?b&&(b=S=void 0):(b=e.width/s,S=e.height/r,nl.stretchMode(v,e,b,S));break;case"normal":case"clip":if(Bu.x||Bu.y||b||g||u||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),nl.clipMode(v,e,Bu.x,Bu.y,b,S,u,p,t,i),t&&(b=b?b*t:t,S=S?S*i:i)}break;case"repeat":(!x||b||u||p)&&nl.repeatMode(v,e,s,r,Bu.x,Bu.y,b,S,u,p,o,t.freeTransform),f||(v.repeat="repeat");const i=_(f);(y||i)&&(v.gap=function(t,e,i,s,r){let n,o;_(t)?(n=t.x,o=t.y):n=o=t;return{x:Pu(n,i,r.width,e&&e.x),y:Pu(o,s,r.height,e&&e.y)}}(y,i&&f,Bu.width,Bu.height,e));break;default:b&&nl.fillOrFitMode(v,e,Bu.x,Bu.y,b,S,u)}return v.transform||(e.x||e.y)&&bu(v.transform=wu(),e.x,e.y),b&&(v.scaleX=b,v.scaleY=S),f&&(v.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(v.interlace=l(m)||"percent"===m.type?{type:"x",offset:m}:m),v},stretchMode:function(t,e,i,s){const r=Cu(),{x:n,y:o}=e;n||o?Au(r,n,o):i>0&&s>0&&(r.onlyScale=!0),Fu(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,o){const a=Cu();Au(a,e.x+i,e.y+s),Fu(a,r,n),o&&Lu(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,r,n,o,a,h,l){const d=Cu();Wu(d,e,i,s,r,n,o,a),h&&(o||a?(Tu(Eu),Ou(Eu,e,h,l),Du(d,Eu)):Ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,o,a,h,l,d,c){const u=Cu();if(c)Wu(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)Lu(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Au(u,s,0);break;case 180:Au(u,i,s);break;case 270:Au(u,0,i)}Ru.x=e.x+r,Ru.y=e.y+n,Au(u,Ru.x,Ru.y),o&&Ou(u,Ru,o,a)}t.transform=u}},{toPoint:ju}=kt,{hasTransparent:qu}=el,Vu={},Gu={};function Ku(t,e,i,s){if(i){let r,n,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],a(r)?(o=t/(l-1),n=el.string(r,s)):(o=r.offset,n=el.string(r.color,s)),e.addColorStop(o,n),!h&&qu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ju,getDistance:Qu}=lt,{get:Zu,rotateOfOuter:$u,scaleOfOuter:t_}=Q,{toPoint:e_}=kt,i_={},s_={};function r_(t,e,i,s,r){let n;const{width:o,height:a}=t;if(o!==a||s){const t=Ju(e,i);n=Zu(),r?(t_(n,e,o/a*(s||1),1),$u(n,e,t+90)):(t_(n,e,1,o/a*(s||1)),$u(n,e,t))}return n}const{getDistance:n_}=lt,{toPoint:o_}=kt,a_={},h_={};const l_={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;ju(i||"top",e,Vu),ju(s||"bottom",e,Gu);const o=ee.canvas.createLinearGradient(Vu.x,Vu.y,Gu.x,Gu.y),a={type:r,style:o};return Ku(a,o,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;e_(i||"center",e,i_),e_(s||"bottom",e,s_);const a=ee.canvas.createRadialGradient(i_.x,i_.y,0,i_.x,i_.y,Qu(i_,s_)),h={type:r,style:a};Ku(h,a,t.stops,n);const l=r_(e,i_,s_,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:o}=t;o_(i||"center",e,a_),o_(s||"bottom",e,h_);const a=ee.conicGradientSupport?ee.canvas.createConicGradient(0,a_.x,a_.y):ee.canvas.createRadialGradient(a_.x,a_.y,0,a_.x,a_.y,n_(a_,h_)),h={type:r,style:a};Ku(h,a,t.stops,n);const l=r_(e,a_,h_,o||1,ee.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:r_},{copy:d_,move:c_,toOffsetOutBounds:u_}=Ut,{max:__,abs:p_}=Math,g_={},f_=new yt,y_={};function m_(t,e){let i,s,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=p_(t.spread||0),o=__(o,r+n-s),a=__(a,r+n+i),h=__(h,r+n+s),l=__(l,r+n-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function x_(t,e,i){const{shapeBounds:s}=i;let r,n;ee.fullImageShadow?(d_(g_,t.bounds),c_(g_,e.x-s.x,e.y-s.y),r=t.bounds,n=g_):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:v_}=Ut,w_={};const b_=m_;const S_={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;u_(h,y_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(y_.offsetX+(o.x||0)*c*f,y_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,el.string(o.color)),r=al.getShadowTransform(t,_,i,o,y_,f),r&&_.setTransform(r),x_(_,y_,i),r&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),s=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),uo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;v_(h,w_,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(w_.offsetX+(o.x||0)*c*f,w_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),r=al.getShadowTransform(t,_,i,o,w_,f,!0),r&&_.setTransform(r),x_(_,w_,i),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,el.string(o.color),"source-in"),uo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:m_,getShadowTransform:function(t,e,i,s,r,n,o){if(s.spread){const i=2*s.spread*n*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return f_.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/a,1+i/h),f_}},isTransformShadow(t){},getInnerShadowSpread:b_},{excludeRenderBounds:k_}=vo;let B_;function P_(t,e,i,s,r,n,o,a){switch(e){case"grayscale":B_||(B_=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),n&&s.recycle(o);E_(t,e,i,1,r,n)}(t,i,s,r,o,a);break;case"opacity-path":E_(t,i,s,n,o,a);break;case"path":a&&i.restore()}}function R_(t){return t.getSameCanvas(!1,!0)}function E_(t,e,i,s,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,r),n?i.recycle(o):i.clearWorld(o)}Ul.prototype.__renderMask=function(t,e){let i,s,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(P_(this,o,t,r,s,n,void 0,!0),s=r=null),"clipping"!==a&&"clipping-path"!==a||k_(i,e)||i.__render(t,e),n=i.__.opacity,B_=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=R_(t))):(o="path",t.save()),i.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=R_(t)),r||(r=R_(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&P_(this,o,t,r,s,n,void 0,!1),k_(i,e)||i.__render(r||t,e),d&&P_(this,o,t,r,s,n,d,!1)}P_(this,o,t,r,s,n,void 0,!0)};const C_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",T_=C_+"_#~&*+\\=|≮≯≈≠=…",L_=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 A_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const O_=A_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),D_=A_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),F_=A_(C_),M_=A_(T_),I_=A_("- —/~|┆·");var W_;!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"}(W_||(W_={}));const{Letter:N_,Single:z_,Before:Y_,After:X_,Symbol:H_,Break:U_}=W_;function j_(t){return O_[t]?N_:I_[t]?U_:D_[t]?Y_:F_[t]?X_:M_[t]?H_:L_.test(t)?z_:N_}const q_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function V_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:G_}=q_,{Letter:K_,Single:J_,Before:Q_,After:Z_,Symbol:$_,Break:tp}=W_;let ep,ip,sp,rp,np,op,ap,hp,lp,dp,cp,up,_p,pp,gp,fp,yp,mp=[];function xp(t,e){lp&&!hp&&(hp=lp),ep.data.push({char:t,width:e}),sp+=e}function vp(){rp+=sp,ep.width=sp,ip.words.push(ep),ep={data:[]},sp=0}function wp(){pp&&(gp.paraNumber++,ip.paraStart=!0,pp=!1),lp&&(ip.startCharSize=hp,ip.endCharSize=lp,hp=0),ip.width=rp,fp.width?G_(ip):yp&&bp(),mp.push(ip),ip={words:[]},rp=0}function bp(){rp>(gp.maxWidth||0)&&(gp.maxWidth=rp)}const{top:Sp,right:kp,bottom:Bp,left:Pp}=wt;function Rp(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const Ep={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[Pp],r-=o[kp]+o[Pp],!r&&(r=.01)):e.autoSizeAlign||(i=o[Pp]),n?(s=o[Sp],n-=o[Sp]+o[Bp],!n&&(n=.01)):e.autoSizeAlign||(s=o[Sp]));const h={bounds:{x:i,y:s,width:r,height:n},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){gp=t,mp=t.rows,fp=t.bounds,yp=!fp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:o}=ee,{width:a}=fp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;pp=!0,cp=null,hp=ap=lp=sp=rp=0,ep={data:[]},ip={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)op=e[i],"\n"===op?(sp&&vp(),ip.paraEnd=!0,wp(),pp=!0):(dp=j_(op),dp===K_&&"none"!==n&&(op=V_(op,n,!sp)),ap=o.measureText(op).width,s&&(s<0&&(lp=ap),ap+=s),up=dp===J_&&(cp===J_||cp===K_)||cp===J_&&dp!==Z_,_p=!(dp!==Q_&&dp!==J_||cp!==$_&&cp!==Z_),np=pp&&r?a-r:a,t&&a&&rp+sp+ap>np&&(h?(sp&&vp(),rp&&wp()):(_p||(_p=dp===K_&&cp==Z_),up||_p||dp===tp||dp===Q_||dp===J_||sp+ap>np?(sp&&vp(),rp&&wp()):rp&&wp()))," "===op&&!0!==pp&&rp+sp===0||(dp===tp?(" "===op&&sp&&vp(),xp(op,ap),vp()):up||_p?(sp&&vp(),xp(op,ap)):xp(op,ap)),cp=dp);sp&&vp(),rp&&wp(),mp.length>0&&(mp[mp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{gp.paraNumber++,rp=o.measureText(t).width,mp.push({x:r||0,text:t,width:rp,paraStart:!0}),yp&&bp()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Rp(e,"x",t[Pp]);break;case"right":Rp(e,"x",-t[kp])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Rp(e,"y",t[Sp]);break;case"bottom":Rp(e,"y",-t[Bp])}}(o,h,e,r,n),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,v,w,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(x=i[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=n,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),v=x.x,w=x.width,a<0&&(x.width<0?(w=-x.width+e.fontSize+a,v-=w,w+=e.fontSize):w-=a),v<s.x&&(s.x=v),w>s.width&&(s.width=w),h&&g&&g<w&&(x.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,__letterSpacing:o}=e,a=i&&r.includes("both"),h=a||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(x=!t.paraEnd||a,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){const{rows:r,overflow:n}=t;let{textOverflow:o}=e;if(n&&r.splice(n),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?ee.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,_(n)?(i=n.type,n.color&&(t.decorationColor=el.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const Cp={string:function(t,e){if(!t)return"#000";const i=l(e)&&e<1;if(a(t)){if(!i||!el.object)return t;t=el.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(tl,Ep),Object.assign(el,Cp),Object.assign(rl,cu),Object.assign(nl,Uu),Object.assign(ol,l_),Object.assign(al,S_),Object.assign(ue,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new Eh(t,e),hitCanvasManager:()=>new Fc}),Ch();class Tp extends ml{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Lp=class extends Hl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!n(t))if(l(t))this.now=t;else if(_(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=sn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:r,size:n,total:o}=e,{width:a,height:h}=n&&(l(n)?{width:n,height:n}:n)||(o>1?this:t);let d=r?r.x:0,c=r?r.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new qo(qo.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:r}=this;r&&(r.FPS&&(i=r.FPS),n(r.loop)||(s=r.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:r}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,r)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};function Ap(t,e){return _n(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?dl.setStyleName(this,e,i):dl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Op(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Dp(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Fp(t,e){_(e)||(e=void 0),Wp(t,e,"in")}function Mp(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),Wp(t,e,"out"))}i([Xn(Tp)],Lp.prototype,"__",void 0),i([bn()],Lp.prototype,"robot",void 0),i([fn()],Lp.prototype,"actions",void 0),i([fn("")],Lp.prototype,"action",void 0),i([Ln(0)],Lp.prototype,"now",void 0),i([fn(12)],Lp.prototype,"FPS",void 0),i([fn(!0)],Lp.prototype,"loop",void 0),Lp=i([Zn()],Lp),ce.add("robot");const Ip={};function Wp(t,e,i){const{normalStyle:s}=t;e||(e=Ip),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==Ip&&dl.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&o(i[s])&&o(e[s])&&(s="transition");return o(e[s])?i[s]:e[s]}(i,e,t);const n=r?function(t,e){const i=Yp(e,t),s=t.animate();s&&Yp(i,t,s.fromStyle);return i}(t,e):void 0;dl.canAnimate&&Np(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Np(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete a.animation}t.normalStyle=zp(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(r){const e=zp(n,t);t.set(n,"temp"),t.animate([n,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function Np(t){let e;const i={},s=Dp(t),r=s?t.state||s.state:t.state,n=r&&t.states[r];n&&dl.isState(r,t,s)&&(e=Xp(i,n));const o=i.selectedStyle||t.selectedStyle;o&&dl.isSelected(t,s)&&(e=Xp(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&dl.isPlacehold(t,s)&&(e=Xp(i,a)),dl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Xp(i,s))}else{const r=i.focusStyle||t.focusStyle;r&&dl.isFocus(t,s)&&(e=Xp(i,r));const n=i.hoverStyle||t.hoverStyle;n&&dl.isHover(t,s)&&(e=Xp(i,n));const o=i.pressStyle||t.pressStyle;o&&dl.isPress(t,s)&&(e=Xp(i,o))}return e?i:void 0}function zp(t,e,i,s){const r=i?t:{},n=i||t;for(let t in n)s&&dl.animateExcludes[t]||(r[t]=e[t]);return r}function Yp(t,e,i){return zp(t,e,i,!0)}function Xp(t,e){return Object.assign(t,e),!0}function Hp(t,e){const i=t[e];i&&Fp(t,i),t.button&&jp(t.children,e)}function Up(t,e,i){i||(i=t.states[e]),Fp(t,i),t.button&&jp(t.children,null,e)}function jp(t,e,i){if(!t)return;let s,r;for(let o=0,a=t.length;o<a;o++){if(s=t[o],e){switch(r=!0,e){case"hoverStyle":dl.isHover(s)&&(r=!1);break;case"pressStyle":dl.isPress(s)&&(r=!1);break;case"focusStyle":dl.isFocus(s)&&(r=!1)}r&&Hp(s,e)}else n(i)||Up(s,i);s.isBranch&&jp(s.children,e,i)}}function qp(t,e){const i=t[e];i&&Mp(t,i),t.button&&Gp(t.children,e)}function Vp(t,e,i){Mp(t,i),t.button&&Gp(t.children,null,e)}function Gp(t,e,i){if(!t)return;let s;for(let r=0,o=t.length;r<o;r++)s=t[r],e?qp(s,e):n(i)||Vp(s,i),s.isBranch&&Gp(s.children,e,i)}function Kp(t,e,i){let s;const r=e.leafer?e.leafer.interaction:null;if(r&&(s=r[t](e),!s&&i)){const n=Dp(e,i);n&&(s=r[t](n))}return s}function Jp(t,e,i){let s=e[t];if(!s&&i){const r=Dp(e,i);r&&(s=r[t])}return s}ce.add("state"),dl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},dl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const r=Dp(e,i);r&&(s=r.states[t])}return!!s}(t,e,i)},dl.isSelected=function(t,e){return Jp("selected",t,e)},dl.isDisabled=function(t,e){return Jp("disabled",t,e)},dl.isFocus=function(t,e){return Kp("isFocus",t,e)},dl.isHover=function(t,e){return Kp("isHover",t,e)},dl.isPress=function(t,e){return Kp("isPress",t,e)},dl.isPlacehold=function(t,e){return t.__.__isPlacehold},dl.isDrag=function(t,e){return Kp("isDrag",t,e)},dl.setStyleName=function(t,e,i){i?Up(t,e,t[e]):Vp(t,e,t[e])},dl.set=function(t,e){const i=t.states[e];i?Up(t,e,i):Vp(t,e,i)},dl.getStyle=Np,dl.updateStyle=Wp,dl.updateEventStyle=function(t,e){switch(e){case rc.ENTER:Hp(t,"hoverStyle");break;case rc.LEAVE:qp(t,"hoverStyle");break;case rc.DOWN:Hp(t,"pressStyle");break;case rc.UP:qp(t,"pressStyle")}};const Qp=Hl.prototype;Hl.addAttr("selected",!1,Ap,"selectedStyle"),Hl.addAttr("disabled",!1,Ap,"disabledStyle"),Hl.addAttr("states",{},Op),Hl.addAttr("state","",Ap),Hl.addAttr("normalStyle",void 0,fn),Hl.addAttr("hoverStyle",void 0,Op),Hl.addAttr("pressStyle",void 0,Op),Hl.addAttr("focusStyle",void 0,Op),Hl.addAttr("selectedStyle",void 0,Op),Hl.addAttr("disabledStyle",void 0,Op),Hl.addAttr("placeholderStyle",void 0,Op),Hl.addAttr("button",!1,fn),Qp.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Qp.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Hp(this,"focusStyle"):qp(this,"focusStyle")})},Qp.updateState=function(){dl.updateStyle(this,void 0,"in")};const Zp=Id.prototype,$p="text";dn(Zp,$p,Object.assign(Object.assign({},cn(Zp,$p)),{set(t){const e=this,i=e.text;e.__setAttr($p,t)&&(kn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:tg,sin:eg,pow:ig,sqrt:sg,abs:rg,ceil:ng,floor:og,round:ag,PI:hg}=Math,lg=5*hg,dg=1.70158,cg=2.5949095,ug=7.5625,_g=2.75;function pg(t){return e=>ig(e,t)}function gg(t){return e=>1-ig(1-e,t)}function fg(t){return e=>e<.5?.5*ig(2*e,t):1-.5*ig(2-2*e,t)}function yg(t){return t<1/_g?ug*t*t:t<2/_g?ug*(t-=1.5/_g)*t+.75:t<2.5/_g?ug*(t-=2.25/_g)*t+.9375:ug*(t-=2.625/_g)*t+.984375}function mg(t,e,i,s){const r={};return n=>{const o=~~(1e4*n),a=r[o];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=xg(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(rg(l)<1e-6));e++)c-=d/l;return r[o]=xg(c,e,s)}}function xg(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const vg={get(t){const{list:e}=vg;return a(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){vg.list[t]=e},list:{linear:t=>t,ease:mg(.25,.1,.25,1),"ease-in":mg(.42,0,1,1),"ease-out":mg(0,0,.58,1),"ease-in-out":mg(.42,0,.58,1),"sine-in":t=>1-tg(t*hg*.5),"sine-out":t=>eg(t*hg*.5),"sine-in-out":t=>.5*(1-tg(t*hg)),"quad-in":pg(2),"quad-out":gg(2),"quad-in-out":fg(2),"cubic-in":pg(3),"cubic-out":gg(3),"cubic-in-out":fg(3),"quart-in":pg(4),"quart-out":gg(4),"quart-in-out":fg(4),"quint-in":pg(5),"quint-out":gg(5),"quint-in-out":fg(5),"expo-in":t=>t?ig(2,10*t-10):0,"expo-out":t=>1===t?1:1-ig(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*ig(2,2*t*10-10):.5*(2-ig(2,10-2*t*10)),"circ-in":t=>1-sg(1-ig(t,2)),"circ-out":t=>sg(1-ig(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-sg(1-ig(2*t,2))):.5*(sg(1-ig(2-2*t,2))+1),"back-in":t=>((dg+1)*t-dg)*t*t,"back-out":t=>(t-=1)*t*((dg+1)*t+dg)+1,"back-in-out":t=>t<.5?(t*=2)*t*((cg+1)*t-cg)*.5:.5*((t=2*t-2)*t*((cg+1)*t+cg)+2),"elastic-in":t=>0===t||1===t?t:-ig(2,10*(t-1))*eg((t-1.1)*lg),"elastic-out":t=>0===t||1===t?t:ig(2,-10*t)*eg((t-.1)*lg)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-ig(2,10*((t*=2)-1))*eg((t-1.1)*lg)*.5:ig(2,10*(1-(t*=2)))*eg((t-1.1)*lg)*.5+1,"bounce-in":t=>1-yg(1-t),"bounce-out":yg,"bounce-in-out":t=>t<.5?.5*(1-yg(1-2*t)):.5*(1+yg(2*t-1)),"cubic-bezier":mg,steps:function(t,e="floor"){return i=>("floor"===e?og(i*t):"ceil"===e?ng(i*t):ag(i*t))/t}}};function wg(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class bg{}bg.CREATED="created",bg.PLAY="play",bg.PAUSE="pause",bg.STOP="stop",bg.SEEK="seek",bg.UPDATE="update",bg.COMPLETED="completed";let Sg=class extends da{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:r}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&r&&l(r)&&(t+=r-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:r,attrs:n}=this;this.easingFn=vg.get(r),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(bg.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(bg.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(bg.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;_(t)&&(t=il.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(bg.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:r}=i,o=!(r>1)||this.join;let a,h,d,c,u,_=0,p=0;r>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<r;s++){if(h=i[s],c=h.style||h,a||(a=o?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:r,swing:n,loop:o}=h;n&&(d.swing=l(n)?n:2,u=2*d.swing-1),o&&(d.loop=u=l(o)?o:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),r&&(d.easingFn=vg.get(r))}if(!d.autoDuration&&n(d.duration)&&(r>1?s>0||o?p+=u:d.duration=0:d.duration=this.duration),r>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(bg.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:r,target:o}=this;for(let a in e)n(s[a])&&(s[a]=r[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=n(i[a])?r[a]:i[a],r[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let r=0;r<s;r++)e=i[r],n(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ee.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(bg.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,r=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(r);else{const{attrsMap:i,target:n}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),cl.setBetweenStyle(o,s,r,e,t,n,i),this.setStyle(o)}this.emitType(bg.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return l(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};i([wg("ease")],Sg.prototype,"easing",void 0),i([wg(0)],Sg.prototype,"delay",void 0),i([wg(.2)],Sg.prototype,"duration",void 0),i([wg("auto")],Sg.prototype,"ending",void 0),i([wg(!1)],Sg.prototype,"reverse",void 0),i([wg(!1)],Sg.prototype,"swing",void 0),i([wg(!1)],Sg.prototype,"loop",void 0),i([wg(0)],Sg.prototype,"loopDelay",void 0),i([wg(1)],Sg.prototype,"speed",void 0),i([wg(!0)],Sg.prototype,"autoplay",void 0),i([wg()],Sg.prototype,"join",void 0),i([wg()],Sg.prototype,"jump",void 0),i([wg()],Sg.prototype,"attrs",void 0),Sg=i([Qn(wa)],Sg);let kg=class extends Sg{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Sg(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(bg.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(bg.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(bg.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(bg.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case bg.COMPLETED:this.completed&&this.emitType(t);break;case bg.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};kg=i([Qn(wa)],kg);const Bg={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Pg=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Rg=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Eg=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Cg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Tg=parseInt,Lg=parseFloat,{round:Ag}=Math;let Og={},Dg=0;function Fg(t){let e,i,s,r=1;switch(t.length){case 9:e=Tg(t.slice(1,3),16),i=Tg(t.slice(3,5),16),s=Tg(t.slice(5,7),16),r=Tg(t.slice(7,9),16)/255;break;case 7:e=Tg(t.slice(1,3),16),i=Tg(t.slice(3,5),16),s=Tg(t.slice(5,7),16);break;case 5:e=Tg(t[1]+t[1],16),i=Tg(t[2]+t[2],16),s=Tg(t[3]+t[3],16),r=Tg(t[4]+t[4],16)/255;break;case 4:e=Tg(t[1]+t[1],16),i=Tg(t[2]+t[2],16),s=Tg(t[3]+t[3],16);break;case 3:e=i=s=Tg(t[1]+t[2],16);break;case 2:e=i=s=Tg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:r}}const Mg=1/6,Ig=.5,Wg=2/3,Ng=1/3;function zg(t,e,i){return i<0?i++:i>1&&i--,i<Mg?t+6*(e-t)*i:i<Ig?e:i<Wg?t+(e-t)*(Wg-i)*6:t}function Yg(t,e,i,s=1){let r,n,o;if(t/=360,i/=100,0===(e/=100))r=n=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;r=zg(a,s,t+Ng),n=zg(a,s,t),o=zg(a,s,t-Ng)}return{r:Ag(255*r),g:Ag(255*n),b:Ag(255*o),a:s}}ce.add("color"),el.object=function(t,e){let i,s=!n(e)&&e<1;if(a(t)){const e=Og[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Fg(t);break;case"R":case"r":"("===t[4]&&Rg.test(t)?i=function(t){const e=Rg.exec(t);return{r:Tg(e[1]),g:Tg(e[2]),b:Tg(e[3]),a:Lg(e[4])}}(t):"("===t[3]&&Pg.test(t)&&(i=function(t){const e=Pg.exec(t);return{r:Tg(e[1]),g:Tg(e[2]),b:Tg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Cg.test(t)?i=function(t){const e=Cg.exec(t);return Yg(Lg(e[1]),Lg(e[2]),Lg(e[3]),Lg(e[4]))}(t):"("===t[3]&&Eg.test(t)&&(i=function(t){const e=Eg.exec(t);return Yg(Lg(e[1]),Lg(e[2]),Lg(e[3]),1)}(t))}if(!i){const e=Bg[t.toLowerCase()];e&&(i=Fg("#"+e))}i&&(Dg++,Dg>1e4&&(Og={},Dg=0),Og[t]=Object.assign({},i))}}else _(t)&&(n(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Xg}=Math,{fourNumber:Hg}=M,Ug={fill:Kg,stroke:Kg,cornerRadius:(t,e,i)=>l(t)&&l(e)?Vg(t,e,i):(t=Hg(t),e=Hg(e),t.map((t,s)=>Vg(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,r=e.length,n=Vg(s,r,i,1);return s<r?e.substring(0,n):t.substring(0,n)}return l(t)||l(e)?M.float(Vg(t,e,i),Math.max(qg(t),qg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const r=Object.assign(Object.assign({},t),e);return cl.setBetweenStyle(r,t,e,r,i,s),r},shadow:Jg,innerShadow:Jg},jg={value:function(t,e,i){const s=l(t),r=l(e);return s&&r?t+(e-t)*i:r||s?Vg(t,e,i):t},number:Vg,color:Gg,setBetweenStyle:function(t,e,i,s,r,n,o){let a,h,l;const{list:d,value:c}=cl;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,r,n)))}};function qg(t){const e=String(t).split(".")[1];return e?e.length:0}function Vg(t,e,i,s){t||(t=0),e||(e=0);const r=t+(e-t)*i;return s?Xg(r):r}function Gg(t,e,i){t=el.object(t),e=el.object(e);const s=Vg(t.r,e.r,i,1)+","+Vg(t.g,e.g,i,1)+","+Vg(t.b,e.b,i,1),r=Vg(t.a,e.a,i);return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}function Kg(t,e,i){return a(t)&&a(e)?Gg(t,e,i):e}function Jg(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Vg((t=t||{}).x,e.x,i),y:Vg(t.y,e.y,i),blur:Vg(t.blur,e.blur,i),spread:Vg(t.spread,e.spread,i),color:Gg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ce.add("animate","color"),dl.canAnimate=!0,Object.assign(cl.list,Ug),Object.assign(cl,jg);const Qg=Hl.prototype;Hl.addAttr("animation",void 0,function(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Hl.addAttr("animationOut",void 0,fn),Hl.addAttr("transition",!0,fn),Hl.addAttr("transitionOut",void 0,fn),Qg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Qg.animate=function(t,e,i,s){if(n(t))return this.__animate;let r=u(t)&&!e&&i?new kg(this,t,s):new Sg(this,t,e,s);this.killAnimate(i,r.toStyle);const o=this.__animate;return o&&(r instanceof kg?r.list.unshift(o):r=new kg(this,[o,r])),this.__animate=r},Qg.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof kg&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Qg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(bg.COMPLETED,e)};const Zg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],$g=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:tf}=Math,{getDerivative:ef}=li,sf={getDistance(t,e,i,s,r,n,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<Zg.length;h++)l=f*(1+Zg[h]),d=f*(1-Zg[h]),c=ef(l,t,i,r,o),u=ef(l,e,s,n,a),_=ef(d,t,i,r,o),p=ef(d,e,s,n,a),g+=$g[h]*(tf(c*c+u*u)+tf(_*_+p*p));return g*f},getRotation(t,e,i,s,r,n,o,a,h){const l=ef(t,e,s,n,a),d=ef(t,i,r,o,h);return Math.atan2(d,l)/W},getT(t,e,i,s,r,n,o,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)rf(i,s,r,n,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,r,n,o,a,h,l){const d=1-e,c=d*i+e*r,u=d*s+e*n,_=d*r+e*o,p=d*n+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*o+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(Me.C,c,u,g,f,y,m)}},{getDistance:rf}=sf,{M:nf,L:of,C:af,Z:hf}=Me,{float:lf}=M,df={},cf={},uf={transform(t,e){let i,s=0;const r=t.length;for(;s<r;)switch(i=t[s],i){case nf:case of:uf.transformPoints(t,e,s,1),s+=3;break;case af:uf.transformPoints(t,e,s,3),s+=7;break;case hf:s+=1}},transformPoints(t,e,i,s){for(let r=i+1,n=r+2*s;r<n;r+=2)df.x=t[r],df.y=t[r+1],Q.toOuterPoint(e,df),t[r]=df.x,t[r+1]=df.y},getMotionPathData(t){let e,i,s,r,n=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(r=t[a],r){case nf:case of:i=t[a+1],s=t[a+2],e=r===of&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case af:i=t[a+5],s=t[a+6],e=sf.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case hf:a+=1;default:e=0}o.push(e),n+=e}return{total:n,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:r}=t;e=il.number(e,t.total);let n,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,x=0;const v=r.length;for(;f<v;){switch(h=r[f],h){case nf:case of:if(o=r[f+1],a=r[f+2],n=s[y],p+n>=e||!t.total)return f||(m=o,x=a),cf.x=m,cf.y=x,g.x=o,g.y=a,lt.getDistancePoint(cf,g,e-p,!0),g.rotation=lt.getAngle(cf,g),g;m=o,x=a,f+=3;break;case af:if(o=r[f+5],a=r[f+6],n=s[y],p+n>=e)return l=r[f+1],d=r[f+2],c=r[f+3],u=r[f+4],_=sf.getT(e-p,n,m,x,l,d,c,u,o,a,i),li.getPointAndSet(_,m,x,l,d,c,u,o,a,g),g.rotation=sf.getRotation(_,m,x,l,d,c,u,o,a),g;m=o,x=a,f+=7;break;case hf:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:r}=t,n=[];e=il.number(e,t.total);let o,a,h,l,d,c,u,_,p,g,f=0,y={},m=0,x=0,v=0,w=0;const b=r.length;for(;m<b;){switch(d=r[m],d){case nf:case of:if(h=r[m+1],l=r[m+2],o=s[x],f+o>e||!t.total)return m||(v=h,w=l),cf.x=v,cf.y=w,y.x=h,y.y=l,a=lf(e-f),a&&(lt.getDistancePoint(cf,y,a,!0),n.push(d,y.x,y.y)),n;v=h,w=l,m+=3,n.push(d,v,w);break;case af:if(c=r[m+1],u=r[m+2],_=r[m+3],p=r[m+4],h=r[m+5],l=r[m+6],o=s[x],f+o>e)return a=lf(e-f),a&&(g=sf.getT(a,o,v,w,c,u,_,p,h,l,i),sf.cut(n,g,v,w,c,u,_,p,h,l)),n;v=h,w=l,m+=7,n.push(d,c,u,_,p,h,l);break;case hf:m+=1,n.push(d);default:o=0}x++,f+=o}return n}};function _f(t){return _n(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!o(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ce.add("motion-path"),cl.register("motion",function(t,e,i,s){return _(t)&&(t=il.number(t,s.getMotionTotal())),_(e)&&(e=il.number(e,s.getMotionTotal())),cl.number(t||0,e||0,i)}),cl.register("motionRotation",function(t,e,i){return cl.number(t,e,i)});const pf=Hl.prototype,{updateMatrix:gf,updateAllMatrix:ff}=uo,{updateBounds:yf}=ko;function mf(t){const{motion:e,leaferIsCreated:i}=t;if(!o(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=vf(t);i.total&&(t.__.__pathForRender=uf.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(ff(t),yf(t,t)):gf(t));i&&(t.leafer.created=!0)}}function xf(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function vf(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=uf.getMotionPathData(t.getPath(!0,!0))}Hl.addAttr("motionPath",void 0,_f),Hl.addAttr("motionPrecision",1,_f),Hl.addAttr("motion",void 0,_f),Hl.addAttr("motionRotation",!0,_f),pf.getMotionPathData=function(){return vf(xf(this))},pf.getMotionPoint=function(t){const e=xf(this),i=vf(e);if(!i.total)return{};const s=uf.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:r}=this;return!1===r?delete s.rotation:l(r)&&(s.rotation+=r),s},pf.getMotionTotal=function(){return this.getMotionPathData().total},pf.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],o(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),mf(t))}else mf(this)};const{Yes:wf,NoAndSkip:bf,YesAndSkip:Sf}=e,kf={},Bf={},Pf={};class Rf{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":kf.id=t.substring(1),t=kf;break;case".":Bf.className=t.substring(1),t=Bf;break;default:Pf.tag=t,t=Pf}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,r=u(s);return this.getByMethod(r?this.methods.tags:this.methods.tag,e,i,r?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&uo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const r=i?null:[];return this.eachFind(this.toChildren(e),t,r,s),r||this.findLeaf}eachFind(t,e,i,s){let r,n;for(let o=0,a=t.length;o<a;o++){if(r=t[o],n=e(r,s),"boolean"==typeof n&&(n=n?1:0),n===wf||n===Sf){if(!i)return void(this.findLeaf=r);i.push(r)}r.isBranch&&n<bf&&this.eachFind(r.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Xo.REMOVE,this.__onRemoveChild,this),this.target.on_(Uo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Ef=Hl.prototype;function Cf(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}Ef.find=function(t,e){return Cf(this).getBy(t,this,!1,e)},Ef.findOne=function(t,e){return Cf(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t){return new Rf(t)};export{Rt as AlignHelper,Sg as Animate,vg as AnimateEasing,bg as AnimateEvent,kg as AnimateList,e as Answer,zd as App,kt as AroundHelper,Jt as AutoBounds,li as BezierHelper,Gt as Bounds,Vo as BoundsEvent,Ut as BoundsHelper,td as Box,wl as BoxData,kh as Branch,ko as BranchHelper,Xa as BranchRender,Ld as Canvas,Dl as CanvasData,xe as CanvasManager,Xo as ChildEvent,el as ColorConvert,ue as Creator,Dc as Cursor,f as DataHelper,re as Debug,wt as Direction4,bt as Direction9,ic as DragBoundsHelper,ac as DragEvent,Sc as Dragger,lc as DropEvent,al as Effect,nd as Ellipse,Pl as EllipseData,mi as EllipseHelper,Yo as Event,ye as EventCreator,da as Eventer,ll as Export,Gr as FileHelper,hl as Filter,Rf as Finder,P as FourNumberHelper,ed as Frame,Sl as FrameData,Ul as Group,vl as GroupData,sf as HighBezierHelper,uf as HighCurveHelper,Fc as HitCanvasManager,Cd as Image,Ol as ImageData,qo as ImageEvent,sn as ImageManager,x as IncrementId,Oc as InteractionBase,yc as InteractionHelper,fc as KeyEvent,Xd as Keyboard,ea as LayoutEvent,Xh as Layouter,ph as Leaf,Wa as LeafBounds,vo as LeafBoundsHelper,m as LeafData,Sa as LeafDataProxy,wa as LeafEventer,uo as LeafHelper,zo as LeafLayout,Ph as LeafLevelList,Bh as LeafList,Ta as LeafMatrix,Na as LeafRender,Vl as Leafer,Eh as LeaferCanvas,Oe as LeaferCanvasBase,bl as LeaferData,sa as LeaferEvent,hn as LeaferFilm,an as LeaferImage,ln as LeaferVideo,Ed as Line,kl as LineData,M as MathHelper,yt as Matrix,Q as MatrixHelper,dc as MoveEvent,hc as MyDragEvent,Td as MyImage,nc as MyPointerEvent,uc as MyTouchEvent,We as NeedConvertToCanvasCommandMap,W as OneRadian,N as PI2,z as PI_2,rl as Paint,ol as PaintGradient,nl as PaintImage,Wd as Path,sl as PathArrow,Mr as PathBounds,Ps as PathCommandDataHelper,Me as PathCommandMap,xi as PathCommandNodeHelper,ss as PathConvert,Hr as PathCorner,Hs as PathCreator,Cl as PathData,rr as PathDrawer,De as PathHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Nd as Pen,Tl as PenData,Gh as Picker,ee as Platform,ce as Plugin,gt as Point,lt as PointHelper,Hd as PointerButton,rc as PointerEvent,_d as Polygon,Rl as PolygonData,Uo as PropertyEvent,Gl as Rect,Bl as RectData,He as RectHelper,Yl as RectRender,ia as RenderEvent,Uh as Renderer,$o as ResizeEvent,tn as Resource,Lp as Robot,Tp as RobotData,_c as RotateEvent,he as Run,Kh as Selector,vd as Star,El as StarData,dl as State,Zt as StringNumberMap,pc as SwipeEvent,Qr as TaskItem,Zr as TaskProcessor,Id as Text,tl as TextConvert,Al as TextData,cc as TouchEvent,cl as Transition,xt as TwoPointBoundsHelper,Hl as UI,Il as UIBounds,pe as UICreator,ml as UIData,Ud as UIEvent,Nl as UIRender,il as UnitConvert,Qt as UnitConvertHelper,To as WaitHelper,ta as WatchEvent,Lh as Watcher,gc as ZoomEvent,Tn as affectRenderBoundsType,Rn as affectStrokeBoundsType,pn as attr,xn as autoLayoutType,bn as boundsType,Vr as canvasPatch,Ae as canvasSizeAttrs,$h as createAttr,un as createDescriptor,Yn as cursorType,Xn as dataProcessor,fn as dataType,_n as decorateLeafAttr,Un as defineDataProcessor,dn as defineKey,gn as defineLeafAttr,An as dimType,kn as doBoundsType,En as doStrokeType,Jh as effectType,r as emptyData,Nn as eraserType,jo as extraPropertyEventMap,X as getBoundsData,cn as getDescriptor,H as getMatrixData,Y as getPointData,zn as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,o as isNull,l as isNumber,_ as isObject,a as isString,n as isUndefined,Hn as layoutProcessor,ha as leaferTransformAttrMap,Wn as maskType,_f as motionPathType,Sn as naturalBoundsType,On as opacityType,Ur as path,Bn as pathInputType,Pn as pathType,jr as pen,yn as positionType,Zn as registerUI,$n as registerUIEvent,Qh as resizeType,Gn as rewrite,Kn as rewriteAble,wn as rotationType,vn as scaleType,mn as scrollType,In as sortType,Op as stateStyleType,Ap as stateType,Cn as strokeType,Ln as surfaceType,Kt as tempBounds,mt as tempMatrix,ft as tempPoint,c as tryToNumber,Ch as useCanvas,Qn as useModule,Rh as version,Dn as visibleType,Zh as zoomLayerType};
2
2
  //# sourceMappingURL=worker.module.min.js.map