leafer-game 1.12.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.js +122 -99
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +126 -103
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function n(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:a}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return p(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&p(t[n]={},e[n],i[n]):t[n]=e[n]})},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:p}=_;class g{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(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: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:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,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{floor:f,max:y}=Math,m={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||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=m.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h){const l=m.origin.createCanvas(y(f(e+(s||0)),1),y(f(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,t)if(r){const s=e/r.width,n=i/r.height;d.setTransform(s,0,0,n,-r.x*s,-r.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:v}=m,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=w;let b,E,P;const{max:S}=Math,B=[0,0,0,0],T={zero:[...B],tempFour:B,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>k(B,t,e,i,s),toTempAB(t,e,i){P=i?h(t)?e:t:[],h(t)?(b=C(t),E=e):h(e)?(b=t,E=C(e)):(b=t,E=e),4!==b.length&&(b=R(b)),4!==E.length&&(E=R(E))},get(t,e){let i;if(!h(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)=>h(t)&&h(e)?S(t,e):(L(t,e,i),k(P,S(b[0],E[0]),S(b[1],E[1]),S(b[2],E[2]),S(b[3],E[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(L(t,e,i),k(P,b[0]+E[0],b[1]+E[1],b[2]+E[2],b[3]+E[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,l]=4===t.length?t:R(t);return k(n,a*i,l*e,r*i,o*e)}},{set:k,get:R,setTemp:C,toTempAB:L}=T,{round:A,pow:D,max:O,floor:I,PI:M}=Math,F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.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:D(10,e);return-0===(t=A(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,n=(h(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&F.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(I(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const U=M/180,N=2*M,z=M/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:j,cos:V,acos:G,sqrt:q}=Math,{float:K}=F,Z={};function $(){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:$(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:H,getWorld:$,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){J.toInnerPoint(t,e,Z),J.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=V(e*=U),a=j(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){J.toInnerPoint(t,e,Z),J.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=U,t.a=s+r*i,t.b=n+o*i),e&&(e*=U,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,Z),J.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+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){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*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:n}=e,r=i*U,o=V(r),a=j(r);if(s||n){const e=s*U,i=n*U;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)&&J.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=q(n*n+r*r),c=t/d;const e=n/d;u=r>0?G(e):-G(e)}else{c=q(o*o+a*a),d=t/c;const e=o/c;u=z-(a>0?G(-e):-G(e))}const e=K(V(u)),i=j(u);d=K(d),c=K(c),_=e?K((o/c+i)/e/U,9):0,p=e?K((r/d-i)/e/U,9):0,u=K(u/U)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+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:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=q(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Q,{float:tt}=F,{toInnerPoint:et,toOuterPoint:it}=Q,{sin:st,cos:nt,abs:rt,sqrt:ot,atan2:at,min:ht,round:lt}=Math,dt={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?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(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=ct.defaultPoint);const s=nt(e*=U),n=st(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return _t(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return _t(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return _t(i,t),ct.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(_t(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(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)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=rt(i-t),r=rt(s-e);return ot(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>ht(ut(t,e,i,s),ut(i,s,n,r)),getAngle:(t,e)=>gt(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),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)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=gt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+nt(r)*i,e.y=t.y+st(r)*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)=>tt(t.x)===tt(e.x)&&tt(t.y)===tt(e.y),reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:_t,setRadius:pt,getAtan2:gt}=ct;class ft{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ft(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new ft(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new ft(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const yt=new ft;class mt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),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:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new mt(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 vt=new mt,wt={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,n){xt(t,e,i),xt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=wt;var bt,Et;t.Direction4=void 0,(bt=t.Direction4||(t.Direction4={}))[bt.top=0]="top",bt[bt.right=1]="right",bt[bt.bottom=2]="bottom",bt[bt.left=3]="left",t.Direction9=void 0,(Et=t.Direction9||(t.Direction9={}))[Et.topLeft=0]="topLeft",Et[Et.top=1]="top",Et[Et.topRight=2]="topRight",Et[Et.right=3]="right",Et[Et.bottomRight=4]="bottomRight",Et[Et.bottom=5]="bottom",Et[Et.bottomLeft=6]="bottomLeft",Et[Et.left=7]="left",Et[Et.center=8]="center",Et[Et["top-left"]=0]="top-left",Et[Et["top-right"]=2]="top-right",Et[Et["bottom-right"]=4]="bottom-right",Et[Et["bottom-left"]=6]="bottom-left";const Pt=[{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}];Pt.forEach(t=>t.type="percent");const St={directionData:Pt,tempPoint:{},get:Bt,toPoint(t,e,i,s,n,r){const o=Bt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),St.toPoint(t,e,i,!0),i)};function Bt(e){return o(e)?Pt[t.Direction9[e]]:e}const{toPoint:Tt}=St,kt={toPoint(t,e,i,s,n,r){Tt(t,i,s,n,e,r)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Lt,toBounds:At}=wt,{toOuterPoint:Dt}=Q,{float:Ot,fourNumber:It}=F,{floor:Mt,ceil:Ft}=Math;let Wt,Ut,Nt,zt;const Yt={},Xt={},Ht={},jt={tempBounds:Ht,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(d(i)){const e=It(i);s?Vt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,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),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?qt(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Ht,t),Vt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Yt.x=t.x,Yt.y=t.y,Dt(e,Yt,Xt),Ct(Rt,Xt.x,Xt.y),Yt.x=t.x+t.width,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.y=t.y+t.height,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.x=t.x,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),At(Rt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),o(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Ht.width=n?e.width*=s:e.width*s,Ht.height=n?e.height*=s:e.height*s,kt.toPoint(i,Ht,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(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){Wt=t.x+t.width,Ut=t.y+t.height,Nt=e.x,zt=e.y,i||(Nt+=e.width,zt+=e.height),Wt=Wt>Nt?Wt:Nt,Ut=Ut>zt?Ut:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Ut-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||qt(t,n)):Gt(t,n));r&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Lt(Rt,t.x,t.y)),At(Rt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){Gt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.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=dt.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=Vt.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=Vt.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=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Wt=s+r,Ut=n+o,Nt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Wt=Wt<Nt?Wt:Nt,Ut=Ut<zt?Ut:zt,r=Wt-s,o=Ut-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Vt.copy(t,Vt.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,reset(t){Vt.set(t)}},Vt=jt,{add:Gt,copy:qt}=Vt;class Kt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?jt.copy(this,t):jt.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 Kt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Zt=new Kt;class $t{constructor(t,e,i,s,n,r){c(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Kt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Jt}=F;class te{constructor(t){this.repeatMap={},this.name=t}static get(t){return new te(t)}static set filter(t){this.filterList=ee(t)}static set exclude(t){this.excludeList=ee(t)}static drawRepaint(t,e){const i=Jt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===te.showBounds,n=t.__nowWorld,r=Jt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(ie.enable){if(ie.filterList.length&&ie.filterList.every(t=>t!==this.name))return;if(ie.excludeList.length&&ie.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ie.enable&&this.warn(...t)}warn(...t){ie.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 ee(t){return t?o(t)&&(t=[t]):t=[],t}te.filterList=[],te.excludeList=[],te.showWarn=!0;const ie=te,se=te.get("RunTime"),ne={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return re.currentId=re.idMap[i]=e?performance.now():Date.now(),re.currentName=re.nameMap[i]=t,re.nameToIdMap[t]=i,i},end(t,e){const i=re.idMap[t],s=re.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;re.idMap[t]=re.nameMap[t]=re.nameToIdMap[s]=void 0,se.log(s,n,"ms")},endOfName(t,e){const i=re.nameToIdMap[t];n(i)||re.end(i,e)}},re=ne,oe=[],ae={list:{},add(t,...e){this.list[t]=!0,oe.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(()=>oe.forEach(t=>ae.has(t,!0)));const he={editor:t=>ae.need("editor")},le=te.get("UICreator"),de={list:{},register(t){const{__tag:e}=t.prototype;ce[e]&&le.repeat(e),ce[e]=t},get(t,e,i,s,r,o){ce[t]||le.error("not register "+t);const a=new ce[t](e);return n(i)||(a.x=i,s&&(a.y=s),r&&(a.width=r),o&&(a.height=o)),a}},{list:ce}=de,ue=te.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(pe[e]&&ue.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class ge{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=he.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 fe(t,e,i,s){var n,r=arguments.length,o=r<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--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function ye(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(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 me(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 ve=[];function we(){return(t,e)=>{ve.push(e)}}const xe=[];class be{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||xe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ve.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}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,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}fe([me("imageSmoothingEnabled")],be.prototype,"smooth",void 0),fe([me("imageSmoothingQuality")],be.prototype,"smoothLevel",void 0),fe([me("globalAlpha")],be.prototype,"opacity",void 0),fe([me()],be.prototype,"fillStyle",void 0),fe([me()],be.prototype,"strokeStyle",void 0),fe([me("lineWidth")],be.prototype,"strokeWidth",void 0),fe([me("lineCap")],be.prototype,"strokeCap",void 0),fe([me("lineJoin")],be.prototype,"strokeJoin",void 0),fe([me("lineDashOffset")],be.prototype,"dashOffset",void 0),fe([me()],be.prototype,"miterLimit",void 0),fe([me()],be.prototype,"shadowBlur",void 0),fe([me()],be.prototype,"shadowColor",void 0),fe([me()],be.prototype,"shadowOffsetX",void 0),fe([me()],be.prototype,"shadowOffsetY",void 0),fe([me()],be.prototype,"filter",void 0),fe([me()],be.prototype,"font",void 0),fe([me()],be.prototype,"fontKerning",void 0),fe([me()],be.prototype,"fontStretch",void 0),fe([me()],be.prototype,"fontVariantCaps",void 0),fe([me()],be.prototype,"textAlign",void 0),fe([me()],be.prototype,"textBaseline",void 0),fe([me()],be.prototype,"textRendering",void 0),fe([me()],be.prototype,"wordSpacing",void 0),fe([me()],be.prototype,"letterSpacing",void 0),fe([me()],be.prototype,"direction",void 0),fe([we()],be.prototype,"setTransform",null),fe([we()],be.prototype,"resetTransform",null),fe([we()],be.prototype,"getTransform",null),fe([we()],be.prototype,"save",null),fe([we()],be.prototype,"restore",null),fe([we()],be.prototype,"translate",null),fe([we()],be.prototype,"scale",null),fe([we()],be.prototype,"rotate",null),fe([we()],be.prototype,"fill",null),fe([we()],be.prototype,"stroke",null),fe([we()],be.prototype,"clip",null),fe([we()],be.prototype,"fillRect",null),fe([we()],be.prototype,"strokeRect",null),fe([we()],be.prototype,"clearRect",null),fe([we()],be.prototype,"beginPath",null),fe([we()],be.prototype,"moveTo",null),fe([we()],be.prototype,"lineTo",null),fe([we()],be.prototype,"bezierCurveTo",null),fe([we()],be.prototype,"quadraticCurveTo",null),fe([we()],be.prototype,"closePath",null),fe([we()],be.prototype,"arc",null),fe([we()],be.prototype,"arcTo",null),fe([we()],be.prototype,"ellipse",null),fe([we()],be.prototype,"rect",null),fe([we()],be.prototype,"roundRect",null),fe([we()],be.prototype,"createConicGradient",null),fe([we()],be.prototype,"createLinearGradient",null),fe([we()],be.prototype,"createPattern",null),fe([we()],be.prototype,"createRadialGradient",null),fe([we()],be.prototype,"fillText",null),fe([we()],be.prototype,"measureText",null),fe([we()],be.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Pe,pixelScale:Se}=Q,{round:Be}=Math,Te=new Kt,ke=new Kt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Le extends be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Re),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||m.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;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(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,n=this.worldTransform;e&&Pe(t,e,n),Se(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Be(n.e-.5)+.5,n.f=Be(n.f-.5)+.5):(n.e=Be(n.e),n.f=Be(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.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:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=ke):i=Te,this.drawImage(t.view,Te.x,Te.y,Te.width,Te.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,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Te.x,Te.y,Te.width,Te.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Te.x,Te.y,Te.width,Te.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Te.x,Te.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(Te.x,Te.y,Te.width,Te.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Te.x,Te.y,Te.width,Te.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Te.x,Te.y,Te.width,Te.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Te.x,Te.y,Te.width,Te.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Te,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(ke,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,n=this.manager?this.manager.get(i):he.canvas(Object.assign({},i));return n.save(),t&&(Ee(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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 Ae={creator:{},parse(t,e){},convertToCanvasData(t,e){}},De={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},De),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},Me={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},Fe=Object.assign(Object.assign({},Me),De),We=Oe,Ue={};for(let t in We)Ue[We[t]]=t;const Ne={};for(let t in We)Ne[We[t]]=Ie[t];const ze={drawRoundRect(t,e,i,s,n,r){const o=F.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;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:Ye,cos:Xe,hypot:He,atan2:je,ceil:Ve,abs:Ge,PI:qe,sqrt:Ke,pow:Ze}=Math,{setPoint:$e,addPoint:Qe}=wt,{set:Je,toNumberPoints:ti}=dt,{M:ei,L:ii,C:si,Q:ni,Z:ri}=Oe,oi={},ai={points(t,e,i,s){let n=ti(e);if(t.push(ei,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=o-e,g=a-r,f=Ke(Ze(p,2)+Ze(g,2)),y=Ke(Ze(h-o,2)+Ze(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(ni,d,c,o,a):(p||g)&&t.push(si,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(ni,u,_,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ii,n[e],n[e+1]);s&&t.push(ri)},rect(t,e,i,s,n){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Ae.creator.path=[],ze.drawRoundRect(Ae.creator,e,i,s,n,r),t.push(...Ae.convertToCanvasData(Ae.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,p=o-n;let g=je(u,c),f=je(p,_);const y=He(c,u),m=He(_,p);let v=f-g;if(v<0&&(v+=N),y<1e-12||m<1e-12||v<1e-12||Ge(v-qe)<1e-12)return t&&t.push(ii,s,n),h&&($e(h,e,i),Qe(h,s,n)),d&&Je(d,e,i),void(l&&Je(l,s,n));const w=c*p-_*u<0,x=w?-1:1,b=a/Xe(v/2),E=s+b*Xe(g+v/2+z*x),P=n+b*Ye(g+v/2+z*x);return g-=z*x,f-=z*x,di(t,E,P,a,a,0,g/U,f/U,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>di(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*U,_=Ye(u),p=Xe(u);let g=o*U,f=a*U;g>qe&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=Ve(Ge(y/z)),v=y/m,w=Ye(v/4),x=8/3*w*w/Ye(v/2);f=g+v;let b,E,P,S,B,T,k,R,C=Xe(g),L=Ye(g),A=P=p*s*C-_*n*L,D=S=_*s*C+p*n*L,O=e+P,I=i+S;t&&t.push(t.length?ii:ei,O,I),l&&$e(l,O,I),c&&Je(c,O,I);for(let r=0;r<m;r++)b=Xe(f),E=Ye(f),P=p*s*b-_*n*E,S=_*s*b+p*n*E,B=e+A-x*(p*s*L+_*n*C),T=i+D-x*(_*s*L-p*n*C),k=e+P+x*(p*s*E+_*n*b),R=i+S+x*(_*s*E-p*n*b),t&&t.push(si,B,T,k,R,e+P,i+S),l&&li(e+A,i+D,B,T,k,R,e+P,i+S,l,!0),A=P,D=S,C=b,L=E,g=f,f+=v;d&&Je(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(si,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){li(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,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?Qe(h,t,e):$e(h,t,e),Qe(h,o,a);for(let l=0,c=d.length;l<c;l++)hi(d[l],t,e,i,s,n,r,o,a,oi),Qe(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,n,r,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+_*r+p*a,l.y=c*i+u*n+_*o+p*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return hi(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:hi,toTwoPointBounds:li,ellipse:di}=ai,{sin:ci,cos:ui,sqrt:_i,atan2:pi}=Math,{ellipse:gi}=ai,fi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=r*U,p=ci(_),g=ui(_),f=-g*c-p*u,y=-g*u+p*c,v=s*s,w=n*n,x=y*y,b=f*f,E=v*w-v*x-w*b;let P=0;if(E<0){const t=_i(1-E/(v*w));s*=t,n*=t}else P=(o===a?-1:1)*_i(E/(v*x+w*b));const S=P*s*y/n,B=-P*n*f/s,T=pi((y-B)/n,(f-S)/s),k=pi((-y-B)/n,(-f-S)/s);let R=k-T;0===a&&R>0?R-=N:1===a&&R<0&&(R+=N);const C=e+c+g*S-p*B,L=i+u+p*S+g*B,A=R<0?1:0;d||m.ellipseToCurve?gi(t,C,L,s,n,r,T/U,k/U,A):s!==n||r?t.push(Oe.G,C,L,s,n,r,T/U,k/U,A):t.push(Oe.O,C,L,s,T/U,k/U,A)}},yi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:vi,L:wi,l:xi,H:bi,h:Ei,V:Pi,v:Si,C:Bi,c:Ti,S:ki,s:Ri,Q:Ci,q:Li,T:Ai,t:Di,A:Oi,a:Ii,Z:Mi,z:Fi,N:Wi,D:Ui,X:Ni,G:zi,F:Yi,O:Xi,P:Hi,U:ji}=Oe,{rect:Vi,roundRect:Gi,arcTo:qi,arc:Ki,ellipse:Zi,quadraticCurveTo:$i}=ai,{ellipticalArc:Qi}=fi,Ji=te.get("PathConvert"),ts={},es={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ne[s],a+=s===n?" ":Ue[s];for(let s=1;s<i;s++)a+=F.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Fe:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(is.dot&&(ss(o,r),r=""),is.dot++),"0"===r&&"."!==s&&(ss(o,r),r=""),r+=s):Oe[s]?(r&&(ss(o,r),r=""),is.name=Oe[s],is.length=Ie[s],is.index=0,ss(o,is.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&ss(o,r),r=s):r&&(ss(o,r),r=""),n=s;return r&&ss(o,r),i?es.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case vi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],_.push(mi,a,h),c+=3;break;case Ei:t[c+1]+=a;case bi:a=t[c+1],_.push(wi,a,h),c+=2;break;case Si:t[c+1]+=h;case Pi:h=t[c+1],_.push(wi,a,h),c+=2;break;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 Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ki;case ki:o=r===Bi||r===ki,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(Bi,l,d,i,s,a,h),c+=5;break;case Ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Bi;case Bi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Bi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Di:t[c+1]+=a,t[c+2]+=h,n=Ai;case Ai:o=r===Ci||r===Ai,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(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:i=t[c+1],s=t[c+2],e?$i(_,a,h,i,s,t[c+3],t[c+4]):_.push(Ci,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 Oi:Qi(_,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 Fi:case Mi:_.push(Mi),c++;break;case Wi:a=t[c+1],h=t[c+2],e?Vi(_,a,h,t[c+3],t[c+4]):ns(_,t,c,5),c+=5;break;case Ui:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ns(_,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4],t[c+5]):ns(_,t,c,6),c+=6;break;case zi:Zi(e?_:ns(_,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,ts),a=ts.x,h=ts.y,c+=9;break;case Yi:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ns(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:Ki(e?_:ns(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ts),a=ts.x,h=ts.y,c+=7;break;case Hi:e?Ki(_,t[c+1],t[c+2],t[c+3],0,360,!1):ns(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ji:qi(e?_:ns(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ts),a=ts.x,h=ts.y,c+=6;break;default:return Ji.error(`command: ${n} [index:${c}]`,t),_}r=n}return _},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(wi,t.x,t.y);break;case"C":e.push(Bi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Mi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){is.index===is.length&&(is.index=1,t.push(is.name)),t.push(Number(e)),is.index++,is.dot=0}},{current:is,pushData:ss,copyData:ns}=es,{M:rs,L:os,C:as,Q:hs,Z:ls,N:ds,D:cs,X:us,G:_s,F:ps,O:gs,P:fs,U:ys}=Oe,{getMinDistanceFrom:ms,getRadianFrom:vs}=dt,{tan:ws,min:xs,abs:bs}=Math,Es={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(rs,e,i)},lineTo(t,e,i){t.push(os,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(as,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(hs,e,i,s,n)},closePath(t){t.push(ls)},rect(t,e,i,s,n){t.push(ds,e,i,s,n)},roundRect(t,e,i,s,n,r){if(h(r))t.push(us,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(cs,e,i,s,n,...o):t.push(ds,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){if(s===n)return Bs(t,e,i,s,a,h,l);r(o)?t.push(ps,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(_s,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(fs,e,i,s):(r(n)&&(n=0),r(o)&&(o=360),t.push(gs,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,r,o,a,h){if(!n(a)){const t=ms(a,h,e,i,s,r);o=xs(o,xs(t/2,t/2*bs(ws(vs(a,h,e,i,s,r)/2))))}t.push(ys,e,i,s,r,o)},drawEllipse(t,e,i,s,n,o,a,h,l){ai.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Es),t.push(rs,Es.x,Es.y),Ss(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){ai.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Es),t.push(rs,Es.x,Es.y),Bs(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){ai.points(t,e,i,s)}},{ellipse:Ss,arc:Bs}=Ps,{moveTo:Ts,lineTo:ks,quadraticCurveTo:Rs,bezierCurveTo:Cs,closePath:Ls,beginPath:As,rect:Ds,roundRect:Os,ellipse:Is,arc:Ms,arcTo:Fs,drawEllipse:Ws,drawArc:Us,drawPoints:Ns}=Ps;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return Ts(this.__path,t,e),this.paint(),this}lineTo(t,e){return ks(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Cs(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ls(this.__path),this.paint(),this}rect(t,e,i,s){return Ds(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Os(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Is(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Ms(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Fs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Ws(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Us(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ys,L:Xs,C:Hs,Q:js,Z:Vs,N:Gs,D:qs,X:Ks,G:Zs,F:$s,O:Qs,P:Js,U:tn}=Oe,en=te.get("PathDrawer"),sn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Ys:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Vs:t.closePath(),s+=1;break;case Gs: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 Ks: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]*U,e[s+6]*U,e[s+7]*U,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 Qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case tn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void en.error(`command: ${i} [index:${s}]`,e)}}},{M:nn,L:rn,C:on,Q:an,Z:hn,N:ln,D:dn,X:cn,G:un,F:_n,O:pn,P:gn,U:fn}=Oe,{toTwoPointBounds:yn,toTwoPointBoundsByQuadraticCurve:mn,arcTo:vn,arc:wn,ellipse:xn}=ai,{addPointBounds:bn,copy:En,addPoint:Pn,setPoint:Sn,addBounds:Bn,toBounds:Tn}=wt,kn=te.get("PathBounds");let Rn,Cn,Ln;const An={},Dn={},On={},In={toBounds(t,e){In.toTwoPointBounds(t,Dn),Tn(Dn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Sn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===hn||o===on||o===an?Sn(e,h,l):Sn(e,t[a+1],t[a+2])),o){case nn:case rn:h=t[a+1],l=t[a+2],Pn(e,h,l),a+=3;break;case on:n=t[a+5],r=t[a+6],yn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,An),bn(e,An),h=n,l=r,a+=7;break;case an:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],mn(h,l,i,s,n,r,An),bn(e,An),h=n,l=r,a+=5;break;case hn:a+=1;break;case ln:h=t[a+1],l=t[a+2],Bn(e,h,l,t[a+3],t[a+4]),a+=5;break;case dn:case cn:h=t[a+1],l=t[a+2],Bn(e,h,l,t[a+3],t[a+4]),a+=o===dn?9:6;break;case un:xn(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],An,On),0===a?En(e,An):bn(e,An),h=On.x,l=On.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],Cn=t[a+3],Ln=t[a+4],Bn(e,h-Cn,l-Ln,2*Cn,2*Ln),h+=Cn,a+=5;break;case pn:wn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],An,On),0===a?En(e,An):bn(e,An),h=On.x,l=On.y,a+=7;break;case gn:h=t[a+1],l=t[a+2],Rn=t[a+3],Bn(e,h-Rn,l-Rn,2*Rn,2*Rn),h+=Rn,a+=4;break;case fn:vn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],An,On),0===a?En(e,An):bn(e,An),h=On.x,l=On.y,a+=6;break;default:return void kn.error(`command: ${o} [index:${a}]`,t)}}},{M:Mn,L:Fn,Z:Wn}=Oe,{getCenterX:Un,getCenterY:Nn}=dt,{arcTo:zn}=Ps,Yn={smooth(t,e,i){let s,n,r,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=[];for(;o<f;){switch(s=t[o],s){case Mn:l=p=t[o+1],c=g=t[o+2],o+=3,t[o]===Fn?(u=t[o+1],_=t[o+2],y.push(Mn,Un(l,u),Nn(c,_))):y.push(Mn,l,c);break;case Fn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Fn:zn(y,a,h,t[o+1],t[o+2],e,p,g);break;case Wn:zn(y,a,h,l,c,e,p,g);break;default:y.push(Fn,a,h)}p=a,g=h;break;case Wn:n!==Wn&&(zn(y,l,c,u,_,e,p,g),y.push(Wn)),o+=1;break;default:r=Ne[s];for(let e=0;e<r;e++)y.push(t[o+e]);o+=r}n=s}return s!==Wn&&(y[1]=l,y[2]=c),y}};function Xn(t){return new zs(t)}const Hn=Xn();Ae.creator=Xn(),Ae.parse=es.parse,Ae.convertToCanvasData=es.toCanvasData;const{drawRoundRect:jn}=ze;function Vn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){jn(this,t,e,i,s,n)})}(t)}const Gn={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=qn.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{}}}},qn=Gn;qn.alphaPixelTypes.forEach(t=>qn.upperCaseTypeMap[t]=t.toUpperCase());const Kn=te.get("TaskProcessor");class Zn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Kn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class $n{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&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,r,o,a;const l=new Zn(t);return l.parent=this,h(e)?a=e:e&&(r=e.parallel,s=e.start,o=e.time,a=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),n(a)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},a)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(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 Qn=te.get("Resource"),Jn={tasker:new $n,map:{},get isComplete(){return tr.tasker.isComplete},set(t,e){tr.map[t]&&Qn.repeat(t),tr.map[t]=e},get:t=>tr.map[t],remove(t){const e=tr.map[t];e&&(e.destroy&&e.destroy(),delete tr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=he.image(s)),tr.set(t,e),e},destroy(){tr.map={}}},tr=Jn,er={maxRecycled:10,recycledList:[],patternTasker:new $n({parallel:1}),get(t){let e=Jn.get(t.url);return e||Jn.set(t.url,e=he.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(m.image.isLarge(t)?t.url&&Jn.remove(t.url):(t.clearLevels(),ir.recycledList.push(t)))})},recyclePaint(t){ir.recycle(t.image)},clearRecycled(t){const e=ir.recycledList;(e.length>ir.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Jn.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Gn.alphaPixelTypes.some(e=>ir.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:"+Gn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Gn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},ir=er,{IMAGE:sr,create:nr}=w;class rr{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return n(t)?m.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=nr(sr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}er.isFormat("svg",t)&&(this.isSVG=!0),er.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,Jn.tasker.add(()=>ye(this,void 0,void 0,function*(){return yield m.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,n,r,o){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 a=m.image.resize(this.view,t,e,n,r,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=m.canvas.createPattern(t,e);return m.image.setPatternTransform(n,i,s),n}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 or(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ar(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function lr(t,e){return(i,s)=>cr(i,s,t,e&&e(s))}function dr(t){return t}function cr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};or(t,e,Object.assign(n,s||{})),Ur(t,e,i)}function ur(t){return lr(t)}function _r(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pr(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function gr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wr(this))}}))}function fr(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function yr(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mr(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i,e)&&wr(this)}}))}function vr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(wr(this),this.__.__removeNaturalSize())}}))}function wr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xr(t){return lr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wr(this)}}))}const br=mr;function Er(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i)&&(Pr(this),e&&(this.__.__useStroke=!0))}}))}function Pr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wr(t)}const Sr=Er;function Br(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Tr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function kr(t){return lr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Rr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Lr(this)}}))}function Cr(t){return lr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ar(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ar(this,t,e,i),this.mask&&Lr(this)}}))}function Lr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ar(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wr(t))}function Dr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Or(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ir(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Mr(t){return lr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===te.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Fr(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wr(t){return(e,i)=>{or(e,"__DataProcessor",{get:()=>t})}}function Ur(t,e,i){const s=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=hr(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(c(i)){const t=u(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:_.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=ar(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),or(s,e,a)}const Nr=new te("rewrite"),zr=[],Yr=["destroy","constructor"];function Xr(t){return(e,i)=>{zr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Hr(){return t=>{jr()}}function jr(t){zr.length&&(zr.forEach(e=>{t&&Nr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),zr.length=0)}function Vr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Yr.includes(s)||e&&e.includes(s)))if(t.prototype){ar(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Gr(){return t=>{de.register(t)}}function qr(){return t=>{_e.register(t)}}setTimeout(()=>jr(!0));const{copy:Kr,toInnerPoint:Zr,toOuterPoint:$r,scaleOfOuter:Qr,rotateOfOuter:Jr,skewOfOuter:to,multiplyParent:eo,divideParent:io,getLayout:so}=Q,no={},{round:ro}=Math,oo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),lo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)ho(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++)co(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&co(t),t.__updateChange()},updateAllChange(t){if(_o(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)uo(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,n,r){s||(s=t.__nowWorld),t.__worldFlipped||m.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?$r(t.localTransform,r,r,!0):t.parent&&Zr(t.parent.scrollWorldTransform,r,r,!0),ao.moveLocal(t,r.x,r.y,n)},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=ro(e),i=ro(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){ao.zoomOfLocal(t,po(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(h(s)||(s&&(r=s),s=i),Kr(no,o),Qr(no,e,i,s),ao.hasHighPosition(t))ao.setTransform(t,no,n,r);else{const e=t.x+no.e-o.e,a=t.y+no.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){ao.rotateOfLocal(t,po(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Kr(no,n),Jr(no,e,i),ao.hasHighPosition(t)?ao.setTransform(t,no,!1,s):t.set({x:t.x+no.e-n.e,y:t.y+no.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){ao.skewOfLocal(t,po(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Kr(no,t.__localMatrix),to(no,e,i,s),ao.setTransform(t,no,n,r)},transformWorld(t,e,i,s){Kr(no,t.worldTransform),eo(no,e),t.parent&&io(no,t.parent.scrollWorldTransform),ao.setTransform(t,no,i,s)},transform(t,e,i,s){Kr(no,t.localTransform),eo(no,e),ao.setTransform(t,no,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&ao.getInnerOrigin(t,n.origin),o=so(e,r,n.around&&ao.getInnerOrigin(t,n.around));if(ao.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ao.getInnerOrigin(t,n.origin);dt.move(o,r.x-s.x,r.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 Qr(i,ao.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(ao.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Kr(no,t.worldTransform),io(no,e.scrollWorldTransform),i?no:Object.assign({},no)),drop(t,e,i,s){t.setTransform(ao.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ao.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,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),m.requestRender(()=>ao.animateMove(t,e,i))}}},ao=oo,{updateAllMatrix:ho,updateMatrix:lo,updateAllWorldOpacity:co,updateAllChange:uo,updateChange:_o}=ao;function po(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const go={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)=>yo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>yo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>yo(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 fo;function yo(t,e){return e||(fo=0),t.__.mask&&(fo=1),fo<0?null:(fo&&(fo=-1),!0)}const{updateBounds:mo}=oo,vo={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,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),wo(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++)xo(e[t],e)},updateBounds(t,e){const i=[t];xo(t,i),bo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)mo(s[t]);e&&e===i||mo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Eo(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Po(t,e,i,s,n,r,o)}},{pushAllChildBranch:wo,pushAllBranchStack:xo,updateBoundsByBranchStack:bo,move:Eo,scale:Po}=vo,So={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:Bo,updateBounds:To}=oo,{toOuterOf:ko,getPoints:Ro,copy:Co}=jt,Lo="_localContentBounds",Ao="_worldContentBounds",Do="_worldBoxBounds",Oo="_worldStrokeBounds";class Io{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 ko(this.contentBounds,this.leaf.__localMatrix,this[Lo]||(this[Lo]={})),this[Lo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ko(this.contentBounds,this.leaf.__world,this[Ao]||(this[Ao]={})),this[Ao]}get worldBoxBounds(){return ko(this.boxBounds,this.leaf.__world,this[Do]||(this[Do]={})),this[Do]}get worldStrokeBounds(){return ko(this.strokeBounds,this.leaf.__world,this[Oo]||(this[Oo]={})),this[Oo]}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,m.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 Bo(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 Kt(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 n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Bo(s,e,!0)}if(o||(o=Q.getLayout(r)),Co(o,a),dt.copy(o,n),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=Ro(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 Mo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&m.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&m.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&m.event.stop(this.origin)}}class Fo extends Mo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Fo.ADD="child.add",Fo.REMOVE="child.remove",Fo.CREATED="created",Fo.MOUNTED="mounted",Fo.UNMOUNTED="unmounted",Fo.DESTROY="destroy";const Wo="property.scroll";class Uo extends Mo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Uo.CHANGE="property.change",Uo.LEAFER_CHANGE="property.leafer_change",Uo.SCROLL=Wo;const No={scrollX:Wo,scrollY:Wo};class zo extends Mo{constructor(t,e){super(t),Object.assign(this,e)}}zo.LOAD="image.load",zo.LOADED="image.loaded",zo.ERROR="image.error";class Yo extends Mo{static checkHas(t,e,i){"on"===i?e===Vo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Xo)||t.hasEvent(Ho)||t.hasEvent(jo),t.__hasWorldEvent=t.hasEvent(Vo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Xo,t),"inner"===e&&t.emit(Ho,t)),t.emit(jo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Vo,this)}}Yo.RESIZE="bounds.resize",Yo.INNER="bounds.inner",Yo.LOCAL="bounds.local",Yo.WORLD="bounds.world";const{RESIZE:Xo,INNER:Ho,LOCAL:jo,WORLD:Vo}=Yo,Go={};[Xo,Ho,jo,Vo].forEach(t=>Go[t]=1);class qo extends Mo{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(qo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}qo.RESIZE="resize";class Ko extends Mo{constructor(t,e){super(t),this.data=e}}Ko.REQUEST="watch.request",Ko.DATA="watch.data";class Zo extends Mo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Zo.REQUEST="layout.request",Zo.START="layout.start",Zo.BEFORE="layout.before",Zo.LAYOUT="layout",Zo.AFTER="layout.after",Zo.AGAIN="layout.again",Zo.END="layout.end";class $o extends Mo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}$o.REQUEST="render.request",$o.CHILD_START="render.child_start",$o.CHILD_END="render.child_end",$o.START="render.start",$o.BEFORE="render.before",$o.RENDER="render",$o.AFTER="render.after",$o.AGAIN="render.again",$o.END="render.end",$o.NEXT="render.next";class Qo extends Mo{}Qo.START="leafer.start",Qo.BEFORE_READY="leafer.before_ready",Qo.READY="leafer.ready",Qo.AFTER_READY="leafer.after_ready",Qo.VIEW_READY="leafer.view_ready",Qo.VIEW_COMPLETED="leafer.view_completed",Qo.STOP="leafer.stop",Qo.RESTART="leafer.restart",Qo.END="leafer.end",Qo.UPDATE_MODE="leafer.update_mode",Qo.TRANSFORM="leafer.transform",Qo.MOVE="leafer.move",Qo.SCALE="leafer.scale",Qo.ROTATE="leafer.rotate",Qo.SKEW="leafer.skew";const{MOVE:Jo,SCALE:ta,ROTATE:ea,SKEW:ia}=Qo,sa={x:Jo,y:Jo,scaleX:ta,scaleY:ta,rotation:ea,skewX:ia,skewY:ia},na={};class ra{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,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=oa(this,s,!0),h=o(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):a[t]=[l],Go[t]&&Yo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=oa(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],Go[t]&&Yo.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&&_e.has(t)&&(e=_e.get(t,{type:t,target:this,current:this}));const s=oa(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}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 oa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:na)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:na)}}const{on:aa,on_:ha,off:la,off_:da,once:ca,emit:ua,emitEvent:_a,hasEvent:pa,destroy:ga}=ra.prototype,fa={on:aa,on_:ha,off:la,off_:da,once:ca,emit:ua,emitEvent:_a,hasEvent:pa,destroyEventer:ga},ya=te.get("setAttr"),ma={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||a(e)||n(e)||(ya.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Uo(Uo.LEAFER_CHANGE,this,t,s,e));const i=sa[t];i&&(this.emitEvent(new Qo(i,this)),this.emitEvent(new Qo(Qo.TRANSFORM,this)))}this.emitPropertyEvent(Uo.CHANGE,t,s,e);const i=No[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Uo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__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:va,multiplyParent:wa,translateInner:xa,defaultWorld:ba}=Q,{toPoint:Ea,tempPoint:Pa}=St,Sa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;wa(this.__local||e,t?t.__scrollWorld||t.__world:ba,i,!!e.affectScaleOrRotation,n),s&&xa(Object.assign(s,i),n.scrollX,n.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)&&(va(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,Pa),xa(e,-Pa.x,-Pa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ba,updateAllMatrix:Ta}=oo,{updateBounds:ka}=vo,{toOuterOf:Ra,copyAndSpread:Ca,copy:La}=jt,{toBounds:Aa}=In,Da={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ra(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Yo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Yo.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(),Ra(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ra(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ra(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Aa(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),ka(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ta(this),ka(this,this))):Ba(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ca(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?La(e.renderBounds,e.strokeBounds):Ca(e.renderBounds,e.boxBounds,i)}},Oa={__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),oo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);te.showBounds&&te.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:Ia}=go,Ma={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ia(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ia(i[s],e)||i[s].__clip(t,e)}}},Fa={},{LEAF:Wa,create:Ua}=w,{stintSet:Na}=_,{toInnerPoint:za,toOuterPoint:Ya,multiplyParent:Xa}=Q,{toOuterOf:Ha}=jt,{copy:ja,move:Va}=dt,{moveLocal:Ga,zoomOfLocal:qa,rotateOfLocal:Ka,skewOfLocal:Za,moveWorld:$a,zoomOfWorld:Qa,rotateOfWorld:Ja,skewOfWorld:th,transform:eh,transformWorld:ih,setTransform:sh,getFlipTransform:nh,getLocalOrigin:rh,getRelativeWorld:oh,drop:ah}=oo;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return Io}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=Ua(Wa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Fo.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(Fo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Fo.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(Fo.MOUNTED)):this.__emitLifeEvent(Fo.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 Xa(i,t.matrix,e,void 0,i),Ha(this.__layout.renderBounds,e,e),Na(e,"half",i.half),Na(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}=er.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),Fa.scaleX=i,Fa.scaleY=s,Fa}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?oh(this,e):this.worldTransform,n=i?t:{};return Ha(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ja(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ja(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),za(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ya(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 n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Va(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Va(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}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 n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){sh(this,t,e,i)}transform(t,e,i){eh(this,t,e,i)}move(t,e,i){Ga(this,t,e,i)}moveInner(t,e,i){$a(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qa(this,rh(this,t),e,i,s,n)}rotateOf(t,e,i){Ka(this,rh(this,t),e,i)}skewOf(t,e,i,s,n){Za(this,rh(this,t),e,i,s,n)}transformWorld(t,e,i){ih(this,t,e,i)}moveWorld(t,e,i){$a(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Qa(this,t,e,i,s,n)}rotateOfWorld(t,e){Ja(this,t,e)}skewOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}flip(t,e){eh(this,nh(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 ae.need("path")}getMotionPoint(t){return ae.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){ah(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):Ur(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Fo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Fo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=fe([Vr(ma),Vr(Sa),Vr(Da),Vr(fa),Vr(Oa)],t.Leaf);const{setListWithFn:hh}=jt,{sort:lh}=vo,{localBoxBounds:dh,localStrokeBounds:ch,localRenderBounds:uh,maskLocalBoxBounds:_h,maskLocalStrokeBounds:ph,maskLocalRenderBounds:gh}=go,fh=new te("Branch");t.Branch=class extends t.Leaf{__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){hh(e||this.__layout.boxBounds,this.children,this.__hasMask?_h:dh)}__updateStrokeBounds(t){hh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ph:ch)}__updateRenderBounds(t){hh(t||this.__layout.renderBounds,this.children,this.__hasMask?gh:uh)}__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(lh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return fh.warn("add self or destroyed");const i=n(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=de.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 s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Fo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Fo.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(Fo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Fo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Fo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=fe([Vr(Ma)],t.Branch);class yh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(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,n=s.length;t<n;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 yh;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 mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(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 vh=te.get("LeaferCanvas");class wh extends Le{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}m.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=o(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else vh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),vh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),m.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=m.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:m.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};_.copyAttrs(e,this,Ce),this.resize(t),this.resizeListener&&!n(this.width)&&this.resizeListener(new qo(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}Vn(CanvasRenderingContext2D.prototype),Vn(Path2D.prototype);const{mineType:xh,fileType:bh}=Gn;function Eh(t,e){m.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=xh(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,xh(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(xh(bh(e)),i);return m.origin.download(s,e)},download:(t,e)=>new Promise(i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()}),loadImage:t=>new Promise((e,i)=>{const s=new m.origin.Image,{crossOrigin:n}=m.image;n&&(s.setAttribute("crossOrigin",n),s.crossOrigin=n),s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=m.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},m.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},m.canvas=he.canvas(),m.conicGradientSupport=!!m.canvas.context.createConicGradient}Object.assign(he,{canvas:(t,e)=>new wh(t,e),image:t=>new rr(t)}),m.name="web",m.isMobile="ontouchstart"in window,m.requestRender=function(t){window.requestAnimationFrame(t)},or(m,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Ph}=navigator;Ph.indexOf("Firefox")>-1?(m.conicGradientRotate90=!0,m.intWheelDeltaY=!0,m.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(m.fullImageShadow=!0),Ph.indexOf("Windows")>-1?(m.os="Windows",m.intWheelDeltaY=!0):Ph.indexOf("Mac")>-1?m.os="Mac":Ph.indexOf("Linux")>-1&&(m.os="Linux");class Sh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new yh;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 yh,this.target=t,e&&(this.config=_.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($o.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Fo.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 Ko(Ko.DATA,{updatedList:this.updatedList})),this.__updatedList=new yh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Uo.CHANGE,this.__onAttrChange,this],[[Fo.ADD,Fo.REMOVE],this.__onChildEvent,this],[Ko.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Bh,updateBounds:Th,updateChange:kh}=oo,{pushAllChildBranch:Rh,pushAllParent:Ch}=vo;const{worldBounds:Lh}=go;class Ah{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new yh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Lh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Lh),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:Dh,updateAllChange:Oh}=oo,Ih=te.get("Layouter");class Mh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new mh,this.target=t,e&&(this.config=_.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(Zo.START),this.layoutOnce(),t.emitEvent(new Zo(Zo.END,this.layoutedBlocks,this.times))}catch(t){Ih.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ih.warn("layouting"):this.times>3?Ih.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ko.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=ne.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Zo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Zo(n,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?(Bh(t,!0),e.add(t),t.isBranch&&Rh(t,e),Ch(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ch(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;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||Th(s[t])}Th(i)}})}(this.__levelList),function(t){t.list.forEach(kh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Zo(r,a,this.times)),i.emitEvent(new Zo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ne.end(e)}fullLayout(){const t=ne.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Zo,r=this.getBlocks(new yh(e));e.emitEvent(new Zo(i,r,this.times)),Mh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Zo(s,r,this.times)),e.emitEvent(new Zo(n,r,this.times)),this.addBlocks(r),ne.end(t)}static fullLayout(t){Dh(t,!0),t.isBranch?vo.updateBounds(t):oo.updateBounds(t),Oh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ah([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ah(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_([[Zo.REQUEST,this.layout,this],[Zo.AGAIN,this.layoutAgain,this],[Ko.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fh=te.get("Renderer");class Wh{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,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.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(Zo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit($o.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit($o.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit($o.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Fh.log(e.innerName,"---\x3e");try{this.emitRender($o.START),this.renderOnce(t),this.emitRender($o.END,this.totalBounds),er.clearRecycled()}catch(t){this.rendering=!1,Fh.error(t)}Fh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fh.warn("rendering");if(this.times>3)return Fh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender($o.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender($o.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender($o.RENDER,this.renderBounds,this.renderOptions),this.emitRender($o.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=ne.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Kt(s);i.save(),s.spread(Wh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),ne.end(e)}fullRender(){const t=ne.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ne.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),te.showRepaint&&te.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),m.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,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 Kt;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 m.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()};m.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(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 Kt(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||Fh.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 $o(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[$o.REQUEST,this.update,this],[Zo.END,this.__onLayoutEnd,this],[$o.AGAIN,this.renderAgain,this],[qo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Wh.clipSpread=10;const Uh={},{copyRadiusPoint:Nh}=dt,{hitRadiusPoint:zh}=jt;class Yh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new yh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?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 n=this.findList=new yh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||oo.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&oo.hasParent(t,e))){n.reset();break}return n.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),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>oo.worldHittable(t))}getPath(t){const e=new yh,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 yh;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 yh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=zh(i.__world,n.hitRadius?Nh(Uh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}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,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.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 Xh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Yh(this.target=t,this),this.finder=he.finder&&he.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return m.backgrounder&&s&&s.updateLayout(),n.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):ae.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Hh(t){return lr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function jh(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Vh(){return(t,e)=>{const i="_"+e;or(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}})}}Object.assign(he,{watcher:(t,e)=>new Sh(t,e),layouter:(t,e)=>new Mh(t,e),renderer:(t,e,i)=>new Wh(t,e,i),selector:(t,e)=>new Xh(t,e)}),m.layout=Mh.fullLayout,m.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new yh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Gh={},qh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Kh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Zh={},$h={},Qh={},Jh={},tl={},el={apply(){ae.need("filter")}},il={},sl={setStyleName:()=>ae.need("state"),set:()=>ae.need("state")},nl={list:{},register(t,e){nl.list[t]=e},get:t=>nl.list[t]},{parse:rl,objectToCanvasData:ol}=es,{stintSet:al}=_,{hasTransparent:hl}=qh,ll={originPaint:{}},dl=te.get("UIData");class cl extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,dl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,dl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(al(this,"__isTransparentFill",hl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(al(this,"__isTransparentStroke",hl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?rl(t):ol(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ul(this,"shadow",t)}setInnerShadow(t){ul(this,"innerShadow",t)}setFilter(t){ul(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&$h.compute("fill",this.__leaf),e&&$h.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(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ll)):(this.__isStrokes=!0,this._stroke||(this._stroke=ll))}__removePaint(t,e){e&&this.__removeInput(t),Qh.recycleImage(t,this),"fill"===t?(al(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(al(this,"__isAlphaPixelStroke",void 0),al(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ul(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 _l extends cl{}class pl extends _l{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 gl extends _l{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class fl extends pl{}class yl extends cl{get __usePathBox(){return this.points||this.__pathInputed}}class ml extends cl{get __boxStroke(){return!this.__pathInputed}}class vl extends cl{get __boxStroke(){return!this.__pathInputed}}class wl extends yl{}class xl extends cl{}class bl extends cl{get __pathInputed(){return 2}}class El extends _l{}const Pl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Sl extends cl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=Pl[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=de.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.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 Bl extends ml{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 Tl extends ml{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:kl,add:Rl}=T,Cl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=kl(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=tl.getShadowRenderSpread(this,e)),s&&(t=kl(t,s)),r&&(t=Rl(t,el.getSpread(r))),o&&(t=Rl(t,o)),a&&(t=Rl(t,a));let l=t;return i&&(l=kl(l,tl.getInnerShadowSpread(this,i))),n&&(l=kl(l,n)),this.__layout.renderShapeSpread=l,h?kl(h.__updateRenderSpread(),t):t}},{stintSet:Ll}=_,Al={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ll(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ll(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ll(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!tl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Ll(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Dl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=$h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&tl.shadow(this,t,h),a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),n&&(s.__isFills?$h.fills(n,this,t,e):$h.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&tl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),c&&el.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,qh.string(e.color))}n&&(s.__isFills?$h.fills(n,this,t,e):$h.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?$h.strokes(r,this,t,e):$h.stroke(r,this,t,e))}}else s.__pathForRender?Dl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?$h.fills(s,this,t,e):$h.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?$h.strokes(n,this,t,e):$h.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 Dl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&$h.stroke(n,t,e,i),s&&$h.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&$h.stroke(n,t,e,i)}const Ol={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),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,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Il,Ml;t.UI=Il=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){F.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 Hn.set(this.path=t||[]),t||this.__drawPathByBox(Hn),Hn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ae.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ae.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Hn.set(i=[]),this.__drawPathByBox(Hn,!e)),t?es.toCanvasData(i,!0):i}getPathString(t,e,i){return es.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||il.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Yn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Zh.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?sn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,h(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){$h.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ae.need("animate")}killAnimate(t,e){}export(t,e){return ae.need("export")}syncExport(t,e){return ae.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Il.one(e)}static one(t,e,i,s,n){return de.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Gr()(this)}static registerData(t){Wr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},fe([Wr(cl)],t.UI.prototype,"__",void 0),fe([Vh()],t.UI.prototype,"zoomLayer",void 0),fe([ur("")],t.UI.prototype,"id",void 0),fe([ur("")],t.UI.prototype,"name",void 0),fe([ur("")],t.UI.prototype,"className",void 0),fe([Tr("pass-through")],t.UI.prototype,"blendMode",void 0),fe([Rr(1)],t.UI.prototype,"opacity",void 0),fe([Cr(!0)],t.UI.prototype,"visible",void 0),fe([Tr(!1)],t.UI.prototype,"locked",void 0),fe([kr(!1)],t.UI.prototype,"dim",void 0),fe([kr(!1)],t.UI.prototype,"dimskip",void 0),fe([Dr(0)],t.UI.prototype,"zIndex",void 0),fe([Or(!1)],t.UI.prototype,"mask",void 0),fe([Ir(!1)],t.UI.prototype,"eraser",void 0),fe([_r(0,!0)],t.UI.prototype,"x",void 0),fe([_r(0,!0)],t.UI.prototype,"y",void 0),fe([mr(100,!0)],t.UI.prototype,"width",void 0),fe([mr(100,!0)],t.UI.prototype,"height",void 0),fe([fr(1,!0)],t.UI.prototype,"scaleX",void 0),fe([fr(1,!0)],t.UI.prototype,"scaleY",void 0),fe([yr(0,!0)],t.UI.prototype,"rotation",void 0),fe([yr(0,!0)],t.UI.prototype,"skewX",void 0),fe([yr(0,!0)],t.UI.prototype,"skewY",void 0),fe([_r(0,!0)],t.UI.prototype,"offsetX",void 0),fe([_r(0,!0)],t.UI.prototype,"offsetY",void 0),fe([pr(0,!0)],t.UI.prototype,"scrollX",void 0),fe([pr(0,!0)],t.UI.prototype,"scrollY",void 0),fe([gr()],t.UI.prototype,"origin",void 0),fe([gr()],t.UI.prototype,"around",void 0),fe([ur(!1)],t.UI.prototype,"lazy",void 0),fe([vr(1)],t.UI.prototype,"pixelRatio",void 0),fe([Br(0)],t.UI.prototype,"renderSpread",void 0),fe([xr()],t.UI.prototype,"path",void 0),fe([br()],t.UI.prototype,"windingRule",void 0),fe([br(!0)],t.UI.prototype,"closed",void 0),fe([mr(0)],t.UI.prototype,"padding",void 0),fe([mr(!1)],t.UI.prototype,"lockRatio",void 0),fe([mr()],t.UI.prototype,"widthRange",void 0),fe([mr()],t.UI.prototype,"heightRange",void 0),fe([ur(!1)],t.UI.prototype,"draggable",void 0),fe([ur()],t.UI.prototype,"dragBounds",void 0),fe([ur("auto")],t.UI.prototype,"dragBoundsType",void 0),fe([ur(!1)],t.UI.prototype,"editable",void 0),fe([Mr(!0)],t.UI.prototype,"hittable",void 0),fe([Mr("path")],t.UI.prototype,"hitFill",void 0),fe([Sr("path")],t.UI.prototype,"hitStroke",void 0),fe([Mr(!1)],t.UI.prototype,"hitBox",void 0),fe([Mr(!0)],t.UI.prototype,"hitChildren",void 0),fe([Mr(!0)],t.UI.prototype,"hitSelf",void 0),fe([Mr()],t.UI.prototype,"hitRadius",void 0),fe([Fr("")],t.UI.prototype,"cursor",void 0),fe([Tr()],t.UI.prototype,"fill",void 0),fe([Sr(void 0,!0)],t.UI.prototype,"stroke",void 0),fe([Sr("inside")],t.UI.prototype,"strokeAlign",void 0),fe([Sr(1,!0)],t.UI.prototype,"strokeWidth",void 0),fe([Sr(!1)],t.UI.prototype,"strokeWidthFixed",void 0),fe([Sr("none")],t.UI.prototype,"strokeCap",void 0),fe([Sr("miter")],t.UI.prototype,"strokeJoin",void 0),fe([Sr()],t.UI.prototype,"dashPattern",void 0),fe([Sr(0)],t.UI.prototype,"dashOffset",void 0),fe([Sr(10)],t.UI.prototype,"miterLimit",void 0),fe([br(0)],t.UI.prototype,"cornerRadius",void 0),fe([br()],t.UI.prototype,"cornerSmoothing",void 0),fe([Hh()],t.UI.prototype,"shadow",void 0),fe([Hh()],t.UI.prototype,"innerShadow",void 0),fe([Hh()],t.UI.prototype,"blur",void 0),fe([Hh()],t.UI.prototype,"backgroundBlur",void 0),fe([Hh()],t.UI.prototype,"grayscale",void 0),fe([Hh()],t.UI.prototype,"filter",void 0),fe([Tr()],t.UI.prototype,"placeholderColor",void 0),fe([ur(100)],t.UI.prototype,"placeholderDelay",void 0),fe([ur({})],t.UI.prototype,"data",void 0),fe([Xr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Il=fe([Vr(Cl),Vr(Al),Hr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children: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(){}},fe([Wr(_l)],t.Group.prototype,"__",void 0),fe([mr(0)],t.Group.prototype,"width",void 0),fe([mr(0)],t.Group.prototype,"height",void 0),t.Group=fe([Vr(t.Branch),Gr()],t.Group);const Fl=te.get("Leafer");t.Leafer=Ml=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Jn.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),Ml.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,_.assign(s,t));const n=this.canvas=he.canvas(s);this.__controllers.push(this.renderer=he.renderer(this,n,s),this.watcher=he.watcher(this,s),this.layouter=he.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=he.selector(this),this.interaction=he.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=he.hitCanvasManager()),this.canvasManager=new ge,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),So.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(Qo.RESTART):this.emitLeafer(Qo.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(Qo.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(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=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new qo(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),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 $t(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.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(Qo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=_.copyAttrs({},s,Ce);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(Qo.BEFORE_READY),this.emitLeafer(Qo.READY),this.emitLeafer(Qo.AFTER_READY),So.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Qo.VIEW_READY),So.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){So.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(Qo.VIEW_COMPLETED),So.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 ae.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 Qo(t,this))}__listenEvents(){const t=ne.start("FirstCreate "+this.innerName);this.once([[Qo.START,()=>ne.end(t)],[Zo.START,this.updateLazyBounds,this],[$o.START,this.__onCreated,this],[$o.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ko.DATA,this.__onWatchData,this],[Zo.END,this.__onLayoutEnd,this],[$o.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ml.list.remove(this);try{this.stop(),this.emitLeafer(Qo.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(()=>{er.clearRecycled()},100)}catch(t){Fl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new yh,fe([Wr(gl)],t.Leafer.prototype,"__",void 0),fe([mr()],t.Leafer.prototype,"pixelRatio",void 0),fe([ur("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Ml=fe([Gr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},fe([Wr(ml)],t.Rect.prototype,"__",void 0),t.Rect=fe([Vr(Ol),Hr(),Gr()],t.Rect);const{add:Wl,includes:Ul,scroll:Nl}=jt,zl=t.Rect.prototype,Yl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=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"))&&(Wl(a,r),Nl(a,i)),this.__updateRectRenderBounds(),t=!Ul(r,a),t&&"show"===o&&Wl(n,a)}else this.__updateRectRenderBounds();_.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))}},fe([Wr(pl)],t.Box.prototype,"__",void 0),fe([mr(100)],t.Box.prototype,"width",void 0),fe([mr(100)],t.Box.prototype,"height",void 0),fe([ur(!1)],t.Box.prototype,"resizeChildren",void 0),fe([Br("show")],t.Box.prototype,"overflow",void 0),fe([Xr(zl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),fe([Xr(zl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),fe([Xr(zl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),fe([Xr(zl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),fe([Xr(zl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),fe([Xr(zl.__updateChange)],t.Box.prototype,"__updateRectChange",null),fe([Xr(zl.__render)],t.Box.prototype,"__renderRect",null),fe([Xr(Yl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=fe([Hr(),Gr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},fe([Wr(fl)],t.Frame.prototype,"__",void 0),fe([Tr("#FFFFFF")],t.Frame.prototype,"fill",void 0),fe([Br("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=fe([Gr()],t.Frame);const{moveTo:Xl,closePath:Hl,ellipse:jl}=Ps;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];i?s||n?(i<1&&jl(a,r,o,r*i,o*i,0,s,n,!1),jl(a,r,o,r,o,0,n,s,!0)):(i<1&&(jl(a,r,o,r*i,o*i),Xl(a,t,o)),jl(a,r,o,r,o,0,360,0,!0)):s||n?(Xl(a,r,o),jl(a,r,o,r,o,0,s,n,!1)):jl(a,r,o,r,o),Hl(a),m.ellipseToCurve&&(this.__.path=this.getPath(!0))}},fe([Wr(vl)],t.Ellipse.prototype,"__",void 0),fe([br(0)],t.Ellipse.prototype,"innerRadius",void 0),fe([br(0)],t.Ellipse.prototype,"startAngle",void 0),fe([br(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=fe([Gr()],t.Ellipse);const{sin:Vl,cos:Gl,PI:ql}=Math,{moveTo:Kl,lineTo:Zl,closePath:$l,drawPoints:Ql}=Ps;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ql(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Kl(e,r,0);for(let t=1;t<n;t++)Zl(e,r+r*Vl(2*t*ql/n),o-o*Gl(2*t*ql/n));$l(e)}}},fe([Wr(wl)],t.Polygon.prototype,"__",void 0),fe([br(3)],t.Polygon.prototype,"sides",void 0),fe([br()],t.Polygon.prototype,"points",void 0),fe([br(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=fe([Hr(),Gr()],t.Polygon);const{sin:Jl,cos:td,PI:ed}=Math,{moveTo:id,lineTo:sd,closePath:nd}=Ps;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];id(o,n,0);for(let t=1;t<2*i;t++)sd(o,n+(t%2==0?n:n*s)*Jl(t*ed/i),r-(t%2==0?r:r*s)*td(t*ed/i));nd(o)}},fe([Wr(xl)],t.Star.prototype,"__",void 0),fe([br(5)],t.Star.prototype,"corners",void 0),fe([br(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=fe([Gr()],t.Star);const{moveTo:rd,lineTo:od,drawPoints:ad}=Ps,{rotate:hd,getAngle:ld,getDistance:dd,defaultPoint:cd}=dt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&hd(i,e),i}set toPoint(t){this.width=dd(cd,t),this.rotation=ld(cd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ad(e,t.points,t.curve,t.closed):(rd(e,0,0),od(e,this.width,0))}},fe([Wr(yl)],t.Line.prototype,"__",void 0),fe([Er("center")],t.Line.prototype,"strokeAlign",void 0),fe([mr(0)],t.Line.prototype,"height",void 0),fe([br()],t.Line.prototype,"points",void 0),fe([br(0)],t.Line.prototype,"curve",void 0),fe([br(!1)],t.Line.prototype,"closed",void 0),t.Line=fe([Gr()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},fe([Wr(Bl)],t.Image.prototype,"__",void 0),fe([mr("")],t.Image.prototype,"url",void 0),t.Image=fe([Gr()],t.Image);const ud=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=he.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new rr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new zo(zo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),r=new mt;e&&r.translate(e.x,e.y),i&&(h(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.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()}},fe([Wr(Tl)],t.Canvas.prototype,"__",void 0),fe([jh(100)],t.Canvas.prototype,"width",void 0),fe([jh(100)],t.Canvas.prototype,"height",void 0),fe([jh(1)],t.Canvas.prototype,"pixelRatio",void 0),fe([jh(!0)],t.Canvas.prototype,"smooth",void 0),fe([ur(!1)],t.Canvas.prototype,"safeResize",void 0),fe([jh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=fe([Gr()],t.Canvas);const{copyAndSpread:_d,includes:pd,spread:gd,setList:fd}=jt,{stintSet:yd}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Kh.number(e,n),t.__letterSpacing=Kh.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,yd(t,"__padding",l&&F.fourNumber(l)),yd(t,"__clipText","show"!==h&&!t.__autoSize),yd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Gh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&gd(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!pd(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;_d(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()}},fe([Wr(Sl)],t.Text.prototype,"__",void 0),fe([mr(0)],t.Text.prototype,"width",void 0),fe([mr(0)],t.Text.prototype,"height",void 0),fe([Tr()],t.Text.prototype,"boxStyle",void 0),fe([ur(!1)],t.Text.prototype,"resizeFontSize",void 0),fe([Tr("#000000")],t.Text.prototype,"fill",void 0),fe([Er("outside")],t.Text.prototype,"strokeAlign",void 0),fe([Mr("all")],t.Text.prototype,"hitFill",void 0),fe([mr("")],t.Text.prototype,"text",void 0),fe([mr("")],t.Text.prototype,"placeholder",void 0),fe([mr("caption")],t.Text.prototype,"fontFamily",void 0),fe([mr(12)],t.Text.prototype,"fontSize",void 0),fe([mr("normal")],t.Text.prototype,"fontWeight",void 0),fe([mr(!1)],t.Text.prototype,"italic",void 0),fe([mr("none")],t.Text.prototype,"textCase",void 0),fe([mr("none")],t.Text.prototype,"textDecoration",void 0),fe([mr(0)],t.Text.prototype,"letterSpacing",void 0),fe([mr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),fe([mr(0)],t.Text.prototype,"paraIndent",void 0),fe([mr(0)],t.Text.prototype,"paraSpacing",void 0),fe([mr("x")],t.Text.prototype,"writingMode",void 0),fe([mr("left")],t.Text.prototype,"textAlign",void 0),fe([mr("top")],t.Text.prototype,"verticalAlign",void 0),fe([mr(!0)],t.Text.prototype,"autoSizeAlign",void 0),fe([mr("normal")],t.Text.prototype,"textWrap",void 0),fe([mr("show")],t.Text.prototype,"textOverflow",void 0),fe([Tr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=fe([Gr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},fe([Wr(bl)],t.Path.prototype,"__",void 0),fe([Er("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=fe([Gr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},fe([Wr(El)],t.Pen.prototype,"__",void 0),fe([(t,e)=>{or(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=fe([Vr(zs,["set","path","paint"]),Gr()],t.Pen),t.App=class extends t.Leafer{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:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&he.editor(n,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(e){const i=new t.Leafer(e);return this.add(i),i}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&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Zo.END,this.__onReady,this],[$o.START,this.__onCreated,this],[$o.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_($o.END,this.__onChildRenderEnd,this))}},t.App=fe([Gr()],t.App);const md={},vd={isHoldSpaceKey:()=>vd.isHold("Space"),isHold:t=>md[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){md[t]||(md[t]=!0)},setUpCode(t){md[t]=!1}},wd={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 xd extends Mo{get spaceKey(){return vd.isHoldSpaceKey()}get left(){return wd.left(this)}get right(){return wd.right(this)}get middle(){return wd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return vd.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){_e.changeName(t,e)}}const{min:bd,max:Ed,abs:Pd}=Math,{float:Sd,sign:Bd}=F,{minX:Td,maxX:kd,minY:Rd,maxY:Cd}=jt,Ld=new Kt,Ad=new Kt,Dd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Od.getValidMove(t.__localBoxBounds,Od.getDragBounds(t),s,e,!0),Od.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Od.getValidScaleOf(t.__localBoxBounds,Od.getDragBounds(t),r,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,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Od.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),Od.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=Sd(s.x),s.y=Sd(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Ad.set(e),Ld.set(t).scaleOf(s,n.x,n.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 Od.isInnerMode(t,e,i,"width")?(n.x<0&&Ld.scaleOf(s,f=1/n.x,1),p=Sd(Ld.minX-Ad.minX),g=Sd(Ad.maxX-Ld.maxX),u=h&&p>0?1+p/(h*Ld.width):1,_=l&&g>0?1+g/(l*Ld.width):1,f*=Ed(u,_)):(n.x<0&&((Sd(Td(t)-Td(e))<=0||Sd(kd(e)-kd(t))<=0)&&Ld.scaleOf(s,f=1/n.x,1),Ld.unsign()),p=Sd(Ad.minX-Ld.minX),g=Sd(Ld.maxX-Ad.maxX),u=h&&p>0?1-p/(h*Ld.width):1,_=l&&g>0?1-g/(l*Ld.width):1,f*=bd(u,_)),Od.isInnerMode(t,e,i,"height")?(n.y<0&&Ld.scaleOf(s,1,y=1/n.y),p=Sd(Ld.minY-Ad.minY),g=Sd(Ad.maxY-Ld.maxY),u=d&&p>0?1+p/(d*Ld.height):1,_=c&&g>0?1+g/(c*Ld.height):1,y*=Ed(u,_),r&&(u=Ed(Pd(f),Pd(y)),f=Bd(f)*u,y=Bd(y)*u)):(n.y<0&&((Sd(Rd(t)-Rd(e))<=0||Sd(Cd(e)-Cd(t))<=0)&&Ld.scaleOf(s,1,y=1/n.y),Ld.unsign()),p=Sd(Ad.minY-Ld.minY),g=Sd(Ld.maxY-Ad.maxY),u=d&&p>0?1-p/(d*Ld.height):1,_=c&&g>0?1-g/(c*Ld.height):1,y*=bd(u,_)),n.x*=a(f)?f:1,n.y*=a(y)?y:1,n}},Od=Dd;t.PointerEvent=class extends xd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=fe([qr()],t.PointerEvent);const Id=t.PointerEvent,Md={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof yh?t:new yh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return dt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Dd.axisMove(t,n),n}static limitMove(t,e){Dd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Md,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Md,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Md,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 jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){Md.x=t?this.totalX:this.moveX,Md.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=fe([qr()],t.DragEvent);const Fd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=fe([qr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=fe([qr()],t.MoveEvent),t.TouchEvent=class extends xd{},t.TouchEvent=fe([qr()],t.TouchEvent);const Wd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=fe([qr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=fe([qr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=fe([qr()],t.ZoomEvent),t.KeyEvent=class extends xd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=fe([qr()],t.KeyEvent);const Ud={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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:Nd.getSwipeDirection(dt.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 yh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>oo.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Nd=Ud,zd=new yh,{getDragEventData:Yd,getDropEventData:Xd,getSwipeEventData:Hd}=Ud;class jd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Yd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||zd;return this.dragging&&(n?e?zd:new yh(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&wd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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],oo.draggable(e)){this.draggableList=new yh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Yd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:a}=i.p,l=!a||!!e;n.forEach(i=>{if(i.draggable){const n=o(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},l||n);a&&!n&&e?oo.animateMove(i,d,h(a)?a:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Yd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(dt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Hd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Xd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 Vd=te.get("emit");const Gd=["move","zoom","rotate","key"];function qd(t,e,i,s,n){if(Gd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Zd(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Kd(r,e,i,s,n)}}function Kd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Zd(t,n)&&(sl.updateEventStyle&&!s&&sl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=_e.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Zd(t,e){return e&&e.has(t)}const $d={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:Qd,pathCanDrag:Jd,pathHasOutside:tc}=Ud;class ec{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&&wd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&wd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&vd.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=_.clone($d),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new yh(t),this.createTransformer(),this.dragger=new jd(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(wd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),wd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=wd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&wd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=dt.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;wd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,vd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,vd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new yh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Qd(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;m.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,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&&!tc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Jd(t.path))&&!tc(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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,n=s.length;t<n&&(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:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&dt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Qd(e.path,t.PointerEvent.LONG_TAP)||Qd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(qo.RESIZE,this.__onResize,this)],t.once(Qo.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 n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Kd(n,t,e,!0,s))return;n.isApp&&qd(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&qd(n,t,e,!1,s),Kd(n,t,e,!1,s))return}catch(t){Vd.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 ic{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ic.custom={};class sc extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new yh,this.pixelList=new yh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),he.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),he.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()}}m.getSelector=function(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=he.selector())};const{toInnerRadiusPointOf:nc,copyRadiusPoint:rc}=dt,{hitRadiusPoint:oc,hitPoint:ac}=jt,hc={},lc={},dc=t.Leaf.prototype;dc.hit=function(t,e=0){this.updateLayout(),rc(lc,t,e);const i=this.__world;return!!(e?oc(i,lc):ac(i,lc))&&(this.isBranch?m.getSelector(this).hitPoint(Object.assign({},lc),e,{target:this}):this.__hitWorld(lc))},dc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(rc(hc,t,i.hitRadius),t=hc),nc(t,s,hc),i.hitBox||r){if(jt.hitRadiusPoint(n.boxBounds,hc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(hc,e)},dc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},dc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},dc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},dc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const cc=new mt,uc=t.UI.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,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=m.image.hitCanvasSize,o=r.hitScale=Zt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Zt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),er.patternLocked=!0,this.__renderShape(r,{matrix:cc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),er.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.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,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const _c=t.UI.prototype,pc=t.Rect.prototype,gc=t.Box.prototype;pc.__updateHitCanvas=gc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?_c.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},pc.__hitFill=gc.__hitFill=function(t){return this.__hitCanvas?_c.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),m.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const fc=Le.prototype;fc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},fc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},fc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Zt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.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 yc={convert(t,e){const i=Ud.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=Ud.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=yc.getTouch(t),s=Ud.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},mc={convert(t){const e=Ud.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:vc}=Ud;class wc extends ec{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(mc.convert(t))}onKeyUp(t){this.keyUp(mc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(yc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(yc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=yc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(yc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(yc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(yc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(yc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=yc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&vc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(yc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=yc.getTouch(t);this.pointerMove(yc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=yc.getTouch(t);this.pointerUp(yc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Ud.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Ud.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Ud.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(F.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),c(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>c(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,d(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=o(t)&&ic.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function xc(t,e,i){t.__.__font?$h.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function bc(t,e,i,s,n){const r=i.__;c(t)?$h.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&$h.strokeArrow(t,i,s,n)}function Ec(t,e,i,s,n){const r=i.__;c(t)?$h.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),$h.drawTextStroke(i,s,n))}function Pc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Ec(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",$h.fillText(i,r,n),r.blendMode="normal",oo.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Sc,copyAndSpread:Bc,toOuterOf:Tc,getOuterOf:kc,getByMove:Rc,move:Cc,getIntersectData:Lc}=jt,Ac={};let Dc;const{stintSet:Oc}=_,{hasTransparent:Ic}=qh;function Mc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:r}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=Qh.image(i,t,e,r,!Dc||!Dc[e.url]);break;case"linear":s=Jh.linearGradient(e,r);break;case"radial":s=Jh.radialGradient(e,r);break;case"angular":s=Jh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:qh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:qh.string(e)})}if(s&&(s.originPaint=e,o(s.style)&&Ic(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Fc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),Dc=Qh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Mc(t,a[n],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)&&(n=!0),r=!0),"fill"===t?(Oc(i,"__isAlphaPixelFill",n),Oc(i,"__isTransparentFill",r)):(Oc(i,"__isAlphaPixelStroke",n),Oc(i,"__isTransparentStroke",r),Oc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,xc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,Qh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),xc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),xc(e,i,s),i.restoreBlendMode()):xc(e,i,s)}},fillPathOrText:xc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[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(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)$h.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":bc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),bc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)bc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),bc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),oo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){$h.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Ec(t,1,e,i,s);break;case"inside":Pc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Ec(t,2,e,i,s):Pc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[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}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!Qh.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?$h.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?$h.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;Tc(o.strokeSpread?(Bc(Ac,o.boxBounds,o.strokeSpread),Ac):o.boxBounds,r,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))_=s,h=u=a,l=r;else{let s;if(m.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Sc(n,T.swapAndScale(o.renderShapeSpread,p,g)):n;s=Lc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=kc(a,c),h=Rc(u,-c.e,-c.f),l=kc(r,c),Cc(l,-c.e,-c.f);const v=i.matrix;v?(d=new mt(c),d.multiply(v),f*=v.scaleX,y*=v.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 Wc,Uc=new Kt;const{isSame:Nc}=jt;function zc(t,e,i,s,n,r){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 n.data||Qh.createData(n,s,i,r),!0}function Yc(t,e){jc(t,zo.LOAD,e)}function Xc(t,e){jc(t,zo.LOADED,e)}function Hc(t,e,i){e.error=i,t.forceUpdate("surface"),jc(t,zo.ERROR,e)}function jc(t,e,i){t.hasEvent(e)&&t.emitEvent(new zo(e,i))}function Vc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Gc,translate:qc}=Q,Kc=new Kt,Zc={},$c={};function Qc(t,e,i,s){const n=o(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Jc={},tu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:eu,set:iu,rotateOfOuter:su,translate:nu,scaleOfOuter:ru,multiplyParent:ou,scale:au,rotate:hu,skew:lu}=Q;function du(t,e,i,s,n,r,o,a){o&&hu(t,o),a&&lu(t,a.x,a.y),n&&au(t,n,r),nu(t,e.x+i,e.y+s)}const{get:cu,scale:uu,copy:_u}=Q,{getFloorScale:pu}=F,{abs:gu}=Math;const fu={image:function(t,e,i,s,n){let r,o;const a=er.get(i);return Wc&&i===Wc.paint&&Nc(s,Wc.boxBounds)?r=Wc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Wc=a.use>1?{leafPaint:r,paint:i,boxBounds:Uc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(zc(t,e,i,a,r,s),n&&(Yc(t,o),Xc(t,o))):a.error?n&&Hc(t,o,a.error):(n&&(Vc(t,!0),Yc(t,o)),r.loadId=a.load(()=>{Vc(t,!1),t.destroyed||(zc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Xc(t,o)),r.loadId=void 0},e=>{Vc(t,!1),Hc(t,o,e),r.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)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=Qh.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===r+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===m.name&&qo.isResizing(i)||d||(e=m.image.isLarge(a,r,o)||a.width*r>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Qh.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?Qh.createPattern(t,i,s,n):Qh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){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?(n.save(),_&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,g),n.restore()):(o.scaleX&&(p*=o.scaleX,g*=o.scaleY),n.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,er.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=er.patternTasker.add(()=>ye(this,void 0,void 0,function*(){Qh.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:n,scaleY:r}=Qh.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!m.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Qh.getPatternFixScale(t,n,r);let d,c,u,{width:_,height:p}=i;l&&(n*=l,r*=l),_*=n,p*=r,h&&(c=h.x*n/gu(s.scaleX||1),u=h.y*r/gu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=pu(_+(c||0)),r*=pu(p+(u||0)),d=cu(),a&&_u(d,a),uu(d,1/n,1/r));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||m.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=m.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=Qh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Kc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,w={mode:a},x="center"!==h&&(_||0)%180==90;let b,E;switch(jt.set($c,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(F.getScaleData(d,u,i,Zc),b=Zc.scaleX,E=Zc.scaleY),(h||y||f)&&(b&&jt.scale($c,b,E,!0),h&&kt.toPoint(h,$c,e,$c,!0,!0))):v&&!_||(b=E=jt.getFitScale(e,$c,"fit"!==a),jt.put(e,i,h,b,!1,$c),jt.scale($c,b,E,!0)),l&&dt.move($c,l),a){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,Qh.stretchMode(w,e,b,E));break;case"normal":case"clip":if($c.x||$c.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Qh.clipMode(w,e,$c.x,$c.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Qh.repeatMode(w,e,s,n,$c.x,$c.y,b,E,_,p,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:Qc(r,i,n.width,e&&e.x),y:Qc(o,s,n.height,e&&e.y)}}(y,i&&f,$c.width,$c.height,e));break;default:b&&Qh.fillOrFitMode(w,e,$c.x,$c.y,b,E,_)}return w.transform||(e.x||e.y)&&qc(w.transform=Gc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),r&&r<1&&(w.opacity=r),m&&(w.filters=m),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=eu(),{x:r,y:o}=e;r||o?nu(n,r,o):n.onlyScale=!0,au(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=eu();nu(a,e.x+i,e.y+s),au(a,n,r),o&&su(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=eu();du(d,e,i,s,n,r,o,a),h&&(o||a?(iu(tu),ru(tu,e,h,l),ou(d,tu)):ru(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=eu();if(c)du(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)su(u,{x:i/2,y:s/2},h);else switch(hu(u,h),h){case 90:nu(u,s,0);break;case 180:nu(u,i,s);break;case 270:nu(u,0,i)}Jc.x=e.x+n,Jc.y=e.y+r,nu(u,Jc.x,Jc.y),o&&ru(u,Jc,o,a)}t.transform=u}},{toPoint:yu}=St,{hasTransparent:mu}=qh,vu={},wu={};function xu(t,e,i,s){if(i){let n,r,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],o(n)?(a=t/(l-1),r=qh.string(n,s)):(a=n.offset,r=qh.string(n.color,s)),e.addColorStop(a,r),!h&&mu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:bu,getDistance:Eu}=dt,{get:Pu,rotateOfOuter:Su,scaleOfOuter:Bu}=Q,{toPoint:Tu}=St,ku={},Ru={};function Cu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=bu(e,i);r=Pu(),n?(Bu(r,e,o/a*(s||1),1),Su(r,e,t+90)):(Bu(r,e,1,o/a*(s||1)),Su(r,e,t))}return r}const{getDistance:Lu}=dt,{toPoint:Au}=St,Du={},Ou={};const Iu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;yu(i||"top",e,vu),yu(s||"bottom",e,wu);const o=m.canvas.createLinearGradient(vu.x,vu.y,wu.x,wu.y),a={type:n,style:o};return xu(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Tu(i||"center",e,ku),Tu(s||"bottom",e,Ru);const a=m.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,Eu(ku,Ru)),h={type:n,style:a};xu(h,a,t.stops,r);const l=Cu(e,ku,Ru,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Au(i||"center",e,Du),Au(s||"bottom",e,Ou);const a=m.conicGradientSupport?m.canvas.createConicGradient(0,Du.x,Du.y):m.canvas.createRadialGradient(Du.x,Du.y,0,Du.x,Du.y,Lu(Du,Ou)),h={type:n,style:a};xu(h,a,t.stops,r);const l=Cu(e,Du,Ou,o||1,m.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Cu},{copy:Mu,move:Fu,toOffsetOutBounds:Wu}=jt,{max:Uu,abs:Nu}=Math,zu={},Yu=new mt,Xu={};function Hu(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=Nu(t.spread||0),o=Uu(o,n+r-s),a=Uu(a,n+r+i),h=Uu(h,n+r+s),l=Uu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function ju(t,e,i){const{shapeBounds:s}=i;let n,r;m.fullImageShadow?(Mu(zu,t.bounds),Fu(zu,e.x-s.x,e.y-s.y),n=t.bounds,r=zu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:Vu}=jt,Gu={};const qu=Hu;const Ku={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Wu(h,Xu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Xu.offsetX+(o.x||0)*c*f,Xu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,qh.string(o.color)),n=tl.getShadowTransform(t,_,i,o,Xu,f),n&&_.setTransform(n),ju(_,Xu,i),n&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,r,"copy"),s=r),a?_.copyWorld(a,r,r,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),oo.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Vu(h,Gu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Gu.offsetX+(o.x||0)*c*f,Gu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=tl.getShadowTransform(t,_,i,o,Gu,f,!0),n&&_.setTransform(n),ju(_,Gu,i),_.restore(),a?(_.copyWorld(_,l,r,"copy"),_.copyWorld(a,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,qh.string(o.color),"source-in"),oo.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:Hu,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Yu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Yu}},isTransformShadow(t){},getInnerShadowSpread:qu},{excludeRenderBounds:Zu}=go;let $u;function Qu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":$u||($u=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);t_(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":t_(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Ju(t){return t.getSameCanvas(!1,!0)}function t_(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,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&&(Qu(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Zu(i,e)||i.__render(t,e),r=i.__.opacity,$u=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Ju(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Ju(t)),n||(n=Ju(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Qu(this,o,t,n,s,r,void 0,!1),Zu(i,e)||i.__render(n||t,e),d&&Qu(this,o,t,n,s,r,d,!1)}Qu(this,o,t,n,s,r,void 0,!0)};const e_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",i_=e_+"_#~&*+\\=|≮≯≈≠=…",s_=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 n_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const r_=n_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),o_=n_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),a_=n_(e_),h_=n_(i_),l_=n_("- —/~|┆·");var d_;!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"}(d_||(d_={}));const{Letter:c_,Single:u_,Before:__,After:p_,Symbol:g_,Break:f_}=d_;function y_(t){return r_[t]?c_:l_[t]?f_:o_[t]?__:a_[t]?p_:h_[t]?g_:s_.test(t)?u_:c_}const m_={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-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:w_}=m_,{Letter:x_,Single:b_,Before:E_,After:P_,Symbol:S_,Break:B_}=d_;let T_,k_,R_,C_,L_,A_,D_,O_,I_,M_,F_,W_,U_,N_,z_,Y_,X_,H_=[];function j_(t,e){I_&&!O_&&(O_=I_),T_.data.push({char:t,width:e}),R_+=e}function V_(){C_+=R_,T_.width=R_,k_.words.push(T_),T_={data:[]},R_=0}function G_(){N_&&(z_.paraNumber++,k_.paraStart=!0,N_=!1),I_&&(k_.startCharSize=O_,k_.endCharSize=I_,O_=0),k_.width=C_,Y_.width?w_(k_):X_&&q_(),H_.push(k_),k_={words:[]},C_=0}function q_(){C_>(z_.maxWidth||0)&&(z_.maxWidth=C_)}const{top:K_,right:Z_,bottom:$_,left:Q_}=t.Direction4;function J_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const tp={getDrawData:function(t,e){o(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[Q_],n-=a[Z_]+a[Q_],!n&&(n=.01)):e.autoSizeAlign||(i=a[Q_]),r?(s=a[K_],r-=a[K_]+a[$_],!r&&(r=.01)):e.autoSizeAlign||(s=a[K_]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:m.canvas.font=e.__font};return function(t,e,i){z_=t,H_=t.rows,Y_=t.bounds,X_=!Y_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=m,{width:a}=Y_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;N_=!0,F_=null,O_=D_=I_=R_=C_=0,T_={data:[]},k_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)A_=e[i],"\n"===A_?(R_&&V_(),k_.paraEnd=!0,G_(),N_=!0):(M_=y_(A_),M_===x_&&"none"!==r&&(A_=v_(A_,r,!R_)),D_=o.measureText(A_).width,s&&(s<0&&(I_=D_),D_+=s),W_=M_===b_&&(F_===b_||F_===x_)||F_===b_&&M_!==P_,U_=!(M_!==E_&&M_!==b_||F_!==S_&&F_!==P_),L_=N_&&n?a-n:a,t&&a&&C_+R_+D_>L_&&(h?(R_&&V_(),C_&&G_()):(U_||(U_=M_===x_&&F_==P_),W_||U_||M_===B_||M_===E_||M_===b_||R_+D_>L_?(R_&&V_(),C_&&G_()):C_&&G_()))," "===A_&&!0!==N_&&C_+R_===0||(M_===B_?(" "===A_&&R_&&V_(),j_(A_,D_),V_()):W_||U_?(R_&&V_(),j_(A_,D_)):j_(A_,D_)),F_=M_);R_&&V_(),C_&&G_(),H_.length>0&&(H_[H_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{z_.paraNumber++,C_=o.measureText(t).width,H_.push({x:n||0,text:t,width:C_,paraStart:!0}),X_&&q_()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":J_(e,"x",t[Q_]);break;case"right":J_(e,"x",-t[Z_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":J_(e,"y",t[K_]);break;case"bottom":J_(e,"y",-t[$_])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__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=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);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=n;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+=r,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:n,paraIndent:r,letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=r&&t.paraStart?r: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,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),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,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(n.splice(r),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?m.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-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,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=qh.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const ep={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(o(t)){if(!i||!qh.object)return t;t=qh.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(Gh,tp),Object.assign(qh,ep),Object.assign($h,Fc),Object.assign(Qh,fu),Object.assign(Jh,Iu),Object.assign(tl,Ku),Object.assign(he,{interaction:(t,e,i,s)=>new wc(t,e,i,s),hitCanvas:(t,e)=>new wh(t,e),hitCanvasManager:()=>new sc}),Eh();class ip extends cl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function sp(t,e){return lr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?sl.setStyleName(this,e,i):sl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function np(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function rp(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 op(t,e){c(e)||(e=void 0),lp(t,e,"in")}function ap(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),lp(t,e,"out"))}t.Robot=class extends t.UI{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),!n(t))if(h(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=er.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:n,size:r,total:o}=e,{width:a,height:l}=r&&(h(r)?{width:r,height:r}:r)||(o>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:l},d+a>=t.width?(d=0,c+=l):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new zo(zo.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:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},fe([Wr(ip)],t.Robot.prototype,"__",void 0),fe([mr()],t.Robot.prototype,"robot",void 0),fe([ur()],t.Robot.prototype,"actions",void 0),fe([ur("")],t.Robot.prototype,"action",void 0),fe([Tr(0)],t.Robot.prototype,"now",void 0),fe([ur(12)],t.Robot.prototype,"FPS",void 0),fe([ur(!0)],t.Robot.prototype,"loop",void 0),t.Robot=fe([Gr()],t.Robot),ae.add("robot");const hp={};function lp(t,e,i){const{normalStyle:s}=t;e||(e=hp),e.scale&&(F.assignScale(e,e.scale),delete e.scale),e!==hp&&sl.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=up(e,t),s=t.animate();s&&up(i,t,s.fromStyle);return i}(t,e):void 0;sl.canAnimate&&dp(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=dp(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=cp(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=cp(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function dp(t){let e;const i={},s=rp(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&sl.isState(n,t,s)&&(e=_p(i,r));const o=i.selectedStyle||t.selectedStyle;o&&sl.isSelected(t,s)&&(e=_p(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&sl.isPlacehold(t,s)&&(e=_p(i,a)),sl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=_p(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&sl.isFocus(t,s)&&(e=_p(i,n));const r=i.hoverStyle||t.hoverStyle;r&&sl.isHover(t,s)&&(e=_p(i,r));const o=i.pressStyle||t.pressStyle;o&&sl.isPress(t,s)&&(e=_p(i,o))}return e?i:void 0}function cp(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&sl.animateExcludes[t]||(n[t]=e[t]);return n}function up(t,e,i){return cp(t,e,i,!0)}function _p(t,e){return Object.assign(t,e),!0}function pp(t,e){const i=t[e];i&&op(t,i),t.button&&fp(t.children,e)}function gp(t,e,i){i||(i=t.states[e]),op(t,i),t.button&&fp(t.children,null,e)}function fp(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":sl.isHover(s)&&(r=!1);break;case"pressStyle":sl.isPress(s)&&(r=!1);break;case"focusStyle":sl.isFocus(s)&&(r=!1)}r&&pp(s,e)}else n(i)||gp(s,i);s.isBranch&&fp(s.children,e,i)}}function yp(t,e){const i=t[e];i&&ap(t,i),t.button&&vp(t.children,e)}function mp(t,e,i){ap(t,i),t.button&&vp(t.children,null,e)}function vp(t,e,i){if(!t)return;let s;for(let r=0,o=t.length;r<o;r++)s=t[r],e?yp(s,e):n(i)||mp(s,i),s.isBranch&&vp(s.children,e,i)}function wp(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=rp(e,i);r&&(s=n[t](r))}return s}function xp(t,e,i){let s=e[t];if(!s&&i){const n=rp(e,i);n&&(s=n[t])}return s}ae.add("state"),sl.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},sl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=rp(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},sl.isSelected=function(t,e){return xp("selected",t,e)},sl.isDisabled=function(t,e){return xp("disabled",t,e)},sl.isFocus=function(t,e){return wp("isFocus",t,e)},sl.isHover=function(t,e){return wp("isHover",t,e)},sl.isPress=function(t,e){return wp("isPress",t,e)},sl.isPlacehold=function(t,e){return t.__.__isPlacehold},sl.isDrag=function(t,e){return wp("isDrag",t,e)},sl.setStyleName=function(t,e,i){i?gp(t,e,t[e]):mp(t,e,t[e])},sl.set=function(t,e){const i=t.states[e];i?gp(t,e,i):mp(t,e,i)},sl.getStyle=dp,sl.updateStyle=lp,sl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:pp(e,"hoverStyle");break;case t.PointerEvent.LEAVE:yp(e,"hoverStyle");break;case t.PointerEvent.DOWN:pp(e,"pressStyle");break;case t.PointerEvent.UP:yp(e,"pressStyle")}};const bp=t.UI.prototype;t.UI.addAttr("selected",!1,sp,"selectedStyle"),t.UI.addAttr("disabled",!1,sp,"disabledStyle"),t.UI.addAttr("states",{},np),t.UI.addAttr("state","",sp),t.UI.addAttr("normalStyle",void 0,ur),t.UI.addAttr("hoverStyle",void 0,np),t.UI.addAttr("pressStyle",void 0,np),t.UI.addAttr("focusStyle",void 0,np),t.UI.addAttr("selectedStyle",void 0,np),t.UI.addAttr("disabledStyle",void 0,np),t.UI.addAttr("placeholderStyle",void 0,np),t.UI.addAttr("button",!1,ur),bp.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))},bp.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?pp(this,"focusStyle"):yp(this,"focusStyle")})},bp.updateState=function(){sl.updateStyle(this,void 0,"in")};const Ep=t.Text.prototype,Pp="text";or(Ep,Pp,Object.assign(Object.assign({},ar(Ep,Pp)),{set(t){const e=this,i=e.text;e.__setAttr(Pp,t)&&(wr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:Sp,sin:Bp,pow:Tp,sqrt:kp,abs:Rp,ceil:Cp,floor:Lp,round:Ap,PI:Dp}=Math,Op=5*Dp,Ip=1.70158,Mp=2.5949095,Fp=7.5625,Wp=2.75;function Up(t){return e=>Tp(e,t)}function Np(t){return e=>1-Tp(1-e,t)}function zp(t){return e=>e<.5?.5*Tp(2*e,t):1-.5*Tp(2-2*e,t)}function Yp(t){return t<1/Wp?Fp*t*t:t<2/Wp?Fp*(t-=1.5/Wp)*t+.75:t<2.5/Wp?Fp*(t-=2.25/Wp)*t+.9375:Fp*(t-=2.625/Wp)*t+.984375}function Xp(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=Hp(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Rp(l)<1e-6));e++)c-=d/l;return n[o]=Hp(c,e,s)}}function Hp(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const jp={get(t){const{list:e}=jp;return o(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){jp.list[t]=e},list:{linear:t=>t,ease:Xp(.25,.1,.25,1),"ease-in":Xp(.42,0,1,1),"ease-out":Xp(0,0,.58,1),"ease-in-out":Xp(.42,0,.58,1),"sine-in":t=>1-Sp(t*Dp*.5),"sine-out":t=>Bp(t*Dp*.5),"sine-in-out":t=>.5*(1-Sp(t*Dp)),"quad-in":Up(2),"quad-out":Np(2),"quad-in-out":zp(2),"cubic-in":Up(3),"cubic-out":Np(3),"cubic-in-out":zp(3),"quart-in":Up(4),"quart-out":Np(4),"quart-in-out":zp(4),"quint-in":Up(5),"quint-out":Np(5),"quint-in-out":zp(5),"expo-in":t=>t?Tp(2,10*t-10):0,"expo-out":t=>1===t?1:1-Tp(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Tp(2,2*t*10-10):.5*(2-Tp(2,10-2*t*10)),"circ-in":t=>1-kp(1-Tp(t,2)),"circ-out":t=>kp(1-Tp(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-kp(1-Tp(2*t,2))):.5*(kp(1-Tp(2-2*t,2))+1),"back-in":t=>((Ip+1)*t-Ip)*t*t,"back-out":t=>(t-=1)*t*((Ip+1)*t+Ip)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Mp+1)*t-Mp)*.5:.5*((t=2*t-2)*t*((Mp+1)*t+Mp)+2),"elastic-in":t=>0===t||1===t?t:-Tp(2,10*(t-1))*Bp((t-1.1)*Op),"elastic-out":t=>0===t||1===t?t:Tp(2,-10*t)*Bp((t-.1)*Op)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Tp(2,10*((t*=2)-1))*Bp((t-1.1)*Op)*.5:Tp(2,10*(1-(t*=2)))*Bp((t-1.1)*Op)*.5+1,"bounce-in":t=>1-Yp(1-t),"bounce-out":Yp,"bounce-in-out":t=>t<.5?.5*(1-Yp(1-2*t)):.5*(1+Yp(2*t-1)),"cubic-bezier":Xp,steps:function(t,e="floor"){return i=>("floor"===e?Lp(i*t):"ceil"===e?Cp(i*t):Ap(i*t))/t}}};function Vp(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 Gp{}Gp.CREATED="created",Gp.PLAY="play",Gp.PAUSE="pause",Gp.STOP="stop",Gp.SEEK="seek",Gp.UPDATE="update",Gp.COMPLETED="completed";t.Animate=class extends ra{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:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&h(n)&&(t+=n-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:n,attrs:r}=this;this.easingFn=jp.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.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(Gp.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Gp.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Gp.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=Kh.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(Gp.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,l,d,c,u,_=0,p=0;r>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<r;s++){if(l=i[s],c=l.style||l,a||(a=o?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=l;r&&(d.swing=h(r)?r:2,u=2*d.swing-1),o&&(d.loop=u=h(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),n&&(d.easingFn=jp.get(n))}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(Gp.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,m.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(Gp.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,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),nl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(Gp.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 h(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)}},fe([Vp("ease")],t.Animate.prototype,"easing",void 0),fe([Vp(0)],t.Animate.prototype,"delay",void 0),fe([Vp(.2)],t.Animate.prototype,"duration",void 0),fe([Vp("auto")],t.Animate.prototype,"ending",void 0),fe([Vp(!1)],t.Animate.prototype,"reverse",void 0),fe([Vp(!1)],t.Animate.prototype,"swing",void 0),fe([Vp(!1)],t.Animate.prototype,"loop",void 0),fe([Vp(0)],t.Animate.prototype,"loopDelay",void 0),fe([Vp(1)],t.Animate.prototype,"speed",void 0),fe([Vp(!0)],t.Animate.prototype,"autoplay",void 0),fe([Vp()],t.Animate.prototype,"join",void 0),fe([Vp()],t.Animate.prototype,"jump",void 0),fe([Vp()],t.Animate.prototype,"attrs",void 0),t.Animate=fe([Vr(fa)],t.Animate),t.AnimateList=class extends t.Animate{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(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(Gp.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Gp.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Gp.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(Gp.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Gp.COMPLETED:this.completed&&this.emitType(t);break;case Gp.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)}},t.AnimateList=fe([Vr(fa)],t.AnimateList);const qp={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"},Kp=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Zp=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,$p=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Qp=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Jp=parseInt,tg=parseFloat,{round:eg}=Math;let ig={},sg=0;function ng(t){let e,i,s,n=1;switch(t.length){case 9:e=Jp(t.slice(1,3),16),i=Jp(t.slice(3,5),16),s=Jp(t.slice(5,7),16),n=Jp(t.slice(7,9),16)/255;break;case 7:e=Jp(t.slice(1,3),16),i=Jp(t.slice(3,5),16),s=Jp(t.slice(5,7),16);break;case 5:e=Jp(t[1]+t[1],16),i=Jp(t[2]+t[2],16),s=Jp(t[3]+t[3],16),n=Jp(t[4]+t[4],16)/255;break;case 4:e=Jp(t[1]+t[1],16),i=Jp(t[2]+t[2],16),s=Jp(t[3]+t[3],16);break;case 3:e=i=s=Jp(t[1]+t[2],16);break;case 2:e=i=s=Jp(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const rg=1/6,og=.5,ag=2/3,hg=1/3;function lg(t,e,i){return i<0?i++:i>1&&i--,i<rg?t+6*(e-t)*i:i<og?e:i<ag?t+(e-t)*(ag-i)*6:t}function dg(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=lg(a,s,t+hg),r=lg(a,s,t),o=lg(a,s,t-hg)}return{r:eg(255*n),g:eg(255*r),b:eg(255*o),a:s}}ae.add("color"),qh.object=function(t,e){let i,s=!n(e)&&e<1;if(o(t)){const e=ig[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=ng(t);break;case"R":case"r":"("===t[4]&&Zp.test(t)?i=function(t){const e=Zp.exec(t);return{r:Jp(e[1]),g:Jp(e[2]),b:Jp(e[3]),a:tg(e[4])}}(t):"("===t[3]&&Kp.test(t)&&(i=function(t){const e=Kp.exec(t);return{r:Jp(e[1]),g:Jp(e[2]),b:Jp(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Qp.test(t)?i=function(t){const e=Qp.exec(t);return dg(tg(e[1]),tg(e[2]),tg(e[3]),tg(e[4]))}(t):"("===t[3]&&$p.test(t)&&(i=function(t){const e=$p.exec(t);return dg(tg(e[1]),tg(e[2]),tg(e[3]),1)}(t))}if(!i){const e=qp[t.toLowerCase()];e&&(i=ng("#"+e))}i&&(sg++,sg>1e4&&(ig={},sg=0),ig[t]=Object.assign({},i))}}else c(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:cg}=Math,{fourNumber:ug}=F,_g={fill:mg,stroke:mg,cornerRadius:(t,e,i)=>h(t)&&h(e)?fg(t,e,i):(t=ug(t),e=ug(e),t.map((t,s)=>fg(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,n=e.length,r=fg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return h(t)||h(e)?F.float(fg(t,e,i),Math.max(gg(t),gg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return nl.setBetweenStyle(n,t,e,n,i,s),n},shadow:vg,innerShadow:vg},pg={value:function(t,e,i){const s=h(t),n=h(e);return s&&n?t+(e-t)*i:n||s?fg(t,e,i):t},number:fg,color:yg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=nl;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,n,r)))}};function gg(t){const e=String(t).split(".")[1];return e?e.length:0}function fg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?cg(n):n}function yg(t,e,i){t=qh.object(t),e=qh.object(e);const s=fg(t.r,e.r,i,1)+","+fg(t.g,e.g,i,1)+","+fg(t.b,e.b,i,1),n=fg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function mg(t,e,i){return o(t)&&o(e)?yg(t,e,i):e}function vg(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:fg((t=t||{}).x,e.x,i),y:fg(t.y,e.y,i),blur:fg(t.blur,e.blur,i),spread:fg(t.spread,e.spread,i),color:yg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ae.add("animate","color"),sl.canAnimate=!0,Object.assign(nl.list,_g),Object.assign(nl,pg);const wg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,ur),t.UI.addAttr("transition",!0,ur),t.UI.addAttr("transitionOut",void 0,ur),wg.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))},wg.animate=function(e,i,s,r){if(n(e))return this.__animate;let o=d(e)&&!i&&s?new t.AnimateList(this,e,r):new t.Animate(this,e,i,r);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},wg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},wg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Gp.COMPLETED,e)};const xg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],bg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Eg}=Math,{getDerivative:Pg}=ai,Sg={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<xg.length;h++)l=f*(1+xg[h]),d=f*(1-xg[h]),c=Pg(l,t,i,n,o),u=Pg(l,e,s,r,a),_=Pg(d,t,i,n,o),p=Pg(d,e,s,r,a),g+=bg[h]*(Eg(c*c+u*u)+Eg(_*_+p*p));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Pg(t,e,s,r,a),d=Pg(t,i,n,o,h);return Math.atan2(d,l)/U},getT(t,e,i,s,n,r,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;)Bg(i,s,n,r,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,_=d*n+e*o,p=d*r+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(Oe.C,c,u,g,f,y,m)}},{getDistance:Bg}=Sg,{M:Tg,L:kg,C:Rg,Z:Cg}=Oe,{float:Lg}=F,Ag={},Dg={},Og={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Tg:case kg:Og.transformPoints(t,e,s,1),s+=3;break;case Rg:Og.transformPoints(t,e,s,3),s+=7;break;case Cg:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Ag.x=t[n],Ag.y=t[n+1],Q.toOuterPoint(e,Ag),t[n]=Ag.x,t[n+1]=Ag.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Tg:case kg:i=t[a+1],s=t[a+2],e=n===kg&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Rg:i=t[a+5],s=t[a+6],e=Sg.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 Cg:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Kh.number(e,t.total);let r,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Tg:case kg:if(o=n[f+1],a=n[f+2],r=s[y],p+r>=e||!t.total)return f||(m=o,v=a),Dg.x=m,Dg.y=v,g.x=o,g.y=a,dt.getDistancePoint(Dg,g,e-p,!0),g.rotation=dt.getAngle(Dg,g),g;m=o,v=a,f+=3;break;case Rg:if(o=n[f+5],a=n[f+6],r=s[y],p+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],_=Sg.getT(e-p,r,m,v,l,d,c,u,o,a,i),ai.getPointAndSet(_,m,v,l,d,c,u,o,a,g),g.rotation=Sg.getRotation(_,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case Cg:f+=1;default:r=0}y++,p+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=Kh.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=n.length;for(;m<b;){switch(d=n[m],d){case Tg:case kg:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),Dg.x=w,Dg.y=x,y.x=h,y.y=l,a=Lg(e-f),a&&(dt.getDistancePoint(Dg,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Rg:if(c=n[m+1],u=n[m+2],_=n[m+3],p=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Lg(e-f),a&&(g=Sg.getT(a,o,w,x,c,u,_,p,h,l,i),Sg.cut(r,g,w,x,c,u,_,p,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,_,p,h,l);break;case Cg:m+=1,r.push(d);default:o=0}v++,f+=o}return r}};function Ig(t){return lr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ae.add("motion-path"),nl.register("motion",function(t,e,i,s){return c(t)&&(t=Kh.number(t,s.getMotionTotal())),c(e)&&(e=Kh.number(e,s.getMotionTotal())),nl.number(t||0,e||0,i)}),nl.register("motionRotation",function(t,e,i){return nl.number(t,e,i)});const Mg=t.UI.prototype,{updateMatrix:Fg,updateAllMatrix:Wg}=oo,{updateBounds:Ug}=vo;function Ng(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Yg(t);i.total&&(t.__.__pathForRender=Og.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Wg(t),Ug(t,t)):Fg(t));i&&(t.leafer.created=!0)}}function zg(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 Yg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Og.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Ig),t.UI.addAttr("motionPrecision",1,Ig),t.UI.addAttr("motion",void 0,Ig),t.UI.addAttr("motionRotation",!0,Ig),Mg.getMotionPathData=function(){return Yg(zg(this))},Mg.getMotionPoint=function(t){const e=zg(this),i=Yg(e);if(!i.total)return{};const s=Og.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:h(n)&&(s.rotation+=n),s},Mg.getMotionTotal=function(){return this.getMotionPathData().total},Mg.__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(),Ng(t))}else Ng(this)};const{Yes:Xg,NoAndSkip:Hg,YesAndSkip:jg}=t.Answer,Vg={},Gg={},qg={};class Kg{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"#":Vg.id=t.substring(1),t=Vg;break;case".":Gg.className=t.substring(1),t=Gg;break;default:qg.tag=t,t=qg}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,n=d(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?_.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&&oo.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 n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===Xg||r===jg){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Hg&&this.eachFind(n.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_(Fo.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 Zg=t.UI.prototype;function $g(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=he.selector())}return Zg.find=function(t,e){return $g(this).getBy(t,this,!1,e)},Zg.findOne=function(t,e){return $g(this).getBy(t,this,!0,e)},ae.add("find"),he.finder=function(t){return new Kg(t)},t.AlignHelper=kt,t.AnimateEasing=jp,t.AnimateEvent=Gp,t.AroundHelper=St,t.AutoBounds=$t,t.BezierHelper=ai,t.Bounds=Kt,t.BoundsEvent=Yo,t.BoundsHelper=jt,t.BoxData=pl,t.BranchHelper=vo,t.BranchRender=Ma,t.CanvasData=Tl,t.CanvasManager=ge,t.ChildEvent=Fo,t.ColorConvert=qh,t.Creator=he,t.Cursor=ic,t.DataHelper=_,t.Debug=te,t.DragBoundsHelper=Dd,t.Dragger=jd,t.Effect=tl,t.EllipseData=vl,t.EllipseHelper=fi,t.Event=Mo,t.EventCreator=_e,t.Eventer=ra,t.Export=il,t.FileHelper=Gn,t.Filter=el,t.Finder=Kg,t.FourNumberHelper=T,t.FrameData=fl,t.GroupData=_l,t.HighBezierHelper=Sg,t.HighCurveHelper=Og,t.HitCanvasManager=sc,t.ImageData=Bl,t.ImageEvent=zo,t.ImageManager=er,t.IncrementId=w,t.Interaction=wc,t.InteractionBase=ec,t.InteractionHelper=Ud,t.Keyboard=vd,t.LayoutEvent=Zo,t.Layouter=Mh,t.LeafBounds=Da,t.LeafBoundsHelper=go,t.LeafData=g,t.LeafDataProxy=ma,t.LeafEventer=fa,t.LeafHelper=oo,t.LeafLayout=Io,t.LeafLevelList=mh,t.LeafList=yh,t.LeafMatrix=Sa,t.LeafRender=Oa,t.LeaferCanvas=wh,t.LeaferCanvasBase=Le,t.LeaferData=gl,t.LeaferEvent=Qo,t.LeaferImage=rr,t.LineData=yl,t.MathHelper=F,t.Matrix=mt,t.MatrixHelper=Q,t.MyDragEvent=Fd,t.MyImage=ud,t.MyPointerEvent=Id,t.MyTouchEvent=Wd,t.NeedConvertToCanvasCommandMap=Me,t.OneRadian=U,t.PI2=N,t.PI_2=z,t.Paint=$h,t.PaintGradient=Jh,t.PaintImage=Qh,t.PathArrow=Zh,t.PathBounds=In,t.PathCommandDataHelper=Ps,t.PathCommandMap=Oe,t.PathCommandNodeHelper=yi,t.PathConvert=es,t.PathCorner=Yn,t.PathCreator=zs,t.PathData=bl,t.PathDrawer=sn,t.PathHelper=Ae,t.PathNumberCommandLengthMap=Ne,t.PathNumberCommandMap=Ue,t.PenData=El,t.Picker=Yh,t.Platform=m,t.Plugin=ae,t.Point=ft,t.PointHelper=dt,t.PointerButton=wd,t.PolygonData=wl,t.PropertyEvent=Uo,t.RectData=ml,t.RectHelper=ze,t.RectRender=Ol,t.RenderEvent=$o,t.Renderer=Wh,t.ResizeEvent=qo,t.Resource=Jn,t.RobotData=ip,t.Run=ne,t.Selector=Xh,t.StarData=xl,t.State=sl,t.StringNumberMap=Qt,t.TaskItem=Zn,t.TaskProcessor=$n,t.TextConvert=Gh,t.TextData=Sl,t.Transition=nl,t.TwoPointBoundsHelper=wt,t.UIBounds=Cl,t.UICreator=de,t.UIData=cl,t.UIEvent=xd,t.UIRender=Al,t.UnitConvert=Kh,t.WaitHelper=So,t.WatchEvent=Ko,t.Watcher=Sh,t.affectRenderBoundsType=Br,t.affectStrokeBoundsType=Er,t.attr=dr,t.autoLayoutType=gr,t.boundsType=mr,t.canvasPatch=Vn,t.canvasSizeAttrs=Ce,t.createAttr=function(t){return(e,i)=>{or(e,i,hr(i,t))}},t.createDescriptor=hr,t.cursorType=Fr,t.dataProcessor=Wr,t.dataType=ur,t.decorateLeafAttr=lr,t.defineDataProcessor=Ur,t.defineKey=or,t.defineLeafAttr=cr,t.dimType=kr,t.doBoundsType=wr,t.doStrokeType=Pr,t.effectType=Hh,t.emptyData=s,t.eraserType=Ir,t.extraPropertyEventMap=No,t.getBoundsData=X,t.getDescriptor=ar,t.getMatrixData=H,t.getPointData=Y,t.hitType=Mr,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=a,t.isNull=r,t.isNumber=h,t.isObject=c,t.isString=o,t.isUndefined=n,t.layoutProcessor=function(t){return(e,i)=>{or(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=sa,t.maskType=Or,t.motionPathType=Ig,t.naturalBoundsType=vr,t.opacityType=Rr,t.path=Xn,t.pathInputType=xr,t.pathType=br,t.pen=Hn,t.positionType=_r,t.registerUI=Gr,t.registerUIEvent=qr,t.resizeType=jh,t.rewrite=Xr,t.rewriteAble=Hr,t.rotationType=yr,t.scaleType=fr,t.scrollType=pr,t.sortType=Dr,t.stateStyleType=np,t.stateType=sp,t.strokeType=Sr,t.surfaceType=Tr,t.tempBounds=Zt,t.tempMatrix=vt,t.tempPoint=yt,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=Eh,t.useModule=Vr,t.version="1.12.4",t.visibleType=Cr,t.zoomLayerType=Vh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function n(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:a}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return p(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&p(t[n]={},e[n],i[n]):t[n]=e[n]})},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:p}=_;class g{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(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: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:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,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 f={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=y;return e[t]?e[t]++:(e[t]=1,0)}},y=f;let m,v,w;const{max:x}=Math,b=[0,0,0,0],E={zero:[...b],tempFour:b,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>P(b,t,e,i,s),toTempAB(t,e,i){w=i?h(t)?e:t:[],h(t)?(m=B(t),v=e):h(e)?(m=t,v=B(e)):(m=t,v=e),4!==m.length&&(m=S(m)),4!==v.length&&(v=S(v))},get(t,e){let i;if(!h(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)=>h(t)&&h(e)?x(t,e):(T(t,e,i),P(w,x(m[0],v[0]),x(m[1],v[1]),x(m[2],v[2]),x(m[3],v[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(T(t,e,i),P(w,m[0]+v[0],m[1]+v[1],m[2]+v[2],m[3]+v[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,l]=4===t.length?t:S(t);return P(n,a*i,l*e,r*i,o*e)}},{set:P,get:S,setTemp:B,toTempAB:T}=E,{round:k,pow:R,max:C,floor:L,PI:A}=Math,D={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber:E.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=n(e)?1e12:R(10,e);return-0===(t=k(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,n=(h(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&D.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>C(L(t),e)/t,randInt:O,randColor:t=>`rgba(${O(255)},${O(255)},${O(255)},${t||1})`};function O(t){return Math.round(Math.random()*t)}const I=A/180,M=2*A,F=A/2;function W(){return{x:0,y:0}}function U(){return{x:0,y:0,width:0,height:0}}function N(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:z,cos:Y,acos:X,sqrt:H}=Math,{float:j}=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 q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:G(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:N,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){K.toInnerPoint(t,e,V),K.scaleOfInner(t,V,i,s)},scaleOfInner(t,e,i,s=i){K.translateInner(t,e.x,e.y),K.scale(t,i,s),K.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=Y(e*=I),a=z(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){K.toInnerPoint(t,e,V),K.rotateOfInner(t,V,i)},rotateOfInner(t,e,i){K.translateInner(t,e.x,e.y),K.rotate(t,i),K.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=I,t.a=s+r*i,t.b=n+o*i),e&&(e*=I,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){K.toInnerPoint(t,e,V),K.skewOfInner(t,V,i,s)},skewOfInner(t,e,i,s=0){K.translateInner(t,e.x,e.y),K.skew(t,i,s),K.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+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){K.multiply(t,K.tempInvert(e))},divideParent(t,e){K.multiplyParent(t,K.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=K;return K.copy(e,t),K.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*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:n}=e,r=i*I,o=Y(r),a=z(r);if(s||n){const e=s*I,i=n*I;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)&&K.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=H(n*n+r*r),c=t/d;const e=n/d;u=r>0?X(e):-X(e)}else{c=H(o*o+a*a),d=t/c;const e=o/c;u=F-(a>0?X(-e):-X(e))}const e=j(Y(u)),i=z(u);d=j(d),c=j(c),_=e?j((o/c+i)/e/I,9):0,p=e?j((r/d-i)/e/I,9):0,u=j(u/I)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+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:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=H(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){K.set(t)}},K=q,{float:Z}=D,{toInnerPoint:$,toOuterPoint:Q}=q,{sin:J,cos:tt,abs:et,sqrt:it,atan2:st,min:nt,round:rt}=Math,ot={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?rt(t.x-.5)+.5:rt(t.x),t.y=e?rt(t.y-.5)+.5:rt(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=at.defaultPoint);const s=tt(e*=I),n=J(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=at;return lt(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=at;return lt(i,t),Q(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=at;return lt(i,t),at.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(lt(t,e),dt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){Q(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)=>ht(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=et(i-t),r=et(s-e);return it(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>nt(ht(t,e,i,s),ht(i,s,n,r)),getAngle:(t,e)=>ct(t,e)/I,getRotation:(t,e,i,s)=>(s||(s=e),at.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),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)=>st(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=ct(t,e);return n&&(t=e),s||(e={}),e.x=t.x+tt(r)*i,e.y=t.y+J(r)*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)=>Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){at.reset(t)}},at=ot,{getDistanceFrom:ht,copy:lt,setRadius:dt,getAtan2:ct}=at;class ut{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ut(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new ut(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i,s){return new ut(ot.getDistancePoint(this,t,e,i,s))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}isSame(t){return ot.isSame(this,t)}reset(){return ot.reset(this),this}}const _t=new ut;class pt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?q.copy(this,t):q.set(this,t,e,i,s,n,r),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:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new pt(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 gt=new pt,ft={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,n){yt(t,e,i),yt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:yt}=ft;var mt,vt;t.Direction4=void 0,(mt=t.Direction4||(t.Direction4={}))[mt.top=0]="top",mt[mt.right=1]="right",mt[mt.bottom=2]="bottom",mt[mt.left=3]="left",t.Direction9=void 0,(vt=t.Direction9||(t.Direction9={}))[vt.topLeft=0]="topLeft",vt[vt.top=1]="top",vt[vt.topRight=2]="topRight",vt[vt.right=3]="right",vt[vt.bottomRight=4]="bottomRight",vt[vt.bottom=5]="bottom",vt[vt.bottomLeft=6]="bottomLeft",vt[vt.left=7]="left",vt[vt.center=8]="center",vt[vt["top-left"]=0]="top-left",vt[vt["top-right"]=2]="top-right",vt[vt["bottom-right"]=4]="bottom-right",vt[vt["bottom-left"]=6]="bottom-left";const wt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];wt.forEach(t=>t.type="percent");const xt={directionData:wt,tempPoint:{},get:bt,toPoint(t,e,i,s,n,r){const o=bt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),xt.toPoint(t,e,i,!0),i)};function bt(e){return o(e)?wt[t.Direction9[e]]:e}const{toPoint:Et}=xt,Pt={toPoint(t,e,i,s,n,r){Et(t,i,s,n,e,r)}},{tempPointBounds:St,setPoint:Bt,addPoint:Tt,toBounds:kt}=ft,{toOuterPoint:Rt}=q,{float:Ct,fourNumber:Lt}=D,{floor:At,ceil:Dt}=Math;let Ot,It,Mt,Ft;const Wt={},Ut={},Nt={},zt={tempBounds:Nt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(d(i)){const e=Lt(i);s?Yt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Yt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Yt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,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),Yt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ht(e,t):e=t,i||(i=t),e.offsetX=Yt.maxX(i),e.offsetY=Yt.maxY(i),Yt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Yt.copy(Nt,t),Yt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Yt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Wt.x=t.x,Wt.y=t.y,Rt(e,Wt,Ut),Bt(St,Ut.x,Ut.y),Wt.x=t.x+t.width,Rt(e,Wt,Ut),Tt(St,Ut.x,Ut.y),Wt.y=t.y+t.height,Rt(e,Wt,Ut),Tt(St,Ut.x,Ut.y),Wt.x=t.x,Rt(e,Wt,Ut),Tt(St,Ut.x,Ut.y),kt(St,i)},toInnerOf(t,e,i){i||(i=t),Yt.move(i,-e.e,-e.f),Yt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Yt.getFitScale(t,e));return new pt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),o(s)&&(s=Yt.getFitScale(t,e,"cover"===s)),Nt.width=n?e.width*=s:e.width*s,Nt.height=n?e.height*=s:e.height*s,Pt.toPoint(i,Nt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Yt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Yt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Yt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=At(t.x),t.y=At(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=Ct(t.x,e),t.y=Ct(t.y,e),t.width=Ct(t.width,e),t.height=Ct(t.height,e)},add(t,e,i){Ot=t.x+t.width,It=t.y+t.height,Mt=e.x,Ft=e.y,i||(Mt+=e.width,Ft+=e.height),Ot=Ot>Mt?Ot:Mt,It=It>Ft?It:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ot-t.x,t.height=It-t.y},addList(t,e){Yt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Yt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Yt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Ht(t,n)):Xt(t,n));r&&Yt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Bt(St,t.x,t.y):Tt(St,t.x,t.y)),kt(St,t)},setPoint(t,e){Yt.set(t,e.x,e.y)},addPoint(t,e){Xt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.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=ot.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=Yt.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=Yt.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=Yt.tempToOuterOf(e,i)),!Yt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Ot=s+r,It=n+o,Mt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ot=Ot<Mt?Ot:Mt,It=It<Ft?It:Ft,r=Ot-s,o=It-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Yt.copy(t,Yt.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){Yt.set(t)}},Yt=zt,{add:Xt,copy:Ht}=Yt;class jt{get minX(){return zt.minX(this)}get minY(){return zt.minY(this)}get maxX(){return zt.maxX(this)}get maxY(){return zt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?zt.copy(this,t):zt.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 jt(this)}move(t,e){return zt.move(this,t,e),this}scale(t,e,i){return zt.scale(this,t,e,i),this}scaleOf(t,e,i){return zt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return zt.toOuterOf(this,t,e),this}toInnerOf(t,e){return zt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return zt.getFitMatrix(this,t,e)}put(t,e,i){zt.put(this,t,e,i)}spread(t,e){return zt.spread(this,t,e),this}shrink(t,e){return zt.shrink(this,t,e),this}ceil(){return zt.ceil(this),this}unsign(){return zt.unsign(this),this}float(t){return zt.float(this,t),this}add(t){return zt.add(this,t),this}addList(t){return zt.setList(this,t,!0),this}setList(t){return zt.setList(this,t),this}addListWithFn(t,e){return zt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return zt.setListWithFn(this,t,e),this}setPoint(t){return zt.setPoint(this,t),this}setPoints(t){return zt.setPoints(this,t),this}addPoint(t){return zt.addPoint(this,t),this}getPoints(){return zt.getPoints(this)}hitPoint(t,e){return zt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return zt.hitRadiusPoint(this,t,e)}hit(t,e){return zt.hit(this,t,e)}includes(t,e){return zt.includes(this,t,e)}intersect(t,e){return zt.intersect(this,t,e),this}getIntersect(t,e){return new jt(zt.getIntersectData(this,t,e))}isSame(t){return zt.isSame(this,t)}isEmpty(){return zt.isEmpty(this)}reset(){zt.reset(this)}}const Vt=new jt;class Gt{constructor(t,e,i,s,n,r){c(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new jt(n,e,r||t.width-n-i,o||t.height-e-s)}}const qt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Kt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Zt,max:$t}=Math,Qt={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||Jt.maxCacheSize),isSuperLarge:(t,e,i)=>Jt.isLarge(t,e,i,Jt.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=Jt;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=$t(Zt(e+(s||0)),1),c=$t(Zt(i+(n||0)),1);let u,_,p;l&&(p=qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=Qt.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,Jt.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),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&&_.stintSet(i,"transform",e)}}},{image:Jt}=Qt,{randColor:te}=D;class ee{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ee(t)}static set filter(t){this.filterList=ie(t)}static set exclude(t){this.excludeList=ie(t)}static drawRepaint(t,e){const i=te();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ee.showBounds,n=t.__nowWorld,r=te();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(se.enable){if(se.filterList.length&&se.filterList.every(t=>t!==this.name))return;if(se.excludeList.length&&se.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){se.enable&&this.warn(...t)}warn(...t){se.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 ie(t){return t?o(t)&&(t=[t]):t=[],t}ee.filterList=[],ee.excludeList=[],ee.showWarn=!0;const se=ee,ne=ee.get("RunTime"),re={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=f.create(f.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ne.log(s,n,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];n(i)||oe.end(i,e)}},oe=re,ae=[],he={list:{},add(t,...e){this.list[t]=!0,ae.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(()=>ae.forEach(t=>he.has(t,!0)));const le={editor:t=>he.need("editor")},de=ee.get("UICreator"),ce={list:{},register(t){const{__tag:e}=t.prototype;ue[e]&&de.repeat(e),ue[e]=t},get(t,e,i,s,r,o){ue[t]||de.error("not register "+t);const a=new ue[t](e);return n(i)||(a.x=i,s&&(a.y=s),r&&(a.width=r),o&&(a.height=o)),a}},{list:ue}=ce,_e=ee.get("EventCreator"),pe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(ge[e]&&_e.repeat(e),ge[e]=t)})},changeName(t,e){const i=ge[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ge[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ge[t](...e)},{nameList:ge}=pe;class fe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=le.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 ye(t,e,i,s){var n,r=arguments.length,o=r<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--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function me(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(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 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)}}"function"==typeof SuppressedError&&SuppressedError;const we=[];function xe(){return(t,e)=>{we.push(e)}}const be=[];class Ee{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||be)}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,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}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,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}ye([ve("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),ye([ve("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),ye([ve("globalAlpha")],Ee.prototype,"opacity",void 0),ye([ve()],Ee.prototype,"fillStyle",void 0),ye([ve()],Ee.prototype,"strokeStyle",void 0),ye([ve("lineWidth")],Ee.prototype,"strokeWidth",void 0),ye([ve("lineCap")],Ee.prototype,"strokeCap",void 0),ye([ve("lineJoin")],Ee.prototype,"strokeJoin",void 0),ye([ve("lineDashOffset")],Ee.prototype,"dashOffset",void 0),ye([ve()],Ee.prototype,"miterLimit",void 0),ye([ve()],Ee.prototype,"shadowBlur",void 0),ye([ve()],Ee.prototype,"shadowColor",void 0),ye([ve()],Ee.prototype,"shadowOffsetX",void 0),ye([ve()],Ee.prototype,"shadowOffsetY",void 0),ye([ve()],Ee.prototype,"filter",void 0),ye([ve()],Ee.prototype,"font",void 0),ye([ve()],Ee.prototype,"fontKerning",void 0),ye([ve()],Ee.prototype,"fontStretch",void 0),ye([ve()],Ee.prototype,"fontVariantCaps",void 0),ye([ve()],Ee.prototype,"textAlign",void 0),ye([ve()],Ee.prototype,"textBaseline",void 0),ye([ve()],Ee.prototype,"textRendering",void 0),ye([ve()],Ee.prototype,"wordSpacing",void 0),ye([ve()],Ee.prototype,"letterSpacing",void 0),ye([ve()],Ee.prototype,"direction",void 0),ye([xe()],Ee.prototype,"setTransform",null),ye([xe()],Ee.prototype,"resetTransform",null),ye([xe()],Ee.prototype,"getTransform",null),ye([xe()],Ee.prototype,"save",null),ye([xe()],Ee.prototype,"restore",null),ye([xe()],Ee.prototype,"translate",null),ye([xe()],Ee.prototype,"scale",null),ye([xe()],Ee.prototype,"rotate",null),ye([xe()],Ee.prototype,"fill",null),ye([xe()],Ee.prototype,"stroke",null),ye([xe()],Ee.prototype,"clip",null),ye([xe()],Ee.prototype,"fillRect",null),ye([xe()],Ee.prototype,"strokeRect",null),ye([xe()],Ee.prototype,"clearRect",null),ye([xe()],Ee.prototype,"beginPath",null),ye([xe()],Ee.prototype,"moveTo",null),ye([xe()],Ee.prototype,"lineTo",null),ye([xe()],Ee.prototype,"bezierCurveTo",null),ye([xe()],Ee.prototype,"quadraticCurveTo",null),ye([xe()],Ee.prototype,"closePath",null),ye([xe()],Ee.prototype,"arc",null),ye([xe()],Ee.prototype,"arcTo",null),ye([xe()],Ee.prototype,"ellipse",null),ye([xe()],Ee.prototype,"rect",null),ye([xe()],Ee.prototype,"roundRect",null),ye([xe()],Ee.prototype,"createConicGradient",null),ye([xe()],Ee.prototype,"createLinearGradient",null),ye([xe()],Ee.prototype,"createPattern",null),ye([xe()],Ee.prototype,"createRadialGradient",null),ye([xe()],Ee.prototype,"fillText",null),ye([xe()],Ee.prototype,"measureText",null),ye([xe()],Ee.prototype,"strokeText",null);const{copy:Pe,multiplyParent:Se,pixelScale:Be}=q,{round:Te}=Math,ke=new jt,Re=new jt,Ce={width:1,height:1,pixelRatio:1},Le=["width","height","pixelRatio"];class Ae extends Ee{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=Ce),this.manager=e,this.innerId=f.create(f.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||Qt.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;_.copyAttrs(s,t,Le),Le.forEach(t=>s[t]||(s[t]=1)),this.bounds=new jt(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,n=this.worldTransform;e&&Se(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.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:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.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,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,zt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(ke.x,ke.y,ke.width,ke.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,ke.x,ke.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(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ke.x,ke.y,ke.width,ke.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ke.x,ke.y,ke.width,ke.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(ke,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,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,n=this.manager?this.manager.get(i):le.canvas(Object.assign({},i));return n.save(),t&&(Pe(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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){}},Oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Oe),Me={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},Fe={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},We=Object.assign(Object.assign({},Fe),Oe),Ue=Ie,Ne={};for(let t in Ue)Ne[Ue[t]]=t;const ze={};for(let t in Ue)ze[Ue[t]]=Me[t];const Ye={drawRoundRect(t,e,i,s,n,r){const o=D.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;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:Xe,cos:He,hypot:je,atan2:Ve,ceil:Ge,abs:qe,PI:Ke,sqrt:Ze,pow:$e}=Math,{setPoint:Qe,addPoint:Je}=ft,{set:ti,toNumberPoints:ei}=ot,{M:ii,L:si,C:ni,Q:ri,Z:oi}=Ie,ai={},hi={points(t,e,i,s){let n=ei(e);if(t.push(ii,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=o-e,g=a-r,f=Ze($e(p,2)+$e(g,2)),y=Ze($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(ri,d,c,o,a):(p||g)&&t.push(ni,u,_,d,c,o,a),u=o+y*h,_=a+y*l);s||t.push(ri,u,_,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(si,n[e],n[e+1]);s&&t.push(oi)},rect(t,e,i,s,n){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){De.creator.path=[],Ye.drawRoundRect(De.creator,e,i,s,n,r),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,p=o-n;let g=Ve(u,c),f=Ve(p,_);const y=je(c,u),m=je(_,p);let v=f-g;if(v<0&&(v+=M),y<1e-12||m<1e-12||v<1e-12||qe(v-Ke)<1e-12)return t&&t.push(si,s,n),h&&(Qe(h,e,i),Je(h,s,n)),d&&ti(d,e,i),void(l&&ti(l,s,n));const w=c*p-_*u<0,x=w?-1:1,b=a/He(v/2),E=s+b*He(g+v/2+F*x),P=n+b*Xe(g+v/2+F*x);return g-=F*x,f-=F*x,ci(t,E,P,a,a,0,g/I,f/I,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ci(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*I,_=Xe(u),p=He(u);let g=o*I,f=a*I;g>Ke&&(g-=M),f<0&&(f+=M);let y=f-g;y<0?y+=M:y>M&&(y-=M),h&&(y-=M);const m=Ge(qe(y/F)),v=y/m,w=Xe(v/4),x=8/3*w*w/Xe(v/2);f=g+v;let b,E,P,S,B,T,k,R,C=He(g),L=Xe(g),A=P=p*s*C-_*n*L,D=S=_*s*C+p*n*L,O=e+P,W=i+S;t&&t.push(t.length?si:ii,O,W),l&&Qe(l,O,W),c&&ti(c,O,W);for(let r=0;r<m;r++)b=He(f),E=Xe(f),P=p*s*b-_*n*E,S=_*s*b+p*n*E,B=e+A-x*(p*s*L+_*n*C),T=i+D-x*(_*s*L-p*n*C),k=e+P+x*(p*s*E+_*n*b),R=i+S+x*(_*s*E-p*n*b),t&&t.push(ni,B,T,k,R,e+P,i+S),l&&di(e+A,i+D,B,T,k,R,e+P,i+S,l,!0),A=P,D=S,C=b,L=E,g=f,f+=v;d&&ti(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ni,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){di(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,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?Je(h,t,e):Qe(h,t,e),Je(h,o,a);for(let l=0,c=d.length;l<c;l++)li(d[l],t,e,i,s,n,r,o,a,ai),Je(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,n,r,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+_*r+p*a,l.y=c*i+u*n+_*o+p*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return li(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:li,toTwoPointBounds:di,ellipse:ci}=hi,{sin:ui,cos:_i,sqrt:pi,atan2:gi}=Math,{ellipse:fi}=hi,yi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=r*I,p=ui(_),g=_i(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,v=n*n,w=y*y,x=f*f,b=m*v-m*w-v*x;let E=0;if(b<0){const t=pi(1-b/(m*v));s*=t,n*=t}else E=(o===a?-1:1)*pi(b/(m*w+v*x));const P=E*s*y/n,S=-E*n*f/s,B=gi((y-S)/n,(f-P)/s),T=gi((-y-S)/n,(-f-P)/s);let k=T-B;0===a&&k>0?k-=M:1===a&&k<0&&(k+=M);const R=e+c+g*P-p*S,C=i+u+p*P+g*S,L=k<0?1:0;d||Qt.ellipseToCurve?fi(t,R,C,s,n,r,B/I,T/I,L):s!==n||r?t.push(Ie.G,R,C,s,n,r,B/I,T/I,L):t.push(Ie.O,R,C,s,B/I,T/I,L)}},mi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:wi,L:xi,l:bi,H:Ei,h:Pi,V:Si,v:Bi,C:Ti,c:ki,S:Ri,s:Ci,Q:Li,q:Ai,T:Di,t:Oi,A:Ii,a:Mi,Z:Fi,z:Wi,N:Ui,D:Ni,X:zi,G:Yi,F:Xi,O:Hi,P:ji,U:Vi}=Ie,{rect:Gi,roundRect:qi,arcTo:Ki,arc:Zi,ellipse:$i,quadraticCurveTo:Qi}=hi,{ellipticalArc:Ji}=yi,ts=ee.get("PathConvert"),es={},is={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ze[s],a+=s===n?" ":Ne[s];for(let s=1;s<i;s++)a+=D.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?We:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],Kt[s]?("."===s&&(ss.dot&&(ns(o,r),r=""),ss.dot++),"0"===r&&"."!==s&&(ns(o,r),r=""),r+=s):Ie[s]?(r&&(ns(o,r),r=""),ss.name=Ie[s],ss.length=Me[s],ss.index=0,ns(o,ss.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&ns(o,r),r=s):r&&(ns(o,r),r=""),n=s;return r&&ns(o,r),i?is.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){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 Pi:t[c+1]+=a;case Ei:a=t[c+1],_.push(xi,a,h),c+=2;break;case Bi:t[c+1]+=h;case Si:h=t[c+1],_.push(xi,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case xi:a=t[c+1],h=t[c+2],_.push(xi,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ri;case Ri:o=r===Ti||r===Ri,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(Ti,l,d,i,s,a,h),c+=5;break;case ki:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ti;case Ti:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ti,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Oi:t[c+1]+=a,t[c+2]+=h,n=Di;case Di:o=r===Li||r===Di,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Qi(_,a,h,i,s,t[c+1],t[c+2]):_.push(Li,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ai:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:i=t[c+1],s=t[c+2],e?Qi(_,a,h,i,s,t[c+3],t[c+4]):_.push(Li,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Mi:t[c+6]+=a,t[c+7]+=h;case Ii:Ji(_,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 Wi:case Fi:_.push(Fi),c++;break;case Ui:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4]):rs(_,t,c,5),c+=5;break;case Ni:a=t[c+1],h=t[c+2],e?qi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(_,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?qi(_,a,h,t[c+3],t[c+4],t[c+5]):rs(_,t,c,6),c+=6;break;case Yi:$i(e?_:rs(_,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,es),a=es.x,h=es.y,c+=9;break;case Xi:e?$i(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Hi:Zi(e?_:rs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),a=es.x,h=es.y,c+=7;break;case ji:e?Zi(_,t[c+1],t[c+2],t[c+3],0,360,!1):rs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Ki(e?_:rs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),a=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${n} [index:${c}]`,t),_}r=n}return _},objectToCanvasData(t){if(t[0].name.length>1)return mi.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(xi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Li,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ss.index===ss.length&&(ss.index=1,t.push(ss.name)),t.push(Number(e)),ss.index++,ss.dot=0}},{current:ss,pushData:ns,copyData:rs}=is,{M:os,L:as,C:hs,Q:ls,Z:ds,N:cs,D:us,X:_s,G:ps,F:gs,O:fs,P:ys,U:ms}=Ie,{getMinDistanceFrom:vs,getRadianFrom:ws}=ot,{tan:xs,min:bs,abs:Es}=Math,Ps={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(hs,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ls,e,i,s,n)},closePath(t){t.push(ds)},rect(t,e,i,s,n){t.push(cs,e,i,s,n)},roundRect(t,e,i,s,n,r){if(h(r))t.push(_s,e,i,s,n,r);else{const o=D.fourNumber(r);o?t.push(us,e,i,s,n,...o):t.push(cs,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){if(s===n)return Ts(t,e,i,s,a,h,l);r(o)?t.push(gs,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(ps,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(ys,e,i,s):(r(n)&&(n=0),r(o)&&(o=360),t.push(fs,e,i,s,n,o,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=bs(o,bs(t,t*Es(xs(ws(a,h,e,i,s,r)/2))))}t.push(ms,e,i,s,r,o)},drawEllipse(t,e,i,s,n,o,a,h,l){hi.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Ps),t.push(os,Ps.x,Ps.y),Bs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){hi.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Ps),t.push(os,Ps.x,Ps.y),Ts(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){hi.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=Ss,{moveTo:ks,lineTo:Rs,quadraticCurveTo:Cs,bezierCurveTo:Ls,closePath:As,beginPath:Ds,rect:Os,roundRect:Is,ellipse:Ms,arc:Fs,arcTo:Ws,drawEllipse:Us,drawArc:Ns,drawPoints:zs}=Ss;class Ys{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return ks(this.__path,t,e),this.paint(),this}lineTo(t,e){return Rs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ls(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return As(this.__path),this.paint(),this}rect(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Is(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ms(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Ws(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Us(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Ns(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:Hs,C:js,Q:Vs,Z:Gs,N:qs,D:Ks,X:Zs,G:$s,F:Qs,O:Js,P:tn,U:en}=Ie,sn=ee.get("PathDrawer"),nn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js: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 qs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks: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 Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,M,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],0,M,!1),s+=4;break;case en:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sn.error(`command: ${i} [index:${s}]`,e)}}},{M:rn,L:on,C:an,Q:hn,Z:ln,N:dn,D:cn,X:un,G:_n,F:pn,O:gn,P:fn,U:yn}=Ie,{toTwoPointBounds:mn,toTwoPointBoundsByQuadraticCurve:vn,arcTo:wn,arc:xn,ellipse:bn}=hi,{addPointBounds:En,copy:Pn,addPoint:Sn,setPoint:Bn,addBounds:Tn,toBounds:kn}=ft,Rn=ee.get("PathBounds");let Cn,Ln,An;const Dn={},On={},In={},Mn={toBounds(t,e){Mn.toTwoPointBounds(t,On),kn(On,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===ln||o===an||o===hn?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),o){case rn:case on:h=t[a+1],l=t[a+2],Sn(e,h,l),a+=3;break;case an:n=t[a+5],r=t[a+6],mn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Dn),En(e,Dn),h=n,l=r,a+=7;break;case hn:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],vn(h,l,i,s,n,r,Dn),En(e,Dn),h=n,l=r,a+=5;break;case ln:a+=1;break;case dn:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=5;break;case cn:case un:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=o===cn?9:6;break;case _n:bn(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],Dn,In),0===a?Pn(e,Dn):En(e,Dn),h=In.x,l=In.y,a+=9;break;case pn:h=t[a+1],l=t[a+2],Ln=t[a+3],An=t[a+4],Tn(e,h-Ln,l-An,2*Ln,2*An),h+=Ln,a+=5;break;case gn:xn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Dn,In),0===a?Pn(e,Dn):En(e,Dn),h=In.x,l=In.y,a+=7;break;case fn:h=t[a+1],l=t[a+2],Cn=t[a+3],Tn(e,h-Cn,l-Cn,2*Cn,2*Cn),h+=Cn,a+=4;break;case yn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Dn,In),0===a?Pn(e,Dn):En(e,Dn),h=In.x,l=In.y,a+=6;break;default:return void Rn.error(`command: ${o} [index:${a}]`,t)}}},{M:Fn,L:Wn,Z:Un}=Ie,{getCenterX:Nn,getCenterY:zn}=ot,{arcTo:Yn}=Ss,Xn={smooth(t,e,i){let s,n,r,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 Fn:l=p=t[o+1],c=g=t[o+2],o+=3,t[o]===Wn?(u=t[o+1],_=t[o+2],y?m.push(Fn,l,c):m.push(Fn,Nn(l,u),zn(c,_))):m.push(Fn,l,c);break;case Wn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Wn:Yn(m,a,h,t[o+1],t[o+2],e,p,g,y);break;case Un:Yn(m,a,h,l,c,e,p,g,y);break;default:m.push(Wn,a,h)}p=a,g=h;break;case Un:n!==Un&&(Yn(m,l,c,u,_,e,p,g,y),m.push(Un)),o+=1;break;default:r=ze[s];for(let e=0;e<r;e++)m.push(t[o+e]);o+=r}n=s}return s!==Un&&(m[1]=l,m[2]=c),m}};function Hn(t){return new Ys(t)}const jn=Hn();De.creator=Hn(),De.parse=is.parse,De.convertToCanvasData=is.toCanvasData;const{drawRoundRect:Vn}=Ye;function Gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Vn(this,t,e,i,s,n)})}(t)}const qn={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=Kn.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{}}}},Kn=qn;Kn.alphaPixelTypes.forEach(t=>Kn.upperCaseTypeMap[t]=t.toUpperCase());const Zn=ee.get("TaskProcessor");class $n{constructor(t){this.parallel=!0,this.time=1,this.id=f.create(f.TASK),this.task=t}run(){return me(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){Zn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Qn{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&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,r,o,a;const l=new $n(t);return l.parent=this,h(e)?a=e:e&&(r=e.parallel,s=e.start,o=e.time,a=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),n(a)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},a)),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 n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(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 Jn=ee.get("Resource"),tr={tasker:new Qn,map:{},get isComplete(){return er.tasker.isComplete},set(t,e){er.map[t]&&Jn.repeat(t),er.map[t]=e},get:t=>er.map[t],remove(t){const e=er.map[t];e&&(e.destroy&&e.destroy(),delete er.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=le.image(s)),er.set(t,e),e},destroy(){er.map={}}},er=tr,ir={maxRecycled:10,recycledList:[],patternTasker:new Qn({parallel:1}),get(t){let e=tr.get(t.url);return e||tr.set(t.url,e=le.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(Qt.image.isLarge(t)?t.url&&tr.remove(t.url):(t.clearLevels(),sr.recycledList.push(t)))})},recyclePaint(t){sr.recycle(t.image)},clearRecycled(t){const e=sr.recycledList;(e.length>sr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qn.alphaPixelTypes.some(e=>sr.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:"+qn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},sr=ir,{IMAGE:nr,create:rr}=f;class or{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return n(t)?Qt.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rr(nr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ir.isFormat("svg",t)&&(this.isSVG=!0),ir.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tr.tasker.add(()=>me(this,void 0,void 0,function*(){return yield Qt.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,n,r,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=Qt.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=Qt.canvas.createPattern(t,e);return Qt.image.setPatternTransform(n,i,s),n}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 ar(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function hr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function lr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function dr(t,e){return(i,s)=>ur(i,s,t,e&&e(s))}function cr(t){return t}function ur(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ar(t,e,Object.assign(n,s||{})),Nr(t,e,i)}function _r(t){return dr(t)}function pr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function gr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),xr(this))}}))}function yr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function vr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&xr(this)}}))}function wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(xr(this),this.__.__removeNaturalSize())}}))}function xr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function br(t){return dr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),xr(this)}}))}const Er=vr;function Pr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i)&&(Sr(this),e&&(this.__.__useStroke=!0))}}))}function Sr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&xr(t)}const Br=Pr;function Tr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function kr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rr(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Cr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ar(this)}}))}function Lr(t){return dr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Dr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Dr(this,t,e,i),this.mask&&Ar(this)}}))}function Ar(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Dr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||xr(t))}function Or(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ir(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ee.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ur(t){return(e,i)=>{ar(e,"__DataProcessor",{get:()=>t})}}function Nr(t,e,i){const s=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=lr(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(c(i)){const t=u(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:_.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=hr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),ar(s,e,a)}const zr=new ee("rewrite"),Yr=[],Xr=["destroy","constructor"];function Hr(t){return(e,i)=>{Yr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jr(){return t=>{Vr()}}function Vr(t){Yr.length&&(Yr.forEach(e=>{t&&zr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Yr.length=0)}function Gr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Xr.includes(s)||e&&e.includes(s)))if(t.prototype){hr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function qr(){return t=>{ce.register(t)}}function Kr(){return t=>{pe.register(t)}}setTimeout(()=>Vr(!0));const{copy:Zr,toInnerPoint:$r,toOuterPoint:Qr,scaleOfOuter:Jr,rotateOfOuter:to,skewOfOuter:eo,multiplyParent:io,divideParent:so,getLayout:no}=q,ro={},{round:oo}=Math,ao={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),co(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)lo(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++)uo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&uo(t),t.__updateChange()},updateAllChange(t){if(po(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)_o(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,n,r){s||(s=t.__nowWorld),t.__worldFlipped||Qt.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?Qr(t.localTransform,r,r,!0):t.parent&&$r(t.parent.scrollWorldTransform,r,r,!0),ho.moveLocal(t,r.x,r.y,n)},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=oo(e),i=oo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){ho.zoomOfLocal(t,go(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(h(s)||(s&&(r=s),s=i),Zr(ro,o),Jr(ro,e,i,s),ho.hasHighPosition(t))ho.setTransform(t,ro,n,r);else{const e=t.x+ro.e-o.e,a=t.y+ro.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){ho.rotateOfLocal(t,go(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Zr(ro,n),to(ro,e,i),ho.hasHighPosition(t)?ho.setTransform(t,ro,!1,s):t.set({x:t.x+ro.e-n.e,y:t.y+ro.f-n.f,rotation:D.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){ho.skewOfLocal(t,go(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Zr(ro,t.__localMatrix),eo(ro,e,i,s),ho.setTransform(t,ro,n,r)},transformWorld(t,e,i,s){Zr(ro,t.worldTransform),io(ro,e),t.parent&&so(ro,t.parent.scrollWorldTransform),ho.setTransform(t,ro,i,s)},transform(t,e,i,s){Zr(ro,t.localTransform),io(ro,e),ho.setTransform(t,ro,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&ho.getInnerOrigin(t,n.origin),o=no(e,r,n.around&&ho.getInnerOrigin(t,n.around));if(ho.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){zt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ho.getInnerOrigin(t,n.origin);ot.move(o,r.x-s.x,r.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 Jr(i,ho.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(ho.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return xt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zr(ro,t.worldTransform),so(ro,e.scrollWorldTransform),i?ro:Object.assign({},ro)),drop(t,e,i,s){t.setTransform(ho.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ho.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,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),Qt.requestRender(()=>ho.animateMove(t,e,i))}}},ho=ao,{updateAllMatrix:lo,updateMatrix:co,updateAllWorldOpacity:uo,updateAllChange:_o,updateChange:po}=ho;function go(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const fo={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)=>mo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>mo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>mo(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 yo;function mo(t,e){return e||(yo=0),t.__.mask&&(yo=1),yo<0?null:(yo&&(yo=-1),!0)}const{updateBounds:vo}=ao,wo={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,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),xo(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++)bo(e[t],e)},updateBounds(t,e){const i=[t];bo(t,i),Eo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)vo(s[t]);e&&e===i||vo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Po(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&So(t,e,i,s,n,r,o)}},{pushAllChildBranch:xo,pushAllBranchStack:bo,updateBoundsByBranchStack:Eo,move:Po,scale:So}=wo,Bo={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:To,updateBounds:ko}=ao,{toOuterOf:Ro,getPoints:Co,copy:Lo}=zt,Ao="_localContentBounds",Do="_worldContentBounds",Oo="_worldBoxBounds",Io="_worldStrokeBounds";class Mo{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 Ro(this.contentBounds,this.leaf.__localMatrix,this[Ao]||(this[Ao]={})),this[Ao]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ro(this.contentBounds,this.leaf.__world,this[Do]||(this[Do]={})),this[Do]}get worldBoxBounds(){return Ro(this.boxBounds,this.leaf.__world,this[Oo]||(this[Oo]={})),this[Oo]}get worldStrokeBounds(){return Ro(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 ko(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,Qt.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 To(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 jt(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 n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=To(s,e,!0)}if(o||(o=q.getLayout(r)),Lo(o,a),ot.copy(o,n),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=Co(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 Fo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&Qt.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&Qt.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&Qt.event.stop(this.origin)}}class Wo extends Fo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Wo.ADD="child.add",Wo.REMOVE="child.remove",Wo.CREATED="created",Wo.MOUNTED="mounted",Wo.UNMOUNTED="unmounted",Wo.DESTROY="destroy";const Uo="property.scroll";class No extends Fo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}No.CHANGE="property.change",No.LEAFER_CHANGE="property.leafer_change",No.SCROLL=Uo;const zo={scrollX:Uo,scrollY:Uo};class Yo extends Fo{constructor(t,e){super(t),Object.assign(this,e)}}Yo.LOAD="image.load",Yo.LOADED="image.loaded",Yo.ERROR="image.error";class Xo extends Fo{static checkHas(t,e,i){"on"===i?e===Go?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ho)||t.hasEvent(jo)||t.hasEvent(Vo),t.__hasWorldEvent=t.hasEvent(Go))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ho,t),"inner"===e&&t.emit(jo,t)),t.emit(Vo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Go,this)}}Xo.RESIZE="bounds.resize",Xo.INNER="bounds.inner",Xo.LOCAL="bounds.local",Xo.WORLD="bounds.world";const{RESIZE:Ho,INNER:jo,LOCAL:Vo,WORLD:Go}=Xo,qo={};[Ho,jo,Vo,Go].forEach(t=>qo[t]=1);class Ko extends Fo{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(Ko.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Ko.RESIZE="resize";class Zo extends Fo{constructor(t,e){super(t),this.data=e}}Zo.REQUEST="watch.request",Zo.DATA="watch.data";class $o extends Fo{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 Qo extends Fo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Qo.REQUEST="render.request",Qo.CHILD_START="render.child_start",Qo.CHILD_END="render.child_end",Qo.START="render.start",Qo.BEFORE="render.before",Qo.RENDER="render",Qo.AFTER="render.after",Qo.AGAIN="render.again",Qo.END="render.end",Qo.NEXT="render.next";class Jo extends Fo{}Jo.START="leafer.start",Jo.BEFORE_READY="leafer.before_ready",Jo.READY="leafer.ready",Jo.AFTER_READY="leafer.after_ready",Jo.VIEW_READY="leafer.view_ready",Jo.VIEW_COMPLETED="leafer.view_completed",Jo.STOP="leafer.stop",Jo.RESTART="leafer.restart",Jo.END="leafer.end",Jo.UPDATE_MODE="leafer.update_mode",Jo.TRANSFORM="leafer.transform",Jo.MOVE="leafer.move",Jo.SCALE="leafer.scale",Jo.ROTATE="leafer.rotate",Jo.SKEW="leafer.skew";const{MOVE:ta,SCALE:ea,ROTATE:ia,SKEW:sa}=Jo,na={x:ta,y:ta,scaleX:ea,scaleY:ea,rotation:ia,skewX:sa,skewY:sa},ra={};class oa{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,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=aa(this,s,!0),h=o(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):a[t]=[l],qo[t]&&Xo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=aa(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],qo[t]&&Xo.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&&pe.has(t)&&(e=pe.get(t,{type:t,target:this,current:this}));const s=aa(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}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 aa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ra)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ra)}}const{on:ha,on_:la,off:da,off_:ca,once:ua,emit:_a,emitEvent:pa,hasEvent:ga,destroy:fa}=oa.prototype,ya={on:ha,on_:la,off:da,off_:ca,once:ua,emit:_a,emitEvent:pa,hasEvent:ga,destroyEventer:fa},ma=ee.get("setAttr"),va={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||a(e)||n(e)||(ma.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new No(No.LEAFER_CHANGE,this,t,s,e));const i=na[t];i&&(this.emitEvent(new Jo(i,this)),this.emitEvent(new Jo(Jo.TRANSFORM,this)))}this.emitPropertyEvent(No.CHANGE,t,s,e);const i=zo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new No(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__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:wa,multiplyParent:xa,translateInner:ba,defaultWorld:Ea}=q,{toPoint:Pa,tempPoint:Sa}=xt,Ba={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;xa(this.__local||e,t?t.__scrollWorld||t.__world:Ea,i,!!e.affectScaleOrRotation,n),s&&ba(Object.assign(s,i),n.scrollX,n.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)&&(wa(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,Sa),ba(e,-Sa.x,-Sa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ta,updateAllMatrix:ka}=ao,{updateBounds:Ra}=wo,{toOuterOf:Ca,copyAndSpread:La,copy:Aa}=zt,{toBounds:Da}=Mn,Oa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Xo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Xo.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(),Ca(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ca(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ca(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Da(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(),ka(this),Ra(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ka(this),Ra(this,this))):Ta(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;La(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?Aa(e.renderBounds,e.strokeBounds):La(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),ao.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ee.showBounds&&ee.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:Ma}=fo,{hasSize:Fa}=zt,Wa={__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&&Fa(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 n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.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,n=i.length;s<n;s++)Ma(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ma(i[s],e)||i[s].__clip(t,e)}}},Ua={},{LEAF:Na,create:za}=f,{stintSet:Ya}=_,{toInnerPoint:Xa,toOuterPoint:Ha,multiplyParent:ja}=q,{toOuterOf:Va}=zt,{copy:Ga,move:qa}=ot,{moveLocal:Ka,zoomOfLocal:Za,rotateOfLocal:$a,skewOfLocal:Qa,moveWorld:Ja,zoomOfWorld:th,rotateOfWorld:eh,skewOfWorld:ih,transform:sh,transformWorld:nh,setTransform:rh,getFlipTransform:oh,getLocalOrigin:ah,getRelativeWorld:hh,drop:lh}=ao;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return Mo}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=za(Na),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Wo.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(Wo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Wo.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(Wo.MOUNTED)):this.__emitLifeEvent(Wo.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 ja(i,t.matrix,e,void 0,i),Va(this.__layout.renderBounds,e,e),Ya(e,"half",i.half),Ya(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}=ir.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),Ua.scaleX=i,Ua.scaleY=s,Ua}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?hh(this,e):this.worldTransform,n=i?t:{};return Va(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Xa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ha(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 n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}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 n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){rh(this,t,e,i)}transform(t,e,i){sh(this,t,e,i)}move(t,e,i){Ka(this,t,e,i)}moveInner(t,e,i){Ja(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Za(this,ah(this,t),e,i,s,n)}rotateOf(t,e,i){$a(this,ah(this,t),e,i)}skewOf(t,e,i,s,n){Qa(this,ah(this,t),e,i,s,n)}transformWorld(t,e,i){nh(this,t,e,i)}moveWorld(t,e,i){Ja(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}rotateOfWorld(t,e){eh(this,t,e)}skewOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}flip(t,e){sh(this,oh(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 he.need("path")}getMotionPoint(t){return he.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){lh(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):Nr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=vr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Wo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Wo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ye([Gr(va),Gr(Ba),Gr(Oa),Gr(ya),Gr(Ia)],t.Leaf);const{setListWithFn:dh}=zt,{sort:ch}=wo,{localBoxBounds:uh,localStrokeBounds:_h,localRenderBounds:ph,maskLocalBoxBounds:gh,maskLocalStrokeBounds:fh,maskLocalRenderBounds:yh}=fo,mh=new ee("Branch");t.Branch=class extends t.Leaf{__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){dh(e||this.__layout.boxBounds,this.children,this.__hasMask?gh:uh)}__updateStrokeBounds(t){dh(t||this.__layout.strokeBounds,this.children,this.__hasMask?fh:_h)}__updateRenderBounds(t){dh(t||this.__layout.renderBounds,this.children,this.__hasMask?yh:ph)}__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(ch),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return mh.warn("add self or destroyed");const i=n(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ce.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 s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Wo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Wo.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(Wo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Wo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Wo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=ye([Gr(Wa)],t.Branch);class vh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(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,n=s.length;t<n;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 vh;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 wh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(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 xh=ee.get("LeaferCanvas");class bh extends Ae{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}Qt.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=o(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else xh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),xh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),Qt.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=Qt.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:Qt.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};_.copyAttrs(e,this,Le),this.resize(t),this.resizeListener&&!n(this.width)&&this.resizeListener(new Ko(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}Gn(CanvasRenderingContext2D.prototype),Gn(Path2D.prototype);const{mineType:Eh,fileType:Ph}=qn;function Sh(t,e){Qt.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=Eh(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,Eh(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(Eh(Ph(e)),i);return Qt.origin.download(s,e)},download:(t,e)=>new Promise(i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()}),loadImage:t=>new Promise((e,i)=>{const s=new Qt.origin.Image,{crossOrigin:n}=Qt.image;n&&(s.setAttribute("crossOrigin",n),s.crossOrigin=n),s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=Qt.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},Qt.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},Qt.canvas=le.canvas(),Qt.conicGradientSupport=!!Qt.canvas.context.createConicGradient}Object.assign(le,{canvas:(t,e)=>new bh(t,e),image:t=>new or(t)}),Qt.name="web",Qt.isMobile="ontouchstart"in window,Qt.requestRender=function(t){window.requestAnimationFrame(t)},ar(Qt,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Bh}=navigator;Bh.indexOf("Firefox")>-1?(Qt.conicGradientRotate90=!0,Qt.intWheelDeltaY=!0,Qt.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(Qt.fullImageShadow=!0),Bh.indexOf("Windows")>-1?(Qt.os="Windows",Qt.intWheelDeltaY=!0):Bh.indexOf("Mac")>-1?Qt.os="Mac":Bh.indexOf("Linux")>-1&&(Qt.os="Linux");class Th{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new vh;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 vh,this.target=t,e&&(this.config=_.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(Qo.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Wo.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 vh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[No.CHANGE,this.__onAttrChange,this],[[Wo.ADD,Wo.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:kh,updateBounds:Rh,updateChange:Ch}=ao,{pushAllChildBranch:Lh,pushAllParent:Ah}=wo;const{worldBounds:Dh}=fo;class Oh{constructor(t){this.updatedBounds=new jt,this.beforeBounds=new jt,this.afterBounds=new jt,d(t)&&(t=new vh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Dh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Ih,updateAllChange:Mh}=ao,Fh=ee.get("Layouter");class Wh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new wh,this.target=t,e&&(this.config=_.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){Fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Fh.warn("layouting"):this.times>3?Fh.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=re.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=$o,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new $o(n,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?(kh(t,!0),e.add(t),t.isBranch&&Lh(t,e),Ah(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ah(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;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||Rh(s[t])}Rh(i)}})}(this.__levelList),function(t){t.list.forEach(Ch)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new $o(r,a,this.times)),i.emitEvent(new $o(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,re.end(e)}fullLayout(){const t=re.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=$o,r=this.getBlocks(new vh(e));e.emitEvent(new $o(i,r,this.times)),Wh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new $o(s,r,this.times)),e.emitEvent(new $o(n,r,this.times)),this.addBlocks(r),re.end(t)}static fullLayout(t){Ih(t,!0),t.isBranch?wo.updateBounds(t):ao.updateBounds(t),Mh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Oh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Oh(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 Uh=ee.get("Renderer");class Nh{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=_.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(Qo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Qo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Qo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new jt,Uh.log(e.innerName,"---\x3e");try{this.emitRender(Qo.START),this.renderOnce(t),this.emitRender(Qo.END,this.totalBounds),ir.clearRecycled()}catch(t){this.rendering=!1,Uh.error(t)}Uh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Uh.warn("rendering");if(this.times>3)return Uh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new jt,this.renderOptions={},t)this.emitRender(Qo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Qo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Qo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Qo.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=re.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new jt(s);i.save(),s.spread(Nh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),re.end(e)}fullRender(){const t=re.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),re.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ee.showRepaint&&ee.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),Qt.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,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 jt;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 Qt.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()};Qt.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new jt(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 jt(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||Uh.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 Qo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Qo.REQUEST,this.update,this],[$o.END,this.__onLayoutEnd,this],[Qo.AGAIN,this.renderAgain,this],[Ko.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Nh.clipSpread=10;const zh={},{copyRadiusPoint:Yh}=ot,{hitRadiusPoint:Xh}=zt;class Hh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new vh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?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 n=this.findList=new vh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||ao.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ao.hasParent(t,e))){n.reset();break}return n.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),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>ao.worldHittable(t))}getPath(t){const e=new vh,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 vh;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 vh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=Xh(i.__world,n.hitRadius?Yh(zh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}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,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.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 jh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Hh(this.target=t,this),this.finder=le.finder&&le.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return Qt.backgrounder&&s&&s.updateLayout(),n.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):he.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Vh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Gh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function qh(){return(t,e)=>{const i="_"+e;ar(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}})}}Object.assign(le,{watcher:(t,e)=>new Th(t,e),layouter:(t,e)=>new Wh(t,e),renderer:(t,e,i)=>new Nh(t,e,i),selector:(t,e)=>new jh(t,e)}),Qt.layout=Wh.fullLayout,Qt.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new vh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Kh={},Zh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},$h=qt,Qh={},Jh={},tl={},el={},il={},sl={apply(){he.need("filter")}},nl={},rl={setStyleName:()=>he.need("state"),set:()=>he.need("state")},ol={list:{},register(t,e){ol.list[t]=e},get:t=>ol.list[t]},{parse:al,objectToCanvasData:hl}=is,{stintSet:ll}=_,{hasTransparent:dl}=Zh,cl={originPaint:{}},ul=ee.get("UIData");class _l extends g{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,ul.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ul.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(ll(this,"__isTransparentFill",dl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(ll(this,"__isTransparentStroke",dl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?al(t):hl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){pl(this,"shadow",t)}setInnerShadow(t){pl(this,"innerShadow",t)}setFilter(t){pl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Jh.compute("fill",this.__leaf),e&&Jh.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(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=cl)):(this.__isStrokes=!0,this._stroke||(this._stroke=cl))}__removePaint(t,e){e&&this.__removeInput(t),tl.recycleImage(t,this),"fill"===t?(ll(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ll(this,"__isAlphaPixelStroke",void 0),ll(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function pl(t,e,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 gl extends _l{}class fl extends gl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class yl extends gl{__getInputData(t,e){const i=super.__getInputData(t,e);return Le.forEach(t=>delete i[t]),i}}class ml extends fl{}class vl extends _l{get __usePathBox(){return this.points||this.__pathInputed}}class wl extends _l{get __boxStroke(){return!this.__pathInputed}}class xl extends _l{get __boxStroke(){return!this.__pathInputed}}class bl extends vl{}class El extends _l{}class Pl extends _l{get __pathInputed(){return 2}}class Sl extends gl{}const Bl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Tl extends _l{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=Bl[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=ce.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.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 kl extends wl{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 Rl extends wl{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:Cl,add:Ll}=E,Al={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Cl(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=il.getShadowRenderSpread(this,e)),s&&(t=Cl(t,s)),r&&(t=Ll(t,sl.getSpread(r))),o&&(t=Ll(t,o)),a&&(t=Ll(t,a));let l=t;return i&&(l=Cl(l,il.getInnerShadowSpread(this,i))),n&&(l=Cl(l,n)),this.__layout.renderShapeSpread=l,h?Cl(h.__updateRenderSpread(),t):t}},{stintSet:Dl}=_,Ol={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Dl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Dl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Dl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!il.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Dl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Il(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Jh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&il.shadow(this,t,h),a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),n&&(s.__isFills?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&il.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),c&&sl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Zh.string(e.color))}n&&(s.__isFills?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Jh.strokes(r,this,t,e):Jh.stroke(r,this,t,e))}}else s.__pathForRender?Il(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Jh.fills(s,this,t,e):Jh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Jh.strokes(n,this,t,e):Jh.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 Il(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Jh.stroke(n,t,e,i),s&&Jh.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&Jh.stroke(n,t,e,i)}const Ml={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),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,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Fl,Wl;t.UI=Fl=class extends t.Leaf{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 jn.set(this.path=t||[]),t||this.__drawPathByBox(jn),jn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return he.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return he.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?is.toCanvasData(i,!0):i}getPathString(t,e,i){return is.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||nl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Xn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Qh.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?nn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,h(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){Jh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),he.need("animate")}killAnimate(t,e){}export(t,e){return he.need("export")}syncExport(t,e){return he.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Fl.one(e)}static one(t,e,i,s,n){return ce.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){qr()(this)}static registerData(t){Ur(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ye([Ur(_l)],t.UI.prototype,"__",void 0),ye([qh()],t.UI.prototype,"zoomLayer",void 0),ye([_r("")],t.UI.prototype,"id",void 0),ye([_r("")],t.UI.prototype,"name",void 0),ye([_r("")],t.UI.prototype,"className",void 0),ye([kr("pass-through")],t.UI.prototype,"blendMode",void 0),ye([Cr(1)],t.UI.prototype,"opacity",void 0),ye([Lr(!0)],t.UI.prototype,"visible",void 0),ye([kr(!1)],t.UI.prototype,"locked",void 0),ye([Rr(!1)],t.UI.prototype,"dim",void 0),ye([Rr(!1)],t.UI.prototype,"dimskip",void 0),ye([Or(0)],t.UI.prototype,"zIndex",void 0),ye([Ir(!1)],t.UI.prototype,"mask",void 0),ye([Mr(!1)],t.UI.prototype,"eraser",void 0),ye([pr(0,!0)],t.UI.prototype,"x",void 0),ye([pr(0,!0)],t.UI.prototype,"y",void 0),ye([vr(100,!0)],t.UI.prototype,"width",void 0),ye([vr(100,!0)],t.UI.prototype,"height",void 0),ye([yr(1,!0)],t.UI.prototype,"scaleX",void 0),ye([yr(1,!0)],t.UI.prototype,"scaleY",void 0),ye([mr(0,!0)],t.UI.prototype,"rotation",void 0),ye([mr(0,!0)],t.UI.prototype,"skewX",void 0),ye([mr(0,!0)],t.UI.prototype,"skewY",void 0),ye([pr(0,!0)],t.UI.prototype,"offsetX",void 0),ye([pr(0,!0)],t.UI.prototype,"offsetY",void 0),ye([gr(0,!0)],t.UI.prototype,"scrollX",void 0),ye([gr(0,!0)],t.UI.prototype,"scrollY",void 0),ye([fr()],t.UI.prototype,"origin",void 0),ye([fr()],t.UI.prototype,"around",void 0),ye([_r(!1)],t.UI.prototype,"lazy",void 0),ye([wr(1)],t.UI.prototype,"pixelRatio",void 0),ye([Tr(0)],t.UI.prototype,"renderSpread",void 0),ye([br()],t.UI.prototype,"path",void 0),ye([Er()],t.UI.prototype,"windingRule",void 0),ye([Er(!0)],t.UI.prototype,"closed",void 0),ye([vr(0)],t.UI.prototype,"padding",void 0),ye([vr(!1)],t.UI.prototype,"lockRatio",void 0),ye([vr()],t.UI.prototype,"widthRange",void 0),ye([vr()],t.UI.prototype,"heightRange",void 0),ye([_r(!1)],t.UI.prototype,"draggable",void 0),ye([_r()],t.UI.prototype,"dragBounds",void 0),ye([_r("auto")],t.UI.prototype,"dragBoundsType",void 0),ye([_r(!1)],t.UI.prototype,"editable",void 0),ye([Fr(!0)],t.UI.prototype,"hittable",void 0),ye([Fr("path")],t.UI.prototype,"hitFill",void 0),ye([Br("path")],t.UI.prototype,"hitStroke",void 0),ye([Fr(!1)],t.UI.prototype,"hitBox",void 0),ye([Fr(!0)],t.UI.prototype,"hitChildren",void 0),ye([Fr(!0)],t.UI.prototype,"hitSelf",void 0),ye([Fr()],t.UI.prototype,"hitRadius",void 0),ye([Wr("")],t.UI.prototype,"cursor",void 0),ye([kr()],t.UI.prototype,"fill",void 0),ye([Br(void 0,!0)],t.UI.prototype,"stroke",void 0),ye([Br("inside")],t.UI.prototype,"strokeAlign",void 0),ye([Br(1,!0)],t.UI.prototype,"strokeWidth",void 0),ye([Br(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ye([Br("none")],t.UI.prototype,"strokeCap",void 0),ye([Br("miter")],t.UI.prototype,"strokeJoin",void 0),ye([Br()],t.UI.prototype,"dashPattern",void 0),ye([Br(0)],t.UI.prototype,"dashOffset",void 0),ye([Br(10)],t.UI.prototype,"miterLimit",void 0),ye([Er(0)],t.UI.prototype,"cornerRadius",void 0),ye([Er()],t.UI.prototype,"cornerSmoothing",void 0),ye([Vh()],t.UI.prototype,"shadow",void 0),ye([Vh()],t.UI.prototype,"innerShadow",void 0),ye([Vh()],t.UI.prototype,"blur",void 0),ye([Vh()],t.UI.prototype,"backgroundBlur",void 0),ye([Vh()],t.UI.prototype,"grayscale",void 0),ye([Vh()],t.UI.prototype,"filter",void 0),ye([kr()],t.UI.prototype,"placeholderColor",void 0),ye([_r(100)],t.UI.prototype,"placeholderDelay",void 0),ye([_r({})],t.UI.prototype,"data",void 0),ye([Hr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Fl=ye([Gr(Al),Gr(Ol),jr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children: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(){}},ye([Ur(gl)],t.Group.prototype,"__",void 0),ye([vr(0)],t.Group.prototype,"width",void 0),ye([vr(0)],t.Group.prototype,"height",void 0),t.Group=ye([Gr(t.Branch),qr()],t.Group);const Ul=ee.get("Leafer");t.Leafer=Wl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tr.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),Wl.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,_.assign(s,t));const n=this.canvas=le.canvas(s);this.__controllers.push(this.renderer=le.renderer(this,n,s),this.watcher=le.watcher(this,s),this.layouter=le.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=le.selector(this),this.interaction=le.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=le.hitCanvasManager()),this.canvasManager=new fe,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Bo.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(Jo.RESTART):this.emitLeafer(Jo.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(Jo.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Le);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new jt(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=_.copyAttrs({},this.canvas,Le);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ko(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Le),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&&(Le.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(Jo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Le.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=_.copyAttrs({},s,Le);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(Jo.BEFORE_READY),this.emitLeafer(Jo.READY),this.emitLeafer(Jo.AFTER_READY),Bo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Jo.VIEW_READY),Bo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Bo.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(Jo.VIEW_COMPLETED),Bo.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 he.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 Jo(t,this))}__listenEvents(){const t=re.start("FirstCreate "+this.innerName);this.once([[Jo.START,()=>re.end(t)],[$o.START,this.updateLazyBounds,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Zo.DATA,this.__onWatchData,this],[$o.END,this.__onLayoutEnd,this],[Qo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Wl.list.remove(this);try{this.stop(),this.emitLeafer(Jo.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(()=>{ir.clearRecycled()},100)}catch(t){Ul.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new vh,ye([Ur(yl)],t.Leafer.prototype,"__",void 0),ye([vr()],t.Leafer.prototype,"pixelRatio",void 0),ye([_r("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Wl=ye([qr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ye([Ur(wl)],t.Rect.prototype,"__",void 0),t.Rect=ye([Gr(Ml),jr(),qr()],t.Rect);const{add:Nl,includes:zl,scroll:Yl}=zt,Xl=t.Rect.prototype,Hl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=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"))&&(Nl(a,r),Yl(a,i)),this.__updateRectRenderBounds(),t=!zl(r,a),t&&"show"===o&&Nl(n,a)}else this.__updateRectRenderBounds();_.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))}},ye([Ur(fl)],t.Box.prototype,"__",void 0),ye([vr(100)],t.Box.prototype,"width",void 0),ye([vr(100)],t.Box.prototype,"height",void 0),ye([_r(!1)],t.Box.prototype,"resizeChildren",void 0),ye([Tr("show")],t.Box.prototype,"overflow",void 0),ye([Hr(Xl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ye([Hr(Xl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ye([Hr(Xl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ye([Hr(Xl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ye([Hr(Xl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ye([Hr(Xl.__updateChange)],t.Box.prototype,"__updateRectChange",null),ye([Hr(Xl.__render)],t.Box.prototype,"__renderRect",null),ye([Hr(Hl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ye([jr(),qr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ye([Ur(ml)],t.Frame.prototype,"__",void 0),ye([kr("#FFFFFF")],t.Frame.prototype,"fill",void 0),ye([Tr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ye([qr()],t.Frame);const{moveTo:jl,closePath:Vl,ellipse:Gl}=Ss;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h;i?s||n?(i<1?Gl(a,r,o,r*i,o*i,0,s,n,!1):h=!0,Gl(a,r,o,r,o,0,n,s,!0)):(i<1&&(Gl(a,r,o,r*i,o*i),jl(a,t,o)),Gl(a,r,o,r,o,0,360,0,!0)):s||n?(jl(a,r,o),Gl(a,r,o,r,o,0,s,n,!1)):Gl(a,r,o,r,o),h||Vl(a),Qt.ellipseToCurve&&(this.__.path=this.getPath(!0))}},ye([Ur(xl)],t.Ellipse.prototype,"__",void 0),ye([Er(0)],t.Ellipse.prototype,"innerRadius",void 0),ye([Er(0)],t.Ellipse.prototype,"startAngle",void 0),ye([Er(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ye([qr()],t.Ellipse);const{sin:ql,cos:Kl,PI:Zl}=Math,{moveTo:$l,lineTo:Ql,closePath:Jl,drawPoints:td}=Ss;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)td(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;$l(e,r,0);for(let t=1;t<n;t++)Ql(e,r+r*ql(2*t*Zl/n),o-o*Kl(2*t*Zl/n));Jl(e)}}},ye([Ur(bl)],t.Polygon.prototype,"__",void 0),ye([Er(3)],t.Polygon.prototype,"sides",void 0),ye([Er()],t.Polygon.prototype,"points",void 0),ye([Er(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ye([jr(),qr()],t.Polygon);const{sin:ed,cos:id,PI:sd}=Math,{moveTo:nd,lineTo:rd,closePath:od}=Ss;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];nd(o,n,0);for(let t=1;t<2*i;t++)rd(o,n+(t%2==0?n:n*s)*ed(t*sd/i),r-(t%2==0?r:r*s)*id(t*sd/i));od(o)}},ye([Ur(El)],t.Star.prototype,"__",void 0),ye([Er(5)],t.Star.prototype,"corners",void 0),ye([Er(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ye([qr()],t.Star);const{moveTo:ad,lineTo:hd,drawPoints:ld}=Ss,{rotate:dd,getAngle:cd,getDistance:ud,defaultPoint:_d}=ot;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&dd(i,e),i}set toPoint(t){this.width=ud(_d,t),this.rotation=cd(_d,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ld(e,t.points,t.curve,t.closed):(ad(e,0,0),hd(e,this.width,0))}},ye([Ur(vl)],t.Line.prototype,"__",void 0),ye([Pr("center")],t.Line.prototype,"strokeAlign",void 0),ye([vr(0)],t.Line.prototype,"height",void 0),ye([Er()],t.Line.prototype,"points",void 0),ye([Er(0)],t.Line.prototype,"curve",void 0),ye([Er(!1)],t.Line.prototype,"closed",void 0),t.Line=ye([qr()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},ye([Ur(kl)],t.Image.prototype,"__",void 0),ye([vr("")],t.Image.prototype,"url",void 0),t.Image=ye([qr()],t.Image);const pd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=le.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new or({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Yo(Yo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new pt(t.worldTransform).invert(),r=new pt;e&&r.translate(e.x,e.y),i&&(h(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.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()}},ye([Ur(Rl)],t.Canvas.prototype,"__",void 0),ye([Gh(100)],t.Canvas.prototype,"width",void 0),ye([Gh(100)],t.Canvas.prototype,"height",void 0),ye([Gh(1)],t.Canvas.prototype,"pixelRatio",void 0),ye([Gh(!0)],t.Canvas.prototype,"smooth",void 0),ye([_r(!1)],t.Canvas.prototype,"safeResize",void 0),ye([Gh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ye([qr()],t.Canvas);const{copyAndSpread:gd,includes:fd,spread:yd,setList:md}=zt,{stintSet:vd}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=$h.number(e,n),t.__letterSpacing=$h.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,vd(t,"__padding",l&&D.fourNumber(l)),vd(t,"__clipText","show"!==h&&!t.__autoSize),vd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Kh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&yd(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!fd(h,a)),this.isOverflow?(md(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;gd(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()}},ye([Ur(Tl)],t.Text.prototype,"__",void 0),ye([vr(0)],t.Text.prototype,"width",void 0),ye([vr(0)],t.Text.prototype,"height",void 0),ye([kr()],t.Text.prototype,"boxStyle",void 0),ye([_r(!1)],t.Text.prototype,"resizeFontSize",void 0),ye([kr("#000000")],t.Text.prototype,"fill",void 0),ye([Pr("outside")],t.Text.prototype,"strokeAlign",void 0),ye([Fr("all")],t.Text.prototype,"hitFill",void 0),ye([vr("")],t.Text.prototype,"text",void 0),ye([vr("")],t.Text.prototype,"placeholder",void 0),ye([vr("caption")],t.Text.prototype,"fontFamily",void 0),ye([vr(12)],t.Text.prototype,"fontSize",void 0),ye([vr("normal")],t.Text.prototype,"fontWeight",void 0),ye([vr(!1)],t.Text.prototype,"italic",void 0),ye([vr("none")],t.Text.prototype,"textCase",void 0),ye([vr("none")],t.Text.prototype,"textDecoration",void 0),ye([vr(0)],t.Text.prototype,"letterSpacing",void 0),ye([vr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ye([vr(0)],t.Text.prototype,"paraIndent",void 0),ye([vr(0)],t.Text.prototype,"paraSpacing",void 0),ye([vr("x")],t.Text.prototype,"writingMode",void 0),ye([vr("left")],t.Text.prototype,"textAlign",void 0),ye([vr("top")],t.Text.prototype,"verticalAlign",void 0),ye([vr(!0)],t.Text.prototype,"autoSizeAlign",void 0),ye([vr("normal")],t.Text.prototype,"textWrap",void 0),ye([vr("show")],t.Text.prototype,"textOverflow",void 0),ye([kr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ye([qr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ye([Ur(Pl)],t.Path.prototype,"__",void 0),ye([Pr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ye([qr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ye([Ur(Sl)],t.Pen.prototype,"__",void 0),ye([(t,e)=>{ar(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ye([Gr(Ys,["set","path","paint"]),qr()],t.Pen),t.App=class extends t.Leafer{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:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&le.editor(n,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(e){const i=new t.Leafer(e);return this.add(i),i}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&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Le),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[$o.END,this.__onReady,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Qo.END,this.__onChildRenderEnd,this))}},t.App=ye([qr()],t.App);const wd={},xd={isHoldSpaceKey:()=>xd.isHold("Space"),isHold:t=>wd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){wd[t]||(wd[t]=!0)},setUpCode(t){wd[t]=!1}},bd={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 Ed extends Fo{get spaceKey(){return xd.isHoldSpaceKey()}get left(){return bd.left(this)}get right(){return bd.right(this)}get middle(){return bd.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){pe.changeName(t,e)}}const{min:Pd,max:Sd,abs:Bd}=Math,{float:Td,sign:kd}=D,{minX:Rd,maxX:Cd,minY:Ld,maxY:Ad}=zt,Dd=new jt,Od=new jt,Id={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Md.getValidMove(t.__localBoxBounds,Md.getDragBounds(t),s,e,!0),Md.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Md.getValidScaleOf(t.__localBoxBounds,Md.getDragBounds(t),r,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,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Md.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),Md.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=Td(s.x),s.y=Td(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Od.set(e),Dd.set(t).scaleOf(s,n.x,n.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 Md.isInnerMode(t,e,i,"width")?(n.x<0&&Dd.scaleOf(s,f=1/n.x,1),p=Td(Dd.minX-Od.minX),g=Td(Od.maxX-Dd.maxX),u=h&&p>0?1+p/(h*Dd.width):1,_=l&&g>0?1+g/(l*Dd.width):1,f*=Sd(u,_)):(n.x<0&&((Td(Rd(t)-Rd(e))<=0||Td(Cd(e)-Cd(t))<=0)&&Dd.scaleOf(s,f=1/n.x,1),Dd.unsign()),p=Td(Od.minX-Dd.minX),g=Td(Dd.maxX-Od.maxX),u=h&&p>0?1-p/(h*Dd.width):1,_=l&&g>0?1-g/(l*Dd.width):1,f*=Pd(u,_)),Md.isInnerMode(t,e,i,"height")?(n.y<0&&Dd.scaleOf(s,1,y=1/n.y),p=Td(Dd.minY-Od.minY),g=Td(Od.maxY-Dd.maxY),u=d&&p>0?1+p/(d*Dd.height):1,_=c&&g>0?1+g/(c*Dd.height):1,y*=Sd(u,_),r&&(u=Sd(Bd(f),Bd(y)),f=kd(f)*u,y=kd(y)*u)):(n.y<0&&((Td(Ld(t)-Ld(e))<=0||Td(Ad(e)-Ad(t))<=0)&&Dd.scaleOf(s,1,y=1/n.y),Dd.unsign()),p=Td(Od.minY-Dd.minY),g=Td(Dd.maxY-Od.maxY),u=d&&p>0?1-p/(d*Dd.height):1,_=c&&g>0?1-g/(c*Dd.height):1,y*=Pd(u,_)),n.x*=a(f)?f:1,n.y*=a(y)?y:1,n}},Md=Id;t.PointerEvent=class extends Ed{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=ye([Kr()],t.PointerEvent);const Fd=t.PointerEvent,Wd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof vh?t:new vh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ot.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Id.axisMove(t,n),n}static limitMove(t,e){Id.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Wd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Wd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Wd,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 zt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),zt.unsign(i),i}assignMove(t){Wd.x=t?this.totalX:this.moveX,Wd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=ye([Kr()],t.DragEvent);const Ud=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=ye([Kr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=ye([Kr()],t.MoveEvent),t.TouchEvent=class extends Ed{},t.TouchEvent=ye([Kr()],t.TouchEvent);const Nd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=ye([Kr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=ye([Kr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=ye([Kr()],t.ZoomEvent),t.KeyEvent=class extends Ed{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=ye([Kr()],t.KeyEvent);const zd={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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:Yd.getSwipeDirection(ot.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 vh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ao.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Yd=zd,Xd=new vh,{getDragEventData:Hd,getDropEventData:jd,getSwipeEventData:Vd}=zd;class Gd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Hd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||Xd;return this.dragging&&(n?e?Xd:new vh(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&bd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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],ao.draggable(e)){this.draggableList=new vh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Hd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:a}=i.p,l=!a||!!e;n.forEach(i=>{if(i.draggable){const n=o(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},l||n);a&&!n&&e?ao.animateMove(i,d,h(a)?a:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Hd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(ot.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Vd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=jd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 qd=ee.get("emit");const Kd=["move","zoom","rotate","key"];function Zd(t,e,i,s,n){if(Kd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Qd(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&$d(r,e,i,s,n)}}function $d(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Qd(t,n)&&(rl.updateEventStyle&&!s&&rl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=pe.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Qd(t,e){return e&&e.has(t)}const Jd={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:ec,pathHasOutside:ic}=zd;class sc{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&&bd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&bd.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=_.clone(Jd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new vh(t),this.createTransformer(),this.dragger=new Gd(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(bd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),bd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=bd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&bd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ot.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;bd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,xd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,xd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new vh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>tc(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;Qt.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,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&&!ic(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!ec(t.path))&&!ic(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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,n=s.length;t<n&&(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:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ot.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(tc(e.path,t.PointerEvent.LONG_TAP)||tc(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new jt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ko.RESIZE,this.__onResize,this)],t.once(Jo.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 n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],$d(n,t,e,!0,s))return;n.isApp&&Zd(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Zd(n,t,e,!1,s),$d(n,t,e,!1,s))return}catch(t){qd.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 nc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}nc.custom={};class rc extends fe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new vh,this.pixelList=new vh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),le.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),le.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()}}Qt.getSelector=function(t){return t.leafer?t.leafer.selector:Qt.selector||(Qt.selector=le.selector())};const{toInnerRadiusPointOf:oc,copyRadiusPoint:ac}=ot,{hitRadiusPoint:hc,hitPoint:lc}=zt,dc={},cc={},uc=t.Leaf.prototype;uc.hit=function(t,e=0){this.updateLayout(),ac(cc,t,e);const i=this.__world;return!!(e?hc(i,cc):lc(i,cc))&&(this.isBranch?Qt.getSelector(this).hitPoint(Object.assign({},cc),e,{target:this}):this.__hitWorld(cc))},uc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(ac(dc,t,i.hitRadius),t=dc),oc(t,s,dc),i.hitBox||r){if(zt.hitRadiusPoint(n.boxBounds,dc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(dc,e)},uc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},uc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},uc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},uc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const _c=new pt,pc=t.UI.prototype;pc.__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,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=Qt.image.hitCanvasSize,o=r.hitScale=Vt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Vt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),ir.patternLocked=!0,this.__renderShape(r,{matrix:_c.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),ir.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},pc.__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,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const gc=t.UI.prototype,fc=t.Rect.prototype,yc=t.Box.prototype;fc.__updateHitCanvas=yc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?gc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},fc.__hitFill=yc.__hitFill=function(t){return this.__hitCanvas?gc.__hitFill.call(this,t):zt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),Qt.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const mc=Ae.prototype;mc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},mc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},mc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Vt.set(s-r,n-o,2*r,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 vc={convert(t,e){const i=zd.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=zd.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=vc.getTouch(t),s=zd.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},wc={convert(t){const e=zd.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:xc}=zd;class bc extends sc{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(wc.convert(t))}onKeyUp(t){this.keyUp(wc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(vc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(vc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=vc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(vc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(vc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(vc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(vc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=vc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&xc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(vc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=vc.getTouch(t);this.pointerMove(vc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=vc.getTouch(t);this.pointerUp(vc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(zd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},zd.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=zd.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(D.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),c(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>c(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,d(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=o(t)&&nc.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Ec(t,e,i){t.__.__font?Jh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Pc(t,e,i,s,n){const r=i.__;c(t)?Jh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&Jh.strokeArrow(t,i,s,n)}function Sc(t,e,i,s,n){const r=i.__;c(t)?Jh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),Jh.drawTextStroke(i,s,n))}function Bc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Sc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",Jh.fillText(i,r,n),r.blendMode="normal",ao.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Tc,copyAndSpread:kc,toOuterOf:Rc,getOuterOf:Cc,getByMove:Lc,move:Ac,getIntersectData:Dc}=zt,Oc={};let Ic;const{stintSet:Mc}=_,{hasTransparent:Fc}=Zh;function Wc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:r}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=tl.image(i,t,e,r,!Ic||!Ic[e.url]);break;case"linear":s=el.linearGradient(e,r);break;case"radial":s=el.radialGradient(e,r);break;case"angular":s=el.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:Zh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Zh.string(e)})}if(s&&(s.originPaint=e,o(s.style)&&Fc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Uc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),Ic=tl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Wc(t,a[n],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)&&(n=!0),r=!0),"fill"===t?(Mc(i,"__isAlphaPixelFill",n),Mc(i,"__isTransparentFill",r)):(Mc(i,"__isAlphaPixelStroke",n),Mc(i,"__isTransparentStroke",r),Mc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Ec(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,tl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),Ec(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),Ec(e,i,s),i.restoreBlendMode()):Ec(e,i,s)}},fillPathOrText:Ec,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[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(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)Jh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Pc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Pc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Pc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Pc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ao.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Jh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Sc(t,1,e,i,s);break;case"inside":Bc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Sc(t,2,e,i,s):Bc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[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}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!tl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?Jh.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?Jh.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;Rc(o.strokeSpread?(kc(Oc,o.boxBounds,o.strokeSpread),Oc):o.boxBounds,r,a);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))_=s,h=u=a,l=r;else{let s;if(Qt.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Tc(n,E.swapAndScale(o.renderShapeSpread,p,g)):n;s=Dc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=Cc(a,c),h=Lc(u,-c.e,-c.f),l=Cc(r,c),Ac(l,-c.e,-c.f);const m=i.matrix;m?(d=new pt(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 Nc,zc=new jt;const{isSame:Yc}=zt;function Xc(t,e,i,s,n,r){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 n.data||tl.createData(n,s,i,r),!0}function Hc(t,e){Gc(t,Yo.LOAD,e)}function jc(t,e){Gc(t,Yo.LOADED,e)}function Vc(t,e,i){e.error=i,t.forceUpdate("surface"),Gc(t,Yo.ERROR,e)}function Gc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Yo(e,i))}function qc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Kc,translate:Zc}=q,$c=new jt,Qc={},Jc={};function tu(t,e,i,s){const n=o(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let eu={},iu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:su,set:nu,rotateOfOuter:ru,translate:ou,scaleOfOuter:au,multiplyParent:hu,scale:lu,rotate:du,skew:cu}=q;function uu(t,e,i,s,n,r,o,a){o&&du(t,o),a&&cu(t,a.x,a.y),n&&lu(t,n,r),ou(t,e.x+i,e.y+s)}const{get:_u,scale:pu,copy:gu}=q,{getFloorScale:fu}=D,{abs:yu}=Math;const mu={image:function(t,e,i,s,n){let r,o;const a=ir.get(i);return Nc&&i===Nc.paint&&Yc(s,Nc.boxBounds)?r=Nc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Nc=a.use>1?{leafPaint:r,paint:i,boxBounds:zc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Xc(t,e,i,a,r,s),n&&(Hc(t,o),jc(t,o))):a.error?n&&Vc(t,o,a.error):(n&&(qc(t,!0),Hc(t,o)),r.loadId=a.load(()=>{qc(t,!1),t.destroyed||(Xc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),jc(t,o)),r.loadId=void 0},e=>{qc(t,!1),Vc(t,o,e),r.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)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=tl.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d,snapshot:c}=n;return!(!h||t.patternId===r+"-"+o&&!d||c)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===Qt.name&&Ko.isResizing(i)||d||(e=Qt.image.isLarge(a,r,o)||a.width*r>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),tl.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?tl.createPattern(t,i,s,n):tl.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){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?(n.save(),_&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,g),n.restore()):(o.scaleX&&(p*=o.scaleX,g*=o.scaleY),n.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,ir.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=ir.patternTasker.add(()=>me(this,void 0,void 0,function*(){tl.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:n,scaleY:r}=tl.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!Qt.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=tl.getPatternFixScale(t,n,r);let d,c,u,{width:_,height:p}=i;l&&(n*=l,r*=l),_*=n,p*=r,h&&(c=h.x*n/yu(s.scaleX||1),u=h.y*r/yu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=fu(_+(c||0)),r*=fu(p+(u||0)),d=_u(),a&&gu(d,a),pu(d,1/n,1/r));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||Qt.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=Qt.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=tl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=$c.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,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===n,b={mode:a},E="center"!==l&&(p||0)%180==90;let P,S;switch(zt.set(Jc,0,0,E?n:s,E?s:n),a&&"cover"!==a&&"fit"!==a?((u||_)&&(D.getScaleData(u,_,i,Qc),P=Qc.scaleX,S=Qc.scaleY),(l||m||y)&&(P&&zt.scale(Jc,P,S,!0),l&&Pt.toPoint(l,Jc,e,Jc,!0,!0))):x&&!p||(P=S=zt.getFitScale(e,Jc,"fit"!==a),zt.put(e,i,l,P,!1,Jc),zt.scale(Jc,P,S,!0)),d&&ot.move(Jc,d),a){case"stretch":x?P&&(P=S=void 0):(P=e.width/s,S=e.height/n,tl.stretchMode(b,e,P,S));break;case"normal":case"clip":if(Jc.x||Jc.y||P||f||p||g){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),tl.clipMode(b,e,Jc.x,Jc.y,P,S,p,g,t,i),t&&(P=P?P*t:t,S=S?S*i:i)}break;case"repeat":(!x||P||p||g)&&tl.repeatMode(b,e,s,n,Jc.x,Jc.y,P,S,p,g,l,t.freeTransform),y||(b.repeat="repeat");const i=c(y);(m||i)&&(b.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:tu(r,i,n.width,e&&e.x),y:tu(o,s,n.height,e&&e.y)}}(m,i&&y,Jc.width,Jc.height,e));break;default:P&&tl.fillOrFitMode(b,e,Jc.x,Jc.y,P,S,p)}return b.transform||(e.x||e.y)&&Zc(b.transform=Kc(),e.x,e.y),P&&(b.scaleX=P,b.scaleY=S),r&&r<1&&(b.opacity=r),v&&(b.filters=v),y&&(b.repeat=o(y)?"x"===y?"repeat-x":"repeat-y":"repeat"),w&&(b.interlace=h(w)||"percent"===w.type?{type:"x",offset:w}:w),b},stretchMode:function(t,e,i,s){const n=su(),{x:r,y:o}=e;r||o?ou(n,r,o):n.onlyScale=!0,lu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=su();ou(a,e.x+i,e.y+s),lu(a,n,r),o&&ru(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=su();uu(d,e,i,s,n,r,o,a),h&&(o||a?(nu(iu),au(iu,e,h,l),hu(d,iu)):au(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=su();if(c)uu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)ru(u,{x:i/2,y:s/2},h);else switch(du(u,h),h){case 90:ou(u,s,0);break;case 180:ou(u,i,s);break;case 270:ou(u,0,i)}eu.x=e.x+n,eu.y=e.y+r,ou(u,eu.x,eu.y),o&&au(u,eu,o,a)}t.transform=u}},{toPoint:vu}=xt,{hasTransparent:wu}=Zh,xu={},bu={};function Eu(t,e,i,s){if(i){let n,r,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],o(n)?(a=t/(l-1),r=Zh.string(n,s)):(a=n.offset,r=Zh.string(n.color,s)),e.addColorStop(a,r),!h&&wu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Pu,getDistance:Su}=ot,{get:Bu,rotateOfOuter:Tu,scaleOfOuter:ku}=q,{toPoint:Ru}=xt,Cu={},Lu={};function Au(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Pu(e,i);r=Bu(),n?(ku(r,e,o/a*(s||1),1),Tu(r,e,t+90)):(ku(r,e,1,o/a*(s||1)),Tu(r,e,t))}return r}const{getDistance:Du}=ot,{toPoint:Ou}=xt,Iu={},Mu={};const Fu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;vu(i||"top",e,xu),vu(s||"bottom",e,bu);const o=Qt.canvas.createLinearGradient(xu.x,xu.y,bu.x,bu.y),a={type:n,style:o};return Eu(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Ru(i||"center",e,Cu),Ru(s||"bottom",e,Lu);const a=Qt.canvas.createRadialGradient(Cu.x,Cu.y,0,Cu.x,Cu.y,Su(Cu,Lu)),h={type:n,style:a};Eu(h,a,t.stops,r);const l=Au(e,Cu,Lu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Ou(i||"center",e,Iu),Ou(s||"bottom",e,Mu);const a=Qt.conicGradientSupport?Qt.canvas.createConicGradient(0,Iu.x,Iu.y):Qt.canvas.createRadialGradient(Iu.x,Iu.y,0,Iu.x,Iu.y,Du(Iu,Mu)),h={type:n,style:a};Eu(h,a,t.stops,r);const l=Au(e,Iu,Mu,o||1,Qt.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Au},{copy:Wu,move:Uu,toOffsetOutBounds:Nu}=zt,{max:zu,abs:Yu}=Math,Xu={},Hu=new pt,ju={};function Vu(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=Yu(t.spread||0),o=zu(o,n+r-s),a=zu(a,n+r+i),h=zu(h,n+r+s),l=zu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Gu(t,e,i){const{shapeBounds:s}=i;let n,r;Qt.fullImageShadow?(Wu(Xu,t.bounds),Uu(Xu,e.x-s.x,e.y-s.y),n=t.bounds,r=Xu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:qu}=zt,Ku={};const Zu=Vu;const $u={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;Nu(h,ju,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(ju.offsetX+(o.x||0)*c*f,ju.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Zh.string(o.color)),n=il.getShadowTransform(t,_,i,o,ju,f),n&&_.setTransform(n),Gu(_,ju,i),n&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,r,"copy"),s=r),a?_.copyWorld(a,r,r,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),ao.copyCanvasByWorld(t,e,_,s,o.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=o.length-1;qu(h,Ku,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Ku.offsetX+(o.x||0)*c*f,Ku.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=il.getShadowTransform(t,_,i,o,Ku,f,!0),n&&_.setTransform(n),Gu(_,Ku,i),_.restore(),a?(_.copyWorld(_,l,r,"copy"),_.copyWorld(a,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Zh.string(o.color),"source-in"),ao.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:Vu,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Hu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Hu}},isTransformShadow(t){},getInnerShadowSpread:Zu},{excludeRenderBounds:Qu}=fo;let Ju;function t_(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Ju||(Ju=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);i_(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":i_(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function e_(t){return t.getSameCanvas(!1,!0)}function i_(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,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&&(t_(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Qu(i,e)||i.__render(t,e),r=i.__.opacity,Ju=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=e_(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=e_(t)),n||(n=e_(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&t_(this,o,t,n,s,r,void 0,!1),Qu(i,e)||i.__render(n||t,e),d&&t_(this,o,t,n,s,r,d,!1)}t_(this,o,t,n,s,r,void 0,!0)};const s_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",n_=s_+"_#~&*+\\=|≮≯≈≠=…",r_=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 o_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const a_=o_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),h_=o_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),l_=o_(s_),d_=o_(n_),c_=o_("- —/~|┆·");var u_;!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"}(u_||(u_={}));const{Letter:__,Single:p_,Before:g_,After:f_,Symbol:y_,Break:m_}=u_;function v_(t){return a_[t]?__:c_[t]?m_:h_[t]?g_:l_[t]?f_:d_[t]?y_:r_.test(t)?p_:__}const w_={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function x_(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:b_}=w_,{Letter:E_,Single:P_,Before:S_,After:B_,Symbol:T_,Break:k_}=u_;let R_,C_,L_,A_,D_,O_,I_,M_,F_,W_,U_,N_,z_,Y_,X_,H_,j_,V_=[];function G_(t,e){F_&&!M_&&(M_=F_),R_.data.push({char:t,width:e}),L_+=e}function q_(){A_+=L_,R_.width=L_,C_.words.push(R_),R_={data:[]},L_=0}function K_(){Y_&&(X_.paraNumber++,C_.paraStart=!0,Y_=!1),F_&&(C_.startCharSize=M_,C_.endCharSize=F_,M_=0),C_.width=A_,H_.width?b_(C_):j_&&Z_(),V_.push(C_),C_={words:[]},A_=0}function Z_(){A_>(X_.maxWidth||0)&&(X_.maxWidth=A_)}const{top:$_,right:Q_,bottom:J_,left:tp}=t.Direction4;function ep(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const ip={getDrawData:function(t,e){o(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[tp],n-=a[Q_]+a[tp],!n&&(n=.01)):e.autoSizeAlign||(i=a[tp]),r?(s=a[$_],r-=a[$_]+a[J_],!r&&(r=.01)):e.autoSizeAlign||(s=a[$_]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:Qt.canvas.font=e.__font};return function(t,e,i){X_=t,V_=t.rows,H_=t.bounds,j_=!H_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=Qt,{width:a}=H_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Y_=!0,U_=null,M_=I_=F_=L_=A_=0,R_={data:[]},C_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)O_=e[i],"\n"===O_?(L_&&q_(),C_.paraEnd=!0,K_(),Y_=!0):(W_=v_(O_),W_===E_&&"none"!==r&&(O_=x_(O_,r,!L_)),I_=o.measureText(O_).width,s&&(s<0&&(F_=I_),I_+=s),N_=W_===P_&&(U_===P_||U_===E_)||U_===P_&&W_!==B_,z_=!(W_!==S_&&W_!==P_||U_!==T_&&U_!==B_),D_=Y_&&n?a-n:a,t&&a&&A_+L_+I_>D_&&(h?(L_&&q_(),A_&&K_()):(z_||(z_=W_===E_&&U_==B_),N_||z_||W_===k_||W_===S_||W_===P_||L_+I_>D_?(L_&&q_(),A_&&K_()):A_&&K_()))," "===O_&&!0!==Y_&&A_+L_===0||(W_===k_?(" "===O_&&L_&&q_(),G_(O_,I_),q_()):N_||z_?(L_&&q_(),G_(O_,I_)):G_(O_,I_)),U_=W_);L_&&q_(),A_&&K_(),V_.length>0&&(V_[V_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{X_.paraNumber++,A_=o.measureText(t).width,V_.push({x:n||0,text:t,width:A_,paraStart:!0}),j_&&Z_()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":ep(e,"x",t[tp]);break;case"right":ep(e,"x",-t[Q_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ep(e,"y",t[$_]);break;case"bottom":ep(e,"y",-t[J_])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__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=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,r),n>1&&(t.overflow=n);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=n;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+=r,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:n,paraIndent:r,__letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=r&&t.paraStart?r: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,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),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,n),h.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?Qt.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-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,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=Zh.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const sp={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(o(t)){if(!i||!Zh.object)return t;t=Zh.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(Kh,ip),Object.assign(Zh,sp),Object.assign(Jh,Uc),Object.assign(tl,mu),Object.assign(el,Fu),Object.assign(il,$u),Object.assign(le,{interaction:(t,e,i,s)=>new bc(t,e,i,s),hitCanvas:(t,e)=>new bh(t,e),hitCanvasManager:()=>new rc}),Sh();class np extends _l{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function rp(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?rl.setStyleName(this,e,i):rl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function op(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function ap(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 hp(t,e){c(e)||(e=void 0),cp(t,e,"in")}function lp(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),cp(t,e,"out"))}t.Robot=class extends t.UI{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),!n(t))if(h(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=ir.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:n,size:r,total:o}=e,{width:a,height:l}=r&&(h(r)?{width:r,height:r}:r)||(o>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:l},d+a>=t.width?(d=0,c+=l):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Yo(Yo.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:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},ye([Ur(np)],t.Robot.prototype,"__",void 0),ye([vr()],t.Robot.prototype,"robot",void 0),ye([_r()],t.Robot.prototype,"actions",void 0),ye([_r("")],t.Robot.prototype,"action",void 0),ye([kr(0)],t.Robot.prototype,"now",void 0),ye([_r(12)],t.Robot.prototype,"FPS",void 0),ye([_r(!0)],t.Robot.prototype,"loop",void 0),t.Robot=ye([qr()],t.Robot),he.add("robot");const dp={};function cp(t,e,i){const{normalStyle:s}=t;e||(e=dp),e.scale&&(D.assignScale(e,e.scale),delete e.scale),e!==dp&&rl.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=pp(e,t),s=t.animate();s&&pp(i,t,s.fromStyle);return i}(t,e):void 0;rl.canAnimate&&up(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=up(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=_p(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=_p(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function up(t){let e;const i={},s=ap(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&rl.isState(n,t,s)&&(e=gp(i,r));const o=i.selectedStyle||t.selectedStyle;o&&rl.isSelected(t,s)&&(e=gp(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&rl.isPlacehold(t,s)&&(e=gp(i,a)),rl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=gp(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&rl.isFocus(t,s)&&(e=gp(i,n));const r=i.hoverStyle||t.hoverStyle;r&&rl.isHover(t,s)&&(e=gp(i,r));const o=i.pressStyle||t.pressStyle;o&&rl.isPress(t,s)&&(e=gp(i,o))}return e?i:void 0}function _p(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&rl.animateExcludes[t]||(n[t]=e[t]);return n}function pp(t,e,i){return _p(t,e,i,!0)}function gp(t,e){return Object.assign(t,e),!0}function fp(t,e){const i=t[e];i&&hp(t,i),t.button&&mp(t.children,e)}function yp(t,e,i){i||(i=t.states[e]),hp(t,i),t.button&&mp(t.children,null,e)}function mp(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":rl.isHover(s)&&(r=!1);break;case"pressStyle":rl.isPress(s)&&(r=!1);break;case"focusStyle":rl.isFocus(s)&&(r=!1)}r&&fp(s,e)}else n(i)||yp(s,i);s.isBranch&&mp(s.children,e,i)}}function vp(t,e){const i=t[e];i&&lp(t,i),t.button&&xp(t.children,e)}function wp(t,e,i){lp(t,i),t.button&&xp(t.children,null,e)}function xp(t,e,i){if(!t)return;let s;for(let r=0,o=t.length;r<o;r++)s=t[r],e?vp(s,e):n(i)||wp(s,i),s.isBranch&&xp(s.children,e,i)}function bp(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=ap(e,i);r&&(s=n[t](r))}return s}function Ep(t,e,i){let s=e[t];if(!s&&i){const n=ap(e,i);n&&(s=n[t])}return s}he.add("state"),rl.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},rl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=ap(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},rl.isSelected=function(t,e){return Ep("selected",t,e)},rl.isDisabled=function(t,e){return Ep("disabled",t,e)},rl.isFocus=function(t,e){return bp("isFocus",t,e)},rl.isHover=function(t,e){return bp("isHover",t,e)},rl.isPress=function(t,e){return bp("isPress",t,e)},rl.isPlacehold=function(t,e){return t.__.__isPlacehold},rl.isDrag=function(t,e){return bp("isDrag",t,e)},rl.setStyleName=function(t,e,i){i?yp(t,e,t[e]):wp(t,e,t[e])},rl.set=function(t,e){const i=t.states[e];i?yp(t,e,i):wp(t,e,i)},rl.getStyle=up,rl.updateStyle=cp,rl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:fp(e,"hoverStyle");break;case t.PointerEvent.LEAVE:vp(e,"hoverStyle");break;case t.PointerEvent.DOWN:fp(e,"pressStyle");break;case t.PointerEvent.UP:vp(e,"pressStyle")}};const Pp=t.UI.prototype;t.UI.addAttr("selected",!1,rp,"selectedStyle"),t.UI.addAttr("disabled",!1,rp,"disabledStyle"),t.UI.addAttr("states",{},op),t.UI.addAttr("state","",rp),t.UI.addAttr("normalStyle",void 0,_r),t.UI.addAttr("hoverStyle",void 0,op),t.UI.addAttr("pressStyle",void 0,op),t.UI.addAttr("focusStyle",void 0,op),t.UI.addAttr("selectedStyle",void 0,op),t.UI.addAttr("disabledStyle",void 0,op),t.UI.addAttr("placeholderStyle",void 0,op),t.UI.addAttr("button",!1,_r),Pp.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))},Pp.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?fp(this,"focusStyle"):vp(this,"focusStyle")})},Pp.updateState=function(){rl.updateStyle(this,void 0,"in")};const Sp=t.Text.prototype,Bp="text";ar(Sp,Bp,Object.assign(Object.assign({},hr(Sp,Bp)),{set(t){const e=this,i=e.text;e.__setAttr(Bp,t)&&(xr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:Tp,sin:kp,pow:Rp,sqrt:Cp,abs:Lp,ceil:Ap,floor:Dp,round:Op,PI:Ip}=Math,Mp=5*Ip,Fp=1.70158,Wp=2.5949095,Up=7.5625,Np=2.75;function zp(t){return e=>Rp(e,t)}function Yp(t){return e=>1-Rp(1-e,t)}function Xp(t){return e=>e<.5?.5*Rp(2*e,t):1-.5*Rp(2-2*e,t)}function Hp(t){return t<1/Np?Up*t*t:t<2/Np?Up*(t-=1.5/Np)*t+.75:t<2.5/Np?Up*(t-=2.25/Np)*t+.9375:Up*(t-=2.625/Np)*t+.984375}function jp(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=Vp(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Lp(l)<1e-6));e++)c-=d/l;return n[o]=Vp(c,e,s)}}function Vp(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Gp={get(t){const{list:e}=Gp;return o(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Gp.list[t]=e},list:{linear:t=>t,ease:jp(.25,.1,.25,1),"ease-in":jp(.42,0,1,1),"ease-out":jp(0,0,.58,1),"ease-in-out":jp(.42,0,.58,1),"sine-in":t=>1-Tp(t*Ip*.5),"sine-out":t=>kp(t*Ip*.5),"sine-in-out":t=>.5*(1-Tp(t*Ip)),"quad-in":zp(2),"quad-out":Yp(2),"quad-in-out":Xp(2),"cubic-in":zp(3),"cubic-out":Yp(3),"cubic-in-out":Xp(3),"quart-in":zp(4),"quart-out":Yp(4),"quart-in-out":Xp(4),"quint-in":zp(5),"quint-out":Yp(5),"quint-in-out":Xp(5),"expo-in":t=>t?Rp(2,10*t-10):0,"expo-out":t=>1===t?1:1-Rp(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Rp(2,2*t*10-10):.5*(2-Rp(2,10-2*t*10)),"circ-in":t=>1-Cp(1-Rp(t,2)),"circ-out":t=>Cp(1-Rp(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Cp(1-Rp(2*t,2))):.5*(Cp(1-Rp(2-2*t,2))+1),"back-in":t=>((Fp+1)*t-Fp)*t*t,"back-out":t=>(t-=1)*t*((Fp+1)*t+Fp)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Wp+1)*t-Wp)*.5:.5*((t=2*t-2)*t*((Wp+1)*t+Wp)+2),"elastic-in":t=>0===t||1===t?t:-Rp(2,10*(t-1))*kp((t-1.1)*Mp),"elastic-out":t=>0===t||1===t?t:Rp(2,-10*t)*kp((t-.1)*Mp)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Rp(2,10*((t*=2)-1))*kp((t-1.1)*Mp)*.5:Rp(2,10*(1-(t*=2)))*kp((t-1.1)*Mp)*.5+1,"bounce-in":t=>1-Hp(1-t),"bounce-out":Hp,"bounce-in-out":t=>t<.5?.5*(1-Hp(1-2*t)):.5*(1+Hp(2*t-1)),"cubic-bezier":jp,steps:function(t,e="floor"){return i=>("floor"===e?Dp(i*t):"ceil"===e?Ap(i*t):Op(i*t))/t}}};function qp(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 Kp{}Kp.CREATED="created",Kp.PLAY="play",Kp.PAUSE="pause",Kp.STOP="stop",Kp.SEEK="seek",Kp.UPDATE="update",Kp.COMPLETED="completed";t.Animate=class extends oa{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:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&h(n)&&(t+=n-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:n,attrs:r}=this;this.easingFn=Gp.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.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(Kp.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Kp.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Kp.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=$h.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(Kp.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,l,d,c,u,_=0,p=0;r>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<r;s++){if(l=i[s],c=l.style||l,a||(a=o?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=l;r&&(d.swing=h(r)?r:2,u=2*d.swing-1),o&&(d.loop=u=h(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),n&&(d.easingFn=Gp.get(n))}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(Kp.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,Qt.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(Kp.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,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),ol.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(Kp.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 h(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)}},ye([qp("ease")],t.Animate.prototype,"easing",void 0),ye([qp(0)],t.Animate.prototype,"delay",void 0),ye([qp(.2)],t.Animate.prototype,"duration",void 0),ye([qp("auto")],t.Animate.prototype,"ending",void 0),ye([qp(!1)],t.Animate.prototype,"reverse",void 0),ye([qp(!1)],t.Animate.prototype,"swing",void 0),ye([qp(!1)],t.Animate.prototype,"loop",void 0),ye([qp(0)],t.Animate.prototype,"loopDelay",void 0),ye([qp(1)],t.Animate.prototype,"speed",void 0),ye([qp(!0)],t.Animate.prototype,"autoplay",void 0),ye([qp()],t.Animate.prototype,"join",void 0),ye([qp()],t.Animate.prototype,"jump",void 0),ye([qp()],t.Animate.prototype,"attrs",void 0),t.Animate=ye([Gr(ya)],t.Animate),t.AnimateList=class extends t.Animate{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(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(Kp.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Kp.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Kp.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(Kp.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Kp.COMPLETED:this.completed&&this.emitType(t);break;case Kp.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)}},t.AnimateList=ye([Gr(ya)],t.AnimateList);const Zp={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"},$p=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Qp=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Jp=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,tg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,eg=parseInt,ig=parseFloat,{round:sg}=Math;let ng={},rg=0;function og(t){let e,i,s,n=1;switch(t.length){case 9:e=eg(t.slice(1,3),16),i=eg(t.slice(3,5),16),s=eg(t.slice(5,7),16),n=eg(t.slice(7,9),16)/255;break;case 7:e=eg(t.slice(1,3),16),i=eg(t.slice(3,5),16),s=eg(t.slice(5,7),16);break;case 5:e=eg(t[1]+t[1],16),i=eg(t[2]+t[2],16),s=eg(t[3]+t[3],16),n=eg(t[4]+t[4],16)/255;break;case 4:e=eg(t[1]+t[1],16),i=eg(t[2]+t[2],16),s=eg(t[3]+t[3],16);break;case 3:e=i=s=eg(t[1]+t[2],16);break;case 2:e=i=s=eg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const ag=1/6,hg=.5,lg=2/3,dg=1/3;function cg(t,e,i){return i<0?i++:i>1&&i--,i<ag?t+6*(e-t)*i:i<hg?e:i<lg?t+(e-t)*(lg-i)*6:t}function ug(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=cg(a,s,t+dg),r=cg(a,s,t),o=cg(a,s,t-dg)}return{r:sg(255*n),g:sg(255*r),b:sg(255*o),a:s}}he.add("color"),Zh.object=function(t,e){let i,s=!n(e)&&e<1;if(o(t)){const e=ng[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=og(t);break;case"R":case"r":"("===t[4]&&Qp.test(t)?i=function(t){const e=Qp.exec(t);return{r:eg(e[1]),g:eg(e[2]),b:eg(e[3]),a:ig(e[4])}}(t):"("===t[3]&&$p.test(t)&&(i=function(t){const e=$p.exec(t);return{r:eg(e[1]),g:eg(e[2]),b:eg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&tg.test(t)?i=function(t){const e=tg.exec(t);return ug(ig(e[1]),ig(e[2]),ig(e[3]),ig(e[4]))}(t):"("===t[3]&&Jp.test(t)&&(i=function(t){const e=Jp.exec(t);return ug(ig(e[1]),ig(e[2]),ig(e[3]),1)}(t))}if(!i){const e=Zp[t.toLowerCase()];e&&(i=og("#"+e))}i&&(rg++,rg>1e4&&(ng={},rg=0),ng[t]=Object.assign({},i))}}else c(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:_g}=Math,{fourNumber:pg}=D,gg={fill:wg,stroke:wg,cornerRadius:(t,e,i)=>h(t)&&h(e)?mg(t,e,i):(t=pg(t),e=pg(e),t.map((t,s)=>mg(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,n=e.length,r=mg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return h(t)||h(e)?D.float(mg(t,e,i),Math.max(yg(t),yg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return ol.setBetweenStyle(n,t,e,n,i,s),n},shadow:xg,innerShadow:xg},fg={value:function(t,e,i){const s=h(t),n=h(e);return s&&n?t+(e-t)*i:n||s?mg(t,e,i):t},number:mg,color:vg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=ol;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,n,r)))}};function yg(t){const e=String(t).split(".")[1];return e?e.length:0}function mg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?_g(n):n}function vg(t,e,i){t=Zh.object(t),e=Zh.object(e);const s=mg(t.r,e.r,i,1)+","+mg(t.g,e.g,i,1)+","+mg(t.b,e.b,i,1),n=mg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function wg(t,e,i){return o(t)&&o(e)?vg(t,e,i):e}function xg(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:mg((t=t||{}).x,e.x,i),y:mg(t.y,e.y,i),blur:mg(t.blur,e.blur,i),spread:mg(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})}he.add("animate","color"),rl.canAnimate=!0,Object.assign(ol.list,gg),Object.assign(ol,fg);const bg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,_r),t.UI.addAttr("transition",!0,_r),t.UI.addAttr("transitionOut",void 0,_r),bg.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))},bg.animate=function(e,i,s,r){if(n(e))return this.__animate;let o=d(e)&&!i&&s?new t.AnimateList(this,e,r):new t.Animate(this,e,i,r);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},bg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},bg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Kp.COMPLETED,e)};const Eg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Pg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Sg}=Math,{getDerivative:Bg}=hi,Tg={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<Eg.length;h++)l=f*(1+Eg[h]),d=f*(1-Eg[h]),c=Bg(l,t,i,n,o),u=Bg(l,e,s,r,a),_=Bg(d,t,i,n,o),p=Bg(d,e,s,r,a),g+=Pg[h]*(Sg(c*c+u*u)+Sg(_*_+p*p));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Bg(t,e,s,r,a),d=Bg(t,i,n,o,h);return Math.atan2(d,l)/I},getT(t,e,i,s,n,r,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;)kg(i,s,n,r,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,_=d*n+e*o,p=d*r+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(Ie.C,c,u,g,f,y,m)}},{getDistance:kg}=Tg,{M:Rg,L:Cg,C:Lg,Z:Ag}=Ie,{float:Dg}=D,Og={},Ig={},Mg={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Rg:case Cg:Mg.transformPoints(t,e,s,1),s+=3;break;case Lg:Mg.transformPoints(t,e,s,3),s+=7;break;case Ag:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Og.x=t[n],Og.y=t[n+1],q.toOuterPoint(e,Og),t[n]=Og.x,t[n+1]=Og.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Rg:case Cg:i=t[a+1],s=t[a+2],e=n===Cg&&a>0?ot.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Lg:i=t[a+5],s=t[a+6],e=Tg.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 Ag:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=$h.number(e,t.total);let r,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Rg:case Cg:if(o=n[f+1],a=n[f+2],r=s[y],p+r>=e||!t.total)return f||(m=o,v=a),Ig.x=m,Ig.y=v,g.x=o,g.y=a,ot.getDistancePoint(Ig,g,e-p,!0),g.rotation=ot.getAngle(Ig,g),g;m=o,v=a,f+=3;break;case Lg:if(o=n[f+5],a=n[f+6],r=s[y],p+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],_=Tg.getT(e-p,r,m,v,l,d,c,u,o,a,i),hi.getPointAndSet(_,m,v,l,d,c,u,o,a,g),g.rotation=Tg.getRotation(_,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case Ag:f+=1;default:r=0}y++,p+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=$h.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=n.length;for(;m<b;){switch(d=n[m],d){case Rg:case Cg:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),Ig.x=w,Ig.y=x,y.x=h,y.y=l,a=Dg(e-f),a&&(ot.getDistancePoint(Ig,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Lg:if(c=n[m+1],u=n[m+2],_=n[m+3],p=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Dg(e-f),a&&(g=Tg.getT(a,o,w,x,c,u,_,p,h,l,i),Tg.cut(r,g,w,x,c,u,_,p,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,_,p,h,l);break;case Ag:m+=1,r.push(d);default:o=0}v++,f+=o}return r}};function Fg(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}he.add("motion-path"),ol.register("motion",function(t,e,i,s){return c(t)&&(t=$h.number(t,s.getMotionTotal())),c(e)&&(e=$h.number(e,s.getMotionTotal())),ol.number(t||0,e||0,i)}),ol.register("motionRotation",function(t,e,i){return ol.number(t,e,i)});const Wg=t.UI.prototype,{updateMatrix:Ug,updateAllMatrix:Ng}=ao,{updateBounds:zg}=wo;function Yg(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Hg(t);i.total&&(t.__.__pathForRender=Mg.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Ng(t),zg(t,t)):Ug(t));i&&(t.leafer.created=!0)}}function Xg(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 Hg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Mg.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Fg),t.UI.addAttr("motionPrecision",1,Fg),t.UI.addAttr("motion",void 0,Fg),t.UI.addAttr("motionRotation",!0,Fg),Wg.getMotionPathData=function(){return Hg(Xg(this))},Wg.getMotionPoint=function(t){const e=Xg(this),i=Hg(e);if(!i.total)return{};const s=Mg.getDistancePoint(i,t,e.motionPrecision);q.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:h(n)&&(s.rotation+=n),s},Wg.getMotionTotal=function(){return this.getMotionPathData().total},Wg.__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(),Yg(t))}else Yg(this)};const{Yes:jg,NoAndSkip:Vg,YesAndSkip:Gg}=t.Answer,qg={},Kg={},Zg={};class $g{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"#":qg.id=t.substring(1),t=qg;break;case".":Kg.className=t.substring(1),t=Kg;break;default:Zg.tag=t,t=Zg}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,n=d(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?_.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&&ao.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 n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===jg||r===Gg){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Vg&&this.eachFind(n.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_(Wo.REMOVE,this.__onRemoveChild,this),this.target.on_(No.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 Qg=t.UI.prototype;function Jg(t){return t.leafer?t.leafer.selector:Qt.selector||(Qt.selector=le.selector())}return Qg.find=function(t,e){return Jg(this).getBy(t,this,!1,e)},Qg.findOne=function(t,e){return Jg(this).getBy(t,this,!0,e)},he.add("find"),le.finder=function(t){return new $g(t)},t.AlignHelper=Pt,t.AnimateEasing=Gp,t.AnimateEvent=Kp,t.AroundHelper=xt,t.AutoBounds=Gt,t.BezierHelper=hi,t.Bounds=jt,t.BoundsEvent=Xo,t.BoundsHelper=zt,t.BoxData=fl,t.BranchHelper=wo,t.BranchRender=Wa,t.CanvasData=Rl,t.CanvasManager=fe,t.ChildEvent=Wo,t.ColorConvert=Zh,t.Creator=le,t.Cursor=nc,t.DataHelper=_,t.Debug=ee,t.DragBoundsHelper=Id,t.Dragger=Gd,t.Effect=il,t.EllipseData=xl,t.EllipseHelper=yi,t.Event=Fo,t.EventCreator=pe,t.Eventer=oa,t.Export=nl,t.FileHelper=qn,t.Filter=sl,t.Finder=$g,t.FourNumberHelper=E,t.FrameData=ml,t.GroupData=gl,t.HighBezierHelper=Tg,t.HighCurveHelper=Mg,t.HitCanvasManager=rc,t.ImageData=kl,t.ImageEvent=Yo,t.ImageManager=ir,t.IncrementId=f,t.Interaction=bc,t.InteractionBase=sc,t.InteractionHelper=zd,t.Keyboard=xd,t.LayoutEvent=$o,t.Layouter=Wh,t.LeafBounds=Oa,t.LeafBoundsHelper=fo,t.LeafData=g,t.LeafDataProxy=va,t.LeafEventer=ya,t.LeafHelper=ao,t.LeafLayout=Mo,t.LeafLevelList=wh,t.LeafList=vh,t.LeafMatrix=Ba,t.LeafRender=Ia,t.LeaferCanvas=bh,t.LeaferCanvasBase=Ae,t.LeaferData=yl,t.LeaferEvent=Jo,t.LeaferImage=or,t.LineData=vl,t.MathHelper=D,t.Matrix=pt,t.MatrixHelper=q,t.MyDragEvent=Ud,t.MyImage=pd,t.MyPointerEvent=Fd,t.MyTouchEvent=Nd,t.NeedConvertToCanvasCommandMap=Fe,t.OneRadian=I,t.PI2=M,t.PI_2=F,t.Paint=Jh,t.PaintGradient=el,t.PaintImage=tl,t.PathArrow=Qh,t.PathBounds=Mn,t.PathCommandDataHelper=Ss,t.PathCommandMap=Ie,t.PathCommandNodeHelper=mi,t.PathConvert=is,t.PathCorner=Xn,t.PathCreator=Ys,t.PathData=Pl,t.PathDrawer=nn,t.PathHelper=De,t.PathNumberCommandLengthMap=ze,t.PathNumberCommandMap=Ne,t.PenData=Sl,t.Picker=Hh,t.Platform=Qt,t.Plugin=he,t.Point=ut,t.PointHelper=ot,t.PointerButton=bd,t.PolygonData=bl,t.PropertyEvent=No,t.RectData=wl,t.RectHelper=Ye,t.RectRender=Ml,t.RenderEvent=Qo,t.Renderer=Nh,t.ResizeEvent=Ko,t.Resource=tr,t.RobotData=np,t.Run=re,t.Selector=jh,t.StarData=El,t.State=rl,t.StringNumberMap=Kt,t.TaskItem=$n,t.TaskProcessor=Qn,t.TextConvert=Kh,t.TextData=Tl,t.Transition=ol,t.TwoPointBoundsHelper=ft,t.UIBounds=Al,t.UICreator=ce,t.UIData=_l,t.UIEvent=Ed,t.UIRender=Ol,t.UnitConvert=$h,t.UnitConvertHelper=qt,t.WaitHelper=Bo,t.WatchEvent=Zo,t.Watcher=Th,t.affectRenderBoundsType=Tr,t.affectStrokeBoundsType=Pr,t.attr=cr,t.autoLayoutType=fr,t.boundsType=vr,t.canvasPatch=Gn,t.canvasSizeAttrs=Le,t.createAttr=function(t){return(e,i)=>{ar(e,i,lr(i,t))}},t.createDescriptor=lr,t.cursorType=Wr,t.dataProcessor=Ur,t.dataType=_r,t.decorateLeafAttr=dr,t.defineDataProcessor=Nr,t.defineKey=ar,t.defineLeafAttr=ur,t.dimType=Rr,t.doBoundsType=xr,t.doStrokeType=Sr,t.effectType=Vh,t.emptyData=s,t.eraserType=Mr,t.extraPropertyEventMap=zo,t.getBoundsData=U,t.getDescriptor=hr,t.getMatrixData=N,t.getPointData=W,t.hitType=Fr,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=a,t.isNull=r,t.isNumber=h,t.isObject=c,t.isString=o,t.isUndefined=n,t.layoutProcessor=function(t){return(e,i)=>{ar(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=na,t.maskType=Ir,t.motionPathType=Fg,t.naturalBoundsType=wr,t.opacityType=Cr,t.path=Hn,t.pathInputType=br,t.pathType=Er,t.pen=jn,t.positionType=pr,t.registerUI=qr,t.registerUIEvent=Kr,t.resizeType=Gh,t.rewrite=Hr,t.rewriteAble=jr,t.rotationType=mr,t.scaleType=yr,t.scrollType=gr,t.sortType=Or,t.stateStyleType=op,t.stateType=rp,t.strokeType=Br,t.surfaceType=kr,t.tempBounds=Vt,t.tempMatrix=gt,t.tempPoint=_t,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=Sh,t.useModule=Gr,t.version="2.0.1",t.visibleType=Lr,t.zoomLayerType=qh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=web.min.js.map
|