@leafer/worker 1.11.2 → 1.12.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.
@@ -1,2 +1,2 @@
1
- var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:r}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function g(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return _(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&_(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let n in this)"_"!==n[0]&&(i=e?e[n]:void 0,t[n]=s(i)?this[n]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:n}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!s(t))){if("path"===o&&!this.__pathInputed)continue;e=n?n[o]:void 0,i[o]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}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:m,max:y}=Math,v={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||w.maxCacheSize),isSuperLarge:(t,e,i)=>w.isLarge(t,e,i,w.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.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,o,r,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,o){const s=e/o.width,n=i/o.height;d.setTransform(s,0,0,n,-o.x*s,-o.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&&p.stintSet(i,"transform",e)}}},{image:w}=v,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=x;let k,S,E;const{max:B}=Math,T=[0,0,0,0],R={zero:[...T],tempFour:T,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)=>C(T,t,e,i,s),toTempAB(t,e,i){E=i?a(t)?e:t:[],a(t)?(k=P(t),S=e):a(e)?(k=t,S=P(e)):(k=t,S=e),4!==k.length&&(k=O(k)),4!==S.length&&(S=O(S))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(L(t,e,i),C(E,B(k[0],S[0]),B(k[1],S[1]),B(k[2],S[2]),B(k[3],S[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(L(t,e,i),C(E,k[0]+S[0],k[1]+S[1],k[2]+S[2],k[3]+S[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,h,l]=4===t.length?t:O(t);return C(n,h*i,l*e,o*i,r*e)}},{set:C,get:O,setTemp:P,toTempAB:L}=R,{round:A,pow:D,max:M,floor:F,PI:I}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12: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=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(F(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const Y=I/180,N=2*I,X=I/2;function H(){return{x:0,y:0}}function V(){return{x:0,y:0,width:0,height:0}}function j(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:G,acos:q,sqrt:K}=Math,{float:Z}=W,J={};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,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:j,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){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=G(e*=Y),a=U(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=Y,t.a=s+o*i,t.b=n+r*i),e&&(e*=Y,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,n,o){const{e:r,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=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=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,n,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:n}=e,o=i*Y,r=G(o),a=U(o);if(s||n){const e=s*Y,i=n*Y;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||n)&&tt.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=K(n*n+o*o),c=t/d;const e=n/d;u=o>0?q(e):-q(e)}else{c=K(r*r+a*a),d=t/c;const e=r/c;u=X-(a>0?q(-e):-q(e))}const e=Z(G(u)),i=U(u);d=Z(d),c=Z(c),g=e?Z((r/c+i)/e/Y,9):0,p=e?Z((o/d-i)/e/Y,9):0,u=Z(u/Y)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=K(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{toInnerPoint:et,toOuterPoint:it}=Q,{sin:st,cos:nt,abs:ot,sqrt:rt,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=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?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*=Y),n=st(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return gt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return gt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return gt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},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=ot(i-t),o=ot(s-e);return rt(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>ht(ut(t,e,i,s),ut(i,s,n,o)),getAngle:(t,e)=>pt(t,e)/Y,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)/Y),getRadianFrom(t,e,i,n,o,r,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=o-a,u=r-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 o=pt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+nt(o)*i,e.y=t.y+st(o)*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)=>t.x===e.x&&t.y===e.y,reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:gt,getAtan2:pt}=ct;class _t{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 _t(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 _t(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(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 ft=new _t;class mt{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,o),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}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 yt=new mt,vt={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){wt(t,e,i),wt(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:wt}=vt;var xt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(bt||(bt={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const St={directionData:kt,tempPoint:{},get:Et,toPoint(t,e,i,s,n,o){const r=Et(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.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 Et(t){return o(t)?kt[bt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,o){Bt(t,i,s,n,e,o)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Ot,toBounds:Pt}=vt,{toOuterPoint:Lt}=Q,{float:At,fourNumber:Dt}=W,{floor:Mt,ceil:Ft}=Math;let It,Wt,zt,Yt;const Nt={},Xt={},Ht={},Vt={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:o,y:r,width:a,height:h}=e;if(d(i)){const e=Dt(i);s?jt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||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)=>(jt.copy(Ht,t),jt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:o,f:r}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=r+t.y*n):(i.height=t.height*-n,i.y=r+t.y*n-i.height)}else Nt.x=t.x,Nt.y=t.y,Lt(e,Nt,Xt),Ct(Rt,Xt.x,Xt.y),Nt.x=t.x+t.width,Lt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Nt.y=t.y+t.height,Lt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Nt.x=t.x,Lt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Pt(Rt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new 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=jt.getFitScale(t,e,"cover"===s)),Ht.width=n?e.width*=s:e.width*s,Ht.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){It=t.x+t.width,Wt=t.y+t.height,zt=e.x,Yt=e.y,i||(zt+=e.width,Yt+=e.height),It=It>zt?It:zt,Wt=Wt>Yt?Wt:Yt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=It-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||Gt(t,n)):Ut(t,n));o&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Ot(Rt,t.x,t.y)),Pt(Rt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Ut(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=jt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return It=s+o,Wt=n+r,zt=t.x+t.width,Yt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,It=It<zt?It:zt,Wt=Wt<Yt?Wt:Yt,o=It-s,r=Wt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){jt.copy(t,jt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){jt.set(t)}},jt=Vt,{add:Ut,copy:Gt}=jt;class qt{get minX(){return Vt.minX(this)}get minY(){return Vt.minY(this)}get maxX(){return Vt.maxX(this)}get maxY(){return Vt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Vt.copy(this,t):Vt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return Vt.move(this,t,e),this}scale(t,e,i){return Vt.scale(this,t,e,i),this}scaleOf(t,e,i){return Vt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Vt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Vt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Vt.getFitMatrix(this,t,e)}put(t,e,i){Vt.put(this,t,e,i)}spread(t,e){return Vt.spread(this,t,e),this}shrink(t,e){return Vt.shrink(this,t,e),this}ceil(){return Vt.ceil(this),this}unsign(){return Vt.unsign(this),this}float(t){return Vt.float(this,t),this}add(t){return Vt.add(this,t),this}addList(t){return Vt.setList(this,t,!0),this}setList(t){return Vt.setList(this,t),this}addListWithFn(t,e){return Vt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Vt.setListWithFn(this,t,e),this}setPoint(t){return Vt.setPoint(this,t),this}setPoints(t){return Vt.setPoints(this,t),this}addPoint(t){return Vt.addPoint(this,t),this}getPoints(){return Vt.getPoints(this)}hitPoint(t,e){return Vt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Vt.hitRadiusPoint(this,t,e)}hit(t,e){return Vt.hit(this,t,e)}includes(t,e){return Vt.includes(this,t,e)}intersect(t,e){return Vt.intersect(this,t,e),this}getIntersect(t,e){return new qt(Vt.getIntersectData(this,t,e))}isSame(t){return Vt.isSame(this,t)}isEmpty(){return Vt.isEmpty(this)}reset(){Vt.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,o){c(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new qt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Jt={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:$t}=W;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,n=t.__nowWorld,o=$t();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(ee.enable){if(ee.filterList.length&&ee.filterList.every(t=>t!==this.name))return;if(ee.excludeList.length&&ee.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ee.enable&&this.warn(...t)}warn(...t){ee.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 te(t){return t?o(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const ee=Qt,ie=Qt.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,ie.log(s,n,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];s(i)||ne.end(i,e)}},ne=se,oe=[],re={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=>re.has(t,!0)));const ae={editor:t=>re.need("editor")},he=Qt.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,n,o,r){de[t]||he.error("not register "+t);const a=new de[t](e);return s(i)||(a.x=i,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:de}=le,ce=Qt.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(ge[e]&&ce.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}=ue;class pe{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=ae.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 _e(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function fe(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(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(r,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 ye=[];function ve(){return(t,e)=>{ye.push(e)}}const we=[];let xe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){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,o)}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,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,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,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,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,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};_e([me("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),_e([me("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),_e([me("globalAlpha")],xe.prototype,"opacity",void 0),_e([me()],xe.prototype,"fillStyle",void 0),_e([me()],xe.prototype,"strokeStyle",void 0),_e([me("lineWidth")],xe.prototype,"strokeWidth",void 0),_e([me("lineCap")],xe.prototype,"strokeCap",void 0),_e([me("lineJoin")],xe.prototype,"strokeJoin",void 0),_e([me("lineDashOffset")],xe.prototype,"dashOffset",void 0),_e([me()],xe.prototype,"miterLimit",void 0),_e([me()],xe.prototype,"shadowBlur",void 0),_e([me()],xe.prototype,"shadowColor",void 0),_e([me()],xe.prototype,"shadowOffsetX",void 0),_e([me()],xe.prototype,"shadowOffsetY",void 0),_e([me()],xe.prototype,"filter",void 0),_e([me()],xe.prototype,"font",void 0),_e([me()],xe.prototype,"fontKerning",void 0),_e([me()],xe.prototype,"fontStretch",void 0),_e([me()],xe.prototype,"fontVariantCaps",void 0),_e([me()],xe.prototype,"textAlign",void 0),_e([me()],xe.prototype,"textBaseline",void 0),_e([me()],xe.prototype,"textRendering",void 0),_e([me()],xe.prototype,"wordSpacing",void 0),_e([me()],xe.prototype,"letterSpacing",void 0),_e([me()],xe.prototype,"direction",void 0),_e([ve()],xe.prototype,"setTransform",null),_e([ve()],xe.prototype,"resetTransform",null),_e([ve()],xe.prototype,"getTransform",null),_e([ve()],xe.prototype,"save",null),_e([ve()],xe.prototype,"restore",null),_e([ve()],xe.prototype,"translate",null),_e([ve()],xe.prototype,"scale",null),_e([ve()],xe.prototype,"rotate",null),_e([ve()],xe.prototype,"fill",null),_e([ve()],xe.prototype,"stroke",null),_e([ve()],xe.prototype,"clip",null),_e([ve()],xe.prototype,"fillRect",null),_e([ve()],xe.prototype,"strokeRect",null),_e([ve()],xe.prototype,"clearRect",null),_e([ve()],xe.prototype,"beginPath",null),_e([ve()],xe.prototype,"moveTo",null),_e([ve()],xe.prototype,"lineTo",null),_e([ve()],xe.prototype,"bezierCurveTo",null),_e([ve()],xe.prototype,"quadraticCurveTo",null),_e([ve()],xe.prototype,"closePath",null),_e([ve()],xe.prototype,"arc",null),_e([ve()],xe.prototype,"arcTo",null),_e([ve()],xe.prototype,"ellipse",null),_e([ve()],xe.prototype,"rect",null),_e([ve()],xe.prototype,"roundRect",null),_e([ve()],xe.prototype,"createConicGradient",null),_e([ve()],xe.prototype,"createLinearGradient",null),_e([ve()],xe.prototype,"createPattern",null),_e([ve()],xe.prototype,"createRadialGradient",null),_e([ve()],xe.prototype,"fillText",null),_e([ve()],xe.prototype,"measureText",null),_e([ve()],xe.prototype,"strokeText",null);const{copy:be,multiplyParent:ke,pixelScale:Se}=Q,{round:Ee}=Math,Be=new qt,Te=new qt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Oe extends xe{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=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;p.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ke(t,e,n),Se(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Ee(n.e-.5)+.5,n.f=Ee(n.f-.5)+.5):(n.e=Ee(n.e),n.f=Ee(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:n,dashPattern:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(o=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=o,this.dashOffset=r,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=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Te):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Vt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o=!0){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return n.save(),t&&(be(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 Pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=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},Le),De={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),Le),Ie=Ae,We={};for(let t in Ie)We[Ie[t]]=t;const ze={};for(let t in Ie)ze[Ie[t]]=De[t];const Ye={drawRoundRect(t,e,i,s,n,o){const r=W.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ne,cos:Xe,hypot:He,atan2:Ve,ceil:je,abs:Ue,PI:Ge,sqrt:qe,pow:Ke}=Math,{setPoint:Ze,addPoint:Je}=vt,{set:$e,toNumberPoints:Qe}=dt,{M:ti,L:ei,C:ii,Q:si,Z:ni}=Ae,oi={},ri={points(t,e,i,s){let n=Qe(e);if(t.push(ti,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=qe(Ke(r-e,2)+Ke(a-o,2)),_=qe(Ke(h-r,2)+Ke(l-a,2)),(p||_)&&(f=p+_,p=y*p/f,_=y*_/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(si,d,c,r,a):t.push(ii,u,g,d,c,r,a),u=r+_*h,g=a+_*l);s||t.push(si,u,g,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ei,n[e],n[e+1]);s&&t.push(ni)},rect(t,e,i,s,n){Pe.creator.path=t,Pe.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,o){Pe.creator.path=[],Ye.drawRoundRect(Pe.creator,e,i,s,n,o),t.push(...Pe.convertToCanvasData(Pe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=Ve(u,c),f=Ve(p,g);const m=He(c,u),y=He(g,p);let v=f-_;if(v<0&&(v+=N),m<1e-12||y<1e-12||v<1e-12||Ue(v-Ge)<1e-12)return t&&t.push(ei,s,n),h&&(Ze(h,e,i),Je(h,s,n)),d&&$e(d,e,i),void(l&&$e(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Xe(v/2),k=s+b*Xe(_+v/2+X*x),S=n+b*Ne(_+v/2+X*x);return _-=X*x,f-=X*x,li(t,k,S,a,a,0,_/Y,f/Y,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>li(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*Y,g=Ne(u),p=Xe(u);let _=r*Y,f=a*Y;_>Ge&&(_-=N),f<0&&(f+=N);let m=f-_;m<0?m+=N:m>N&&(m-=N),h&&(m-=N);const y=je(Ue(m/X)),v=m/y,w=Ne(v/4),x=8/3*w*w/Ne(v/2);f=_+v;let b,k,S,E,B,T,R,C,O=Xe(_),P=Ne(_),L=S=p*s*O-g*n*P,A=E=g*s*O+p*n*P,D=e+S,M=i+E;t&&t.push(t.length?ei:ti,D,M),l&&Ze(l,D,M),c&&$e(c,D,M);for(let o=0;o<y;o++)b=Xe(f),k=Ne(f),S=p*s*b-g*n*k,E=g*s*b+p*n*k,B=e+L-x*(p*s*P+g*n*O),T=i+A-x*(g*s*P-p*n*O),R=e+S+x*(p*s*k+g*n*b),C=i+E+x*(g*s*k-p*n*b),t&&t.push(ii,B,T,R,C,e+S,i+E),l&&hi(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,_=f,f+=v;d&&$e(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ii,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):Ze(h,t,e),Je(h,r,a);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,n,o,r,a,oi),Je(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ai(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ri,{sin:di,cos:ci,sqrt:ui,atan2:gi}=Math,{ellipse:pi}=ri,_i={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*Y,p=di(g),_=ci(g),f=-_*c-p*u,m=-_*u+p*c,y=s*s,w=n*n,x=m*m,b=f*f,k=y*w-y*x-w*b;let S=0;if(k<0){const t=ui(1-k/(y*w));s*=t,n*=t}else S=(r===a?-1:1)*ui(k/(y*x+w*b));const E=S*s*m/n,B=-S*n*f/s,T=gi((m-B)/n,(f-E)/s),R=gi((-m-B)/n,(-f-E)/s);let C=R-T;0===a&&C>0?C-=N:1===a&&C<0&&(C+=N);const O=e+c+_*E-p*B,P=i+u+p*E+_*B,L=C<0?1:0;d||v.ellipseToCurve?pi(t,O,P,s,n,o,T/Y,R/Y,L):s!==n||o?t.push(Ae.G,O,P,s,n,o,T/Y,R/Y,L):t.push(Ae.O,O,P,s,T/Y,R/Y,L)}},fi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:yi,L:vi,l:wi,H:xi,h:bi,V:ki,v:Si,C:Ei,c:Bi,S:Ti,s:Ri,Q:Ci,q:Oi,T:Pi,t:Li,A:Ai,a:Di,Z:Mi,z:Fi,N:Ii,D:Wi,X:zi,G:Yi,F:Ni,O:Xi,P:Hi,U:Vi}=Ae,{rect:ji,roundRect:Ui,arcTo:Gi,arc:qi,ellipse:Ki,quadraticCurveTo:Zi}=ri,{ellipticalArc:Ji}=_i,$i=Qt.get("PathConvert"),Qi={},ts={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=ze[s],a+=s===n?" ":We[s];for(let s=1;s<i;s++)a+=W.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?Fe:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(es.dot&&(is(r,o),o=""),es.dot++),"0"===o&&"."!==s&&(is(r,o),o=""),o+=s):Ae[s]?(o&&(is(r,o),o=""),es.name=Ae[s],es.length=De[s],es.index=0,is(r,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&is(r,o),o=s):o&&(is(r,o),o=""),n=s;return o&&is(r,o),i?ts.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],g.push(mi,a,h),c+=3;break;case bi:t[c+1]+=a;case xi:a=t[c+1],g.push(vi,a,h),c+=2;break;case Si:t[c+1]+=h;case ki:h=t[c+1],g.push(vi,a,h),c+=2;break;case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],g.push(vi,a,h),c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ti;case Ti:r=o===Ei||o===Ti,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Ei,l,d,i,s,a,h),c+=5;break;case Bi: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=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Li:t[c+1]+=a,t[c+2]+=h,n=Pi;case Pi:r=o===Ci||o===Pi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Zi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:i=t[c+1],s=t[c+2],e?Zi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=a,t[c+7]+=h;case Ai:Ji(g,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:g.push(Mi),c++;break;case Ii:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4]):ss(g,t,c,5),c+=5;break;case Wi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(g,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],t[c+5]):ss(g,t,c,6),c+=6;break;case Yi:Ki(e?g:ss(g,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,Qi),a=Qi.x,h=Qi.y,c+=9;break;case Ni:e?Ki(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:qi(e?g:ss(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),a=Qi.x,h=Qi.y,c+=7;break;case Hi:e?qi(g,t[c+1],t[c+2],t[c+3],0,360,!1):ss(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Gi(e?g:ss(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),a=Qi.x,h=Qi.y,c+=6;break;default:return $i.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return fi.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(vi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(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,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){es.index===es.length&&(es.index=1,t.push(es.name)),t.push(Number(e)),es.index++,es.dot=0}},{current:es,pushData:is,copyData:ss}=ts,{M:ns,L:os,C:rs,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:gs,O:ps,P:_s,U:fs}=Ae,{getMinDistanceFrom:ms,getRadianFrom:ys}=dt,{tan:vs,min:ws,abs:xs}=Math,bs={},ks={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ns,e,i)},lineTo(t,e,i){t.push(os,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(rs,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(as,e,i,s,n)},closePath(t){t.push(hs)},rect(t,e,i,s,n){t.push(ls,e,i,s,n)},roundRect(t,e,i,s,n,o){if(a(o))t.push(cs,e,i,s,n,o);else{const r=W.fourNumber(o);r?t.push(ds,e,i,s,n,...r):t.push(ls,e,i,s,n)}},ellipse(t,e,i,s,o,r,a,h,l){n(r)?t.push(gs,e,i,s,o):(n(a)&&(a=0),n(h)&&(h=360),t.push(us,e,i,s,o,r,a,h,l?1:0))},arc(t,e,i,s,o,r,a){n(o)?t.push(_s,e,i,s):(n(r)&&(r=360),t.push(ps,e,i,s,o,r,a?1:0))},arcTo(t,e,i,n,o,r,a,h){if(!s(a)){const t=ms(a,h,e,i,n,o);r=ws(r,ws(t/2,t/2*xs(vs(ys(a,h,e,i,n,o)/2))))}t.push(fs,e,i,n,o,r)},drawEllipse(t,e,i,s,o,r,a,h,l){ri.ellipse(null,e,i,s,o,n(r)?0:r,n(a)?0:a,n(h)?360:h,l,null,null,bs),t.push(ns,bs.x,bs.y),Ss(t,e,i,s,o,r,a,h,l)},drawArc(t,e,i,s,o,r,a){ri.arc(null,e,i,s,n(o)?0:o,n(r)?360:r,a,null,null,bs),t.push(ns,bs.x,bs.y),Es(t,e,i,s,o,r,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:Ss,arc:Es}=ks,{moveTo:Bs,lineTo:Ts,quadraticCurveTo:Rs,bezierCurveTo:Cs,closePath:Os,beginPath:Ps,rect:Ls,roundRect:As,ellipse:Ds,arc:Ms,arcTo:Fs,drawEllipse:Is,drawArc:Ws,drawPoints:zs}=ks;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)?Pe.parse(t):t:[],this}beginPath(){return Ps(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Cs(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Os(this.__path),this.paint(),this}rect(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return As(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Ds(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Ms(this.__path,t,e,i,s,n,o),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,o,r,a){return Is(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Ws(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ns,L:Xs,C:Hs,Q:Vs,Z:js,N:Us,D:Gs,X:qs,G:Ks,F:Zs,O:Js,P:$s,U:Qs}=Ae,tn=Qt.get("PathDrawer"),en={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Ns: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 Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.closePath(),s+=1;break;case Us:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*Y,e[s+6]*Y,e[s+7]*Y,e[s+8]),s+=9;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*Y,e[s+5]*Y,e[s+6]),s+=7;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void tn.error(`command: ${i} [index:${s}]`,e)}}},{M:sn,L:nn,C:on,Q:rn,Z:an,N:hn,D:ln,X:dn,G:cn,F:un,O:gn,P:pn,U:_n}=Ae,{toTwoPointBounds:fn,toTwoPointBoundsByQuadraticCurve:mn,arcTo:yn,arc:vn,ellipse:wn}=ri,{addPointBounds:xn,copy:bn,addPoint:kn,setPoint:Sn,addBounds:En,toBounds:Bn}=vt,Tn=Qt.get("PathBounds");let Rn,Cn,On;const Pn={},Ln={},An={},Dn={toBounds(t,e){Dn.toTwoPointBounds(t,Ln),Bn(Ln,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Sn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===an||r===on||r===rn?Sn(e,h,l):Sn(e,t[a+1],t[a+2])),r){case sn:case nn:h=t[a+1],l=t[a+2],kn(e,h,l),a+=3;break;case on:n=t[a+5],o=t[a+6],fn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Pn),xn(e,Pn),h=n,l=o,a+=7;break;case rn:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],mn(h,l,i,s,n,o,Pn),xn(e,Pn),h=n,l=o,a+=5;break;case an:a+=1;break;case hn:h=t[a+1],l=t[a+2],En(e,h,l,t[a+3],t[a+4]),a+=5;break;case ln:case dn:h=t[a+1],l=t[a+2],En(e,h,l,t[a+3],t[a+4]),a+=r===ln?9:6;break;case cn:wn(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],Pn,An),0===a?bn(e,Pn):xn(e,Pn),h=An.x,l=An.y,a+=9;break;case un:h=t[a+1],l=t[a+2],Cn=t[a+3],On=t[a+4],En(e,h-Cn,l-On,2*Cn,2*On),h+=Cn,a+=5;break;case gn:vn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Pn,An),0===a?bn(e,Pn):xn(e,Pn),h=An.x,l=An.y,a+=7;break;case pn:h=t[a+1],l=t[a+2],Rn=t[a+3],En(e,h-Rn,l-Rn,2*Rn,2*Rn),h+=Rn,a+=4;break;case _n:yn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Pn,An),0===a?bn(e,Pn):xn(e,Pn),h=An.x,l=An.y,a+=6;break;default:return void Tn.error(`command: ${r} [index:${a}]`,t)}}},{M:Mn,L:Fn,Z:In}=Ae,{getCenterX:Wn,getCenterY:zn}=dt,{arcTo:Yn}=ks,Nn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,p=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case Mn:l=g=t[r+1],d=p=t[r+2],r+=3,t[r]===Fn?(c=t[r+1],u=t[r+2],f.push(Mn,Wn(l,c),zn(d,u))):f.push(Mn,l,d);break;case Fn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Fn:Yn(f,a,h,t[r+1],t[r+2],e,g,p);break;case In:Yn(f,a,h,l,d,e,g,p);break;default:f.push(Fn,a,h)}g=a,p=h;break;case In:n!==In&&(Yn(f,l,d,c,u,e,g,p),f.push(In)),r+=1;break;default:o=ze[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==In&&(f[1]=l,f[2]=d),f}};function Xn(t){return new Ys(t)}const Hn=Xn();Pe.creator=Xn(),Pe.parse=ts.parse,Pe.convertToCanvasData=ts.toCanvasData;const{drawRoundRect:Vn}=Ye;function jn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Vn(this,t,e,i,s,n)})}(t)}const Un={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=Gn.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{}}}},Gn=Un;Gn.alphaPixelTypes.forEach(t=>Gn.upperCaseTypeMap[t]=t.toUpperCase());const qn=Qt.get("TaskProcessor");class Kn{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return fe(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){qn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e,i){let n,o,r,h;const l=new Kn(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,n=e.start,r=e.time,h=e.delay,i||(i=e.canUse)),r&&(l.time=r),!1===o&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list: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=Qt.get("Resource"),$n={tasker:new Zn,map:{},get isComplete(){return Qn.tasker.isComplete},set(t,e){Qn.map[t]&&Jn.repeat(t),Qn.map[t]=e},get:t=>Qn.map[t],remove(t){const e=Qn.map[t];e&&(e.destroy&&e.destroy(),delete Qn.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=ae.image(s)),Qn.set(t,e),e},destroy(){Qn.map={}}},Qn=$n,to={maxRecycled:10,recycledList:[],patternTasker:new Zn,get(t){let e=$n.get(t.url);return e||$n.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||eo.recycledList.push(t)})},clearRecycled(){const t=eo.recycledList;t.length>eo.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&$n.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Un.alphaPixelTypes.some(e=>eo.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:"+Un.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Un.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){eo.recycledList=[]}},eo=to,{IMAGE:io,create:so}=x;class no{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=so(io),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}to.isFormat("svg",t)&&(this.isSVG=!0),to.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;$n.tasker.add(()=>fe(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,s(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const 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=t.naturalWidth||t.width,this.height=t.naturalHeight||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,o,r){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=v.image.resize(this.view,t,e,n,o,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function oo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ro(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ao(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ho(t,e){return(i,s)=>co(i,s,t,e&&e(s))}function lo(t){return t}function co(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};oo(t,e,Object.assign(n,s||{})),Yo(t,e,i)}function uo(t){return ho(t)}function go(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function po(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function _o(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wo(this))}}))}function fo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function yo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&wo(this)}}))}function vo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(wo(this),this.__.__removeNaturalSize())}}))}function wo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xo(t){return ho(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wo(this)}}))}const bo=yo;function ko(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i)&&(So(this),e&&(this.__.__useStroke=!0))}}))}function So(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wo(t)}const Eo=ko;function Bo(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function To(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Ro(t){return ho(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Co(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Po(this)}}))}function Oo(t){return ho(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Lo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Lo(this,t,e,i),this.mask&&Po(this)}}))}function Po(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Lo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wo(t))}function Ao(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Do(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Io(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wo(t){return(e,i)=>{oo(e,"__DataProcessor",{get:()=>t})}}function zo(t){return(e,i)=>{oo(e,"__LayoutProcessor",{get:()=>t})}}function Yo(t,e,i){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ao(e,i);if(s(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(c(i)){const t=g(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=ro(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),oo(n,e,a)}const No=new Qt("rewrite"),Xo=[],Ho=["destroy","constructor"];function Vo(t){return(e,i)=>{Xo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jo(){return t=>{Uo()}}function Uo(t){Xo.length&&(Xo.forEach(e=>{t&&No.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Xo.length=0)}function Go(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ho.includes(s)||e&&e.includes(s)))if(t.prototype){ro(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function qo(){return t=>{le.register(t)}}function Ko(){return t=>{ue.register(t)}}setTimeout(()=>Uo(!0));const{copy:Zo,toInnerPoint:Jo,toOuterPoint:$o,scaleOfOuter:Qo,rotateOfOuter:tr,skewOfOuter:er,multiplyParent:ir,divideParent:sr,getLayout:nr}=Q,or={},{round:rr}=Math,ar={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),dr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)lr(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++)cr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&cr(t),t.__updateChange()},updateAllChange(t){if(gr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ur(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,o){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const o=c(e)?Object.assign({},e):{x:e,y:i};s?$o(t.localTransform,o,o,!0):t.parent&&Jo(t.parent.scrollWorldTransform,o,o,!0),hr.moveLocal(t,o.x,o.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=rr(e),i=rr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){hr.zoomOfLocal(t,pr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(a(s)||(s&&(o=s),s=i),Zo(or,r),Qo(or,e,i,s),hr.hasHighPosition(t))hr.setTransform(t,or,n,o);else{const e=t.x+or.e-r.e,a=t.y+or.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){hr.rotateOfLocal(t,pr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Zo(or,n),tr(or,e,i),hr.hasHighPosition(t)?hr.setTransform(t,or,!1,s):t.set({x:t.x+or.e-n.e,y:t.y+or.f-n.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){hr.skewOfLocal(t,pr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Zo(or,t.__localMatrix),er(or,e,i,s),hr.setTransform(t,or,n,o)},transformWorld(t,e,i,s){Zo(or,t.worldTransform),ir(or,e),t.parent&&sr(or,t.parent.scrollWorldTransform),hr.setTransform(t,or,i,s)},transform(t,e,i,s){Zo(or,t.localTransform),ir(or,e),hr.setTransform(t,or,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&hr.getInnerOrigin(t,n.origin),r=nr(e,o,n.around&&hr.getInnerOrigin(t,n.around));if(hr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=hr.getInnerOrigin(t,n.origin);dt.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Qo(i,hr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(hr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zo(or,t.worldTransform),sr(or,e.scrollWorldTransform),i?or:Object.assign({},or)),drop(t,e,i,s){t.setTransform(hr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||hr.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),v.requestRender(()=>hr.animateMove(t,e,i))}}},hr=ar,{updateAllMatrix:lr,updateMatrix:dr,updateAllWorldOpacity:cr,updateAllChange:ur,updateChange:gr}=hr;function pr(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const _r={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)=>mr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>mr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>mr(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 fr;function mr(t,e){return e||(fr=0),t.__.mask&&(fr=1),fr<0?null:(fr&&(fr=-1),!0)}const{updateBounds:yr}=ar,vr={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),wr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)xr(e[t],e)},updateBounds(t,e){const i=[t];xr(t,i),br(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++)yr(s[t]);e&&e===i||yr(i)}}},{pushAllChildBranch:wr,pushAllBranchStack:xr,updateBoundsByBranchStack:br}=vr,kr={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:Sr,updateBounds:Er}=ar,{toOuterOf:Br,getPoints:Tr,copy:Rr}=Vt,Cr="_localContentBounds",Or="_worldContentBounds",Pr="_worldBoxBounds",Lr="_worldStrokeBounds";class Ar{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 Br(this.contentBounds,this.leaf.__localMatrix,this[Cr]||(this[Cr]={})),this[Cr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Br(this.contentBounds,this.leaf.__world,this[Or]||(this[Or]={})),this[Or]}get worldBoxBounds(){return Br(this.boxBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}get worldStrokeBounds(){return Br(this.strokeBounds,this.leaf.__world,this[Lr]||(this[Lr]={})),this[Lr]}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 Er(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,v.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 Sr(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Sr(s,e,!0)}if(r||(r=Q.getLayout(o)),Rr(r,a),dt.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,n=Tr(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return s(o)||n.forEach(t=>i.innerToWorld(t,null,!1,o)),n}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 Dr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class Mr extends Dr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Mr.ADD="child.add",Mr.REMOVE="child.remove",Mr.CREATED="created",Mr.MOUNTED="mounted",Mr.UNMOUNTED="unmounted",Mr.DESTROY="destroy";const Fr="property.scroll";class Ir extends Dr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Ir.CHANGE="property.change",Ir.LEAFER_CHANGE="property.leafer_change",Ir.SCROLL=Fr;const Wr={scrollX:Fr,scrollY:Fr};class zr extends Dr{constructor(t,e){super(t),Object.assign(this,e)}}zr.LOAD="image.load",zr.LOADED="image.loaded",zr.ERROR="image.error";class Yr extends Dr{static checkHas(t,e,i){"on"===i?e===Vr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Nr)||t.hasEvent(Xr)||t.hasEvent(Hr),t.__hasWorldEvent=t.hasEvent(Vr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Nr,t),"inner"===e&&t.emit(Xr,t)),t.emit(Hr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Vr,this)}}Yr.RESIZE="bounds.resize",Yr.INNER="bounds.inner",Yr.LOCAL="bounds.local",Yr.WORLD="bounds.world";const{RESIZE:Nr,INNER:Xr,LOCAL:Hr,WORLD:Vr}=Yr,jr={};[Nr,Xr,Hr,Vr].forEach(t=>jr[t]=1);class Ur extends Dr{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(Ur.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Ur.RESIZE="resize";class Gr extends Dr{constructor(t,e){super(t),this.data=e}}Gr.REQUEST="watch.request",Gr.DATA="watch.data";class qr extends Dr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}qr.REQUEST="layout.request",qr.START="layout.start",qr.BEFORE="layout.before",qr.LAYOUT="layout",qr.AFTER="layout.after",qr.AGAIN="layout.again",qr.END="layout.end";class Kr extends Dr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Kr.REQUEST="render.request",Kr.CHILD_START="render.child_start",Kr.CHILD_END="render.child_end",Kr.START="render.start",Kr.BEFORE="render.before",Kr.RENDER="render",Kr.AFTER="render.after",Kr.AGAIN="render.again",Kr.END="render.end",Kr.NEXT="render.next";class Zr extends Dr{}Zr.START="leafer.start",Zr.BEFORE_READY="leafer.before_ready",Zr.READY="leafer.ready",Zr.AFTER_READY="leafer.after_ready",Zr.VIEW_READY="leafer.view_ready",Zr.VIEW_COMPLETED="leafer.view_completed",Zr.STOP="leafer.stop",Zr.RESTART="leafer.restart",Zr.END="leafer.end",Zr.UPDATE_MODE="leafer.update_mode",Zr.TRANSFORM="leafer.transform",Zr.MOVE="leafer.move",Zr.SCALE="leafer.scale",Zr.ROTATE="leafer.rotate",Zr.SKEW="leafer.skew";const{MOVE:Jr,SCALE:$r,ROTATE:Qr,SKEW:ta}=Zr,ea={x:Jr,y:Jr,scaleX:$r,scaleY:$r,rotation:Qr,skewX:ta,skewY:ta},ia={};class sa{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=na(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],jr[t]&&Yr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=na(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],jr[t]&&Yr.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&&ue.has(t)&&(e=ue.get(t,{type:t,target:this,current:this}));const s=na(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}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:n}=this,o=i&&i[t],r=n&&n[t];return!!(s(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function na(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ia)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ia)}}const{on:oa,on_:ra,off:aa,off_:ha,once:la,emit:da,emitEvent:ca,hasEvent:ua,destroy:ga}=sa.prototype,pa={on:oa,on_:ra,off:aa,off_:ha,once:la,emit:da,emitEvent:ca,hasEvent:ua,destroyEventer:ga},_a=Qt.get("setAttr"),fa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||r(e)||s(e)||(_a.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ir(Ir.LEAFER_CHANGE,this,t,n,e));const i=ea[t];i&&(this.emitEvent(new Zr(i,this)),this.emitEvent(new Zr(Zr.TRANSFORM,this)))}this.emitPropertyEvent(Ir.CHANGE,t,n,e);const i=Wr[t];return i&&this.emitPropertyEvent(i,t,n,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Ir(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||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ma,multiplyParent:ya,translateInner:va,defaultWorld:wa}=Q,{toPoint:xa,tempPoint:ba}=St,ka={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ya(this.__local||e,t?t.__scrollWorld||t.__world:wa,i,!!e.affectScaleOrRotation,n),s&&va(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)&&(ma(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)&&(xa(i.around||i.origin,t.boxBounds,ba),va(e,-ba.x,-ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Sa,updateAllMatrix:Ea}=ar,{updateBounds:Ba}=vr,{toOuterOf:Ta,copyAndSpread:Ra,copy:Ca}=Vt,{toBounds:Oa}=Dn,Pa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ta(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Yr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Yr.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(),Ta(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ta(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ta(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Oa(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(),Ea(this),Ba(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ea(this),Ba(this,this))):Sa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ra(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ca(e.renderBounds,e.strokeBounds):Ra(e.renderBounds,e.boxBounds,i)}},La={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(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),ar.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.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:Aa}=_r,Da={__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++)Aa(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++)Aa(i[s],e)||i[s].__clip(t,e)}}},Ma={},{LEAF:Fa,create:Ia}=x,{stintSet:Wa}=p,{toInnerPoint:za,toOuterPoint:Ya,multiplyParent:Na}=Q,{toOuterOf:Xa}=Vt,{copy:Ha,move:Va}=dt,{moveLocal:ja,zoomOfLocal:Ua,rotateOfLocal:Ga,skewOfLocal:qa,moveWorld:Ka,zoomOfWorld:Za,rotateOfWorld:Ja,skewOfWorld:$a,transform:Qa,transformWorld:th,setTransform:eh,getFlipTransform:ih,getLocalOrigin:sh,getRelativeWorld:nh,drop:oh}=ar;let rh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Ar}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ia(Fa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Mr.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(Mr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Mr.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(Mr.MOUNTED)):this.__emitLifeEvent(Mr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Na(i,t.matrix,e,void 0,i),Xa(this.__layout.renderBounds,e,e),Wa(e,"half",i.half),Wa(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}=to.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),Ma.scaleX=i,Ma.scaleY=s,Ma}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?nh(this,e):this.worldTransform,n=i?t:{};return Xa(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ha(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ha(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:o,y:r}=this.boxBounds;return Va(n,-o,-r),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:o,y:r}=this.boxBounds;return Va(n,o,r),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){eh(this,t,e,i)}transform(t,e,i){Qa(this,t,e,i)}move(t,e,i){ja(this,t,e,i)}moveInner(t,e,i){Ka(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ua(this,sh(this,t),e,i,s,n)}rotateOf(t,e,i){Ga(this,sh(this,t),e,i)}skewOf(t,e,i,s,n){qa(this,sh(this,t),e,i,s,n)}transformWorld(t,e,i){th(this,t,e,i)}moveWorld(t,e,i){Ka(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Za(this,t,e,i,s,n)}rotateOfWorld(t,e){Ja(this,t,e)}skewOfWorld(t,e,i,s,n){$a(this,t,e,i,s,n)}flip(t,e){Qa(this,ih(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){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.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){oh(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):Yo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=yo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Mr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Mr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};rh=_e([Go(fa),Go(ka),Go(Pa),Go(pa),Go(La)],rh);const{setListWithFn:ah}=Vt,{sort:hh}=vr,{localBoxBounds:lh,localStrokeBounds:dh,localRenderBounds:ch,maskLocalBoxBounds:uh,maskLocalStrokeBounds:gh,maskLocalRenderBounds:ph}=_r,_h=new Qt("Branch");let fh=class extends rh{__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){ah(e||this.__layout.boxBounds,this.children,this.__hasMask?uh:lh)}__updateStrokeBounds(t){ah(t||this.__layout.strokeBounds,this.children,this.__hasMask?gh:dh)}__updateRenderBounds(t){ah(t||this.__layout.renderBounds,this.children,this.__hasMask?ph:ch)}__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(hh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return _h.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=le.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 n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Mr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Mr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Mr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Mr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Mr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};fh=_e([Go(Da)],fh);class mh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,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 n=0,o=e.length;n<o;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new mh;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 yh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const vh="1.11.2";class wh extends Oe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}jn(OffscreenCanvasRenderingContext2D.prototype),jn(Path2D.prototype);const{mineType:xh}=Un;function bh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:xh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:xh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new wh(t,e),image:t=>new no(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},oo(v,"devicePixelRatio",{get:()=>1});const{userAgent:kh}=navigator;kh.indexOf("Firefox")>-1?(v.conicGradientRotate90=!0,v.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(v.fullImageShadow=!0),kh.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):kh.indexOf("Mac")>-1?v.os="Mac":kh.indexOf("Linux")>-1&&(v.os="Linux");class Sh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new mh;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 mh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Kr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Mr.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 Gr(Gr.DATA,{updatedList:this.updatedList})),this.__updatedList=new mh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ir.CHANGE,this.__onAttrChange,this],[[Mr.ADD,Mr.REMOVE],this.__onChildEvent,this],[Gr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Eh,updateBounds:Bh,updateChange:Th}=ar,{pushAllChildBranch:Rh,pushAllParent:Ch}=vr;const{worldBounds:Oh}=_r;class Ph{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new mh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Oh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Oh),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:Lh,updateAllChange:Ah}=ar,Dh=Qt.get("Layouter");class Mh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new yh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(qr.START),this.layoutOnce(),t.emitEvent(new qr(qr.END,this.layoutedBlocks,this.times))}catch(t){Dh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Dh.warn("layouting"):this.times>3?Dh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Gr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=se.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=qr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new qr(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?(Eh(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||Bh(s[t])}Bh(i)}})}(this.__levelList),function(t){t.list.forEach(Th)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new qr(o,a,this.times)),i.emitEvent(new qr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,se.end(e)}fullLayout(){const t=se.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=qr,o=this.getBlocks(new mh(e));e.emitEvent(new qr(i,o,this.times)),Mh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new qr(s,o,this.times)),e.emitEvent(new qr(n,o,this.times)),this.addBlocks(o),se.end(t)}static fullLayout(t){Lh(t,!0),t.isBranch?vr.updateBounds(t):ar.updateBounds(t),Ah(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ph([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ph(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_([[qr.REQUEST,this.layout,this],[qr.AGAIN,this.layoutAgain,this],[Gr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fh=Qt.get("Renderer");class Ih{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=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(qr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Kr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Kr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Kr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Fh.log(e.innerName,"---\x3e");try{this.emitRender(Kr.START),this.renderOnce(t),this.emitRender(Kr.END,this.totalBounds),to.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 qt,this.renderOptions={},t)this.emitRender(Kr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Kr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Kr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Kr.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=se.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Ih.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),se.end(e)}fullRender(){const t=se.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),se.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),v.render(this.target,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.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()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||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 Kr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Kr.REQUEST,this.update,this],[qr.END,this.__onLayoutEnd,this],[Kr.AGAIN,this.renderAgain,this],[Ur.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Ih.clipSpread=10;const{hitRadiusPoint:Wh}=Vt;class zh{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,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new mh(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):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 mh;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||ar.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ar.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=>ar.worldHittable(t))}getPath(t){const e=new mh,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 mh;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 mh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Wh(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[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 Yh{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new zh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.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):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Nh(t){return ho(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Xh(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Hh(){return(t,e)=>{const i="_"+e;oo(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Vh(t){return(e,i)=>{oo(e,i,ao(i,t))}}Object.assign(ae,{watcher:(t,e)=>new Sh(t,e),layouter:(t,e)=>new Mh(t,e),renderer:(t,e,i)=>new Ih(t,e,i),selector:(t,e)=>new Yh(t,e)}),v.layout=Mh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new mh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const jh={},Uh={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}},Gh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},qh={},Kh={},Zh={},Jh={},$h={},Qh={apply(){re.need("filter")}},tl={},el={setStyleName:()=>re.need("state"),set:()=>re.need("state")},il={list:{},register(t,e){il.list[t]=e},get:t=>il.list[t]},{parse:sl,objectToCanvasData:nl}=ts,{stintSet:ol}=p,{hasTransparent:rl}=Uh,al={originPaint:{}},hl=Qt.get("UIData");class ll extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!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,hl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,hl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(ol(this,"__isTransparentFill",rl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(ol(this,"__isTransparentStroke",rl(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?sl(t):nl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){dl(this,"shadow",t)}setInnerShadow(t){dl(this,"innerShadow",t)}setFilter(t){dl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Kh.compute("fill",this.__leaf),e&&Kh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=al)):(this.__isStrokes=!0,this._stroke||(this._stroke=al))}__removePaint(t,e){e&&this.__removeInput(t),Zh.recycleImage(t,this),"fill"===t?(ol(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ol(this,"__isAlphaPixelStroke",void 0),ol(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function dl(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 cl extends ll{}class ul extends cl{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 cl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class pl extends ul{}class _l extends ll{get __usePathBox(){return this.points||this.__pathInputed}}class fl extends ll{get __boxStroke(){return!this.__pathInputed}}class ml extends ll{get __boxStroke(){return!this.__pathInputed}}class yl extends _l{}class vl extends ll{}class wl extends ll{get __pathInputed(){return 2}}class xl extends cl{}const bl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class kl extends ll{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=le.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Sl extends fl{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 El extends fl{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:Bl,add:Tl}=R,Rl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=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),o&&(t=Bl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=$h.getShadowRenderSpread(this,e)),s&&(t=Bl(t,s)),o&&(t=Tl(t,Qh.getSpread(o))),r&&(t=Tl(t,r)),a&&(t=Tl(t,a));let l=t;return i&&(l=Bl(l,$h.getInnerShadowSpread(this,i))),n&&(l=Bl(l,n)),this.__layout.renderShapeSpread=l,h?Bl(h.__updateRenderSpread(),t):t}},{stintSet:Cl}=p,Ol={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Cl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Cl(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;Cl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!$h.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Cl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Pl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Kh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&$h.shadow(this,t,h),a&&(s.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e)),n&&(s.__isFills?Kh.fills(n,this,t,e):Kh.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&$h.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e)),c&&Qh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,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,Uh.string(e.color))}n&&(s.__isFills?Kh.fills(n,this,t,e):Kh.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Kh.strokes(o,this,t,e):Kh.stroke(o,this,t,e))}}else s.__pathInputed?Pl(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?Kh.fills(s,this,t,e):Kh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Kh.strokes(n,this,t,e):Kh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Pl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Kh.stroke(n,t,e,i),s&&Kh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&Kh.stroke(n,t,e,i)}const Ll={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Al;let Dl=Al=class extends rh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return 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 re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.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)),t?ts.toCanvasData(i,!0):i}getPathString(t,e,i){return ts.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||tl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Nn.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)}__drawPathByData(t,e){e?en.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,a(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Kh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Al.one(e)}static one(t,e,i,s,n){return le.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){qo()(this)}static registerData(t){Wo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};_e([Wo(ll)],Dl.prototype,"__",void 0),_e([Hh()],Dl.prototype,"zoomLayer",void 0),_e([uo("")],Dl.prototype,"id",void 0),_e([uo("")],Dl.prototype,"name",void 0),_e([uo("")],Dl.prototype,"className",void 0),_e([To("pass-through")],Dl.prototype,"blendMode",void 0),_e([Co(1)],Dl.prototype,"opacity",void 0),_e([Oo(!0)],Dl.prototype,"visible",void 0),_e([To(!1)],Dl.prototype,"locked",void 0),_e([Ro(!1)],Dl.prototype,"dim",void 0),_e([Ro(!1)],Dl.prototype,"dimskip",void 0),_e([Ao(0)],Dl.prototype,"zIndex",void 0),_e([Do(!1)],Dl.prototype,"mask",void 0),_e([Mo(!1)],Dl.prototype,"eraser",void 0),_e([go(0,!0)],Dl.prototype,"x",void 0),_e([go(0,!0)],Dl.prototype,"y",void 0),_e([yo(100,!0)],Dl.prototype,"width",void 0),_e([yo(100,!0)],Dl.prototype,"height",void 0),_e([fo(1,!0)],Dl.prototype,"scaleX",void 0),_e([fo(1,!0)],Dl.prototype,"scaleY",void 0),_e([mo(0,!0)],Dl.prototype,"rotation",void 0),_e([mo(0,!0)],Dl.prototype,"skewX",void 0),_e([mo(0,!0)],Dl.prototype,"skewY",void 0),_e([go(0,!0)],Dl.prototype,"offsetX",void 0),_e([go(0,!0)],Dl.prototype,"offsetY",void 0),_e([po(0,!0)],Dl.prototype,"scrollX",void 0),_e([po(0,!0)],Dl.prototype,"scrollY",void 0),_e([_o()],Dl.prototype,"origin",void 0),_e([_o()],Dl.prototype,"around",void 0),_e([uo(!1)],Dl.prototype,"lazy",void 0),_e([vo(1)],Dl.prototype,"pixelRatio",void 0),_e([Bo(0)],Dl.prototype,"renderSpread",void 0),_e([xo()],Dl.prototype,"path",void 0),_e([bo()],Dl.prototype,"windingRule",void 0),_e([bo(!0)],Dl.prototype,"closed",void 0),_e([yo(0)],Dl.prototype,"padding",void 0),_e([yo(!1)],Dl.prototype,"lockRatio",void 0),_e([yo()],Dl.prototype,"widthRange",void 0),_e([yo()],Dl.prototype,"heightRange",void 0),_e([uo(!1)],Dl.prototype,"draggable",void 0),_e([uo()],Dl.prototype,"dragBounds",void 0),_e([uo("auto")],Dl.prototype,"dragBoundsType",void 0),_e([uo(!1)],Dl.prototype,"editable",void 0),_e([Fo(!0)],Dl.prototype,"hittable",void 0),_e([Fo("path")],Dl.prototype,"hitFill",void 0),_e([Eo("path")],Dl.prototype,"hitStroke",void 0),_e([Fo(!1)],Dl.prototype,"hitBox",void 0),_e([Fo(!0)],Dl.prototype,"hitChildren",void 0),_e([Fo(!0)],Dl.prototype,"hitSelf",void 0),_e([Fo()],Dl.prototype,"hitRadius",void 0),_e([Io("")],Dl.prototype,"cursor",void 0),_e([To()],Dl.prototype,"fill",void 0),_e([Eo(void 0,!0)],Dl.prototype,"stroke",void 0),_e([Eo("inside")],Dl.prototype,"strokeAlign",void 0),_e([Eo(1,!0)],Dl.prototype,"strokeWidth",void 0),_e([Eo(!1)],Dl.prototype,"strokeWidthFixed",void 0),_e([Eo("none")],Dl.prototype,"strokeCap",void 0),_e([Eo("miter")],Dl.prototype,"strokeJoin",void 0),_e([Eo()],Dl.prototype,"dashPattern",void 0),_e([Eo(0)],Dl.prototype,"dashOffset",void 0),_e([Eo(10)],Dl.prototype,"miterLimit",void 0),_e([bo(0)],Dl.prototype,"cornerRadius",void 0),_e([bo()],Dl.prototype,"cornerSmoothing",void 0),_e([Nh()],Dl.prototype,"shadow",void 0),_e([Nh()],Dl.prototype,"innerShadow",void 0),_e([Nh()],Dl.prototype,"blur",void 0),_e([Nh()],Dl.prototype,"backgroundBlur",void 0),_e([Nh()],Dl.prototype,"grayscale",void 0),_e([Nh()],Dl.prototype,"filter",void 0),_e([To()],Dl.prototype,"placeholderColor",void 0),_e([uo(100)],Dl.prototype,"placeholderDelay",void 0),_e([uo({})],Dl.prototype,"data",void 0),_e([Vo(rh.prototype.reset)],Dl.prototype,"reset",null),Dl=Al=_e([Go(Rl),Go(Ol),jo()],Dl);let Ml=class extends Dl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Fl;_e([Wo(cl)],Ml.prototype,"__",void 0),_e([yo(0)],Ml.prototype,"width",void 0),_e([yo(0)],Ml.prototype,"height",void 0),Ml=_e([Go(fh),qo()],Ml);const Il=Qt.get("Leafer");let Wl=Fl=class extends Ml{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&$n.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Fl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const n=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,n,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new pe,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))),kr.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(Zr.RESTART):this.emitLeafer(Zr.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(Zr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=p.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ur(t,i))}__onResize(t){this.emitEvent(t),p.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 Zt(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(Zr.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=p.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(Zr.BEFORE_READY),this.emitLeafer(Zr.READY),this.emitLeafer(Zr.AFTER_READY),kr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Zr.VIEW_READY),kr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){kr.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(Zr.VIEW_COMPLETED),kr.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 re.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 Zr(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[Zr.START,()=>se.end(t)],[qr.START,this.updateLazyBounds,this],[Kr.START,this.__onCreated,this],[Kr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Gr.DATA,this.__onWatchData,this],[qr.END,this.__onLayoutEnd,this],[Kr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Fl.list.remove(this);try{this.stop(),this.emitLeafer(Zr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{to.clearRecycled()},100)}catch(t){Il.error(t)}}};t?e():setTimeout(e)}};Wl.list=new mh,_e([Wo(gl)],Wl.prototype,"__",void 0),_e([yo()],Wl.prototype,"pixelRatio",void 0),_e([uo("normal")],Wl.prototype,"mode",void 0),Wl=Fl=_e([qo()],Wl);let zl=class extends Dl{get __tag(){return"Rect"}};_e([Wo(fl)],zl.prototype,"__",void 0),zl=_e([Go(Ll),jo(),qo()],zl);const{add:Yl,includes:Nl,scroll:Xl}=Vt,Hl=zl.prototype,Vl=Ml.prototype;let jl=class extends Ml{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:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(Yl(a,o),Xl(a,i)),this.__updateRectRenderBounds(),t=!Nl(o,a),t&&"show"===r&&Yl(n,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};_e([Wo(ul)],jl.prototype,"__",void 0),_e([yo(100)],jl.prototype,"width",void 0),_e([yo(100)],jl.prototype,"height",void 0),_e([uo(!1)],jl.prototype,"resizeChildren",void 0),_e([Bo("show")],jl.prototype,"overflow",void 0),_e([Vo(Hl.__updateStrokeSpread)],jl.prototype,"__updateStrokeSpread",null),_e([Vo(Hl.__updateRenderSpread)],jl.prototype,"__updateRectRenderSpread",null),_e([Vo(Hl.__updateBoxBounds)],jl.prototype,"__updateRectBoxBounds",null),_e([Vo(Hl.__updateStrokeBounds)],jl.prototype,"__updateStrokeBounds",null),_e([Vo(Hl.__updateRenderBounds)],jl.prototype,"__updateRectRenderBounds",null),_e([Vo(Hl.__updateChange)],jl.prototype,"__updateRectChange",null),_e([Vo(Hl.__render)],jl.prototype,"__renderRect",null),_e([Vo(Vl.__render)],jl.prototype,"__renderGroup",null),jl=_e([jo(),qo()],jl);let Ul=class extends jl{get __tag(){return"Frame"}get isFrame(){return!0}};_e([Wo(pl)],Ul.prototype,"__",void 0),_e([To("#FFFFFF")],Ul.prototype,"fill",void 0),_e([Bo("hide")],Ul.prototype,"overflow",void 0),Ul=_e([qo()],Ul);const{moveTo:Gl,closePath:ql,ellipse:Kl}=ks;let Zl=class extends Dl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,o=t/2,r=e/2,a=this.__.path=[];i?(s||n?(i<1&&Kl(a,o,r,o*i,r*i,0,s,n,!1),Kl(a,o,r,o,r,0,n,s,!0),i<1&&ql(a)):(i<1&&(Kl(a,o,r,o*i,r*i),Gl(a,t,r)),Kl(a,o,r,o,r,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Gl(a,o,r),Kl(a,o,r,o,r,0,s,n,!1),ql(a)):Kl(a,o,r,o,r)}};_e([Wo(ml)],Zl.prototype,"__",void 0),_e([bo(0)],Zl.prototype,"innerRadius",void 0),_e([bo(0)],Zl.prototype,"startAngle",void 0),_e([bo(0)],Zl.prototype,"endAngle",void 0),Zl=_e([qo()],Zl);const{sin:Jl,cos:$l,PI:Ql}=Math,{moveTo:td,lineTo:ed,closePath:id,drawPoints:sd}=ks;let nd=class extends Dl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)sd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;td(e,o,0);for(let t=1;t<n;t++)ed(e,o+o*Jl(2*t*Ql/n),r-r*$l(2*t*Ql/n));id(e)}}};_e([Wo(yl)],nd.prototype,"__",void 0),_e([bo(3)],nd.prototype,"sides",void 0),_e([bo()],nd.prototype,"points",void 0),_e([bo(0)],nd.prototype,"curve",void 0),nd=_e([jo(),qo()],nd);const{sin:od,cos:rd,PI:ad}=Math,{moveTo:hd,lineTo:ld,closePath:dd}=ks;let cd=class extends Dl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];hd(r,n,0);for(let t=1;t<2*i;t++)ld(r,n+(t%2==0?n:n*s)*od(t*ad/i),o-(t%2==0?o:o*s)*rd(t*ad/i));dd(r)}};_e([Wo(vl)],cd.prototype,"__",void 0),_e([bo(5)],cd.prototype,"corners",void 0),_e([bo(.382)],cd.prototype,"innerRadius",void 0),cd=_e([qo()],cd);const{moveTo:ud,lineTo:gd,drawPoints:pd}=ks,{rotate:_d,getAngle:fd,getDistance:md,defaultPoint:yd}=dt;let vd=class extends Dl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&_d(i,e),i}set toPoint(t){this.width=md(yd,t),this.rotation=fd(yd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?pd(e,t.points,t.curve,t.closed):(ud(e,0,0),gd(e,this.width,0))}};_e([Wo(_l)],vd.prototype,"__",void 0),_e([ko("center")],vd.prototype,"strokeAlign",void 0),_e([yo(0)],vd.prototype,"height",void 0),_e([bo()],vd.prototype,"points",void 0),_e([bo(0)],vd.prototype,"curve",void 0),_e([bo(!1)],vd.prototype,"closed",void 0),vd=_e([qo()],vd);let wd=class extends zl{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}};_e([Wo(Sl)],wd.prototype,"__",void 0),_e([yo("")],wd.prototype,"url",void 0),wd=_e([qo()],wd);const xd=wd;let bd=class extends zl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new no({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new zr(zr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),o=new mt;e&&o.translate(e.x,e.y),i&&(a(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),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()}};_e([Wo(El)],bd.prototype,"__",void 0),_e([Xh(100)],bd.prototype,"width",void 0),_e([Xh(100)],bd.prototype,"height",void 0),_e([Xh(1)],bd.prototype,"pixelRatio",void 0),_e([Xh(!0)],bd.prototype,"smooth",void 0),_e([uo(!1)],bd.prototype,"safeResize",void 0),_e([Xh()],bd.prototype,"contextSettings",void 0),bd=_e([qo()],bd);const{copyAndSpread:kd,includes:Sd,spread:Ed,setList:Bd}=Vt,{stintSet:Td}=p;let Rd=class extends Dl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Gh.number(e,n),t.__letterSpacing=Gh.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,Td(t,"__padding",l&&W.fourNumber(l)),Td(t,"__clipText","show"!==h&&!t.__autoSize),Td(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Ed(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),p.stintSet(this,"isOverflow",!Sd(h,a)),this.isOverflow?(Bd(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;kd(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()}};_e([Wo(kl)],Rd.prototype,"__",void 0),_e([yo(0)],Rd.prototype,"width",void 0),_e([yo(0)],Rd.prototype,"height",void 0),_e([To()],Rd.prototype,"boxStyle",void 0),_e([uo(!1)],Rd.prototype,"resizeFontSize",void 0),_e([To("#000000")],Rd.prototype,"fill",void 0),_e([ko("outside")],Rd.prototype,"strokeAlign",void 0),_e([Fo("all")],Rd.prototype,"hitFill",void 0),_e([yo("")],Rd.prototype,"text",void 0),_e([yo("")],Rd.prototype,"placeholder",void 0),_e([yo("caption")],Rd.prototype,"fontFamily",void 0),_e([yo(12)],Rd.prototype,"fontSize",void 0),_e([yo("normal")],Rd.prototype,"fontWeight",void 0),_e([yo(!1)],Rd.prototype,"italic",void 0),_e([yo("none")],Rd.prototype,"textCase",void 0),_e([yo("none")],Rd.prototype,"textDecoration",void 0),_e([yo(0)],Rd.prototype,"letterSpacing",void 0),_e([yo({type:"percent",value:1.5})],Rd.prototype,"lineHeight",void 0),_e([yo(0)],Rd.prototype,"paraIndent",void 0),_e([yo(0)],Rd.prototype,"paraSpacing",void 0),_e([yo("x")],Rd.prototype,"writingMode",void 0),_e([yo("left")],Rd.prototype,"textAlign",void 0),_e([yo("top")],Rd.prototype,"verticalAlign",void 0),_e([yo(!0)],Rd.prototype,"autoSizeAlign",void 0),_e([yo("normal")],Rd.prototype,"textWrap",void 0),_e([yo("show")],Rd.prototype,"textOverflow",void 0),_e([To(!1)],Rd.prototype,"textEditing",void 0),Rd=_e([qo()],Rd);let Cd=class extends Dl{get __tag(){return"Path"}};_e([Wo(wl)],Cd.prototype,"__",void 0),_e([ko("center")],Cd.prototype,"strokeAlign",void 0),Cd=_e([qo()],Cd);let Od=class extends Ml{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Cd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){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,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};_e([Wo(xl)],Od.prototype,"__",void 0),_e([(t,e)=>{oo(t,e,{get(){return this.__path}})}],Od.prototype,"path",void 0),Od=_e([Go(Ys,["set","path","paint"]),qo()],Od);let Pd=class extends Wl{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&&ae.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(t){const e=new Wl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[qr.END,this.__onReady,this],[Kr.START,this.__onCreated,this],[Kr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Kr.END,this.__onChildRenderEnd,this))}};Pd=_e([qo()],Pd);const Ld={},Ad={isHoldSpaceKey:()=>Ad.isHold("Space"),isHold:t=>Ld[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Ld[t]||(Ld[t]=!0)},setUpCode(t){Ld[t]=!1}},Dd={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 Md extends Dr{get spaceKey(){return Ad.isHoldSpaceKey()}get left(){return Dd.left(this)}get right(){return Dd.right(this)}get middle(){return Dd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ad.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){ue.changeName(t,e)}}const{min:Fd,max:Id,abs:Wd}=Math,{float:zd,sign:Yd}=W,{minX:Nd,maxX:Xd,minY:Hd,maxY:Vd}=Vt,jd=new qt,Ud=new qt,Gd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&qd.getValidMove(t.__localBoxBounds,qd.getDragBounds(t),s,e,!0),qd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&qd.getValidScaleOf(t.__localBoxBounds,qd.getDragBounds(t),o,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 o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),qd.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),qd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=zd(s.x),s.y=zd(s.y),s},getValidScaleOf(t,e,i,s,n,o,a){a||(n=Object.assign({},n)),Ud.set(e),jd.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,g,p,_,f=1,m=1;return qd.isInnerMode(t,e,i,"width")?(n.x<0&&jd.scaleOf(s,f=1/n.x,1),p=zd(jd.minX-Ud.minX),_=zd(Ud.maxX-jd.maxX),u=h&&p>0?1+p/(h*jd.width):1,g=l&&_>0?1+_/(l*jd.width):1,f*=Id(u,g)):(n.x<0&&((zd(Nd(t)-Nd(e))<=0||zd(Xd(e)-Xd(t))<=0)&&jd.scaleOf(s,f=1/n.x,1),jd.unsign()),p=zd(Ud.minX-jd.minX),_=zd(jd.maxX-Ud.maxX),u=h&&p>0?1-p/(h*jd.width):1,g=l&&_>0?1-_/(l*jd.width):1,f*=Fd(u,g)),qd.isInnerMode(t,e,i,"height")?(n.y<0&&jd.scaleOf(s,1,m=1/n.y),p=zd(jd.minY-Ud.minY),_=zd(Ud.maxY-jd.maxY),u=d&&p>0?1+p/(d*jd.height):1,g=c&&_>0?1+_/(c*jd.height):1,m*=Id(u,g),o&&(u=Id(Wd(f),Wd(m)),f=Yd(f)*u,m=Yd(m)*u)):(n.y<0&&((zd(Hd(t)-Hd(e))<=0||zd(Vd(e)-Vd(t))<=0)&&jd.scaleOf(s,1,m=1/n.y),jd.unsign()),p=zd(Ud.minY-jd.minY),_=zd(jd.maxY-Ud.maxY),u=d&&p>0?1-p/(d*jd.height):1,g=c&&_>0?1-_/(c*jd.height):1,m*=Fd(u,g)),n.x*=r(f)?f:1,n.y*=r(m)?m:1,n}},qd=Gd;let Kd=class extends Md{};Kd.POINTER="pointer",Kd.BEFORE_DOWN="pointer.before_down",Kd.BEFORE_MOVE="pointer.before_move",Kd.BEFORE_UP="pointer.before_up",Kd.DOWN="pointer.down",Kd.MOVE="pointer.move",Kd.UP="pointer.up",Kd.OVER="pointer.over",Kd.OUT="pointer.out",Kd.ENTER="pointer.enter",Kd.LEAVE="pointer.leave",Kd.TAP="tap",Kd.DOUBLE_TAP="double_tap",Kd.CLICK="click",Kd.DOUBLE_CLICK="double_click",Kd.LONG_PRESS="long_press",Kd.LONG_TAP="long_tap",Kd.MENU="pointer.menu",Kd.MENU_TAP="pointer.menu_tap",Kd=_e([Ko()],Kd);const Zd=Kd,Jd={};let $d=class extends Kd{static setList(t){this.list=t instanceof mh?t:new mh(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),Gd.axisMove(t,n),n}static limitMove(t,e){Gd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Jd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Jd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Jd,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 Vt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Vt.unsign(i),i}assignMove(t){Jd.x=t?this.totalX:this.moveX,Jd.y=t?this.totalY:this.moveY}};$d.BEFORE_DRAG="drag.before_drag",$d.START="drag.start",$d.DRAG="drag",$d.END="drag.end",$d.OVER="drag.over",$d.OUT="drag.out",$d.ENTER="drag.enter",$d.LEAVE="drag.leave",$d=_e([Ko()],$d);const Qd=$d;let tc=class extends Kd{static setList(t){$d.setList(t)}static setData(t){$d.setData(t)}};tc.DROP="drop",tc=_e([Ko()],tc);let ec=class extends $d{};ec.BEFORE_MOVE="move.before_move",ec.START="move.start",ec.MOVE="move",ec.END="move.end",ec=_e([Ko()],ec);let ic=class extends Md{};ic=_e([Ko()],ic);const sc=ic;let nc=class extends Kd{};nc.BEFORE_ROTATE="rotate.before_rotate",nc.START="rotate.start",nc.ROTATE="rotate",nc.END="rotate.end",nc=_e([Ko()],nc);let oc=class extends $d{};oc.SWIPE="swipe",oc.LEFT="swipe.left",oc.RIGHT="swipe.right",oc.UP="swipe.up",oc.DOWN="swipe.down",oc=_e([Ko()],oc);let rc=class extends Kd{};rc.BEFORE_ZOOM="zoom.before_zoom",rc.START="zoom.start",rc.ZOOM="zoom",rc.END="zoom.end",rc=_e([Ko()],rc);let ac=class extends Md{};ac.BEFORE_DOWN="key.before_down",ac.BEFORE_UP="key.before_up",ac.DOWN="key.down",ac.HOLD="key.hold",ac.UP="key.up",ac=_e([Ko()],ac);const hc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?oc.UP:t>45&&t<135?oc.DOWN:t<=45&&t>=-45?oc.RIGHT:oc.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:lc.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,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new mh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>ar.draggable(t)||!t.isLeafer&&t.hasEvent($d.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},lc=hc,dc=new mh,{getDragEventData:cc,getDropEventData:uc,getSwipeEventData:gc}=hc;class pc{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=cc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=$d.list||this.draggableList||dc;return this.dragging&&(s?t?dc:new mh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(ec.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Dd.left(t),this.dragging&&(this.interaction.emit($d.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],ar.draggable(e)){this.draggableList=new mh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=cc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(ec.BEFORE_MOVE,this.dragData),e.emit(ec.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit($d.BEFORE_DRAG,this.dragData),e.emit($d.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:r}=e.p,h=!r||!!t;s.forEach(e=>{if(e.draggable){const s=o(e.draggable),l=$d.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);r&&!s&&t?ar.animateMove(e,l,a(r)?r:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit($d.OUT,t,i),e.emit($d.OVER,t,s)):e.emit($d.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit($d.LEAVE,t,i,s),e.emit($d.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=cc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(ec.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit($d.END,r),this.swipe(t,i,s,r),this.drop(t,n,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=gc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=uc(t,e,$d.data);s.path=i,this.interaction.emit(tc.DROP,s),this.interaction.emit($d.LEAVE,t,i)}dragReset(){$d.list=$d.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const _c=Qt.get("emit");const fc=["move","zoom","rotate","key"];function mc(t,e,i,s,n){if(fc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!vc(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&yc(o,e,i,s,n)}}function yc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!vc(t,n)&&(el.updateEventStyle&&!s&&el.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ue.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function vc(t,e){return e&&e.has(t)}const wc={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:xc,pathCanDrag:bc,pathHasOutside:kc}=hc;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&&Dd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Dd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ad.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=p.clone(wc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new mh(t),this.createTransformer(),this.dragger=new pc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Dd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Kd.BEFORE_DOWN,t),this.emit(Kd.DOWN,t),Dd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Dd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Dd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Kd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=dt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Kd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Dd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Kd.BEFORE_UP,t),this.emit(Kd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Kd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Kd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(ac.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ad.setDownCode(e),this.emit(ac.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(ac.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(ac.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ad.setUpCode(e),this.emit(ac.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new mh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Kd.OUT,t,i),this.emit(Kd.OVER,t,e)):this.emit(Kd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(Kd.LEAVE,t,i,e),this.emit(Kd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Kd.LEAVE,t),this.dragger.dragging&&this.emit(tc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[Kd.DOUBLE_TAP,Kd.DOUBLE_CLICK].some(e=>xc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;v.backgrounder||t.origin||o&&o.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!kc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!bc(t.path))&&!kc(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))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Kd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,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(t){this.emit(Kd.TAP,t),this.emit(Kd.CLICK,t)}emitDoubleTap(t){this.emit(Kd.DOUBLE_TAP,t),this.emit(Kd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(Kd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Kd.LONG_TAP,t),(xc(t.path,Kd.LONG_TAP)||xc(t.path,Kd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ur.RESIZE,this.__onResize,this)],t.once(Zr.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 o=i.length-1;o>-1;o--){if(n=i.list[o],yc(n,t,e,!0,s))return;n.isApp&&mc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&mc(n,t,e,!1,s),yc(n,t,e,!1,s))return}catch(t){_c.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 Ec{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ec.custom={};class Bc extends pe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new mh,this.pixelList=new mh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.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()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())};const{toInnerRadiusPointOf:Tc,copy:Rc,setRadius:Cc}=dt,{hitRadiusPoint:Oc,hitPoint:Pc}=Vt,Lc={},Ac={},Dc=rh.prototype;Dc.hit=function(t,e=0){this.updateLayout(),Rc(Ac,t),Cc(Ac,e);const i=this.__world;return!!(e?Oc(i,Ac):Pc(i,Ac))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Ac),e,{target:this}):this.__hitWorld(Ac))},Dc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Rc(Lc,t),Cc(t=Lc,e.hitRadius)),Tc(t,i,Lc),e.hitBox||n){if(Vt.hitRadiusPoint(s.boxBounds,Lc))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Lc)},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 Mc=new mt,Fc=Dl.prototype;Fc.__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 o=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=v.image.hitCanvasSize,r=o.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),to.patternLocked=!0,this.__renderShape(o,{matrix:Mc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),to.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},Fc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ic=Dl.prototype,Wc=zl.prototype,zc=jl.prototype;Wc.__updateHitCanvas=zc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ic.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Wc.__hitFill=zc.__hitFill=function(t){return this.__hitCanvas?Ic.__hitFill.call(this,t):Vt.hitRadiusPoint(this.__layout.boxBounds,t)},Rd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},Ml.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Yc=Oe.prototype;function Nc(t,e,i){t.__.__font?Kh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Xc(t,e,i,s,n){const o=i.__;c(t)?Kh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Kh.strokeArrow(t,i,s,n)}function Hc(t,e,i,s,n){const o=i.__;c(t)?Kh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),Kh.drawTextStroke(i,s,n))}function Vc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Hc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",Kh.fillText(i,o,n),o.blendMode="normal",ar.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}Yc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Yc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Yc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:jc,copyAndSpread:Uc,toOuterOf:Gc,getOuterOf:qc,getByMove:Kc,move:Zc,getIntersectData:Jc}=Vt,$c={};let Qc;const{stintSet:tu}=p,{hasTransparent:eu}=Uh;function iu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:r}=i.__layout;switch(e.type){case"image":n=Zh.image(i,t,e,r,!Qc||!Qc[e.url]);break;case"linear":n=Jh.linearGradient(e,r);break;case"radial":n=Jh.radialGradient(e,r);break;case"angular":n=Jh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;n={type:o,style:Uh.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:Uh.string(e)})}if(n&&(n.originPaint=e,o(n.style)&&eu(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const su={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];d(a)||(a=[a]),Qc=Zh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=iu(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(tu(i,"__isAlphaPixelFill",n),tu(i,"__isTransparentFill",o)):(tu(i,"__isAlphaPixelStroke",n),tu(i,"__isTransparentStroke",o),tu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Nc(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,Zh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}o.blendMode&&(i.blendMode=o.blendMode),Nc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Nc(e,i,s),i.restoreBlendMode()):Nc(e,i,s)}},fillPathOrText:Nc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.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)Kh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Xc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Xc(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)Xc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Xc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),ar.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Kh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Hc(t,1,e,i,s);break;case"inside":Vc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Hc(t,2,e,i,s):Vc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[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(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;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(r=t[l],(!r.image||!Zh.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?Kh.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?Kh.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;Gc(r.strokeSpread?(Uc($c,r.boxBounds,r.strokeSpread),$c):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(v.fullImageShadow)s=a;else{const t=r.renderShapeSpread?jc(n,R.swapAndScale(r.renderShapeSpread,p,_)):n;s=Jc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=qc(a,c),h=Kc(u,-c.e,-c.f),l=qc(o,c),Zc(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let nu,ou=new qt;const{isSame:ru}=Vt;function au(t,e,i,s,n,o){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||Zh.createData(n,s,i,o),!0}function hu(t,e){cu(t,zr.LOAD,e)}function lu(t,e){cu(t,zr.LOADED,e)}function du(t,e,i){e.error=i,t.forceUpdate("surface"),cu(t,zr.ERROR,e)}function cu(t,e,i){t.hasEvent(e)&&t.emitEvent(new zr(e,i))}function uu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:gu,translate:pu}=Q,_u=new qt,fu={},mu={};function yu(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 vu={},wu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:xu,set:bu,rotateOfOuter:ku,translate:Su,scaleOfOuter:Eu,multiplyParent:Bu,scale:Tu,rotate:Ru,skew:Cu}=Q;function Ou(t,e,i,s,n,o,r,a){r&&Ru(t,r),a&&Cu(t,a.x,a.y),n&&Tu(t,n,o),Su(t,e.x+i,e.y+s)}const{get:Pu,scale:Lu,copy:Au}=Q,{getFloorScale:Du}=W,{abs:Mu}=Math;const Fu={image:function(t,e,i,s,n){let o,r;const a=to.get(i);return nu&&i===nu.paint&&ru(s,nu.boxBounds)?o=nu.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),nu=a.use>1?{leafPaint:o,paint:i,boxBounds:ou.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(au(t,e,i,a,o,s),n&&(hu(t,r),lu(t,r))):a.error?n&&du(t,r,a.error):(n&&(uu(t,!0),hu(t,r)),o.loadId=a.load(()=>{uu(t,!1),t.destroyed||(au(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),lu(t,r)),o.loadId=void 0},e=>{uu(t,!1),du(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,n){const{scaleX:o,scaleY:r}=Zh.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===o+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&Ur.isResizing(i)||d||(e=v.image.isLarge(a,o,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Zh.drawImage(t,o,r,i,s,n),!0):(!t.style||l.sync||d?Zh.createPattern(t,i,s,n):Zh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let g,{width:p,height:_}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),g&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,_),n.restore()):(r.scaleX&&(p*=r.scaleX,_*=r.scaleY),n.drawImage(c,0,0,p,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,to.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],d(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=to.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Zh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=Zh.getImageRenderScaleData(t,e,i,s),r=n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!v.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Zh.getPatternFixScale(t,n,o);let d,c,u,{width:g,height:p}=i;l&&(n*=l,o*=l),g*=n,p*=o,h&&(c=h.x*n/Mu(s.scaleX||1),u=h.y*o/Mu(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=Du(g+(c||0)),o*=Du(p+(u||0)),d=Pu(),a&&Au(d,a),Lu(d,1/n,1/o));const _=i.getCanvas(g,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=v.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){t.data=Zh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=_u.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:g,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Vt.set(mu,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,fu),b=fu.scaleX,k=fu.scaleY),(h||m||f)&&(b&&Vt.scale(mu,b,k,!0),h&&Tt.toPoint(h,mu,e,mu,!0,!0))):v&&!g||(b=k=Vt.getFitScale(e,mu,"fit"!==a),Vt.put(e,i,h,b,!1,mu),Vt.scale(mu,b,k,!0)),l&&dt.move(mu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,Zh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(mu.x||mu.y||b||_||g||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Zh.clipMode(w,e,mu.x,mu.y,b,k,g,p,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||p)&&Zh.repeatMode(w,e,s,n,mu.x,mu.y,b,k,g,p,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;c(t)?(o=t.x,r=t.y):o=r=t;return{x:yu(o,i,n.width,e&&e.x),y:yu(r,s,n.height,e&&e.y)}}(m,i&&f,mu.width,mu.height,e));break;default:b&&Zh.fillOrFitMode(w,e,mu.x,mu.y,b,k,g)}return w.transform||(e.x||e.y)&&pu(w.transform=gu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=xu(),{x:o,y:r}=e;o||r?Su(n,o,r):n.onlyScale=!0,Tu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=xu();Su(a,e.x+i,e.y+s),Tu(a,n,o),r&&ku(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const d=xu();Ou(d,e,i,s,n,o,r,a),h&&(r||a?(bu(wu),Eu(wu,e,h,l),Bu(d,wu)):Eu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=xu();if(c)Ou(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)ku(u,{x:i/2,y:s/2},h);else switch(Ru(u,h),h){case 90:Su(u,s,0);break;case 180:Su(u,i,s);break;case 270:Su(u,0,i)}vu.x=e.x+n,vu.y=e.y+o,Su(u,vu.x,vu.y),r&&Eu(u,vu,r,a)}t.transform=u}},{toPoint:Iu}=St,{hasTransparent:Wu}=Uh,zu={},Yu={};function Nu(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=Uh.string(n,s)):(a=n.offset,r=Uh.string(n.color,s)),e.addColorStop(a,r),!h&&Wu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Xu,getDistance:Hu}=dt,{get:Vu,rotateOfOuter:ju,scaleOfOuter:Uu}=Q,{toPoint:Gu}=St,qu={},Ku={};function Zu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Xu(e,i);o=Vu(),n?(Uu(o,e,r/a*(s||1),1),ju(o,e,t+90)):(Uu(o,e,1,r/a*(s||1)),ju(o,e,t))}return o}const{getDistance:Ju}=dt,{toPoint:$u}=St,Qu={},tg={};const eg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Iu(i||"top",e,zu),Iu(s||"bottom",e,Yu);const r=v.canvas.createLinearGradient(zu.x,zu.y,Yu.x,Yu.y),a={type:n,style:r};return Nu(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;Gu(i||"center",e,qu),Gu(s||"bottom",e,Ku);const a=v.canvas.createRadialGradient(qu.x,qu.y,0,qu.x,qu.y,Hu(qu,Ku)),h={type:n,style:a};Nu(h,a,t.stops,o);const l=Zu(e,qu,Ku,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;$u(i||"center",e,Qu),$u(s||"bottom",e,tg);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,Qu.x,Qu.y):v.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Ju(Qu,tg)),h={type:n,style:a};Nu(h,a,t.stops,o);const l=Zu(e,Qu,tg,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Zu},{copy:ig,move:sg,toOffsetOutBounds:ng}=Vt,{max:og,abs:rg}=Math,ag={},hg=new mt,lg={};function dg(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=rg(t.spread||0),r=og(r,n+o-s),a=og(a,n+o+i),h=og(h,n+o+s),l=og(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function cg(t,e,i){const{shapeBounds:s}=i;let n,o;v.fullImageShadow?(ig(ag,t.bounds),sg(ag,e.x-s.x,e.y-s.y),n=t.bounds,o=ag):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:ug}=Vt,gg={};const pg=dg;const _g={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;ng(h,lg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(lg.offsetX+(r.x||0)*c*f,lg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Uh.string(r.color)),n=$h.getShadowTransform(t,g,i,r,lg,f),n&&g.setTransform(n),cg(g,lg,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;ug(h,gg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(gg.offsetX+(r.x||0)*c*f,gg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=$h.getShadowTransform(t,g,i,r,gg,f,!0),n&&g.setTransform(n),cg(g,gg,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Uh.string(r.color),"source-in"),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.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:dg,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return hg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),hg}},isTransformShadow(t){},getInnerShadowSpread:pg},{excludeRenderBounds:fg}=_r;let mg;function yg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":mg||(mg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);wg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":wg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function vg(t){return t.getSameCanvas(!1,!0)}function wg(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}Ml.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(yg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||fg(i,e)||i.__render(t,e),o=i.__.opacity,mg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=vg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=vg(t)),n||(n=vg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&yg(this,r,t,n,s,o,void 0,!1),fg(i,e)||i.__render(n||t,e),d&&yg(this,r,t,n,s,o,d,!1)}yg(this,r,t,n,s,o,void 0,!0)};const xg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",bg=xg+"_#~&*+\\=|≮≯≈≠=…",kg=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 Sg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Eg=Sg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Bg=Sg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Tg=Sg(xg),Rg=Sg(bg),Cg=Sg("- —/~|┆·");var Og;!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"}(Og||(Og={}));const{Letter:Pg,Single:Lg,Before:Ag,After:Dg,Symbol:Mg,Break:Fg}=Og;function Ig(t){return Eg[t]?Pg:Cg[t]?Fg:Bg[t]?Ag:Tg[t]?Dg:Rg[t]?Mg:kg.test(t)?Lg:Pg}const Wg={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function zg(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:Yg}=Wg,{Letter:Ng,Single:Xg,Before:Hg,After:Vg,Symbol:jg,Break:Ug}=Og;let Gg,qg,Kg,Zg,Jg,$g,Qg,tp,ep,ip,sp,np,op,rp,ap,hp,lp,dp=[];function cp(t,e){ep&&!tp&&(tp=ep),Gg.data.push({char:t,width:e}),Kg+=e}function up(){Zg+=Kg,Gg.width=Kg,qg.words.push(Gg),Gg={data:[]},Kg=0}function gp(){rp&&(ap.paraNumber++,qg.paraStart=!0,rp=!1),ep&&(qg.startCharSize=tp,qg.endCharSize=ep,tp=0),qg.width=Zg,hp.width?Yg(qg):lp&&pp(),dp.push(qg),qg={words:[]},Zg=0}function pp(){Zg>(ap.maxWidth||0)&&(ap.maxWidth=Zg)}const{top:_p,right:fp,bottom:mp,left:yp}=xt;function vp(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 wp={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[yp],n-=a[fp]+a[yp],!n&&(n=.01)):e.autoSizeAlign||(i=a[yp]),r?(s=a[_p],r-=a[_p]+a[mp],!r&&(r=.01)):e.autoSizeAlign||(s=a[_p]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){ap=t,dp=t.rows,hp=t.bounds,lp=!hp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=v,{width:a}=hp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;rp=!0,sp=null,tp=Qg=ep=Kg=Zg=0,Gg={data:[]},qg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)$g=e[i],"\n"===$g?(Kg&&up(),qg.paraEnd=!0,gp(),rp=!0):(ip=Ig($g),ip===Ng&&"none"!==o&&($g=zg($g,o,!Kg)),Qg=r.measureText($g).width,s&&(s<0&&(ep=Qg),Qg+=s),np=ip===Xg&&(sp===Xg||sp===Ng)||sp===Xg&&ip!==Vg,op=!(ip!==Hg&&ip!==Xg||sp!==jg&&sp!==Vg),Jg=rp&&n?a-n:a,t&&a&&Zg+Kg+Qg>Jg&&(h?(Kg&&up(),Zg&&gp()):(op||(op=ip===Ng&&sp==Vg),np||op||ip===Ug||ip===Hg||ip===Xg||Kg+Qg>Jg?(Kg&&up(),Zg&&gp()):Zg&&gp()))," "===$g&&!0!==rp&&Zg+Kg===0||(ip===Ug?(" "===$g&&Kg&&up(),cp($g,Qg),up()):np||op?(Kg&&up(),cp($g,Qg)):cp($g,Qg)),sp=ip);Kg&&up(),Zg&&gp(),dp.length>0&&(dp[dp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{ap.paraNumber++,Zg=r.measureText(t).width,dp.push({x:n||0,text:t,width:Zg,paraStart:!0}),lp&&pp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":vp(e,"x",t[yp]);break;case"right":vp(e,"x",-t[fp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":vp(e,"y",t[_p]);break;case"bottom":vp(e,"y",-t[mp])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(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===_?(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&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:o}=t;let{textOverflow:r}=e;if(n.splice(o),r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?v.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?n:[n[o-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:r,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:o}=e;switch(t.decorationHeight=n/11,c(o)?(i=o.type,o.color&&(t.decorationColor=Uh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,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 xp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(o(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const r=t.r+","+t.g+","+t.b;return 1===n?"rgb("+r+")":"rgba("+r+","+n+")"}};function bp(t){return t?d(t)?t:[t]:[]}Object.assign(jh,wp),Object.assign(Uh,xp),Object.assign(Kh,su),Object.assign(Zh,Fu),Object.assign(Jh,eg),Object.assign($h,_g),Object.assign(ae,{interaction:(t,e,i,s)=>new Sc(t,e,i,s),hitCanvas:(t,e)=>new wh(t,e),hitCanvasManager:()=>new Bc}),bh();class kp extends Dr{get list(){return bp(this.value)}get oldList(){return bp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Sp(t){return(e,i)=>{const s="_"+i;oo(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?kp.BEFORE_SELECT:kp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new kp(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}kp.BEFORE_SELECT="editor.before_select",kp.SELECT="editor.select",kp.AFTER_SELECT="editor.after_select",kp.BEFORE_HOVER="editor.before_hover",kp.HOVER="editor.hover";const{abs:Ep}=Math,{copy:Bp,scale:Tp}=Q,{setListWithFn:Rp}=Vt,{worldBounds:Cp}=_r,Op={a:1,b:0,c:0,d:1,e:0,f:0},Pp={x:0,y:0,width:0,height:0};class Lp extends Dl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Rp(Pp,e,Cp),t&&this.set(t),this.set(Pp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Ep(c.scaleX),l=Ep(c.scaleY);if(Bp(Op,c),Op.half=a%2,i!==l){Tp(Op,1/i,1/l),t.setWorld(Op,e.matrix),t.beginPath(),n.strokeWidth=a;const{x:o,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,r*l,h*i,d*l)}else t.setWorld(Op,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Ep(c.scaleX);r&&(o(r)?Kh.stroke(r,this,t,e):Kh.strokes(r,this,t,e)),h&&(o(h)?Kh.fill(h,this,t,e):Kh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}_e([Sp(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],Lp.prototype,"target",void 0);class Ap extends Ml{constructor(t){super(t),this.strokeArea=new zl({strokeAlign:"center"}),this.fillArea=new zl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Dp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Mp([t],i,e),i}};function Mp(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&Mp(s.children,e,i)}}const{findOne:Fp,findByBounds:Ip}=Dp;class Wp extends Ml{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Lp,this.targetStroker=new Lp,this.bounds=new qt,this.selectArea=new Ap,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new mh(Ip(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Fp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new mh(this.editor.editBox.rect)};return Fp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Fp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[kp.HOVER,this.onHover,this],[kp.SELECT,this.onSelect,this]]),e.on_([[Kd.MOVE,this.onPointerMove,this],[Kd.BEFORE_DOWN,this.onBeforeDown,this],[Kd.TAP,this.onTap,this],[$d.START,this.onDragStart,this,!0],[$d.DRAG,this.onDrag,this],[$d.END,this.onDragEnd,this],[ec.MOVE,this.onAutoMove,this],[[rc.ZOOM,ec.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:zp,top:Yp,topRight:Np,right:Xp,bottomRight:Hp,bottom:Vp,bottomLeft:jp,left:Up}=bt,{toPoint:Gp}=St,{within:qp,sign:Kp}=W,{abs:Zp}=Math,Jp={getScaleData(t,e,i,s,n,o,r,h){let l,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Kp(x),S=Kp(b),E=h?x:k*p.width/v,B=h?b:S*p.height/w;if(a(s))u=g=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case Yp:g=t,l="bottom";break;case Xp:u=e,l="left";break;case Vp:g=r,l="top";break;case Up:u=a,l="right";break;case zp:g=t,u=a,l="bottom-right";break;case Np:g=t,u=e,l="bottom-left";break;case Hp:g=r,u=e,l="top-left";break;case jp:g=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case Yp:case Vp:u=g;break;case Up:case Xp:g=u;break;default:d=Math.sqrt(Zp(u*g)),u=Kp(u)*d,g=Kp(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(Gp(o||l,p,c,!0),m){const e={x:u,y:g};Gd.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=qp(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=qp(e*g,f)/e}return T&&Zp(u*y.width)<1&&(u=Kp(u)/y.width),R&&Zp(g*y.height)<1&&(g=Kp(g)/y.height),n&&u!==g&&(d=Math.min(Zp(u),Zp(g)),u=Kp(u)*d,g=Kp(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case zp:o="bottom-right";break;case Np:o="bottom-left";break;case Hp:o="top-left";break;case jp:o="top-right";break;default:o="center"}return Gp(n||o,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Yp:case zp:o={x:.5,y:0},n="bottom",a=1;break;case Vp:case Hp:o={x:.5,y:1},n="top",a=1;break;case Up:case jp:o={x:0,y:.5},n="right",h=1;break;case Xp:case Np:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,Gp(s||n,t,r,!0);const c=dt.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Up:t=Xp;break;case zp:t=Np;break;case jp:t=Hp;break;case Xp:t=Up;break;case Np:t=zp;break;case Hp:t=jp}if(i)switch(t){case Yp:t=Vp;break;case zp:t=jp;break;case Np:t=Hp;break;case Vp:t=Yp;break;case jp:t=zp;break;case Hp:t=Np}return t}},$p={};function Qp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return t_(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*(Jp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(W.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;$p[S]?i.cursor=$p[S]:$p[S]=i.cursor={url:e_(x,h),x:b,y:k}}function t_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function e_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class i_ extends jl{constructor(t){super(t),this.useFastShadow=!0}}const s_=["top","right","bottom","left"],n_=void 0;class o_ extends Ml{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return o(t)||o(e)||o(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Ml,this.rect=new i_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new i_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Ml({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new i_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new i_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new i_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=r[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:n_},e.rect||{}));const f=n(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&p.stintSet(t.__world,"ignorePixelSnap",d),t_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:p,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Vt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=a(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)St.toPoint(St.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!p),v.visible=y&&p&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,_&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=s_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=s_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Jp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:n_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return d(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return d(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return d(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}Qp(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Ur.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof $d||t instanceof ec)&&this.transformTool.onMove(t),this.resizing&&(Ur.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),o(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case ec.START:this.onTransformStart(t);break;case ec.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case rc.START:this.onTransformStart(t);break;case rc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case rc.START:this.onTransformStart(t);break;case rc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Qp(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Rd)||t.find(t=>t instanceof Rd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[$d.START,this.onDragStart,this],[$d.DRAG,this.onDrag,this],[$d.END,this.onDragEnd,this],[Kd.ENTER,e=>{this.enterPoint=t,Qp(this,e)}],[Kd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[Kd.DOUBLE_TAP,this.onDoubleTap,this],[Kd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[ac.HOLD,ac.UP],this.onKey,this],[ac.DOWN,this.onArrow,this],[[ec.START,ec.BEFORE_MOVE,ec.END],this.onMove,this,!0],[[rc.START,rc.BEFORE_ZOOM,rc.END],this.onScale,this,!0],[[nc.START,nc.BEFORE_ROTATE,nc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const r_={x:0,y:0,width:1e5,height:1e5};class a_ extends Dl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,r_),Object.assign(this.__world,r_)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const h_='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',l_={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${h_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${h_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${h_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},d_=new qt;function c_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{d_.setListWithFn(i,t=>t.getBounds("box","page")),0===d_.width&&(d_.width=.1),0===d_.height&&(d_.height=.1),e.reset(d_.get())}),s.add(e)}const u_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),g_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),p_={group(t,e,i){t.sort(g_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Ml(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(u_);const r=new mt(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(u_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(g_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},__=Qt.get("EditToolCreator");function f_(){return t=>{y_.register(t)}}const m_=f_,y_={list:{},register(t){const{tag:e}=t.prototype;v_[e]&&__.repeat(e),v_[e]=t},get:(t,e)=>new v_[t](e)},{list:v_}=y_;class w_ extends kp{constructor(t,e){super(t,e)}}w_.BEFORE_OPEN="innerEditor.before_open",w_.OPEN="innerEditor.open",w_.BEFORE_CLOSE="innerEditor.before_close",w_.CLOSE="innerEditor.close";class x_ extends kp{constructor(t,e){super(t,e)}}x_.BEFORE_GROUP="editor.before_group",x_.GROUP="editor.group",x_.BEFORE_UNGROUP="editor.before_ungroup",x_.UNGROUP="editor.ungroup",x_.BEFORE_OPEN="editor.before_open_group",x_.OPEN="editor.open_group",x_.BEFORE_CLOSE="editor.before_close_group",x_.CLOSE="editor.close_group";const{updateMatrix:b_}=ar,k_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},S_="top-left";class E_ extends zl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Ir.CHANGE,e=>{if(this.checkChange&&k_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,b_(this.parent),b_(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),b_(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(S_,o);break;case"scaleX":t.scaleOf(S_,o,1);break;case"scaleY":t.scaleOf(S_,1,o);break;case"skewX":t.skewOf(S_,o,0);break;case"skewY":t.skewOf(S_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class B_ extends kp{constructor(t,e){super(t,e)}}B_.BEFORE_MOVE="editor.before_move",B_.MOVE="editor.move";class T_ extends kp{constructor(t,e){super(t,e)}}T_.BEFORE_SCALE="editor.before_scale",T_.SCALE="editor.scale";class R_ extends kp{constructor(t,e){super(t,e)}}R_.BEFORE_ROTATE="editor.before_rotate",R_.ROTATE="editor.rotate";class C_ extends kp{constructor(t,e){super(t,e)}}C_.BEFORE_SKEW="editor.before_skew",C_.SKEW="editor.skew";class O_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:r}=i;const h=t.type===ec.END||t.type===$d.END,l=o(e.draggable),d=!r||h||l,c={x:t.totalX,y:t.totalY};t instanceof ec&&dt.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=$d.getValidMove(e,s.point,c,d),(n.x||n.y)&&(r&&!l&&h?ar.animateMove(this,n,a(r)?r:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof rc?(r=e.getBoxPoint(t),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=Jp.getScaleData(e,n.bounds,d,o,a,Jp.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof $d&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),dt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof nc)d=t.rotation,l=o?St.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=Jp.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=W.float(W.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),dt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Jp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Jp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(c(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new B_(B_.BEFORE_MOVE,h));const l=new B_(B_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new T_(T_.BEFORE_SCALE,t));const o=new T_(T_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(c(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new T_(T_.BEFORE_SCALE,u));const g=new T_(T_.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new mt(ar.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new T_(T_.BEFORE_SCALE,r));const a=new T_(T_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(a(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new R_(R_.BEFORE_ROTATE,d));const c=new R_(R_.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(c(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new C_(C_.BEFORE_SKEW,u));const g=new C_(C_.SKEW,u);this.doSkew(g),this.emitEvent(g)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ar.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let P_=class extends Ml{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new mh,this.openedGroupList=new mh,this.simulateTarget=new E_(this),this.editBox=new o_(this),this.editToolList={},this.selector=new Wp(this),this.editMask=new a_(this),this.targetEventIds=[];let i=p.clone(l_);t&&(i=p.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),re.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>p.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&c_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||y_.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(o(s))e=s;else if(!1===s)return}if(y_.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(x_.BEFORE_GROUP),this.target=p_.group(this.list,this.element,t),this.emitGroupEvent(x_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(x_.BEFORE_UNGROUP,t)),this.target=p_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(x_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(x_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(x_.OPEN,t)}closeGroup(t){this.emitGroupEvent(x_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(x_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ar.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new x_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||y_.get(t,this)}openInnerEditor(t,e,i){let s;if(o(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(o(i))s=i;else if(!1===i)return}y_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(w_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(w_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(w_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(w_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new w_(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(p_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(p_.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Kr.START,this.onRenderStart,this),i&&i.on_(Ir.SCROLL,this.onChildScroll,this),t.on_(Kr.CHILD_START,this.onAppRenderStart,this),t.on_(Zr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};_e([(t,e)=>{oo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:o,app:r}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return o.config&&Object.assign(a,o.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),n(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],P_.prototype,"mergeConfig",void 0),_e([Sp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof mh?i:new mh(i),t.multiple&&c_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new kp(kp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new kp(kp.AFTER_SELECT,s))})],P_.prototype,"target",void 0),_e([Sp(function(t,e){t.emitEvent(new kp(kp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],P_.prototype,"hoverTarget",void 0),P_=_e([Go(O_,["editBox","editTool","emitEvent"])],P_);class L_{static registerInnerEditor(){y_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Ml,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let A_=class extends L_{static registerEditTool(){y_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};A_=_e([f_()],A_);const{left:D_,right:M_}=bt,{move:F_,copy:I_,toNumberPoints:W_}=dt;let z_=class extends A_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===D_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=W_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(F_(t,o,r),s&&F_(e,-o,-r)):(s&&F_(t,-o,-r),F_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),I_(s[7],i),I_(e[7],i),I_(s[3],a),I_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===D_||t===M_,s[t].visible=a,e[t].visible=!r&&a}};z_=_e([f_()],z_);const{M:Y_,L:N_,C:X_,Q:H_,Z:V_,N:j_,D:U_,X:G_,G:q_,F:K_,O:Z_,P:J_,U:$_}=Ae,Q_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Y_:case N_:tf(t,e,i,n,1),n+=3;break;case X_:tf(t,e,i,n,3),n+=7;break;case H_:tf(t,e,i,n,2),n+=5;break;case V_:n+=1;break;case j_:tf(t,e,i,n,2),n+=5;break;case U_:tf(t,e,i,n,2),n+=9;break;case G_:tf(t,e,i,n,2),n+=6;break;case q_:tf(t,e,i,n,2),n+=9;break;case K_:tf(t,e,i,n,2),n+=5;break;case Z_:t[n]=q_,t.splice(n+4,0,t[n+3],0),tf(t,e,i,n,2),n+=9,o+=2;break;case J_:t[n]=K_,t.splice(n+4,0,t[n+3]),tf(t,e,i,n,2),n+=5,o+=1;break;case $_:tf(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:tf}=Q_,ef=Q.get(),{topLeft:sf,top:nf,topRight:of,right:rf,bottom:af,left:hf}=bt;function lf(t,e,i){t.pathInputed?cf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function df(t,e,i,n){let o=e;if(!s(n)){const s=t.__layout;let{width:r,height:a}=s.boxBounds;switch(r*=i-e,a*=e-i,n){case nf:case af:o=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case hf:case rf:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case sf:case of:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=d(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function cf(t,e,i){Q_.scale(t.__.path,e,i),t.path=t.__.path}function uf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):Q_.scalePoints(s,e,i),t.points=s}function gf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)ef.a=e,ef.d=i,s[t].transform(ef,!0)}const pf=rh.prototype;pf.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},pf.__scaleResize=function(t,e){lf(this,t,e)},pf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},pf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Rd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)df(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),lf(this,t,e)}},Cd.prototype.__scaleResize=function(t,e){cf(this,t,e)},vd.prototype.__scaleResize=function(t,e){this.pathInputed?cf(this,t,e):this.points?uf(this,t,e):this.width*=t},nd.prototype.__scaleResize=function(t,e){this.pathInputed?cf(this,t,e):this.points?uf(this,t,e):lf(this,t,e)},Ml.prototype.__scaleResize=function(t,e){gf(this,t,e)},jl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||lf(this,t,e),i&&gf(this,t,e)},re.add("resize"),re.add("editor","resize"),ae.editor=function(t,e){const i=new P_(t);return e&&e.sky.add(e.editor=i),i},jl.addAttr("textBox",!1,uo),Dl.addAttr("editConfig",void 0,uo),Dl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),uo),Dl.addAttr("editInner","PathEditor",uo),Ml.addAttr("editInner","",uo),Rd.addAttr("editInner","TextEditor",uo),Dl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Dl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Dl.setEditInner=function(t){this.changeAttr("editInner",t)};const _f={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},ff={top:"flex-start",middle:"center",bottom:"flex-end"},mf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function yf(t,e,i){const{style:n}=t,{fill:r,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let g;n.fontFamily=e.fontFamily,n.fontSize=e.fontSize*i+"px",function(t,e){let i="black";d(e)&&(e=e[0]);if(c(e))switch(e.type){case"solid":i=Uh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Uh.string(o(t)?t:t.color);break;default:s(e.r)||(i=Uh.string(e))}else i=e;t.color=i}(n,r),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,c(u)?(g=u.type,u.color&&(n.textDecorationColor=Uh.string(u.color))):g=u,n.textDecoration=mf[g],n.textTransform=_f[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=ff[e.verticalAlign],n.lineHeight=(e.__.__lineHeight||0)*i+"px",n.letterSpacing=(e.__.__letterSpacing||0)*i+"px",n.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",n.wordBreak="break"===h?"break-all":"normal",n.textIndent=(e.paraIndent||0)*i+"px",n.padding=d(a)?a.map(t=>t*i+"px").join(" "):(a||0)*i+"px",n.textOverflow="show"===l?"":"hide"===l?"clip":l}let vf=class extends L_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Rd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(Kd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new mt(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||yf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function wf(t,e,i){xf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(ec.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(ec.END,e=>{ar.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(rc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function xf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&p.assign(i,e),p.assign(t.config,i,t.userConfig)}vf=_e([m_()],vf),re.add("text-editor","editor");const bf=Qt.get("LeaferTypeCreator"),kf={list:{},register(t,e){Sf[t]&&bf.repeat(t),Sf[t]=e},run(t,e){const i=Sf[t];i&&i(e)}},{list:Sf,register:Ef}=kf;Ef("viewport",wf),Ef("custom",function(t){wf(t,null,!0)}),Ef("design",function(t){wf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Ef("document",function(t){wf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Bf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),n=dt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=dt.getDistance(e.from,i.from);return{move:o,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Tf,s=Tf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Tf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Tf.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Tf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Tf=Bf,{abs:Rf,max:Cf}=Math,{sign:Of,within:Pf}=W,Lf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Rf(s),r=Rf(n);return o>50&&(s=Cf(50,o/3)*Of(s)),r>50&&(n=Cf(50,r/3)*Of(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(v.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=Pf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Pf(1-Rf(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Af,Df,Mf,Ff;class If{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Af=0,Df=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Af,totalY:Df}),e.emit(ec.START,this.moveData)),t.path=this.moveData.path,t.totalX=Af+=t.moveX,t.totalY=Df+=t.moveY,e.emit(ec.BEFORE_MOVE,t),e.emit(ec.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Mf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Mf}),e.emit(rc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Mf*=t.scale,e.emit(rc.BEFORE_ZOOM,t),e.emit(rc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Ff=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Ff}),e.emit(nc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Ff+=t.rotation,e.emit(nc.BEFORE_ROTATE,t),e.emit(nc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(ec.END,Object.assign(Object.assign({},e),{totalX:Af,totalY:Df})),i&&t.emit(rc.END,Object.assign(Object.assign({},i),{totalScale:Mf})),s&&t.emit(nc.END,Object.assign(Object.assign({},s),{totalRotation:Ff})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Wf=Wl.prototype,zf=new qt,Yf=new _t;function Nf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Xf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Wf.initType=function(t){kf.run(t,this)},Wf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(Yf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Yf.y=0:t.includes("y")?Yf.x=0:Math.abs(Yf.x)>Math.abs(Yf.y)?Yf.y=0:Yf.x=0,i&&t.includes("limit")&&(zf.set(this.__world).addPoint(this.zoomLayer),Gd.getValidMove(zf,this.canvas.bounds,"inner",Yf,!0),t.includes("x")?Yf.y=0:t.includes("y")&&(Yf.x=0))}return{x:n?0:Yf.x,y:n?0:Yf.y}},Wf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const Hf=Sc.prototype;Hf.createTransformer=function(){this.transformer=new If(this)},Hf.move=function(t){this.transformer.move(t)},Hf.zoom=function(t){this.transformer.zoom(t)},Hf.rotate=function(t){this.transformer.rotate(t)},Hf.transformEnd=function(){this.transformer.transformEnd()},Hf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Lf.getScale(t,e);if(1!==o)this.zoom(Xf(o,t));else{const s=e.getMove?e.getMove(t,e):Lf.getMove(t,e);i.snap&&dt.round(s),this.move(Nf(s,t))}},Hf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Bf.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Bf.detect(n,c(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Bf.reset()}o||(n.center=Bf.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Xf(n.scale,t)),o&&this.move(Nf(n.move,t))};const Vf=pc.prototype,{abs:jf}=Math;function Uf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Vf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=jf(i),o=jf(s),r=e?1:.1,h=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(h){const r="touch"===t.pointerType?3:1,l=70;n*(e=e?a(h)?h:.95:r)>l?e=l/n:o*e>l&&(e=l/o),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Vf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Vf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Vf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Vt.maxX(r),d=Vt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},Vf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},re.add("viewport"),re.add("view"),Wl.prototype.zoom=function(t,e,i,s){let r;this.killAnimate(),u(e)?(r=e.padding,i=e.scroll,s=e.transition):r=e;const{zoomLayer:h}=this,l=this.canvas.bounds.clone().shrink(n(r)?30:r),g=new qt,p={x:l.x+l.width/2,y:l.y+l.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(o(t))switch(t){case"in":_=Uf(y,"in");break;case"out":_=Uf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new qt(this.boxBounds)).height=0;break;case"fit-height":(t=new qt(this.boxBounds)).width=0}else a(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(p,_,_,!1,s);else if(c(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=d(t);if(n||t.tag){const e=n?t:[t];g.setListWithFn(e,_r.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,l);g.set(h.getWorldBounds(e))}const{width:o,height:r}=g;let a=l.x-g.x,c=l.y-g.y;return i?(a+=Math.max((l.width-o)/2,0),c+=Math.max((l.height-r)/2,0)):(_=this.getValidScale(Math.min(l.width/o,l.height/r)),a+=(l.width-o*_)/2,c+=(l.height-r*_)/2,dt.scaleOf(e,g,_),g.scaleOf(g,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(a=0),dt.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class Gf extends Ml{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&p.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;o(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new jl,this.scrollYBar=new jl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new qt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_($d.DRAG,this.onDrag,this),e.on_($d.DRAG,this.onDrag,this),t.on_($d.END,this.onDragEnd,this),e.on_($d.END,this.onDragEnd,this),this.target.on_(Kr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Ur.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class qf extends Sl{setText(t){this._text=t,this.__htmlChanged=!0}}const Kf={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let Zf=class extends wd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=Kf[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){o(t)?Kf[t]=e:Object.assign(Kf,t)}};_e([Wo(qf)],Zf.prototype,"__",void 0),_e([yo("")],Zf.prototype,"text",void 0),_e([uo("TextEditor")],Zf.prototype,"editInner",void 0),_e([To(!1)],Zf.prototype,"textEditing",void 0),Zf=_e([qo()],Zf),re.add("html");class Jf extends _l{}function $f(t){return ho(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wo(this),t.__useArrow=e,So(this)}}}))}let Qf=class extends vd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){qh.register(t,e)}};_e([Wo(Jf)],Qf.prototype,"__",void 0),_e([$f("angle")],Qf.prototype,"endArrow",void 0),Qf=_e([qo()],Qf);const{M:tm,L:em,C:im,Q:sm,O:nm}=Ae,{rotate:om,copyFrom:rm,scale:am}=dt,hm={},lm={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case tm:case em:dm(t,l+1,e,i,s,n,o,r),l+=3;break;case im:for(h=1;h<6;h+=2)dm(t,l+h,e,i,s,n,o,r);l+=7;break;case sm:for(h=1;h<4;h+=2)dm(t,l+h,e,i,s,n,o,r);l+=5;break;case nm:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){lm.layout(t,0,0,1,1,e,i)}};function dm(t,e,i,s,n,o,r,a){rm(hm,t[e],t[e+1]),r&&om(hm,r,a),n&&am(hm,n,o),t[e]=i+hm.x,t[e+1]=s+hm.y}const{layout:cm,rotate:um}=lm,{getAngle:gm}=dt,pm={x:-.5},_m={connect:pm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},fm={connect:pm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},mm={connect:pm,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},ym={connect:pm,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},vm={offset:pm,path:[...mm.path],dashPath:[1,-2.5,0,2,-1,0]};um(vm.path,180,{x:-1.5,y:0});const wm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},xm={connect:{x:.5},path:[...wm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},bm={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},km={path:[...bm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Sm=p.clone(bm),Em=p.clone(km);um(Sm.path,45),um(Em.path,45);const Bm={angle:_m,"angle-side":fm,arrow:ym,triangle:mm,"triangle-flip":vm,circle:xm,"circle-line":wm,square:km,"square-line":bm,diamond:Em,"diamond-line":Sm,mark:{offset:pm,path:[1,0,-2,2,0,2]}};function Tm(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Bm[e.type]):a=e:a=Bm[e];const{offset:u,connect:g,path:p,dashPath:_}=a;let f=g?g.x:0,m=u?u.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&cm(y,0,0,h,h),m&&cm(y,m,0),cm(y,s.x,s.y,n,n,gm(i,s)),o.x=(f+m)*n,y}const{M:Rm,L:Cm,C:Om,Q:Pm,Z:Lm,N:Am,D:Dm,X:Mm,G:Fm,F:Im,O:Wm,P:zm,U:Ym}=Ae,{copy:Nm,copyFrom:Xm,getDistancePoint:Hm}=dt,Vm={},jm={},Um={},Gm={},qm={},Km={list:Bm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case Rm:case Cm:(c<2||l+6>=d)&&(Xm(qm,o[l+1],o[l+2]),!c&&u&&Nm(jm,qm)),l+=3;break;case Om:(1===c||l+7>=d-3)&&Zm(o,Gm,qm,l+3),l+=7;break;case Pm:(1===c||l+5>=d-3)&&Zm(o,Gm,qm,l+1),l+=5;break;case Lm:return;case Am:l+=5;break;case Dm:l+=9;break;case Mm:l+=6;break;case Fm:l+=9;break;case Im:l+=5;break;case Wm:l+=7;break;case zm:l+=4;break;case Ym:(1===c||l+6>=d-3)&&(Zm(o,Gm,qm,l+1),l+6!==d&&(qm.x-=(qm.x-Gm.x)/10,qm.y-=(qm.y-Gm.y)/10)),l+=6}if(c++,1===c&&h!==Rm)return;if(2===c&&u&&Nm(Um,h===Cm?qm:Gm),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Tm(t,e,Um,jm,s,Vm,!!n);n?d.push(...i):r.push(...i),Vm.x&&(Hm(jm,Um,-Vm.x,!0),r[1]=Um.x,r[2]=Um.y)}if(i&&"none"!==i){const e=Tm(t,i,Gm,qm,s,Vm,!!n);if(n?d.push(...e):r.push(...e),Vm.x){let t;switch(Hm(qm,Gm,-Vm.x,!0),h){case Cm:t=l-3+1;break;case Om:t=l-7+5;break;case Pm:t=l-5+3;break;case Ym:t=l-6+3}t&&Jm(r,Gm,t)}}}else Nm(Gm,qm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Zm(t,e,i,s){Xm(e,t[s],t[s+1]),Xm(i,t[s+2],t[s+3])}function Jm(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),Dl.addAttr("startArrow","none",$f),Dl.addAttr("endArrow","none",$f),Object.assign(qh,Km),Object.assign(Kh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let $m=class extends jl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};_e([Wo(class extends ul{})],$m.prototype,"__",void 0),_e([_o("x")],$m.prototype,"flow",void 0),$m=_e([qo()],$m);const Qm={},ty={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},ey={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function iy(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Tt.toPoint(i,e,n,Qm),e.x=s.__autoWidth?n.x:Qm.x,e.y=s.__autoHeight?n.y:Qm.y}const{move:sy}=dt;function ny(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),sy(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function oy(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const ry={};function ay(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:r,__autoHeight:a}=t.__,h=n&&(e?!r:!a);return c(i)?(ry.xGap=i.x||0,ry.yGap=i.y||0):ry.xGap=ry.yGap=l(i),ry.isAutoXGap=o(ry.xGap)&&!r,ry.isAutoYGap=o(ry.yGap)&&!a,ry.complex=h||"top-left"!==s||t.__hasGrow||ry.isAutoXGap||ry.isAutoYGap,ry.wrap=h,ry.complex&&(ry.isFitXGap="fit"===ry.xGap&&!r,ry.isFitYGap="fit"===ry.yGap&&!a,c(s)?(ry.contentAlign=s.content||"top-left",ry.rowXAlign=s.x||"from",ry.rowYAlign=s.y||"from"):(ry.contentAlign=s,ry.rowXAlign=ty[s],ry.rowYAlign=ey[s])),ry}function hy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function ly(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function dy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:cy}=W;function uy(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=gy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=gy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function gy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?cy(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:py}=W;function _y(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=fy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=fy(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function fy(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?py(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:my}=dt;function yy(t,e){const i="width",{children:s,itemBox:n}=t,o=ay(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=dy(p,n),r?(p.__flowBounds=_,y||(y=hy(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?uy(t,y,x,e):d&&ly(y,i,x,c),oy(u,y,i),y=hy(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&fy(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(my(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?uy(t,y,x,e):d&&ly(y,i,x,c),a&&oy(u,y,i)),a?(s?ly(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){iy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=ty[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],ny(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(iy(t,y,r),ny(t,y,0,y.y,g,e))}}const{move:vy}=dt;function wy(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),vy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:xy}=dt;function by(t,e){const i="height",{children:s,itemBox:n}=t,o=ay(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=dy(p,n),r?(p.__flowBounds=_,y||(y=hy(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&_y(t,y,b,e),d&&ly(y,i,b,c),oy(u,y,i),y=hy(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&gy(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(xy(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&_y(t,y,b,e),d&&ly(y,i,b,c),a&&oy(u,y,i)),a?(s?ly(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){iy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=ey[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],wy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(iy(t,y,r),wy(t,y,y.x,0,l,e))}}function ky(t){return ho(t,t=>({set(e){const i=a(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&wo(this)}}))}re.add("flow","resize");const Sy=jl.prototype,{__updateBoxBounds:Ey}=Ml.prototype;Dl.addAttr("flow",!1,_o),Dl.addAttr("gap",0,yo),Dl.addAttr("flowAlign","top-left",yo),Dl.addAttr("flowWrap",!1,yo),Dl.addAttr("itemBox","box",yo),Dl.addAttr("inFlow",!0,yo),Dl.addAttr("autoWidth",void 0,ky),Dl.addAttr("autoHeight",void 0,ky),Dl.addAttr("autoBox",void 0,yo);const{copyAndSpread:By}=Vt;Sy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:yy(this);break;case"y":by(this);break;case"x-reverse":yy(this,!0);break;case"y-reverse":by(this,!0)}t&&(this.leafer.created=!0)},Sy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),By(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Sy.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Ey.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&By(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Ty,sin:Ry,pow:Cy,sqrt:Oy,abs:Py,ceil:Ly,floor:Ay,round:Dy,PI:My}=Math,Fy=5*My,Iy=1.70158,Wy=2.5949095,zy=7.5625,Yy=2.75;function Ny(t){return e=>Cy(e,t)}function Xy(t){return e=>1-Cy(1-e,t)}function Hy(t){return e=>e<.5?.5*Cy(2*e,t):1-.5*Cy(2-2*e,t)}function Vy(t){return t<1/Yy?zy*t*t:t<2/Yy?zy*(t-=1.5/Yy)*t+.75:t<2.5/Yy?zy*(t-=2.25/Yy)*t+.9375:zy*(t-=2.625/Yy)*t+.984375}function jy(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=Uy(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Py(l)<1e-6));e++)c-=d/l;return n[r]=Uy(c,e,s)}}function Uy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Gy={get(t){const{list:e}=Gy;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){Gy.list[t]=e},list:{linear:t=>t,ease:jy(.25,.1,.25,1),"ease-in":jy(.42,0,1,1),"ease-out":jy(0,0,.58,1),"ease-in-out":jy(.42,0,.58,1),"sine-in":t=>1-Ty(t*My*.5),"sine-out":t=>Ry(t*My*.5),"sine-in-out":t=>.5*(1-Ty(t*My)),"quad-in":Ny(2),"quad-out":Xy(2),"quad-in-out":Hy(2),"cubic-in":Ny(3),"cubic-out":Xy(3),"cubic-in-out":Hy(3),"quart-in":Ny(4),"quart-out":Xy(4),"quart-in-out":Hy(4),"quint-in":Ny(5),"quint-out":Xy(5),"quint-in-out":Hy(5),"expo-in":t=>t?Cy(2,10*t-10):0,"expo-out":t=>1===t?1:1-Cy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Cy(2,2*t*10-10):.5*(2-Cy(2,10-2*t*10)),"circ-in":t=>1-Oy(1-Cy(t,2)),"circ-out":t=>Oy(1-Cy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Oy(1-Cy(2*t,2))):.5*(Oy(1-Cy(2-2*t,2))+1),"back-in":t=>((Iy+1)*t-Iy)*t*t,"back-out":t=>(t-=1)*t*((Iy+1)*t+Iy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Wy+1)*t-Wy)*.5:.5*((t=2*t-2)*t*((Wy+1)*t+Wy)+2),"elastic-in":t=>0===t||1===t?t:-Cy(2,10*(t-1))*Ry((t-1.1)*Fy),"elastic-out":t=>0===t||1===t?t:Cy(2,-10*t)*Ry((t-.1)*Fy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Cy(2,10*((t*=2)-1))*Ry((t-1.1)*Fy)*.5:Cy(2,10*(1-(t*=2)))*Ry((t-1.1)*Fy)*.5+1,"bounce-in":t=>1-Vy(1-t),"bounce-out":Vy,"bounce-in-out":t=>t<.5?.5*(1-Vy(1-2*t)):.5*(1+Vy(2*t-1)),"cubic-bezier":jy,steps:function(t,e="floor"){return i=>("floor"===e?Ay(i*t):"ceil"===e?Ly(i*t):Dy(i*t))/t}}};function qy(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 Ky{}Ky.CREATED="created",Ky.PLAY="play",Ky.PAUSE="pause",Ky.STOP="stop",Ky.SEEK="seek",Ky.UPDATE="update",Ky.COMPLETED="completed";let Zy=class extends sa{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&&a(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),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:o}=this;this.easingFn=Gy.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.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.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Ky.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Ky.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Ky.STOP))}seek(t){this.destroyed||(c(t)&&(t=Gh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(Ky.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:n}=this,{length:o}=i,r=!(o>1)||this.join;let h,l,d,c,u,g=0,p=0;o>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<o;n++){if(l=i[n],c=l.style||l,h||(h=r?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=l;o&&(d.swing=a(o)?o:2,u=2*d.swing-1),r&&(d.loop=u=a(r)?r:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=Gy.get(n))}if(!d.autoDuration&&s(d.duration)&&(o>1?n>0||r?p+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=g||!n||!n.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(Ky.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:n,toStyle:o,target:r}=this;for(let a in e)s(n[a])&&(n[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=s(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:n}=i;for(let o=0;o<n;o++)e=i[o],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),v.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}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}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?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.requestAnimate()}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(Ky.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:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),il.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(Ky.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return a(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};_e([qy("ease")],Zy.prototype,"easing",void 0),_e([qy(0)],Zy.prototype,"delay",void 0),_e([qy(.2)],Zy.prototype,"duration",void 0),_e([qy("auto")],Zy.prototype,"ending",void 0),_e([qy(!1)],Zy.prototype,"reverse",void 0),_e([qy(!1)],Zy.prototype,"swing",void 0),_e([qy(!1)],Zy.prototype,"loop",void 0),_e([qy(0)],Zy.prototype,"loopDelay",void 0),_e([qy(1)],Zy.prototype,"speed",void 0),_e([qy(!0)],Zy.prototype,"autoplay",void 0),_e([qy()],Zy.prototype,"join",void 0),_e([qy()],Zy.prototype,"attrs",void 0),Zy=_e([Go(pa)],Zy);let Jy=class extends Zy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Zy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Ky.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Ky.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Ky.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Ky.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Ky.COMPLETED:this.completed&&this.emitType(t);break;case Ky.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)}};Jy=_e([Go(pa)],Jy);const $y={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"},Qy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,tv=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,ev=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,iv=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,sv=parseInt,nv=parseFloat,{round:ov}=Math;let rv={},av=0;function hv(t){let e,i,s,n=1;switch(t.length){case 9:e=sv(t.slice(1,3),16),i=sv(t.slice(3,5),16),s=sv(t.slice(5,7),16),n=sv(t.slice(7,9),16)/255;break;case 7:e=sv(t.slice(1,3),16),i=sv(t.slice(3,5),16),s=sv(t.slice(5,7),16);break;case 5:e=sv(t[1]+t[1],16),i=sv(t[2]+t[2],16),s=sv(t[3]+t[3],16),n=sv(t[4]+t[4],16)/255;break;case 4:e=sv(t[1]+t[1],16),i=sv(t[2]+t[2],16),s=sv(t[3]+t[3],16);break;case 3:e=i=s=sv(t[1]+t[2],16);break;case 2:e=i=s=sv(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const lv=1/6,dv=.5,cv=2/3,uv=1/3;function gv(t,e,i){return i<0?i++:i>1&&i--,i<lv?t+6*(e-t)*i:i<dv?e:i<cv?t+(e-t)*(cv-i)*6:t}function pv(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=gv(a,s,t+uv),o=gv(a,s,t),r=gv(a,s,t-uv)}return{r:ov(255*n),g:ov(255*o),b:ov(255*r),a:s}}re.add("color"),Uh.object=function(t,e){let i,n=!s(e)&&e<1;if(o(t)){const e=rv[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=hv(t);break;case"R":case"r":"("===t[4]&&tv.test(t)?i=function(t){const e=tv.exec(t);return{r:sv(e[1]),g:sv(e[2]),b:sv(e[3]),a:nv(e[4])}}(t):"("===t[3]&&Qy.test(t)&&(i=function(t){const e=Qy.exec(t);return{r:sv(e[1]),g:sv(e[2]),b:sv(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&iv.test(t)?i=function(t){const e=iv.exec(t);return pv(nv(e[1]),nv(e[2]),nv(e[3]),nv(e[4]))}(t):"("===t[3]&&ev.test(t)&&(i=function(t){const e=ev.exec(t);return pv(nv(e[1]),nv(e[2]),nv(e[3]),1)}(t))}if(!i){const e=$y[t.toLowerCase()];e&&(i=hv("#"+e))}i&&(av++,av>1e4&&(rv={},av=0),rv[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),n&&(i.a*=e),i};const{round:_v}=Math,{fourNumber:fv}=W,mv={fill:bv,stroke:bv,cornerRadius:(t,e,i)=>a(t)&&a(e)?wv(t,e,i):(t=fv(t),e=fv(e),t.map((t,s)=>wv(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,n=e.length,o=wv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return a(t)||a(e)?W.float(wv(t,e,i),Math.max(vv(t),vv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return il.setBetweenStyle(n,t,e,n,i,s),n},shadow:kv,innerShadow:kv},yv={value:function(t,e,i){const s=a(t),n=a(e);return s&&n?t+(e-t)*i:n||s?wv(t,e,i):t},number:wv,color:xv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=il;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function vv(t){const e=String(t).split(".")[1];return e?e.length:0}function wv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?_v(n):n}function xv(t,e,i){t=Uh.object(t),e=Uh.object(e);const s=wv(t.r,e.r,i,1)+","+wv(t.g,e.g,i,1)+","+wv(t.b,e.b,i,1),n=wv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function bv(t,e,i){return o(t)&&o(e)?xv(t,e,i):e}function kv(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:wv((t=t||{}).x,e.x,i),y:wv(t.y,e.y,i),blur:wv(t.blur,e.blur,i),spread:wv(t.spread,e.spread,i),color:xv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}re.add("animate","color"),el.canAnimate=!0,Object.assign(il.list,mv),Object.assign(il,yv);const Sv=Dl.prototype;Dl.addAttr("animation",void 0,function(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Dl.addAttr("animationOut",void 0,uo),Dl.addAttr("transition",!0,uo),Dl.addAttr("transitionOut",void 0,uo),Sv.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))},Sv.animate=function(t,e,i,n){if(s(t))return this.__animate;let o=d(t)&&!e&&i?new Jy(this,t,n):new Zy(this,t,e,n);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof Jy?o.list.unshift(r):o=new Jy(this,[r,o])),this.__animate=o},Sv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Jy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Sv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Ky.COMPLETED,e)};const Ev=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Bv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Tv}=Math,{getDerivative:Rv}=ri,Cv={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<Ev.length;h++)l=f*(1+Ev[h]),d=f*(1-Ev[h]),c=Rv(l,t,i,n,r),u=Rv(l,e,s,o,a),g=Rv(d,t,i,n,r),p=Rv(d,e,s,o,a),_+=Bv[h]*(Tv(c*c+u*u)+Tv(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Rv(t,e,s,o,a),d=Rv(t,i,n,r,h);return Math.atan2(d,l)/Y},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)Ov(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Ae.C,c,u,_,f,m,y)}},{getDistance:Ov}=Cv,{M:Pv,L:Lv,C:Av,Z:Dv}=Ae,Mv={},Fv={},Iv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Pv:case Lv:Iv.transformPoints(t,e,s,1),s+=3;break;case Av:Iv.transformPoints(t,e,s,3),s+=7;break;case Dv:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Mv.x=t[n],Mv.y=t[n+1],Q.toOuterPoint(e,Mv),t[n]=Mv.x,t[n+1]=Mv.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Pv:case Lv:i=t[a+1],s=t[a+2],e=n===Lv&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Av:i=t[a+5],s=t[a+6],e=Cv.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 Dv:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Gh.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Pv:case Lv:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),Fv.x=y,Fv.y=v,_.x=r,_.y=a,dt.getDistancePoint(Fv,_,e-p,!0),_.rotation=dt.getAngle(Fv,_),_;y=r,v=a,f+=3;break;case Av:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Cv.getT(e-p,o,y,v,l,d,c,u,r,a,i),ri.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=Cv.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Dv:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Gh.number(e,t.total);let r,a,h,l,d,c,u,g,p,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case Pv:case Lv:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),Fv.x=v,Fv.y=w,f.x=a,f.y=h,dt.getDistancePoint(Fv,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case Av:if(d=n[m+1],c=n[m+2],u=n[m+3],g=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return p=Cv.getT(e-_,r,v,w,d,c,u,g,a,h,i),Cv.cut(o,p,v,w,d,c,u,g,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,g,a,h);break;case Dv:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function Wv(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}re.add("motion-path"),il.register("motion",function(t,e,i,s){return c(t)&&(t=Gh.number(t,s.getMotionTotal())),c(e)&&(e=Gh.number(e,s.getMotionTotal())),il.number(t||0,e||0,i)}),il.register("motionRotation",function(t,e,i){return il.number(t,e,i)});const zv=Dl.prototype,{updateMatrix:Yv,updateAllMatrix:Nv}=ar,{updateBounds:Xv}=vr;function Hv(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=jv(t);i.total&&(t.__.__pathForRender=Iv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Nv(t),Xv(t,t)):Yv(t));i&&(t.leafer.created=!0)}}function Vv(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 jv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Iv.getMotionPathData(t.getPath(!0,!0))}function Uv(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?el.setStyleName(this,e,i):el.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Gv(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function qv(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 Kv(t,e){c(e)||(e=void 0),$v(t,e,"in")}function Zv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),$v(t,e,"out"))}Dl.addAttr("motionPath",void 0,Wv),Dl.addAttr("motionPrecision",1,Wv),Dl.addAttr("motion",void 0,Wv),Dl.addAttr("motionRotation",!0,Wv),zv.getMotionPathData=function(){return jv(Vv(this))},zv.getMotionPoint=function(t){const e=Vv(this),i=jv(e);if(!i.total)return{};const s=Iv.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:a(n)&&(s.rotation+=n),s},zv.getMotionTotal=function(){return this.getMotionPathData().total},zv.__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],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Hv(t))}else Hv(this)};const Jv={};function $v(t,e,i){const{normalStyle:s}=t;e||(e=Jv),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==Jv&&el.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const r=o?function(t,e){const i=ew(e,t),s=t.animate();s&&ew(i,t,s.fromStyle);return i}(t,e):void 0;el.canAnimate&&Qv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Qv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=tw(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=tw(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function Qv(t){let e;const i={},s=qv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&el.isState(n,t,s)&&(e=iw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&el.isSelected(t,s)&&(e=iw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&el.isPlacehold(t,s)&&(e=iw(i,a)),el.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=iw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&el.isFocus(t,s)&&(e=iw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&el.isHover(t,s)&&(e=iw(i,o));const r=i.pressStyle||t.pressStyle;r&&el.isPress(t,s)&&(e=iw(i,r))}return e?i:void 0}function tw(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&el.animateExcludes[t]||(n[t]=e[t]);return n}function ew(t,e,i){return tw(t,e,i,!0)}function iw(t,e){return Object.assign(t,e),!0}function sw(t,e){const i=t[e];i&&Kv(t,i),t.button&&ow(t.children,e)}function nw(t,e,i){i||(i=t.states[e]),Kv(t,i),t.button&&ow(t.children,null,e)}function ow(t,e,i){if(!t)return;let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],e){switch(o=!0,e){case"hoverStyle":el.isHover(n)&&(o=!1);break;case"pressStyle":el.isPress(n)&&(o=!1);break;case"focusStyle":el.isFocus(n)&&(o=!1)}o&&sw(n,e)}else s(i)||nw(n,i);n.isBranch&&ow(n.children,e,i)}}function rw(t,e){const i=t[e];i&&Zv(t,i),t.button&&hw(t.children,e)}function aw(t,e,i){Zv(t,i),t.button&&hw(t.children,null,e)}function hw(t,e,i){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?rw(n,e):s(i)||aw(n,i),n.isBranch&&hw(n.children,e,i)}function lw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=qv(e,i);o&&(s=n[t](o))}return s}function dw(t,e,i){let s=e[t];if(!s&&i){const n=qv(e,i);n&&(s=n[t])}return s}re.add("state"),el.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},el.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=qv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},el.isSelected=function(t,e){return dw("selected",t,e)},el.isDisabled=function(t,e){return dw("disabled",t,e)},el.isFocus=function(t,e){return lw("isFocus",t,e)},el.isHover=function(t,e){return lw("isHover",t,e)},el.isPress=function(t,e){return lw("isPress",t,e)},el.isPlacehold=function(t,e){return t.__.__isPlacehold},el.isDrag=function(t,e){return lw("isDrag",t,e)},el.setStyleName=function(t,e,i){i?nw(t,e,t[e]):aw(t,e,t[e])},el.set=function(t,e){const i=t.states[e];i?nw(t,e,i):aw(t,e,i)},el.getStyle=Qv,el.updateStyle=$v,el.updateEventStyle=function(t,e){switch(e){case Kd.ENTER:sw(t,"hoverStyle");break;case Kd.LEAVE:rw(t,"hoverStyle");break;case Kd.DOWN:sw(t,"pressStyle");break;case Kd.UP:rw(t,"pressStyle")}};const cw=Dl.prototype;Dl.addAttr("selected",!1,Uv,"selectedStyle"),Dl.addAttr("disabled",!1,Uv,"disabledStyle"),Dl.addAttr("states",{},Gv),Dl.addAttr("state","",Uv),Dl.addAttr("normalStyle",void 0,uo),Dl.addAttr("hoverStyle",void 0,Gv),Dl.addAttr("pressStyle",void 0,Gv),Dl.addAttr("focusStyle",void 0,Gv),Dl.addAttr("selectedStyle",void 0,Gv),Dl.addAttr("disabledStyle",void 0,Gv),Dl.addAttr("placeholderStyle",void 0,Gv),Dl.addAttr("button",!1,uo),cw.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))},cw.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?sw(this,"focusStyle"):rw(this,"focusStyle")})},cw.updateState=function(){el.updateStyle(this,void 0,"in")};const uw=Rd.prototype,gw="text";oo(uw,gw,Object.assign(Object.assign({},ro(uw,gw)),{set(t){const e=this,i=e.text;e.__setAttr(gw,t)&&(wo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class pw extends ll{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let _w=class extends Dl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=to.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:o,total:r}=e,{width:h,height:l}=o&&(a(o)?{width:o,height:o}:o)||(r>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:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new zr(zr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:n,__action:o}=this;o&&(o.FPS&&(i=o.FPS),s(o.loop)||(n=o.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!n)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()}};_e([Wo(pw)],_w.prototype,"__",void 0),_e([yo()],_w.prototype,"robot",void 0),_e([uo()],_w.prototype,"actions",void 0),_e([uo("")],_w.prototype,"action",void 0),_e([To(0)],_w.prototype,"now",void 0),_e([uo(12)],_w.prototype,"FPS",void 0),_e([uo(!0)],_w.prototype,"loop",void 0),_w=_e([qo()],_w),re.add("robot");const{Yes:fw,NoAndSkip:mw,YesAndSkip:yw}=e,vw={},ww={},xw={};class bw{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,n){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":vw.id=t.substring(1),t=vw;break;case".":ww.className=t.substring(1),t=ww;break;default:xw.tag=t,t=xw}case"object":if(s(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?p.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,n)}}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&&ar.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,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===fw||o===yw){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<mw&&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_(Mr.REMOVE,this.__onRemoveChild,this),this.target.on_(Ir.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 kw=Dl.prototype;function Sw(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}kw.find=function(t,e){return Sw(this).getBy(t,this,!1,e)},kw.findOne=function(t,e){return Sw(this).getBy(t,this,!0,e)},re.add("find"),ae.finder=function(t){return new bw(t)};const{setPoint:Ew,addPoint:Bw,toBounds:Tw}=vt;const Rw={syncExport(t,e,i){let n;tl.running=!0;try{const o=Un.fileType(e),r=e.includes(".");i=Un.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===o)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),n={data:!!r||t.toJSON(i.json)};else if("svg"===o)r&&h(a(t.toSVG(),"svg"),e),n={data:!!r||t.toSVG()};else{let o,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:y}=i,w=s(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,k=Un.isOpaqueImage(e)||b,S=new mt;if(f)o=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}o=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,o,E);let B=i.pixelRatio||1,{x:T,y:R,width:C,height:O}=new qt(o).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let L,A=ae.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(L=t,L.__worldOpacity=0,t=c||t,P.bounds=A.bounds),A.save();const D=u&&!s(b),M=t.get("fill");if(D&&(t.fill=""),v.render(t,A,P),D&&(t.fill=M),A.restore(),L&&L.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Bw(r,n,o):Ew(r={},n,o)),a++;const h=new qt;return r&&(Tw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=ae.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=W.fourNumber(m),n=A,{width:o,height:r}=n;A=ae.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),y&&y(A);n={data:"canvas"===e?A:A.export(e,i),width:A.pixelWidth,height:A.pixelHeight,renderBounds:o,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return tl.running=!1,n},export(t,e,i){return tl.running=!0,function(t){Cw||(Cw=new Zn);return new Promise(e=>{Cw.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>fe(this,void 0,void 0,function*(){if(!$n.isComplete)return v.requestRender(o);const r=tl.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Ow(t);const{leafer:r}=t;r?r.waitViewCompleted(o):o()}))}};let Cw;function Ow(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Ow(t))}const Pw=Oe.prototype,Lw=Qt.get("@leafer-in/export");Pw.export=function(t,e){const{quality:i,blob:s}=Un.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Pw.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Lw.error(t),i(null)})})},Pw.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Pw.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Lw.error(t),i(!1)})})},re.add("export"),Object.assign(tl,Rw),Dl.prototype.export=function(t,e){return tl.export(this,t,e)},Dl.prototype.syncExport=function(t,e){return tl.syncExport(this,t,e)},re.add("filter"),Object.assign(Qh,{list:{},register(t,e){Qh.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=Qh.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Qh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),re.add("bright"),Dl.addAttr("bright",!1,Ro);export{Tt as AlignHelper,Zy as Animate,Gy as AnimateEasing,Ky as AnimateEvent,Jy as AnimateList,e as Answer,Pd as App,St as AroundHelper,Qf as Arrow,Jf as ArrowData,Zt as AutoBounds,ri as BezierHelper,qt as Bounds,Yr as BoundsEvent,Vt as BoundsHelper,jl as Box,ul as BoxData,fh as Branch,vr as BranchHelper,Da as BranchRender,bd as Canvas,El as CanvasData,pe as CanvasManager,Mr as ChildEvent,Uh as ColorConvert,ae as Creator,Ec as Cursor,p as DataHelper,Qt as Debug,xt as Direction4,bt as Direction9,Gd as DragBoundsHelper,$d as DragEvent,pc as Dragger,tc as DropEvent,o_ as EditBox,Jp as EditDataHelper,i_ as EditPoint,Wp as EditSelect,Dp as EditSelectHelper,A_ as EditTool,y_ as EditToolCreator,P_ as Editor,kp as EditorEvent,x_ as EditorGroupEvent,p_ as EditorHelper,B_ as EditorMoveEvent,R_ as EditorRotateEvent,T_ as EditorScaleEvent,C_ as EditorSkewEvent,$h as Effect,Zl as Ellipse,ml as EllipseData,_i as EllipseHelper,Dr as Event,ue as EventCreator,sa as Eventer,tl as Export,Un as FileHelper,Qh as Filter,bw as Finder,$m as Flow,R as FourNumberHelper,Ul as Frame,pl as FrameData,Ml as Group,cl as GroupData,Zf as HTMLText,qf as HTMLTextData,Cv as HighBezierHelper,Iv as HighCurveHelper,Bc as HitCanvasManager,wd as Image,Sl as ImageData,zr as ImageEvent,to as ImageManager,x as IncrementId,L_ as InnerEditor,w_ as InnerEditorEvent,Sc as InteractionBase,hc as InteractionHelper,ac as KeyEvent,Ad as Keyboard,qr as LayoutEvent,Mh as Layouter,rh as Leaf,Pa as LeafBounds,_r as LeafBoundsHelper,f as LeafData,fa as LeafDataProxy,pa as LeafEventer,ar as LeafHelper,Ar as LeafLayout,yh as LeafLevelList,mh as LeafList,ka as LeafMatrix,La as LeafRender,Wl as Leafer,wh as LeaferCanvas,Oe as LeaferCanvasBase,gl as LeaferData,Zr as LeaferEvent,no as LeaferImage,kf as LeaferTypeCreator,vd as Line,_l as LineData,z_ as LineEditTool,W as MathHelper,mt as Matrix,Q as MatrixHelper,ec as MoveEvent,Bf as MultiTouchHelper,Qd as MyDragEvent,xd as MyImage,Zd as MyPointerEvent,sc as MyTouchEvent,Me as NeedConvertToCanvasCommandMap,Y as OneRadian,N as PI2,X as PI_2,Kh as Paint,Jh as PaintGradient,Zh as PaintImage,Cd as Path,qh as PathArrow,Km as PathArrowModule,Dn as PathBounds,ks as PathCommandDataHelper,Ae as PathCommandMap,fi as PathCommandNodeHelper,ts as PathConvert,Nn as PathCorner,Ys as PathCreator,wl as PathData,en as PathDrawer,Pe as PathHelper,lm as PathMatrixHelper,t as PathNodeHandleType,ze as PathNumberCommandLengthMap,We as PathNumberCommandMap,Q_ as PathScaler,Od as Pen,xl as PenData,zh as Picker,v as Platform,re as Plugin,_t as Point,dt as PointHelper,Dd as PointerButton,Kd as PointerEvent,nd as Polygon,yl as PolygonData,Ir as PropertyEvent,zl as Rect,fl as RectData,Ye as RectHelper,Ll as RectRender,Kr as RenderEvent,Ih as Renderer,Ur as ResizeEvent,$n as Resource,_w as Robot,pw as RobotData,nc as RotateEvent,se as Run,Gf as ScrollBar,Ap as SelectArea,Yh as Selector,cd as Star,vl as StarData,el as State,Jt as StringNumberMap,Lp as Stroker,oc as SwipeEvent,Kn as TaskItem,Zn as TaskProcessor,Rd as Text,jh as TextConvert,kl as TextData,vf as TextEditor,ic as TouchEvent,O_ as TransformTool,If as Transformer,il as Transition,vt as TwoPointBoundsHelper,Dl as UI,Rl as UIBounds,le as UICreator,ll as UIData,Md as UIEvent,Ol as UIRender,Gh as UnitConvert,kr as WaitHelper,Gr as WatchEvent,Sh as Watcher,Lf as WheelEventHelper,rc as ZoomEvent,wf as addViewport,xf as addViewportConfig,Bo as affectRenderBoundsType,ko as affectStrokeBoundsType,$f as arrowType,lo as attr,_o as autoLayoutType,yo as boundsType,jn as canvasPatch,Ce as canvasSizeAttrs,Vh as createAttr,ao as createDescriptor,Io as cursorType,Wo as dataProcessor,uo as dataType,ho as decorateLeafAttr,Yo as defineDataProcessor,oo as defineKey,co as defineLeafAttr,Ro as dimType,wo as doBoundsType,So as doStrokeType,Nh as effectType,i as emptyData,Mo as eraserType,Wr as extraPropertyEventMap,V as getBoundsData,ro as getDescriptor,j as getMatrixData,H as getPointData,Fo as hitType,d as isArray,u as isData,g as isEmptyData,r as isFinite,n as isNull,a as isNumber,c as isObject,o as isString,s as isUndefined,zo as layoutProcessor,ea as leaferTransformAttrMap,Do as maskType,Wv as motionPathType,vo as naturalBoundsType,Co as opacityType,Xn as path,xo as pathInputType,bo as pathType,Hn as pen,go as positionType,f_ as registerEditTool,m_ as registerInnerEditor,qo as registerUI,Ko as registerUIEvent,Xh as resizeType,Vo as rewrite,jo as rewriteAble,mo as rotationType,lf as scaleResize,df as scaleResizeFontSize,gf as scaleResizeGroup,cf as scaleResizePath,uf as scaleResizePoints,fo as scaleType,po as scrollType,Ao as sortType,Gv as stateStyleType,Uv as stateType,Eo as strokeType,To as surfaceType,Kt as tempBounds,yt as tempMatrix,ft as tempPoint,l as tryToNumber,bh as useCanvas,Go as useModule,vh as version,Oo as visibleType,Hh as zoomLayerType};
1
+ var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:r}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function g(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return _(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&_(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let n in this)"_"!==n[0]&&(i=e?e[n]:void 0,t[n]=s(i)?this[n]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:n}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!s(t))){if("path"===o&&!this.__pathInputed)continue;e=n?n[o]:void 0,i[o]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}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:m,max:y}=Math,v={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||w.maxCacheSize),isSuperLarge:(t,e,i)=>w.isLarge(t,e,i,w.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.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,o,r,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,o){const s=e/o.width,n=i/o.height;d.setTransform(s,0,0,n,-o.x*s,-o.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&&p.stintSet(i,"transform",e)}}},{image:w}=v,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=x;let k,S,E;const{max:B}=Math,T=[0,0,0,0],R={zero:[...T],tempFour:T,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)=>C(T,t,e,i,s),toTempAB(t,e,i){E=i?a(t)?e:t:[],a(t)?(k=L(t),S=e):a(e)?(k=t,S=L(e)):(k=t,S=e),4!==k.length&&(k=O(k)),4!==S.length&&(S=O(S))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(P(t,e,i),C(E,B(k[0],S[0]),B(k[1],S[1]),B(k[2],S[2]),B(k[3],S[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(P(t,e,i),C(E,k[0]+S[0],k[1]+S[1],k[2]+S[2],k[3]+S[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,h,l]=4===t.length?t:O(t);return C(n,h*i,l*e,o*i,r*e)}},{set:C,get:O,setTemp:L,toTempAB:P}=R,{round:A,pow:D,max:M,floor:F,PI:I}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12: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=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(F(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const Y=I/180,N=2*I,X=I/2;function H(){return{x:0,y:0}}function V(){return{x:0,y:0,width:0,height:0}}function j(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:G,acos:q,sqrt:K}=Math,{float:Z}=W,J={};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,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:j,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){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=G(e*=Y),a=U(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=Y,t.a=s+o*i,t.b=n+r*i),e&&(e*=Y,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,n,o){const{e:r,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=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=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,n,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:n}=e,o=i*Y,r=G(o),a=U(o);if(s||n){const e=s*Y,i=n*Y;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||n)&&tt.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=K(n*n+o*o),c=t/d;const e=n/d;u=o>0?q(e):-q(e)}else{c=K(r*r+a*a),d=t/c;const e=r/c;u=X-(a>0?q(-e):-q(e))}const e=Z(G(u)),i=U(u);d=Z(d),c=Z(c),g=e?Z((r/c+i)/e/Y,9):0,p=e?Z((o/d-i)/e/Y,9):0,u=Z(u/Y)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=K(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{toInnerPoint:et,toOuterPoint:it}=Q,{sin:st,cos:nt,abs:ot,sqrt:rt,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=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?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*=Y),n=st(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return gt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return gt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return gt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},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=ot(i-t),o=ot(s-e);return rt(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>ht(ut(t,e,i,s),ut(i,s,n,o)),getAngle:(t,e)=>pt(t,e)/Y,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)/Y),getRadianFrom(t,e,i,n,o,r,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=o-a,u=r-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 o=pt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+nt(o)*i,e.y=t.y+st(o)*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)=>t.x===e.x&&t.y===e.y,reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:gt,getAtan2:pt}=ct;class _t{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 _t(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 _t(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(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 ft=new _t;class mt{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,o),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}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 yt=new mt,vt={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){wt(t,e,i),wt(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:wt}=vt;var xt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(bt||(bt={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const St={directionData:kt,tempPoint:{},get:Et,toPoint(t,e,i,s,n,o){const r=Et(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.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 Et(t){return o(t)?kt[bt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,o){Bt(t,i,s,n,e,o)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Ot,toBounds:Lt}=vt,{toOuterPoint:Pt}=Q,{float:At,fourNumber:Dt}=W,{floor:Mt,ceil:Ft}=Math;let It,Wt,zt,Yt;const Nt={},Xt={},Ht={},Vt={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:o,y:r,width:a,height:h}=e;if(d(i)){const e=Dt(i);s?jt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||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)=>(jt.copy(Ht,t),jt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:o,f:r}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=r+t.y*n):(i.height=t.height*-n,i.y=r+t.y*n-i.height)}else Nt.x=t.x,Nt.y=t.y,Pt(e,Nt,Xt),Ct(Rt,Xt.x,Xt.y),Nt.x=t.x+t.width,Pt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Nt.y=t.y+t.height,Pt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Nt.x=t.x,Pt(e,Nt,Xt),Ot(Rt,Xt.x,Xt.y),Lt(Rt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new 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=jt.getFitScale(t,e,"cover"===s)),Ht.width=n?e.width*=s:e.width*s,Ht.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){It=t.x+t.width,Wt=t.y+t.height,zt=e.x,Yt=e.y,i||(zt+=e.width,Yt+=e.height),It=It>zt?It:zt,Wt=Wt>Yt?Wt:Yt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=It-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||Gt(t,n)):Ut(t,n));o&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Ot(Rt,t.x,t.y)),Lt(Rt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Ut(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=jt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return It=s+o,Wt=n+r,zt=t.x+t.width,Yt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,It=It<zt?It:zt,Wt=Wt<Yt?Wt:Yt,o=It-s,r=Wt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){jt.copy(t,jt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){jt.set(t)}},jt=Vt,{add:Ut,copy:Gt}=jt;class qt{get minX(){return Vt.minX(this)}get minY(){return Vt.minY(this)}get maxX(){return Vt.maxX(this)}get maxY(){return Vt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Vt.copy(this,t):Vt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return Vt.move(this,t,e),this}scale(t,e,i){return Vt.scale(this,t,e,i),this}scaleOf(t,e,i){return Vt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Vt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Vt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Vt.getFitMatrix(this,t,e)}put(t,e,i){Vt.put(this,t,e,i)}spread(t,e){return Vt.spread(this,t,e),this}shrink(t,e){return Vt.shrink(this,t,e),this}ceil(){return Vt.ceil(this),this}unsign(){return Vt.unsign(this),this}float(t){return Vt.float(this,t),this}add(t){return Vt.add(this,t),this}addList(t){return Vt.setList(this,t,!0),this}setList(t){return Vt.setList(this,t),this}addListWithFn(t,e){return Vt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Vt.setListWithFn(this,t,e),this}setPoint(t){return Vt.setPoint(this,t),this}setPoints(t){return Vt.setPoints(this,t),this}addPoint(t){return Vt.addPoint(this,t),this}getPoints(){return Vt.getPoints(this)}hitPoint(t,e){return Vt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Vt.hitRadiusPoint(this,t,e)}hit(t,e){return Vt.hit(this,t,e)}includes(t,e){return Vt.includes(this,t,e)}intersect(t,e){return Vt.intersect(this,t,e),this}getIntersect(t,e){return new qt(Vt.getIntersectData(this,t,e))}isSame(t){return Vt.isSame(this,t)}isEmpty(){return Vt.isEmpty(this)}reset(){Vt.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,o){c(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new qt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Jt={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:$t}=W;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,n=t.__nowWorld,o=$t();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(ee.enable){if(ee.filterList.length&&ee.filterList.every(t=>t!==this.name))return;if(ee.excludeList.length&&ee.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ee.enable&&this.warn(...t)}warn(...t){ee.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 te(t){return t?o(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const ee=Qt,ie=Qt.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,ie.log(s,n,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];s(i)||ne.end(i,e)}},ne=se,oe=[],re={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=>re.has(t,!0)));const ae={editor:t=>re.need("editor")},he=Qt.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,n,o,r){de[t]||he.error("not register "+t);const a=new de[t](e);return s(i)||(a.x=i,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:de}=le,ce=Qt.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(ge[e]&&ce.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}=ue;class pe{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=ae.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 _e(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function fe(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(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(r,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 ye=[];function ve(){return(t,e)=>{ye.push(e)}}const we=[];let xe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){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,o)}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,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,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,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,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,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};_e([me("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),_e([me("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),_e([me("globalAlpha")],xe.prototype,"opacity",void 0),_e([me()],xe.prototype,"fillStyle",void 0),_e([me()],xe.prototype,"strokeStyle",void 0),_e([me("lineWidth")],xe.prototype,"strokeWidth",void 0),_e([me("lineCap")],xe.prototype,"strokeCap",void 0),_e([me("lineJoin")],xe.prototype,"strokeJoin",void 0),_e([me("lineDashOffset")],xe.prototype,"dashOffset",void 0),_e([me()],xe.prototype,"miterLimit",void 0),_e([me()],xe.prototype,"shadowBlur",void 0),_e([me()],xe.prototype,"shadowColor",void 0),_e([me()],xe.prototype,"shadowOffsetX",void 0),_e([me()],xe.prototype,"shadowOffsetY",void 0),_e([me()],xe.prototype,"filter",void 0),_e([me()],xe.prototype,"font",void 0),_e([me()],xe.prototype,"fontKerning",void 0),_e([me()],xe.prototype,"fontStretch",void 0),_e([me()],xe.prototype,"fontVariantCaps",void 0),_e([me()],xe.prototype,"textAlign",void 0),_e([me()],xe.prototype,"textBaseline",void 0),_e([me()],xe.prototype,"textRendering",void 0),_e([me()],xe.prototype,"wordSpacing",void 0),_e([me()],xe.prototype,"letterSpacing",void 0),_e([me()],xe.prototype,"direction",void 0),_e([ve()],xe.prototype,"setTransform",null),_e([ve()],xe.prototype,"resetTransform",null),_e([ve()],xe.prototype,"getTransform",null),_e([ve()],xe.prototype,"save",null),_e([ve()],xe.prototype,"restore",null),_e([ve()],xe.prototype,"translate",null),_e([ve()],xe.prototype,"scale",null),_e([ve()],xe.prototype,"rotate",null),_e([ve()],xe.prototype,"fill",null),_e([ve()],xe.prototype,"stroke",null),_e([ve()],xe.prototype,"clip",null),_e([ve()],xe.prototype,"fillRect",null),_e([ve()],xe.prototype,"strokeRect",null),_e([ve()],xe.prototype,"clearRect",null),_e([ve()],xe.prototype,"beginPath",null),_e([ve()],xe.prototype,"moveTo",null),_e([ve()],xe.prototype,"lineTo",null),_e([ve()],xe.prototype,"bezierCurveTo",null),_e([ve()],xe.prototype,"quadraticCurveTo",null),_e([ve()],xe.prototype,"closePath",null),_e([ve()],xe.prototype,"arc",null),_e([ve()],xe.prototype,"arcTo",null),_e([ve()],xe.prototype,"ellipse",null),_e([ve()],xe.prototype,"rect",null),_e([ve()],xe.prototype,"roundRect",null),_e([ve()],xe.prototype,"createConicGradient",null),_e([ve()],xe.prototype,"createLinearGradient",null),_e([ve()],xe.prototype,"createPattern",null),_e([ve()],xe.prototype,"createRadialGradient",null),_e([ve()],xe.prototype,"fillText",null),_e([ve()],xe.prototype,"measureText",null),_e([ve()],xe.prototype,"strokeText",null);const{copy:be,multiplyParent:ke,pixelScale:Se}=Q,{round:Ee}=Math,Be=new qt,Te=new qt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Oe extends xe{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=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;p.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ke(t,e,n),Se(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Ee(n.e-.5)+.5,n.f=Ee(n.f-.5)+.5):(n.e=Ee(n.e),n.f=Ee(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:n,dashPattern:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(o=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=o,this.dashOffset=r,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=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Te):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Vt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o=!0){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return n.save(),t&&(be(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 Le={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Pe),De={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),Pe),Ie=Ae,We={};for(let t in Ie)We[Ie[t]]=t;const ze={};for(let t in Ie)ze[Ie[t]]=De[t];const Ye={drawRoundRect(t,e,i,s,n,o){const r=W.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ne,cos:Xe,hypot:He,atan2:Ve,ceil:je,abs:Ue,PI:Ge,sqrt:qe,pow:Ke}=Math,{setPoint:Ze,addPoint:Je}=vt,{set:$e,toNumberPoints:Qe}=dt,{M:ti,L:ei,C:ii,Q:si,Z:ni}=Ae,oi={},ri={points(t,e,i,s){let n=Qe(e);if(t.push(ti,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=qe(Ke(r-e,2)+Ke(a-o,2)),_=qe(Ke(h-r,2)+Ke(l-a,2)),(p||_)&&(f=p+_,p=y*p/f,_=y*_/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(si,d,c,r,a):t.push(ii,u,g,d,c,r,a),u=r+_*h,g=a+_*l);s||t.push(si,u,g,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ei,n[e],n[e+1]);s&&t.push(ni)},rect(t,e,i,s,n){Le.creator.path=t,Le.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,o){Le.creator.path=[],Ye.drawRoundRect(Le.creator,e,i,s,n,o),t.push(...Le.convertToCanvasData(Le.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=Ve(u,c),f=Ve(p,g);const m=He(c,u),y=He(g,p);let v=f-_;if(v<0&&(v+=N),m<1e-12||y<1e-12||v<1e-12||Ue(v-Ge)<1e-12)return t&&t.push(ei,s,n),h&&(Ze(h,e,i),Je(h,s,n)),d&&$e(d,e,i),void(l&&$e(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Xe(v/2),k=s+b*Xe(_+v/2+X*x),S=n+b*Ne(_+v/2+X*x);return _-=X*x,f-=X*x,li(t,k,S,a,a,0,_/Y,f/Y,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>li(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*Y,g=Ne(u),p=Xe(u);let _=r*Y,f=a*Y;_>Ge&&(_-=N),f<0&&(f+=N);let m=f-_;m<0?m+=N:m>N&&(m-=N),h&&(m-=N);const y=je(Ue(m/X)),v=m/y,w=Ne(v/4),x=8/3*w*w/Ne(v/2);f=_+v;let b,k,S,E,B,T,R,C,O=Xe(_),L=Ne(_),P=S=p*s*O-g*n*L,A=E=g*s*O+p*n*L,D=e+S,M=i+E;t&&t.push(t.length?ei:ti,D,M),l&&Ze(l,D,M),c&&$e(c,D,M);for(let o=0;o<y;o++)b=Xe(f),k=Ne(f),S=p*s*b-g*n*k,E=g*s*b+p*n*k,B=e+P-x*(p*s*L+g*n*O),T=i+A-x*(g*s*L-p*n*O),R=e+S+x*(p*s*k+g*n*b),C=i+E+x*(g*s*k-p*n*b),t&&t.push(ii,B,T,R,C,e+S,i+E),l&&hi(e+P,i+A,B,T,R,C,e+S,i+E,l,!0),P=S,A=E,O=b,L=k,_=f,f+=v;d&&$e(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ii,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):Ze(h,t,e),Je(h,r,a);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,n,o,r,a,oi),Je(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ai(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ri,{sin:di,cos:ci,sqrt:ui,atan2:gi}=Math,{ellipse:pi}=ri,_i={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*Y,p=di(g),_=ci(g),f=-_*c-p*u,m=-_*u+p*c,y=s*s,w=n*n,x=m*m,b=f*f,k=y*w-y*x-w*b;let S=0;if(k<0){const t=ui(1-k/(y*w));s*=t,n*=t}else S=(r===a?-1:1)*ui(k/(y*x+w*b));const E=S*s*m/n,B=-S*n*f/s,T=gi((m-B)/n,(f-E)/s),R=gi((-m-B)/n,(-f-E)/s);let C=R-T;0===a&&C>0?C-=N:1===a&&C<0&&(C+=N);const O=e+c+_*E-p*B,L=i+u+p*E+_*B,P=C<0?1:0;d||v.ellipseToCurve?pi(t,O,L,s,n,o,T/Y,R/Y,P):s!==n||o?t.push(Ae.G,O,L,s,n,o,T/Y,R/Y,P):t.push(Ae.O,O,L,s,T/Y,R/Y,P)}},fi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:yi,L:vi,l:wi,H:xi,h:bi,V:ki,v:Si,C:Ei,c:Bi,S:Ti,s:Ri,Q:Ci,q:Oi,T:Li,t:Pi,A:Ai,a:Di,Z:Mi,z:Fi,N:Ii,D:Wi,X:zi,G:Yi,F:Ni,O:Xi,P:Hi,U:Vi}=Ae,{rect:ji,roundRect:Ui,arcTo:Gi,arc:qi,ellipse:Ki,quadraticCurveTo:Zi}=ri,{ellipticalArc:Ji}=_i,$i=Qt.get("PathConvert"),Qi={},ts={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=ze[s],a+=s===n?" ":We[s];for(let s=1;s<i;s++)a+=W.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?Fe:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(es.dot&&(is(r,o),o=""),es.dot++),"0"===o&&"."!==s&&(is(r,o),o=""),o+=s):Ae[s]?(o&&(is(r,o),o=""),es.name=Ae[s],es.length=De[s],es.index=0,is(r,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&is(r,o),o=s):o&&(is(r,o),o=""),n=s;return o&&is(r,o),i?ts.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],g.push(mi,a,h),c+=3;break;case bi:t[c+1]+=a;case xi:a=t[c+1],g.push(vi,a,h),c+=2;break;case Si:t[c+1]+=h;case ki:h=t[c+1],g.push(vi,a,h),c+=2;break;case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],g.push(vi,a,h),c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ti;case Ti:r=o===Ei||o===Ti,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Ei,l,d,i,s,a,h),c+=5;break;case Bi: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=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Pi:t[c+1]+=a,t[c+2]+=h,n=Li;case Li:r=o===Ci||o===Li,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Zi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:i=t[c+1],s=t[c+2],e?Zi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=a,t[c+7]+=h;case Ai:Ji(g,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:g.push(Mi),c++;break;case Ii:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4]):ss(g,t,c,5),c+=5;break;case Wi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(g,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],t[c+5]):ss(g,t,c,6),c+=6;break;case Yi:Ki(e?g:ss(g,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,Qi),a=Qi.x,h=Qi.y,c+=9;break;case Ni:e?Ki(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:qi(e?g:ss(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),a=Qi.x,h=Qi.y,c+=7;break;case Hi:e?qi(g,t[c+1],t[c+2],t[c+3],0,360,!1):ss(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Gi(e?g:ss(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),a=Qi.x,h=Qi.y,c+=6;break;default:return $i.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return fi.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(vi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(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,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){es.index===es.length&&(es.index=1,t.push(es.name)),t.push(Number(e)),es.index++,es.dot=0}},{current:es,pushData:is,copyData:ss}=ts,{M:ns,L:os,C:rs,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:gs,O:ps,P:_s,U:fs}=Ae,{getMinDistanceFrom:ms,getRadianFrom:ys}=dt,{tan:vs,min:ws,abs:xs}=Math,bs={},ks={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ns,e,i)},lineTo(t,e,i){t.push(os,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(rs,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(as,e,i,s,n)},closePath(t){t.push(hs)},rect(t,e,i,s,n){t.push(ls,e,i,s,n)},roundRect(t,e,i,s,n,o){if(a(o))t.push(cs,e,i,s,n,o);else{const r=W.fourNumber(o);r?t.push(ds,e,i,s,n,...r):t.push(ls,e,i,s,n)}},ellipse(t,e,i,s,o,r,a,h,l){n(r)?t.push(gs,e,i,s,o):(n(a)&&(a=0),n(h)&&(h=360),t.push(us,e,i,s,o,r,a,h,l?1:0))},arc(t,e,i,s,o,r,a){n(o)?t.push(_s,e,i,s):(n(r)&&(r=360),t.push(ps,e,i,s,o,r,a?1:0))},arcTo(t,e,i,n,o,r,a,h){if(!s(a)){const t=ms(a,h,e,i,n,o);r=ws(r,ws(t/2,t/2*xs(vs(ys(a,h,e,i,n,o)/2))))}t.push(fs,e,i,n,o,r)},drawEllipse(t,e,i,s,o,r,a,h,l){ri.ellipse(null,e,i,s,o,n(r)?0:r,n(a)?0:a,n(h)?360:h,l,null,null,bs),t.push(ns,bs.x,bs.y),Ss(t,e,i,s,o,r,a,h,l)},drawArc(t,e,i,s,o,r,a){ri.arc(null,e,i,s,n(o)?0:o,n(r)?360:r,a,null,null,bs),t.push(ns,bs.x,bs.y),Es(t,e,i,s,o,r,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:Ss,arc:Es}=ks,{moveTo:Bs,lineTo:Ts,quadraticCurveTo:Rs,bezierCurveTo:Cs,closePath:Os,beginPath:Ls,rect:Ps,roundRect:As,ellipse:Ds,arc:Ms,arcTo:Fs,drawEllipse:Is,drawArc:Ws,drawPoints:zs}=ks;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)?Le.parse(t):t:[],this}beginPath(){return Ls(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Cs(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Os(this.__path),this.paint(),this}rect(t,e,i,s){return Ps(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return As(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Ds(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Ms(this.__path,t,e,i,s,n,o),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,o,r,a){return Is(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Ws(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ns,L:Xs,C:Hs,Q:Vs,Z:js,N:Us,D:Gs,X:qs,G:Ks,F:Zs,O:Js,P:$s,U:Qs}=Ae,tn=Qt.get("PathDrawer"),en={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Ns: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 Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.closePath(),s+=1;break;case Us:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*Y,e[s+6]*Y,e[s+7]*Y,e[s+8]),s+=9;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*Y,e[s+5]*Y,e[s+6]),s+=7;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void tn.error(`command: ${i} [index:${s}]`,e)}}},{M:sn,L:nn,C:on,Q:rn,Z:an,N:hn,D:ln,X:dn,G:cn,F:un,O:gn,P:pn,U:_n}=Ae,{toTwoPointBounds:fn,toTwoPointBoundsByQuadraticCurve:mn,arcTo:yn,arc:vn,ellipse:wn}=ri,{addPointBounds:xn,copy:bn,addPoint:kn,setPoint:Sn,addBounds:En,toBounds:Bn}=vt,Tn=Qt.get("PathBounds");let Rn,Cn,On;const Ln={},Pn={},An={},Dn={toBounds(t,e){Dn.toTwoPointBounds(t,Pn),Bn(Pn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Sn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===an||r===on||r===rn?Sn(e,h,l):Sn(e,t[a+1],t[a+2])),r){case sn:case nn:h=t[a+1],l=t[a+2],kn(e,h,l),a+=3;break;case on:n=t[a+5],o=t[a+6],fn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Ln),xn(e,Ln),h=n,l=o,a+=7;break;case rn:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],mn(h,l,i,s,n,o,Ln),xn(e,Ln),h=n,l=o,a+=5;break;case an:a+=1;break;case hn:h=t[a+1],l=t[a+2],En(e,h,l,t[a+3],t[a+4]),a+=5;break;case ln:case dn:h=t[a+1],l=t[a+2],En(e,h,l,t[a+3],t[a+4]),a+=r===ln?9:6;break;case cn:wn(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],Ln,An),0===a?bn(e,Ln):xn(e,Ln),h=An.x,l=An.y,a+=9;break;case un:h=t[a+1],l=t[a+2],Cn=t[a+3],On=t[a+4],En(e,h-Cn,l-On,2*Cn,2*On),h+=Cn,a+=5;break;case gn:vn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ln,An),0===a?bn(e,Ln):xn(e,Ln),h=An.x,l=An.y,a+=7;break;case pn:h=t[a+1],l=t[a+2],Rn=t[a+3],En(e,h-Rn,l-Rn,2*Rn,2*Rn),h+=Rn,a+=4;break;case _n:yn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ln,An),0===a?bn(e,Ln):xn(e,Ln),h=An.x,l=An.y,a+=6;break;default:return void Tn.error(`command: ${r} [index:${a}]`,t)}}},{M:Mn,L:Fn,Z:In}=Ae,{getCenterX:Wn,getCenterY:zn}=dt,{arcTo:Yn}=ks,Nn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,p=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case Mn:l=g=t[r+1],d=p=t[r+2],r+=3,t[r]===Fn?(c=t[r+1],u=t[r+2],f.push(Mn,Wn(l,c),zn(d,u))):f.push(Mn,l,d);break;case Fn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Fn:Yn(f,a,h,t[r+1],t[r+2],e,g,p);break;case In:Yn(f,a,h,l,d,e,g,p);break;default:f.push(Fn,a,h)}g=a,p=h;break;case In:n!==In&&(Yn(f,l,d,c,u,e,g,p),f.push(In)),r+=1;break;default:o=ze[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==In&&(f[1]=l,f[2]=d),f}};function Xn(t){return new Ys(t)}const Hn=Xn();Le.creator=Xn(),Le.parse=ts.parse,Le.convertToCanvasData=ts.toCanvasData;const{drawRoundRect:Vn}=Ye;function jn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Vn(this,t,e,i,s,n)})}(t)}const Un={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=Gn.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{}}}},Gn=Un;Gn.alphaPixelTypes.forEach(t=>Gn.upperCaseTypeMap[t]=t.toUpperCase());const qn=Qt.get("TaskProcessor");class Kn{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return fe(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){qn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e,i){let n,o,r,h;const l=new Kn(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,n=e.start,r=e.time,h=e.delay,i||(i=e.canUse)),r&&(l.time=r),!1===o&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list: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=Qt.get("Resource"),$n={tasker:new Zn,map:{},get isComplete(){return Qn.tasker.isComplete},set(t,e){Qn.map[t]&&Jn.repeat(t),Qn.map[t]=e},get:t=>Qn.map[t],remove(t){const e=Qn.map[t];e&&(e.destroy&&e.destroy(),delete Qn.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=ae.image(s)),Qn.set(t,e),e},destroy(){Qn.map={}}},Qn=$n,to={maxRecycled:10,recycledList:[],patternTasker:new Zn,get(t){let e=$n.get(t.url);return e||$n.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(v.image.isLarge(t)?t.url&&$n.remove(t.url):(t.clearLevels(),eo.recycledList.push(t)))})},recyclePaint(t){eo.recycle(t.image)},clearRecycled(t){const e=eo.recycledList;(e.length>eo.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&$n.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Un.alphaPixelTypes.some(e=>eo.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:"+Un.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Un.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},eo=to,{IMAGE:io,create:so}=x;class no{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=so(io),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}to.isFormat("svg",t)&&(this.isSVG=!0),to.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;$n.tasker.add(()=>fe(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,s(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const 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=t.naturalWidth||t.width,this.height=t.naturalHeight||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,o,r){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=v.image.resize(this.view,t,e,n,o,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}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 oo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ro(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ao(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ho(t,e){return(i,s)=>co(i,s,t,e&&e(s))}function lo(t){return t}function co(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};oo(t,e,Object.assign(n,s||{})),Yo(t,e,i)}function uo(t){return ho(t)}function go(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function po(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function _o(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wo(this))}}))}function fo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function yo(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i,e)&&wo(this)}}))}function vo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(wo(this),this.__.__removeNaturalSize())}}))}function wo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xo(t){return ho(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wo(this)}}))}const bo=yo;function ko(t,e){return ho(t,t=>({set(i){this.__setAttr(t,i)&&(So(this),e&&(this.__.__useStroke=!0))}}))}function So(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wo(t)}const Eo=ko;function Bo(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function To(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Ro(t){return ho(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Co(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Lo(this)}}))}function Oo(t){return ho(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Po(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Po(this,t,e,i),this.mask&&Lo(this)}}))}function Lo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Po(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wo(t))}function Ao(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Do(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fo(t){return ho(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Io(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wo(t){return(e,i)=>{oo(e,"__DataProcessor",{get:()=>t})}}function zo(t){return(e,i)=>{oo(e,"__LayoutProcessor",{get:()=>t})}}function Yo(t,e,i){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ao(e,i);if(s(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(c(i)){const t=g(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=ro(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),oo(n,e,a)}const No=new Qt("rewrite"),Xo=[],Ho=["destroy","constructor"];function Vo(t){return(e,i)=>{Xo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jo(){return t=>{Uo()}}function Uo(t){Xo.length&&(Xo.forEach(e=>{t&&No.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Xo.length=0)}function Go(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ho.includes(s)||e&&e.includes(s)))if(t.prototype){ro(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function qo(){return t=>{le.register(t)}}function Ko(){return t=>{ue.register(t)}}setTimeout(()=>Uo(!0));const{copy:Zo,toInnerPoint:Jo,toOuterPoint:$o,scaleOfOuter:Qo,rotateOfOuter:tr,skewOfOuter:er,multiplyParent:ir,divideParent:sr,getLayout:nr}=Q,or={},{round:rr}=Math,ar={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),dr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)lr(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++)cr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&cr(t),t.__updateChange()},updateAllChange(t){if(gr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ur(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,o){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const o=c(e)?Object.assign({},e):{x:e,y:i};s?$o(t.localTransform,o,o,!0):t.parent&&Jo(t.parent.scrollWorldTransform,o,o,!0),hr.moveLocal(t,o.x,o.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=rr(e),i=rr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){hr.zoomOfLocal(t,pr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(a(s)||(s&&(o=s),s=i),Zo(or,r),Qo(or,e,i,s),hr.hasHighPosition(t))hr.setTransform(t,or,n,o);else{const e=t.x+or.e-r.e,a=t.y+or.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){hr.rotateOfLocal(t,pr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Zo(or,n),tr(or,e,i),hr.hasHighPosition(t)?hr.setTransform(t,or,!1,s):t.set({x:t.x+or.e-n.e,y:t.y+or.f-n.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){hr.skewOfLocal(t,pr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Zo(or,t.__localMatrix),er(or,e,i,s),hr.setTransform(t,or,n,o)},transformWorld(t,e,i,s){Zo(or,t.worldTransform),ir(or,e),t.parent&&sr(or,t.parent.scrollWorldTransform),hr.setTransform(t,or,i,s)},transform(t,e,i,s){Zo(or,t.localTransform),ir(or,e),hr.setTransform(t,or,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&hr.getInnerOrigin(t,n.origin),r=nr(e,o,n.around&&hr.getInnerOrigin(t,n.around));if(hr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=hr.getInnerOrigin(t,n.origin);dt.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Qo(i,hr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(hr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zo(or,t.worldTransform),sr(or,e.scrollWorldTransform),i?or:Object.assign({},or)),drop(t,e,i,s){t.setTransform(hr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||hr.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),v.requestRender(()=>hr.animateMove(t,e,i))}}},hr=ar,{updateAllMatrix:lr,updateMatrix:dr,updateAllWorldOpacity:cr,updateAllChange:ur,updateChange:gr}=hr;function pr(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const _r={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)=>mr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>mr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>mr(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 fr;function mr(t,e){return e||(fr=0),t.__.mask&&(fr=1),fr<0?null:(fr&&(fr=-1),!0)}const{updateBounds:yr}=ar,vr={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),wr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)xr(e[t],e)},updateBounds(t,e){const i=[t];xr(t,i),br(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++)yr(s[t]);e&&e===i||yr(i)}},move(t,e,i){let s;const{children:n}=t;for(let o=0,r=n.length;o<r;o++)s=(t=n[o]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&kr(t,e,i)},scale(t,e,i,s,n,o,r){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-o)*l+e,a.y=a.f+=(a.f-r)*d+i):(a.e+=(a.e-o)*l+e,a.f+=(a.f-r)*d+i,a.x+=(a.x-o)*l+e,a.y+=(a.y-r)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Sr(t,e,i,s,n,o,r)}},{pushAllChildBranch:wr,pushAllBranchStack:xr,updateBoundsByBranchStack:br,move:kr,scale:Sr}=vr,Er={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:Br,updateBounds:Tr}=ar,{toOuterOf:Rr,getPoints:Cr,copy:Or}=Vt,Lr="_localContentBounds",Pr="_worldContentBounds",Ar="_worldBoxBounds",Dr="_worldStrokeBounds";class Mr{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 Rr(this.contentBounds,this.leaf.__localMatrix,this[Lr]||(this[Lr]={})),this[Lr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Rr(this.contentBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}get worldBoxBounds(){return Rr(this.boxBounds,this.leaf.__world,this[Ar]||(this[Ar]={})),this[Ar]}get worldStrokeBounds(){return Rr(this.strokeBounds,this.leaf.__world,this[Dr]||(this[Dr]={})),this[Dr]}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 Tr(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,v.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 Br(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Br(s,e,!0)}if(r||(r=Q.getLayout(o)),Or(r,a),dt.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,n=Cr(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return s(o)||n.forEach(t=>i.innerToWorld(t,null,!1,o)),n}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 Fr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class Ir extends Fr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Ir.ADD="child.add",Ir.REMOVE="child.remove",Ir.CREATED="created",Ir.MOUNTED="mounted",Ir.UNMOUNTED="unmounted",Ir.DESTROY="destroy";const Wr="property.scroll";class zr extends Fr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}zr.CHANGE="property.change",zr.LEAFER_CHANGE="property.leafer_change",zr.SCROLL=Wr;const Yr={scrollX:Wr,scrollY:Wr};class Nr extends Fr{constructor(t,e){super(t),Object.assign(this,e)}}Nr.LOAD="image.load",Nr.LOADED="image.loaded",Nr.ERROR="image.error";class Xr extends Fr{static checkHas(t,e,i){"on"===i?e===Ur?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Hr)||t.hasEvent(Vr)||t.hasEvent(jr),t.__hasWorldEvent=t.hasEvent(Ur))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Hr,t),"inner"===e&&t.emit(Vr,t)),t.emit(jr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Ur,this)}}Xr.RESIZE="bounds.resize",Xr.INNER="bounds.inner",Xr.LOCAL="bounds.local",Xr.WORLD="bounds.world";const{RESIZE:Hr,INNER:Vr,LOCAL:jr,WORLD:Ur}=Xr,Gr={};[Hr,Vr,jr,Ur].forEach(t=>Gr[t]=1);class qr extends Fr{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(qr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}qr.RESIZE="resize";class Kr extends Fr{constructor(t,e){super(t),this.data=e}}Kr.REQUEST="watch.request",Kr.DATA="watch.data";class Zr extends Fr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Zr.REQUEST="layout.request",Zr.START="layout.start",Zr.BEFORE="layout.before",Zr.LAYOUT="layout",Zr.AFTER="layout.after",Zr.AGAIN="layout.again",Zr.END="layout.end";class Jr extends Fr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Jr.REQUEST="render.request",Jr.CHILD_START="render.child_start",Jr.CHILD_END="render.child_end",Jr.START="render.start",Jr.BEFORE="render.before",Jr.RENDER="render",Jr.AFTER="render.after",Jr.AGAIN="render.again",Jr.END="render.end",Jr.NEXT="render.next";class $r extends Fr{}$r.START="leafer.start",$r.BEFORE_READY="leafer.before_ready",$r.READY="leafer.ready",$r.AFTER_READY="leafer.after_ready",$r.VIEW_READY="leafer.view_ready",$r.VIEW_COMPLETED="leafer.view_completed",$r.STOP="leafer.stop",$r.RESTART="leafer.restart",$r.END="leafer.end",$r.UPDATE_MODE="leafer.update_mode",$r.TRANSFORM="leafer.transform",$r.MOVE="leafer.move",$r.SCALE="leafer.scale",$r.ROTATE="leafer.rotate",$r.SKEW="leafer.skew";const{MOVE:Qr,SCALE:ta,ROTATE:ea,SKEW:ia}=$r,sa={x:Qr,y:Qr,scaleX:ta,scaleY:ta,rotation:ea,skewX:ia,skewY:ia},na={};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=ra(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],Gr[t]&&Xr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ra(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Gr[t]&&Xr.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&&ue.has(t)&&(e=ue.get(t,{type:t,target:this,current:this}));const s=ra(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}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:n}=this,o=i&&i[t],r=n&&n[t];return!!(s(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ra(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:ga,hasEvent:pa,destroy:_a}=oa.prototype,fa={on:aa,on_:ha,off:la,off_:da,once:ca,emit:ua,emitEvent:ga,hasEvent:pa,destroyEventer:_a},ma=Qt.get("setAttr"),ya={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||r(e)||s(e)||(ma.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new zr(zr.LEAFER_CHANGE,this,t,n,e));const i=sa[t];i&&(this.emitEvent(new $r(i,this)),this.emitEvent(new $r($r.TRANSFORM,this)))}this.emitPropertyEvent(zr.CHANGE,t,n,e);const i=Yr[t];return i&&this.emitPropertyEvent(i,t,n,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new zr(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||s(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:ka,tempPoint:Sa}=St,Ea={__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)&&(ka(i.around||i.origin,t.boxBounds,Sa),xa(e,-Sa.x,-Sa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ba,updateAllMatrix:Ta}=ar,{updateBounds:Ra}=vr,{toOuterOf:Ca,copyAndSpread:Oa,copy:La}=Vt,{toBounds:Pa}=Dn,Aa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Xr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Xr.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?Pa(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),Ra(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ta(this),Ra(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;Oa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?La(e.renderBounds,e.strokeBounds):Oa(e.renderBounds,e.boxBounds,i)}},Da={__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),ar.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.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}=_r,Fa={__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++)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)}}},Ia={},{LEAF:Wa,create:za}=x,{stintSet:Ya}=p,{toInnerPoint:Na,toOuterPoint:Xa,multiplyParent:Ha}=Q,{toOuterOf:Va}=Vt,{copy:ja,move:Ua}=dt,{moveLocal:Ga,zoomOfLocal:qa,rotateOfLocal:Ka,skewOfLocal:Za,moveWorld:Ja,zoomOfWorld:$a,rotateOfWorld:Qa,skewOfWorld:th,transform:eh,transformWorld:ih,setTransform:sh,getFlipTransform:nh,getLocalOrigin:oh,getRelativeWorld:rh,drop:ah}=ar;let hh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Mr}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(Wa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ir.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(Ir.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ir.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(Ir.MOUNTED)):this.__emitLifeEvent(Ir.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ha(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}=to.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),Ia.scaleX=i,Ia.scaleY=s,Ia}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?rh(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&&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),Na(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Xa(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:o,y:r}=this.boxBounds;return Ua(n,-o,-r),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:o,y:r}=this.boxBounds;return Ua(n,o,r),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){Ja(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qa(this,oh(this,t),e,i,s,n)}rotateOf(t,e,i){Ka(this,oh(this,t),e,i)}skewOf(t,e,i,s,n){Za(this,oh(this,t),e,i,s,n)}transformWorld(t,e,i){ih(this,t,e,i)}moveWorld(t,e,i){Ja(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){$a(this,t,e,i,s,n)}rotateOfWorld(t,e){Qa(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 re.need("path")}getMotionPoint(t){return re.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):Yo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=yo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ir(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ir.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};hh=_e([Go(ya),Go(Ea),Go(Aa),Go(fa),Go(Da)],hh);const{setListWithFn:lh}=Vt,{sort:dh}=vr,{localBoxBounds:ch,localStrokeBounds:uh,localRenderBounds:gh,maskLocalBoxBounds:ph,maskLocalStrokeBounds:_h,maskLocalRenderBounds:fh}=_r,mh=new Qt("Branch");let yh=class extends hh{__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){lh(e||this.__layout.boxBounds,this.children,this.__hasMask?ph:ch)}__updateStrokeBounds(t){lh(t||this.__layout.strokeBounds,this.children,this.__hasMask?_h:uh)}__updateRenderBounds(t){lh(t||this.__layout.renderBounds,this.children,this.__hasMask?fh:gh)}__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(dh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return mh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=le.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 n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Ir.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ir.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Ir.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ir.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Ir(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};yh=_e([Go(Fa)],yh);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&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,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 n=0,o=e.length;n<o;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new 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!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const xh="1.12.1";class bh extends Oe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}jn(OffscreenCanvasRenderingContext2D.prototype),jn(Path2D.prototype);const{mineType:kh}=Un;function Sh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:kh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:kh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new bh(t,e),image:t=>new no(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},oo(v,"devicePixelRatio",{get:()=>1});const{userAgent:Eh}=navigator;Eh.indexOf("Firefox")>-1?(v.conicGradientRotate90=!0,v.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(v.fullImageShadow=!0),Eh.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):Eh.indexOf("Mac")>-1?v.os="Mac":Eh.indexOf("Linux")>-1&&(v.os="Linux");class Bh{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=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Jr.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Ir.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 Kr(Kr.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_([[zr.CHANGE,this.__onAttrChange,this],[[Ir.ADD,Ir.REMOVE],this.__onChildEvent,this],[Kr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Th,updateBounds:Rh,updateChange:Ch}=ar,{pushAllChildBranch:Oh,pushAllParent:Lh}=vr;const{worldBounds:Ph}=_r;class Ah{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new vh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ph)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ph),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:Mh}=ar,Fh=Qt.get("Layouter");class Ih{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new wh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Zr.START),this.layoutOnce(),t.emitEvent(new Zr(Zr.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(Kr.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=se.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Zr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Zr(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?(Th(t,!0),e.add(t),t.isBranch&&Oh(t,e),Lh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Lh(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 Zr(o,a,this.times)),i.emitEvent(new Zr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,se.end(e)}fullLayout(){const t=se.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Zr,o=this.getBlocks(new vh(e));e.emitEvent(new Zr(i,o,this.times)),Ih.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Zr(s,o,this.times)),e.emitEvent(new Zr(n,o,this.times)),this.addBlocks(o),se.end(t)}static fullLayout(t){Dh(t,!0),t.isBranch?vr.updateBounds(t):ar.updateBounds(t),Mh(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_([[Zr.REQUEST,this.layout,this],[Zr.AGAIN,this.layoutAgain,this],[Kr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Wh=Qt.get("Renderer");class zh{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=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Zr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Jr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Jr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Jr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Wh.log(e.innerName,"---\x3e");try{this.emitRender(Jr.START),this.renderOnce(t),this.emitRender(Jr.END,this.totalBounds),to.clearRecycled()}catch(t){this.rendering=!1,Wh.error(t)}Wh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Wh.warn("rendering");if(this.times>3)return Wh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(Jr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Jr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Jr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Jr.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=se.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(zh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),se.end(e)}fullRender(){const t=se.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),se.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),this.config.useCellRender&&(o.cellList=this.getCellList()),v.render(s,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.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()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Wh.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 Jr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Jr.REQUEST,this.update,this],[Zr.END,this.__onLayoutEnd,this],[Jr.AGAIN,this.renderAgain,this],[qr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}zh.clipSpread=10;const{hitRadiusPoint:Yh}=Vt;class Nh{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,o=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(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):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:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||ar.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ar.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=>ar.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,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Yh(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[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=p.default(e,this.config)),this.picker=new Nh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.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):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Hh(t){return ho(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Vh(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function jh(){return(t,e)=>{const i="_"+e;oo(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Uh(t){return(e,i)=>{oo(e,i,ao(i,t))}}Object.assign(ae,{watcher:(t,e)=>new Bh(t,e),layouter:(t,e)=>new Ih(t,e),renderer:(t,e,i)=>new zh(t,e,i),selector:(t,e)=>new Xh(t,e)}),v.layout=Ih.fullLayout,v.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 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={},Jh={},$h={},Qh={},tl={},el={apply(){re.need("filter")}},il={},sl={setStyleName:()=>re.need("state"),set:()=>re.need("state")},nl={list:{},register(t,e){nl.list[t]=e},get:t=>nl.list[t]},{parse:ol,objectToCanvasData:rl}=ts,{stintSet:al}=p,{hasTransparent:hl}=qh,ll={originPaint:{}},dl=Qt.get("UIData");class cl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!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?ol(t):rl(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&&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),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ll)):(this.__isStrokes=!0,this._stroke||(this._stroke=ll))}__removePaint(t,e){e&&this.__removeInput(t),$h.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 gl extends cl{}class pl 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 _l extends gl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class fl extends pl{}class ml extends cl{get __usePathBox(){return this.points||this.__pathInputed}}class yl extends cl{get __boxStroke(){return!this.__pathInputed}}class vl extends cl{get __boxStroke(){return!this.__pathInputed}}class wl extends ml{}class xl extends cl{}class bl extends cl{get __pathInputed(){return 2}}class kl extends gl{}const Sl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class El extends cl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=Sl[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=le.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.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 yl{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 yl{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:Rl,add:Cl}=R,Ol={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=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),o&&(t=Rl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=tl.getShadowRenderSpread(this,e)),s&&(t=Rl(t,s)),o&&(t=Cl(t,el.getSpread(o))),r&&(t=Cl(t,r)),a&&(t=Cl(t,a));let l=t;return i&&(l=Rl(l,tl.getInnerShadowSpread(this,i))),n&&(l=Rl(l,n)),this.__layout.renderShapeSpread=l,h?Rl(h.__updateRenderSpread(),t):t}},{stintSet:Ll}=p,Pl={__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){Al(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__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&&tl.shadow(this,t,h),a&&(s.__isStrokes?Jh.strokes(o,this,t,e):Jh.stroke(o,this,t,e)),n&&(s.__isFills?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&tl.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Jh.strokes(o,this,t,e):Jh.stroke(o,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?Jh.strokes(o,this,t,e):Jh.stroke(o,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?Jh.fills(n,this,t,e):Jh.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Jh.strokes(o,this,t,e):Jh.stroke(o,this,t,e))}}else s.__pathInputed?Al(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 Al(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Jh.stroke(n,t,e,i),s&&Jh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&Jh.stroke(n,t,e,i)}const Dl={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Ml;let Fl=Ml=class extends hh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return 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 re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.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)),t?ts.toCanvasData(i,!0):i}getPathString(t,e,i){return ts.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?Nn.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)}__drawPathByData(t,e){e?en.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,a(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Jh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Ml.one(e)}static one(t,e,i,s,n){return le.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){qo()(this)}static registerData(t){Wo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};_e([Wo(cl)],Fl.prototype,"__",void 0),_e([jh()],Fl.prototype,"zoomLayer",void 0),_e([uo("")],Fl.prototype,"id",void 0),_e([uo("")],Fl.prototype,"name",void 0),_e([uo("")],Fl.prototype,"className",void 0),_e([To("pass-through")],Fl.prototype,"blendMode",void 0),_e([Co(1)],Fl.prototype,"opacity",void 0),_e([Oo(!0)],Fl.prototype,"visible",void 0),_e([To(!1)],Fl.prototype,"locked",void 0),_e([Ro(!1)],Fl.prototype,"dim",void 0),_e([Ro(!1)],Fl.prototype,"dimskip",void 0),_e([Ao(0)],Fl.prototype,"zIndex",void 0),_e([Do(!1)],Fl.prototype,"mask",void 0),_e([Mo(!1)],Fl.prototype,"eraser",void 0),_e([go(0,!0)],Fl.prototype,"x",void 0),_e([go(0,!0)],Fl.prototype,"y",void 0),_e([yo(100,!0)],Fl.prototype,"width",void 0),_e([yo(100,!0)],Fl.prototype,"height",void 0),_e([fo(1,!0)],Fl.prototype,"scaleX",void 0),_e([fo(1,!0)],Fl.prototype,"scaleY",void 0),_e([mo(0,!0)],Fl.prototype,"rotation",void 0),_e([mo(0,!0)],Fl.prototype,"skewX",void 0),_e([mo(0,!0)],Fl.prototype,"skewY",void 0),_e([go(0,!0)],Fl.prototype,"offsetX",void 0),_e([go(0,!0)],Fl.prototype,"offsetY",void 0),_e([po(0,!0)],Fl.prototype,"scrollX",void 0),_e([po(0,!0)],Fl.prototype,"scrollY",void 0),_e([_o()],Fl.prototype,"origin",void 0),_e([_o()],Fl.prototype,"around",void 0),_e([uo(!1)],Fl.prototype,"lazy",void 0),_e([vo(1)],Fl.prototype,"pixelRatio",void 0),_e([Bo(0)],Fl.prototype,"renderSpread",void 0),_e([xo()],Fl.prototype,"path",void 0),_e([bo()],Fl.prototype,"windingRule",void 0),_e([bo(!0)],Fl.prototype,"closed",void 0),_e([yo(0)],Fl.prototype,"padding",void 0),_e([yo(!1)],Fl.prototype,"lockRatio",void 0),_e([yo()],Fl.prototype,"widthRange",void 0),_e([yo()],Fl.prototype,"heightRange",void 0),_e([uo(!1)],Fl.prototype,"draggable",void 0),_e([uo()],Fl.prototype,"dragBounds",void 0),_e([uo("auto")],Fl.prototype,"dragBoundsType",void 0),_e([uo(!1)],Fl.prototype,"editable",void 0),_e([Fo(!0)],Fl.prototype,"hittable",void 0),_e([Fo("path")],Fl.prototype,"hitFill",void 0),_e([Eo("path")],Fl.prototype,"hitStroke",void 0),_e([Fo(!1)],Fl.prototype,"hitBox",void 0),_e([Fo(!0)],Fl.prototype,"hitChildren",void 0),_e([Fo(!0)],Fl.prototype,"hitSelf",void 0),_e([Fo()],Fl.prototype,"hitRadius",void 0),_e([Io("")],Fl.prototype,"cursor",void 0),_e([To()],Fl.prototype,"fill",void 0),_e([Eo(void 0,!0)],Fl.prototype,"stroke",void 0),_e([Eo("inside")],Fl.prototype,"strokeAlign",void 0),_e([Eo(1,!0)],Fl.prototype,"strokeWidth",void 0),_e([Eo(!1)],Fl.prototype,"strokeWidthFixed",void 0),_e([Eo("none")],Fl.prototype,"strokeCap",void 0),_e([Eo("miter")],Fl.prototype,"strokeJoin",void 0),_e([Eo()],Fl.prototype,"dashPattern",void 0),_e([Eo(0)],Fl.prototype,"dashOffset",void 0),_e([Eo(10)],Fl.prototype,"miterLimit",void 0),_e([bo(0)],Fl.prototype,"cornerRadius",void 0),_e([bo()],Fl.prototype,"cornerSmoothing",void 0),_e([Hh()],Fl.prototype,"shadow",void 0),_e([Hh()],Fl.prototype,"innerShadow",void 0),_e([Hh()],Fl.prototype,"blur",void 0),_e([Hh()],Fl.prototype,"backgroundBlur",void 0),_e([Hh()],Fl.prototype,"grayscale",void 0),_e([Hh()],Fl.prototype,"filter",void 0),_e([To()],Fl.prototype,"placeholderColor",void 0),_e([uo(100)],Fl.prototype,"placeholderDelay",void 0),_e([uo({})],Fl.prototype,"data",void 0),_e([Vo(hh.prototype.reset)],Fl.prototype,"reset",null),Fl=Ml=_e([Go(Ol),Go(Pl),jo()],Fl);let Il=class extends Fl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Wl;_e([Wo(gl)],Il.prototype,"__",void 0),_e([yo(0)],Il.prototype,"width",void 0),_e([yo(0)],Il.prototype,"height",void 0),Il=_e([Go(yh),qo()],Il);const zl=Qt.get("Leafer");let Yl=Wl=class extends Il{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&$n.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),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,p.assign(s,t));const n=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,n,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new pe,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))),Er.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($r.RESTART):this.emitLeafer($r.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($r.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=p.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new qr(t,i))}__onResize(t){this.emitEvent(t),p.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 Zt(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($r.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=p.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($r.BEFORE_READY),this.emitLeafer($r.READY),this.emitLeafer($r.AFTER_READY),Er.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer($r.VIEW_READY),Er.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Er.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($r.VIEW_COMPLETED),Er.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 re.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 $r(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[$r.START,()=>se.end(t)],[Zr.START,this.updateLazyBounds,this],[Jr.START,this.__onCreated,this],[Jr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Kr.DATA,this.__onWatchData,this],[Zr.END,this.__onLayoutEnd,this],[Jr.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($r.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{to.clearRecycled()},100)}catch(t){zl.error(t)}}};t?e():setTimeout(e)}};Yl.list=new vh,_e([Wo(_l)],Yl.prototype,"__",void 0),_e([yo()],Yl.prototype,"pixelRatio",void 0),_e([uo("normal")],Yl.prototype,"mode",void 0),Yl=Wl=_e([qo()],Yl);let Nl=class extends Fl{get __tag(){return"Rect"}};_e([Wo(yl)],Nl.prototype,"__",void 0),Nl=_e([Go(Dl),jo(),qo()],Nl);const{add:Xl,includes:Hl,scroll:Vl}=Vt,jl=Nl.prototype,Ul=Il.prototype;let Gl=class extends Il{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:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(Xl(a,o),Vl(a,i)),this.__updateRectRenderBounds(),t=!Hl(o,a),t&&"show"===r&&Xl(n,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};_e([Wo(pl)],Gl.prototype,"__",void 0),_e([yo(100)],Gl.prototype,"width",void 0),_e([yo(100)],Gl.prototype,"height",void 0),_e([uo(!1)],Gl.prototype,"resizeChildren",void 0),_e([Bo("show")],Gl.prototype,"overflow",void 0),_e([Vo(jl.__updateStrokeSpread)],Gl.prototype,"__updateStrokeSpread",null),_e([Vo(jl.__updateRenderSpread)],Gl.prototype,"__updateRectRenderSpread",null),_e([Vo(jl.__updateBoxBounds)],Gl.prototype,"__updateRectBoxBounds",null),_e([Vo(jl.__updateStrokeBounds)],Gl.prototype,"__updateStrokeBounds",null),_e([Vo(jl.__updateRenderBounds)],Gl.prototype,"__updateRectRenderBounds",null),_e([Vo(jl.__updateChange)],Gl.prototype,"__updateRectChange",null),_e([Vo(jl.__render)],Gl.prototype,"__renderRect",null),_e([Vo(Ul.__render)],Gl.prototype,"__renderGroup",null),Gl=_e([jo(),qo()],Gl);let ql=class extends Gl{get __tag(){return"Frame"}get isFrame(){return!0}};_e([Wo(fl)],ql.prototype,"__",void 0),_e([To("#FFFFFF")],ql.prototype,"fill",void 0),_e([Bo("hide")],ql.prototype,"overflow",void 0),ql=_e([qo()],ql);const{moveTo:Kl,closePath:Zl,ellipse:Jl}=ks;let $l=class extends Fl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,o=t/2,r=e/2,a=this.__.path=[];i?(s||n?(i<1&&Jl(a,o,r,o*i,r*i,0,s,n,!1),Jl(a,o,r,o,r,0,n,s,!0),i<1&&Zl(a)):(i<1&&(Jl(a,o,r,o*i,r*i),Kl(a,t,r)),Jl(a,o,r,o,r,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Kl(a,o,r),Jl(a,o,r,o,r,0,s,n,!1),Zl(a)):Jl(a,o,r,o,r)}};_e([Wo(vl)],$l.prototype,"__",void 0),_e([bo(0)],$l.prototype,"innerRadius",void 0),_e([bo(0)],$l.prototype,"startAngle",void 0),_e([bo(0)],$l.prototype,"endAngle",void 0),$l=_e([qo()],$l);const{sin:Ql,cos:td,PI:ed}=Math,{moveTo:id,lineTo:sd,closePath:nd,drawPoints:od}=ks;let rd=class extends Fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)od(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;id(e,o,0);for(let t=1;t<n;t++)sd(e,o+o*Ql(2*t*ed/n),r-r*td(2*t*ed/n));nd(e)}}};_e([Wo(wl)],rd.prototype,"__",void 0),_e([bo(3)],rd.prototype,"sides",void 0),_e([bo()],rd.prototype,"points",void 0),_e([bo(0)],rd.prototype,"curve",void 0),rd=_e([jo(),qo()],rd);const{sin:ad,cos:hd,PI:ld}=Math,{moveTo:dd,lineTo:cd,closePath:ud}=ks;let gd=class extends Fl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];dd(r,n,0);for(let t=1;t<2*i;t++)cd(r,n+(t%2==0?n:n*s)*ad(t*ld/i),o-(t%2==0?o:o*s)*hd(t*ld/i));ud(r)}};_e([Wo(xl)],gd.prototype,"__",void 0),_e([bo(5)],gd.prototype,"corners",void 0),_e([bo(.382)],gd.prototype,"innerRadius",void 0),gd=_e([qo()],gd);const{moveTo:pd,lineTo:_d,drawPoints:fd}=ks,{rotate:md,getAngle:yd,getDistance:vd,defaultPoint:wd}=dt;let xd=class extends Fl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&md(i,e),i}set toPoint(t){this.width=vd(wd,t),this.rotation=yd(wd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?fd(e,t.points,t.curve,t.closed):(pd(e,0,0),_d(e,this.width,0))}};_e([Wo(ml)],xd.prototype,"__",void 0),_e([ko("center")],xd.prototype,"strokeAlign",void 0),_e([yo(0)],xd.prototype,"height",void 0),_e([bo()],xd.prototype,"points",void 0),_e([bo(0)],xd.prototype,"curve",void 0),_e([bo(!1)],xd.prototype,"closed",void 0),xd=_e([qo()],xd);let bd=class extends Nl{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}};_e([Wo(Bl)],bd.prototype,"__",void 0),_e([yo("")],bd.prototype,"url",void 0),bd=_e([qo()],bd);const kd=bd;let Sd=class extends Nl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new no({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Nr(Nr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),o=new mt;e&&o.translate(e.x,e.y),i&&(a(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),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()}};_e([Wo(Tl)],Sd.prototype,"__",void 0),_e([Vh(100)],Sd.prototype,"width",void 0),_e([Vh(100)],Sd.prototype,"height",void 0),_e([Vh(1)],Sd.prototype,"pixelRatio",void 0),_e([Vh(!0)],Sd.prototype,"smooth",void 0),_e([uo(!1)],Sd.prototype,"safeResize",void 0),_e([Vh()],Sd.prototype,"contextSettings",void 0),Sd=_e([qo()],Sd);const{copyAndSpread:Ed,includes:Bd,spread:Td,setList:Rd}=Vt,{stintSet:Cd}=p;let Od=class extends Fl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,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=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,Cd(t,"__padding",l&&W.fourNumber(l)),Cd(t,"__clipText","show"!==h&&!t.__autoSize),Cd(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:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Td(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),p.stintSet(this,"isOverflow",!Bd(h,a)),this.isOverflow?(Rd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ed(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,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()}};_e([Wo(El)],Od.prototype,"__",void 0),_e([yo(0)],Od.prototype,"width",void 0),_e([yo(0)],Od.prototype,"height",void 0),_e([To()],Od.prototype,"boxStyle",void 0),_e([uo(!1)],Od.prototype,"resizeFontSize",void 0),_e([To("#000000")],Od.prototype,"fill",void 0),_e([ko("outside")],Od.prototype,"strokeAlign",void 0),_e([Fo("all")],Od.prototype,"hitFill",void 0),_e([yo("")],Od.prototype,"text",void 0),_e([yo("")],Od.prototype,"placeholder",void 0),_e([yo("caption")],Od.prototype,"fontFamily",void 0),_e([yo(12)],Od.prototype,"fontSize",void 0),_e([yo("normal")],Od.prototype,"fontWeight",void 0),_e([yo(!1)],Od.prototype,"italic",void 0),_e([yo("none")],Od.prototype,"textCase",void 0),_e([yo("none")],Od.prototype,"textDecoration",void 0),_e([yo(0)],Od.prototype,"letterSpacing",void 0),_e([yo({type:"percent",value:1.5})],Od.prototype,"lineHeight",void 0),_e([yo(0)],Od.prototype,"paraIndent",void 0),_e([yo(0)],Od.prototype,"paraSpacing",void 0),_e([yo("x")],Od.prototype,"writingMode",void 0),_e([yo("left")],Od.prototype,"textAlign",void 0),_e([yo("top")],Od.prototype,"verticalAlign",void 0),_e([yo(!0)],Od.prototype,"autoSizeAlign",void 0),_e([yo("normal")],Od.prototype,"textWrap",void 0),_e([yo("show")],Od.prototype,"textOverflow",void 0),_e([To(!1)],Od.prototype,"textEditing",void 0),Od=_e([qo()],Od);let Ld=class extends Fl{get __tag(){return"Path"}};_e([Wo(bl)],Ld.prototype,"__",void 0),_e([ko("center")],Ld.prototype,"strokeAlign",void 0),Ld=_e([qo()],Ld);let Pd=class extends Il{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Ld(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){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,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};_e([Wo(kl)],Pd.prototype,"__",void 0),_e([(t,e)=>{oo(t,e,{get(){return this.__path}})}],Pd.prototype,"path",void 0),Pd=_e([Go(Ys,["set","path","paint"]),qo()],Pd);let Ad=class extends Yl{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&&ae.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(t){const e=new Yl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Zr.END,this.__onReady,this],[Jr.START,this.__onCreated,this],[Jr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Jr.END,this.__onChildRenderEnd,this))}};Ad=_e([qo()],Ad);const Dd={},Md={isHoldSpaceKey:()=>Md.isHold("Space"),isHold:t=>Dd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Dd[t]||(Dd[t]=!0)},setUpCode(t){Dd[t]=!1}},Fd={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 Id extends Fr{get spaceKey(){return Md.isHoldSpaceKey()}get left(){return Fd.left(this)}get right(){return Fd.right(this)}get middle(){return Fd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Md.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){ue.changeName(t,e)}}const{min:Wd,max:zd,abs:Yd}=Math,{float:Nd,sign:Xd}=W,{minX:Hd,maxX:Vd,minY:jd,maxY:Ud}=Vt,Gd=new qt,qd=new qt,Kd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Zd.getValidMove(t.__localBoxBounds,Zd.getDragBounds(t),s,e,!0),Zd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&Zd.getValidScaleOf(t.__localBoxBounds,Zd.getDragBounds(t),o,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 o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Zd.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),Zd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=Nd(s.x),s.y=Nd(s.y),s},getValidScaleOf(t,e,i,s,n,o,a){a||(n=Object.assign({},n)),qd.set(e),Gd.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,g,p,_,f=1,m=1;return Zd.isInnerMode(t,e,i,"width")?(n.x<0&&Gd.scaleOf(s,f=1/n.x,1),p=Nd(Gd.minX-qd.minX),_=Nd(qd.maxX-Gd.maxX),u=h&&p>0?1+p/(h*Gd.width):1,g=l&&_>0?1+_/(l*Gd.width):1,f*=zd(u,g)):(n.x<0&&((Nd(Hd(t)-Hd(e))<=0||Nd(Vd(e)-Vd(t))<=0)&&Gd.scaleOf(s,f=1/n.x,1),Gd.unsign()),p=Nd(qd.minX-Gd.minX),_=Nd(Gd.maxX-qd.maxX),u=h&&p>0?1-p/(h*Gd.width):1,g=l&&_>0?1-_/(l*Gd.width):1,f*=Wd(u,g)),Zd.isInnerMode(t,e,i,"height")?(n.y<0&&Gd.scaleOf(s,1,m=1/n.y),p=Nd(Gd.minY-qd.minY),_=Nd(qd.maxY-Gd.maxY),u=d&&p>0?1+p/(d*Gd.height):1,g=c&&_>0?1+_/(c*Gd.height):1,m*=zd(u,g),o&&(u=zd(Yd(f),Yd(m)),f=Xd(f)*u,m=Xd(m)*u)):(n.y<0&&((Nd(jd(t)-jd(e))<=0||Nd(Ud(e)-Ud(t))<=0)&&Gd.scaleOf(s,1,m=1/n.y),Gd.unsign()),p=Nd(qd.minY-Gd.minY),_=Nd(Gd.maxY-qd.maxY),u=d&&p>0?1-p/(d*Gd.height):1,g=c&&_>0?1-_/(c*Gd.height):1,m*=Wd(u,g)),n.x*=r(f)?f:1,n.y*=r(m)?m:1,n}},Zd=Kd;let Jd=class extends Id{};Jd.POINTER="pointer",Jd.BEFORE_DOWN="pointer.before_down",Jd.BEFORE_MOVE="pointer.before_move",Jd.BEFORE_UP="pointer.before_up",Jd.DOWN="pointer.down",Jd.MOVE="pointer.move",Jd.UP="pointer.up",Jd.OVER="pointer.over",Jd.OUT="pointer.out",Jd.ENTER="pointer.enter",Jd.LEAVE="pointer.leave",Jd.TAP="tap",Jd.DOUBLE_TAP="double_tap",Jd.CLICK="click",Jd.DOUBLE_CLICK="double_click",Jd.LONG_PRESS="long_press",Jd.LONG_TAP="long_tap",Jd.MENU="pointer.menu",Jd.MENU_TAP="pointer.menu_tap",Jd=_e([Ko()],Jd);const $d=Jd,Qd={};let tc=class extends Jd{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 dt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Kd.axisMove(t,n),n}static limitMove(t,e){Kd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Qd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Qd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Qd,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 Vt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Vt.unsign(i),i}assignMove(t){Qd.x=t?this.totalX:this.moveX,Qd.y=t?this.totalY:this.moveY}};tc.BEFORE_DRAG="drag.before_drag",tc.START="drag.start",tc.DRAG="drag",tc.END="drag.end",tc.OVER="drag.over",tc.OUT="drag.out",tc.ENTER="drag.enter",tc.LEAVE="drag.leave",tc=_e([Ko()],tc);const ec=tc;let ic=class extends Jd{static setList(t){tc.setList(t)}static setData(t){tc.setData(t)}};ic.DROP="drop",ic=_e([Ko()],ic);let sc=class extends tc{};sc.BEFORE_MOVE="move.before_move",sc.START="move.start",sc.MOVE="move",sc.END="move.end",sc=_e([Ko()],sc);let nc=class extends Id{};nc=_e([Ko()],nc);const oc=nc;let rc=class extends Jd{};rc.BEFORE_ROTATE="rotate.before_rotate",rc.START="rotate.start",rc.ROTATE="rotate",rc.END="rotate.end",rc=_e([Ko()],rc);let ac=class extends tc{};ac.SWIPE="swipe",ac.LEFT="swipe.left",ac.RIGHT="swipe.right",ac.UP="swipe.up",ac.DOWN="swipe.down",ac=_e([Ko()],ac);let hc=class extends Jd{};hc.BEFORE_ZOOM="zoom.before_zoom",hc.START="zoom.start",hc.ZOOM="zoom",hc.END="zoom.end",hc=_e([Ko()],hc);let lc=class extends Id{};lc.BEFORE_DOWN="key.before_down",lc.BEFORE_UP="key.before_up",lc.DOWN="key.down",lc.HOLD="key.hold",lc.UP="key.up",lc=_e([Ko()],lc);const dc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?ac.UP:t>45&&t<135?ac.DOWN:t<=45&&t>=-45?ac.RIGHT:ac.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:cc.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,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new 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:t=>t&&t.list.some(t=>ar.draggable(t)||!t.isLeafer&&t.hasEvent(tc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},cc=dc,uc=new vh,{getDragEventData:gc,getDropEventData:pc,getSwipeEventData:_c}=dc;class fc{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=gc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=tc.list||this.draggableList||uc;return this.dragging&&(s?t?uc:new vh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(sc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Fd.left(t),this.dragging&&(this.interaction.emit(tc.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],ar.draggable(e)){this.draggableList=new vh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=gc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(sc.BEFORE_MOVE,this.dragData),e.emit(sc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(tc.BEFORE_DRAG,this.dragData),e.emit(tc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:r}=e.p,h=!r||!!t;s.forEach(e=>{if(e.draggable){const s=o(e.draggable),l=tc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);r&&!s&&t?ar.animateMove(e,l,a(r)?r:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(tc.OUT,t,i),e.emit(tc.OVER,t,s)):e.emit(tc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(tc.LEAVE,t,i,s),e.emit(tc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=gc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(sc.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(tc.END,r),this.swipe(t,i,s,r),this.drop(t,n,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=_c(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=pc(t,e,tc.data);s.path=i,this.interaction.emit(ic.DROP,s),this.interaction.emit(tc.LEAVE,t,i)}dragReset(){tc.list=tc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const mc=Qt.get("emit");const yc=["move","zoom","rotate","key"];function vc(t,e,i,s,n){if(yc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!xc(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&wc(o,e,i,s,n)}}function wc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!xc(t,n)&&(sl.updateEventStyle&&!s&&sl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ue.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function xc(t,e){return e&&e.has(t)}const bc={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:kc,pathCanDrag:Sc,pathHasOutside:Ec}=dc;class Bc{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&&Fd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Fd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Md.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=p.clone(bc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new vh(t),this.createTransformer(),this.dragger=new fc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Fd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Jd.BEFORE_DOWN,t),this.emit(Jd.DOWN,t),Fd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Fd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Fd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Jd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=dt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Jd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Fd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Jd.BEFORE_UP,t),this.emit(Jd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Jd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Jd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(lc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Md.setDownCode(e),this.emit(lc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(lc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(lc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Md.setUpCode(e),this.emit(lc.UP,t,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(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Jd.OUT,t,i),this.emit(Jd.OVER,t,e)):this.emit(Jd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(Jd.LEAVE,t,i,e),this.emit(Jd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Jd.LEAVE,t),this.dragger.dragging&&this.emit(ic.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[Jd.DOUBLE_TAP,Jd.DOUBLE_CLICK].some(e=>kc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;v.backgrounder||t.origin||o&&o.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!Ec(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Sc(t.path))&&!Ec(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))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Jd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,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(t){this.emit(Jd.TAP,t),this.emit(Jd.CLICK,t)}emitDoubleTap(t){this.emit(Jd.DOUBLE_TAP,t),this.emit(Jd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(Jd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Jd.LONG_TAP,t),(kc(t.path,Jd.LONG_TAP)||kc(t.path,Jd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(qr.RESIZE,this.__onResize,this)],t.once($r.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 o=i.length-1;o>-1;o--){if(n=i.list[o],wc(n,t,e,!0,s))return;n.isApp&&vc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&vc(n,t,e,!1,s),wc(n,t,e,!1,s))return}catch(t){mc.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 Tc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Tc.custom={};class Rc extends pe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new vh,this.pixelList=new vh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.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()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())};const{toInnerRadiusPointOf:Cc,copy:Oc,setRadius:Lc}=dt,{hitRadiusPoint:Pc,hitPoint:Ac}=Vt,Dc={},Mc={},Fc=hh.prototype;Fc.hit=function(t,e=0){this.updateLayout(),Oc(Mc,t),Lc(Mc,e);const i=this.__world;return!!(e?Pc(i,Mc):Ac(i,Mc))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Mc),e,{target:this}):this.__hitWorld(Mc))},Fc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,o=s.width<10&&s.height<10;if(i.hitRadius&&(Oc(Dc,t),Lc(t=Dc,i.hitRadius)),Cc(t,s,Dc),i.hitBox||o){if(Vt.hitRadiusPoint(n.boxBounds,Dc))return!0;if(o)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Dc,e)},Fc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Fc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Fc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Fc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Ic=new mt,Wc=Fl.prototype;Wc.__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 o=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=v.image.hitCanvasSize,r=o.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),to.patternLocked=!0,this.__renderShape(o,{matrix:Ic.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),to.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},Wc.__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:o,__maxStrokeWidth:r}=i,a=i.stroke&&("path"===o||"pixel"===o&&!i.__isAlphaPixelStroke)||"all"===o;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*r,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=r;break;case"outside":if(l+=2*r,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const zc=Fl.prototype,Yc=Nl.prototype,Nc=Gl.prototype;Yc.__updateHitCanvas=Nc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?zc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Yc.__hitFill=Nc.__hitFill=function(t){return this.__hitCanvas?zc.__hitFill.call(this,t):Vt.hitRadiusPoint(this.__layout.boxBounds,t)},Od.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},Il.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Xc=Oe.prototype;function Hc(t,e,i){t.__.__font?Jh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Vc(t,e,i,s,n){const o=i.__;c(t)?Jh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Jh.strokeArrow(t,i,s,n)}function jc(t,e,i,s,n){const o=i.__;c(t)?Jh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),Jh.drawTextStroke(i,s,n))}function Uc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,jc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",Jh.fillText(i,o,n),o.blendMode="normal",ar.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}Xc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Xc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Xc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Gc,copyAndSpread:qc,toOuterOf:Kc,getOuterOf:Zc,getByMove:Jc,move:$c,getIntersectData:Qc}=Vt,tu={};let eu;const{stintSet:iu}=p,{hasTransparent:su}=qh;function nu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:r}=i.__layout;switch(e.type){case"image":if(!e.url)return;n=$h.image(i,t,e,r,!eu||!eu[e.url]);break;case"linear":n=Qh.linearGradient(e,r);break;case"radial":n=Qh.radialGradient(e,r);break;case"angular":n=Qh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;n={type:o,style:qh.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:qh.string(e)})}if(n&&(n.originPaint=e,o(n.style)&&su(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const ou={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];d(a)||(a=[a]),eu=$h.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=nu(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(iu(i,"__isAlphaPixelFill",n),iu(i,"__isTransparentFill",o)):(iu(i,"__isAlphaPixelStroke",n),iu(i,"__isTransparentStroke",o),iu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Hc(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,$h.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}o.blendMode&&(i.blendMode=o.blendMode),Hc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Hc(e,i,s),i.restoreBlendMode()):Hc(e,i,s)}},fillPathOrText:Hc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.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":Vc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Vc(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)Vc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Vc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),ar.copyCanvasByWorld(e,i,r),r.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":jc(t,1,e,i,s);break;case"inside":Uc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?jc(t,2,e,i,s):Uc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[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(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;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(r=t[l],(!r.image||!$h.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?Jh.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?Jh.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;Kc(r.strokeSpread?(qc(tu,r.boxBounds,r.strokeSpread),tu):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(v.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Gc(n,R.swapAndScale(r.renderShapeSpread,p,_)):n;s=Qc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=Zc(a,c),h=Jc(u,-c.e,-c.f),l=Zc(o,c),$c(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let ru,au=new qt;const{isSame:hu}=Vt;function lu(t,e,i,s,n,o){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||$h.createData(n,s,i,o),!0}function du(t,e){gu(t,Nr.LOAD,e)}function cu(t,e){gu(t,Nr.LOADED,e)}function uu(t,e,i){e.error=i,t.forceUpdate("surface"),gu(t,Nr.ERROR,e)}function gu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Nr(e,i))}function pu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:_u,translate:fu}=Q,mu=new qt,yu={},vu={};function wu(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 xu={},bu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:ku,set:Su,rotateOfOuter:Eu,translate:Bu,scaleOfOuter:Tu,multiplyParent:Ru,scale:Cu,rotate:Ou,skew:Lu}=Q;function Pu(t,e,i,s,n,o,r,a){r&&Ou(t,r),a&&Lu(t,a.x,a.y),n&&Cu(t,n,o),Bu(t,e.x+i,e.y+s)}const{get:Au,scale:Du,copy:Mu}=Q,{getFloorScale:Fu}=W,{abs:Iu}=Math;const Wu={image:function(t,e,i,s,n){let o,r;const a=to.get(i);return ru&&i===ru.paint&&hu(s,ru.boxBounds)?o=ru.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),ru=a.use>1?{leafPaint:o,paint:i,boxBounds:au.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(lu(t,e,i,a,o,s),n&&(du(t,r),cu(t,r))):a.error?n&&uu(t,r,a.error):(n&&(pu(t,!0),du(t,r)),o.loadId=a.load(()=>{pu(t,!1),t.destroyed||(lu(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),cu(t,r)),o.loadId=void 0},e=>{pu(t,!1),uu(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,n){const{scaleX:o,scaleY:r}=$h.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===o+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&qr.isResizing(i)||d||(e=v.image.isLarge(a,o,r)||a.width*o>8096||a.height*r>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),$h.drawImage(t,o,r,i,s,n),!0):(!t.style||l.sync||d?$h.createPattern(t,i,s,n):$h.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let g,{width:p,height:_}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),g&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,_),n.restore()):(r.scaleX&&(p*=r.scaleX,_*=r.scaleY),n.drawImage(c,0,0,p,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,to.recyclePaint(s),n.loading&&(r||(r=e.__input&&e.__input[t]||[],d(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=to.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&$h.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=$h.getImageRenderScaleData(t,e,i,s),r=n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!v.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=$h.getPatternFixScale(t,n,o);let d,c,u,{width:g,height:p}=i;l&&(n*=l,o*=l),g*=n,p*=o,h&&(c=h.x*n/Iu(s.scaleX||1),u=h.y*o/Iu(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=Fu(g+(c||0)),o*=Fu(p+(u||0)),d=Au(),a&&Mu(d,a),Du(d,1/n,1/o));const _=i.getCanvas(g,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=v.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){t.data=$h.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=mu.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:g,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Vt.set(vu,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,yu),b=yu.scaleX,k=yu.scaleY),(h||m||f)&&(b&&Vt.scale(vu,b,k,!0),h&&Tt.toPoint(h,vu,e,vu,!0,!0))):v&&!g||(b=k=Vt.getFitScale(e,vu,"fit"!==a),Vt.put(e,i,h,b,!1,vu),Vt.scale(vu,b,k,!0)),l&&dt.move(vu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,$h.stretchMode(w,e,b,k));break;case"normal":case"clip":if(vu.x||vu.y||b||_||g||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),$h.clipMode(w,e,vu.x,vu.y,b,k,g,p,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||p)&&$h.repeatMode(w,e,s,n,vu.x,vu.y,b,k,g,p,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;c(t)?(o=t.x,r=t.y):o=r=t;return{x:wu(o,i,n.width,e&&e.x),y:wu(r,s,n.height,e&&e.y)}}(m,i&&f,vu.width,vu.height,e));break;default:b&&$h.fillOrFitMode(w,e,vu.x,vu.y,b,k,g)}return w.transform||(e.x||e.y)&&fu(w.transform=_u(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=ku(),{x:o,y:r}=e;o||r?Bu(n,o,r):n.onlyScale=!0,Cu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=ku();Bu(a,e.x+i,e.y+s),Cu(a,n,o),r&&Eu(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const d=ku();Pu(d,e,i,s,n,o,r,a),h&&(r||a?(Su(bu),Tu(bu,e,h,l),Ru(d,bu)):Tu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=ku();if(c)Pu(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Eu(u,{x:i/2,y:s/2},h);else switch(Ou(u,h),h){case 90:Bu(u,s,0);break;case 180:Bu(u,i,s);break;case 270:Bu(u,0,i)}xu.x=e.x+n,xu.y=e.y+o,Bu(u,xu.x,xu.y),r&&Tu(u,xu,r,a)}t.transform=u}},{toPoint:zu}=St,{hasTransparent:Yu}=qh,Nu={},Xu={};function Hu(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&&Yu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Vu,getDistance:ju}=dt,{get:Uu,rotateOfOuter:Gu,scaleOfOuter:qu}=Q,{toPoint:Ku}=St,Zu={},Ju={};function $u(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Vu(e,i);o=Uu(),n?(qu(o,e,r/a*(s||1),1),Gu(o,e,t+90)):(qu(o,e,1,r/a*(s||1)),Gu(o,e,t))}return o}const{getDistance:Qu}=dt,{toPoint:tg}=St,eg={},ig={};const sg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;zu(i||"top",e,Nu),zu(s||"bottom",e,Xu);const r=v.canvas.createLinearGradient(Nu.x,Nu.y,Xu.x,Xu.y),a={type:n,style:r};return Hu(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;Ku(i||"center",e,Zu),Ku(s||"bottom",e,Ju);const a=v.canvas.createRadialGradient(Zu.x,Zu.y,0,Zu.x,Zu.y,ju(Zu,Ju)),h={type:n,style:a};Hu(h,a,t.stops,o);const l=$u(e,Zu,Ju,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;tg(i||"center",e,eg),tg(s||"bottom",e,ig);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,eg.x,eg.y):v.canvas.createRadialGradient(eg.x,eg.y,0,eg.x,eg.y,Qu(eg,ig)),h={type:n,style:a};Hu(h,a,t.stops,o);const l=$u(e,eg,ig,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:$u},{copy:ng,move:og,toOffsetOutBounds:rg}=Vt,{max:ag,abs:hg}=Math,lg={},dg=new mt,cg={};function ug(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=hg(t.spread||0),r=ag(r,n+o-s),a=ag(a,n+o+i),h=ag(h,n+o+s),l=ag(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function gg(t,e,i){const{shapeBounds:s}=i;let n,o;v.fullImageShadow?(ng(lg,t.bounds),og(lg,e.x-s.x,e.y-s.y),n=t.bounds,o=lg):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:pg}=Vt,_g={};const fg=ug;const mg={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;rg(h,cg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(cg.offsetX+(r.x||0)*c*f,cg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,qh.string(r.color)),n=tl.getShadowTransform(t,g,i,r,cg,f),n&&g.setTransform(n),gg(g,cg,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;pg(h,_g,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(_g.offsetX+(r.x||0)*c*f,_g.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=tl.getShadowTransform(t,g,i,r,_g,f,!0),n&&g.setTransform(n),gg(g,_g,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,qh.string(r.color),"source-in"),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.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:ug,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return dg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),dg}},isTransformShadow(t){},getInnerShadowSpread:fg},{excludeRenderBounds:yg}=_r;let vg;function wg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":vg||(vg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);bg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":bg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function xg(t){return t.getSameCanvas(!1,!0)}function bg(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}Il.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(wg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||yg(i,e)||i.__render(t,e),o=i.__.opacity,vg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=xg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=xg(t)),n||(n=xg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&wg(this,r,t,n,s,o,void 0,!1),yg(i,e)||i.__render(n||t,e),d&&wg(this,r,t,n,s,o,d,!1)}wg(this,r,t,n,s,o,void 0,!0)};const kg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Sg=kg+"_#~&*+\\=|≮≯≈≠=…",Eg=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 Bg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Tg=Bg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Rg=Bg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Cg=Bg(kg),Og=Bg(Sg),Lg=Bg("- —/~|┆·");var Pg;!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"}(Pg||(Pg={}));const{Letter:Ag,Single:Dg,Before:Mg,After:Fg,Symbol:Ig,Break:Wg}=Pg;function zg(t){return Tg[t]?Ag:Lg[t]?Wg:Rg[t]?Mg:Cg[t]?Fg:Og[t]?Ig:Eg.test(t)?Dg:Ag}const Yg={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ng(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:Xg}=Yg,{Letter:Hg,Single:Vg,Before:jg,After:Ug,Symbol:Gg,Break:qg}=Pg;let Kg,Zg,Jg,$g,Qg,tp,ep,ip,sp,np,op,rp,ap,hp,lp,dp,cp,up=[];function gp(t,e){sp&&!ip&&(ip=sp),Kg.data.push({char:t,width:e}),Jg+=e}function pp(){$g+=Jg,Kg.width=Jg,Zg.words.push(Kg),Kg={data:[]},Jg=0}function _p(){hp&&(lp.paraNumber++,Zg.paraStart=!0,hp=!1),sp&&(Zg.startCharSize=ip,Zg.endCharSize=sp,ip=0),Zg.width=$g,dp.width?Xg(Zg):cp&&fp(),up.push(Zg),Zg={words:[]},$g=0}function fp(){$g>(lp.maxWidth||0)&&(lp.maxWidth=$g)}const{top:mp,right:yp,bottom:vp,left:wp}=xt;function xp(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 bp={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[wp],n-=a[yp]+a[wp],!n&&(n=.01)):e.autoSizeAlign||(i=a[wp]),r?(s=a[mp],r-=a[mp]+a[vp],!r&&(r=.01)):e.autoSizeAlign||(s=a[mp]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){lp=t,up=t.rows,dp=t.bounds,cp=!dp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=v,{width:a}=dp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;hp=!0,op=null,ip=ep=sp=Jg=$g=0,Kg={data:[]},Zg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)tp=e[i],"\n"===tp?(Jg&&pp(),Zg.paraEnd=!0,_p(),hp=!0):(np=zg(tp),np===Hg&&"none"!==o&&(tp=Ng(tp,o,!Jg)),ep=r.measureText(tp).width,s&&(s<0&&(sp=ep),ep+=s),rp=np===Vg&&(op===Vg||op===Hg)||op===Vg&&np!==Ug,ap=!(np!==jg&&np!==Vg||op!==Gg&&op!==Ug),Qg=hp&&n?a-n:a,t&&a&&$g+Jg+ep>Qg&&(h?(Jg&&pp(),$g&&_p()):(ap||(ap=np===Hg&&op==Ug),rp||ap||np===qg||np===jg||np===Vg||Jg+ep>Qg?(Jg&&pp(),$g&&_p()):$g&&_p()))," "===tp&&!0!==hp&&$g+Jg===0||(np===qg?(" "===tp&&Jg&&pp(),gp(tp,ep),pp()):rp||ap?(Jg&&pp(),gp(tp,ep)):gp(tp,ep)),op=np);Jg&&pp(),$g&&_p(),up.length>0&&(up[up.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{lp.paraNumber++,$g=r.measureText(t).width,up.push({x:n||0,text:t,width:$g,paraStart:!0}),cp&&fp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":xp(e,"x",t[wp]);break;case"right":xp(e,"x",-t[yp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":xp(e,"y",t[mp]);break;case"bottom":xp(e,"y",-t[vp])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(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===_?(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&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:o}=t;let{textOverflow:r}=e;if(n.splice(o),r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?v.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?n:[n[o-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:r,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:o}=e;switch(t.decorationHeight=n/11,c(o)?(i=o.type,o.color&&(t.decorationColor=qh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,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 kp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(o(t)){if(!i||!qh.object)return t;t=qh.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const r=t.r+","+t.g+","+t.b;return 1===n?"rgb("+r+")":"rgba("+r+","+n+")"}};function Sp(t){return t?d(t)?t:[t]:[]}Object.assign(Gh,bp),Object.assign(qh,kp),Object.assign(Jh,ou),Object.assign($h,Wu),Object.assign(Qh,sg),Object.assign(tl,mg),Object.assign(ae,{interaction:(t,e,i,s)=>new Bc(t,e,i,s),hitCanvas:(t,e)=>new bh(t,e),hitCanvasManager:()=>new Rc}),Sh();class Ep extends Fr{get list(){return Sp(this.value)}get oldList(){return Sp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Bp(t){return(e,i)=>{const s="_"+i;oo(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?Ep.BEFORE_SELECT:Ep.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Ep(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Ep.BEFORE_SELECT="editor.before_select",Ep.SELECT="editor.select",Ep.AFTER_SELECT="editor.after_select",Ep.BEFORE_HOVER="editor.before_hover",Ep.HOVER="editor.hover";const{abs:Tp}=Math,{copy:Rp}=Q,{setListWithFn:Cp}=Vt,{worldBounds:Op}=_r,Lp={a:1,b:0,c:0,d:1,e:0,f:0},Pp={x:0,y:0,width:0,height:0};class Ap extends Fl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Cp(Pp,e,Op),t&&this.set(t),this.set(Pp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Tp(c.scaleX),l=Tp(c.scaleY);Rp(Lp,c),Lp.half=a%2,t.setWorld(Lp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Math.max(i,l),r&&(o(r)?Jh.stroke(r,this,t,e):Jh.strokes(r,this,t,e)),h&&(o(h)?Jh.fill(h,this,t,e):Jh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}_e([Bp(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],Ap.prototype,"target",void 0);class Dp extends Il{constructor(t){super(t),this.strokeArea=new Nl({strokeAlign:"center"}),this.fillArea=new Nl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Mp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Fp([t],i,e),i}};function Fp(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&Fp(s.children,e,i)}}const{findOne:Ip,findByBounds:Wp}=Mp;class zp extends Il{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Ap,this.targetStroker=new Ap,this.bounds=new qt,this.selectArea=new Dp,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new vh(Wp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Ip(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new vh(this.editor.editBox.rect)};return Ip(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Ip(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[Ep.HOVER,this.onHover,this],[Ep.SELECT,this.onSelect,this]]),e.on_([[Jd.MOVE,this.onPointerMove,this],[Jd.BEFORE_DOWN,this.onBeforeDown,this],[Jd.TAP,this.onTap,this],[tc.START,this.onDragStart,this,!0],[tc.DRAG,this.onDrag,this],[tc.END,this.onDragEnd,this],[sc.MOVE,this.onAutoMove,this],[[hc.ZOOM,sc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Yp,top:Np,topRight:Xp,right:Hp,bottomRight:Vp,bottom:jp,bottomLeft:Up,left:Gp}=bt,{toPoint:qp}=St,{within:Kp,sign:Zp}=W,{abs:Jp}=Math,$p={getScaleData(t,e,i,s,n,o,r,h){let l,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Zp(x),S=Zp(b),E=h?x:k*p.width/v,B=h?b:S*p.height/w;if(a(s))u=g=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case Np:g=t,l="bottom";break;case Hp:u=e,l="left";break;case jp:g=r,l="top";break;case Gp:u=a,l="right";break;case Yp:g=t,u=a,l="bottom-right";break;case Xp:g=t,u=e,l="bottom-left";break;case Vp:g=r,u=e,l="top-left";break;case Up:g=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case Np:case jp:u=g;break;case Gp:case Hp:g=u;break;default:d=Math.sqrt(Jp(u*g)),u=Zp(u)*d,g=Zp(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(qp(o||l,p,c,!0),m){const e={x:u,y:g};Kd.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=Kp(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=Kp(e*g,f)/e}return T&&Jp(u*y.width)<1&&(u=Zp(u)/y.width),R&&Jp(g*y.height)<1&&(g=Zp(g)/y.height),n&&u!==g&&(d=Math.min(Jp(u),Jp(g)),u=Zp(u)*d,g=Zp(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case Yp:o="bottom-right";break;case Xp:o="bottom-left";break;case Vp:o="top-left";break;case Up:o="top-right";break;default:o="center"}return qp(n||o,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Np:case Yp:o={x:.5,y:0},n="bottom",a=1;break;case jp:case Vp:o={x:.5,y:1},n="top",a=1;break;case Gp:case Up:o={x:0,y:.5},n="right",h=1;break;case Hp:case Xp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,qp(s||n,t,r,!0);const c=dt.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Gp:t=Hp;break;case Yp:t=Xp;break;case Up:t=Vp;break;case Hp:t=Gp;break;case Xp:t=Yp;break;case Vp:t=Up}if(i)switch(t){case Np:t=jp;break;case Yp:t=Up;break;case Xp:t=Vp;break;case jp:t=Np;break;case Up:t=Yp;break;case Vp:t=Xp}return t}},Qp={};function t_(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return e_(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*($p.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(W.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;Qp[S]?i.cursor=Qp[S]:Qp[S]=i.cursor={url:i_(x,h),x:b,y:k}}function e_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function i_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class s_ extends Gl{constructor(t){super(t),this.useFastShadow=!0}}const n_=["top","right","bottom","left"],o_=void 0;class r_ extends Il{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return o(t)||o(e)||o(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Il,this.rect=new s_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new s_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Il({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new s_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new s_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new s_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=r[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:o_},e.rect||{}));const f=n(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&p.stintSet(t.__world,"ignorePixelSnap",d),e_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:p,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Vt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=a(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)St.toPoint(St.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!p),v.visible=y&&p&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,_&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=n_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=n_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?$p.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:o_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return d(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return d(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return d(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}t_(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(qr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof tc||t instanceof sc)&&this.transformTool.onMove(t),this.resizing&&(qr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),o(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case sc.START:this.onTransformStart(t);break;case sc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case hc.START:this.onTransformStart(t);break;case hc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case hc.START:this.onTransformStart(t);break;case hc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){t_(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Od)||t.find(t=>t instanceof Od);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[tc.START,this.onDragStart,this],[tc.DRAG,this.onDrag,this],[tc.END,this.onDragEnd,this],[Jd.ENTER,e=>{this.enterPoint=t,t_(this,e)}],[Jd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[Jd.DOUBLE_TAP,this.onDoubleTap,this],[Jd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[lc.HOLD,lc.UP],this.onKey,this],[lc.DOWN,this.onArrow,this],[[sc.START,sc.BEFORE_MOVE,sc.END],this.onMove,this,!0],[[hc.START,hc.BEFORE_ZOOM,hc.END],this.onScale,this,!0],[[rc.START,rc.BEFORE_ROTATE,rc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const a_={x:0,y:0,width:1e5,height:1e5};class h_ extends Fl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,a_),Object.assign(this.__world,a_)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const l_='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',d_={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${l_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${l_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${l_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},c_=new qt;function u_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{c_.setListWithFn(i,t=>t.getBounds("box","page")),0===c_.width&&(c_.width=.1),0===c_.height&&(c_.height=.1),e.reset(c_.get())}),s.add(e)}const g_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),p_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),__={group(t,e,i){t.sort(p_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Il(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(g_);const r=new mt(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(g_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(p_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},f_=Qt.get("EditToolCreator");function m_(){return t=>{v_.register(t)}}const y_=m_,v_={list:{},register(t){const{tag:e}=t.prototype;w_[e]&&f_.repeat(e),w_[e]=t},get:(t,e)=>new w_[t](e)},{list:w_}=v_;class x_ extends Ep{constructor(t,e){super(t,e)}}x_.BEFORE_OPEN="innerEditor.before_open",x_.OPEN="innerEditor.open",x_.BEFORE_CLOSE="innerEditor.before_close",x_.CLOSE="innerEditor.close";class b_ extends Ep{constructor(t,e){super(t,e)}}b_.BEFORE_GROUP="editor.before_group",b_.GROUP="editor.group",b_.BEFORE_UNGROUP="editor.before_ungroup",b_.UNGROUP="editor.ungroup",b_.BEFORE_OPEN="editor.before_open_group",b_.OPEN="editor.open_group",b_.BEFORE_CLOSE="editor.before_close_group",b_.CLOSE="editor.close_group";const{updateMatrix:k_}=ar,S_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},E_="top-left";class B_ extends Nl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(zr.CHANGE,e=>{if(this.checkChange&&S_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,k_(this.parent),k_(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),k_(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(E_,o);break;case"scaleX":t.scaleOf(E_,o,1);break;case"scaleY":t.scaleOf(E_,1,o);break;case"skewX":t.skewOf(E_,o,0);break;case"skewY":t.skewOf(E_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class T_ extends Ep{constructor(t,e){super(t,e)}}T_.BEFORE_MOVE="editor.before_move",T_.MOVE="editor.move";class R_ extends Ep{constructor(t,e){super(t,e)}}R_.BEFORE_SCALE="editor.before_scale",R_.SCALE="editor.scale";class C_ extends Ep{constructor(t,e){super(t,e)}}C_.BEFORE_ROTATE="editor.before_rotate",C_.ROTATE="editor.rotate";class O_ extends Ep{constructor(t,e){super(t,e)}}O_.BEFORE_SKEW="editor.before_skew",O_.SKEW="editor.skew";class L_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:r}=i;const h=t.type===sc.END||t.type===tc.END,l=o(e.draggable),d=!r||h||l,c={x:t.totalX,y:t.totalY};t instanceof sc&&dt.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=tc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(r&&!l&&h?ar.animateMove(this,n,a(r)?r:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof hc?(r=e.getBoxPoint(t),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=$p.getScaleData(e,n.bounds,d,o,a,$p.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof tc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),dt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof rc)d=t.rotation,l=o?St.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=$p.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=W.float(W.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),dt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=$p.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),$p.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(c(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new T_(T_.BEFORE_MOVE,h));const l=new T_(T_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new R_(R_.BEFORE_SCALE,t));const o=new R_(R_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(c(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new R_(R_.BEFORE_SCALE,u));const g=new R_(R_.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new mt(ar.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new R_(R_.BEFORE_SCALE,r));const a=new R_(R_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(a(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new C_(C_.BEFORE_ROTATE,d));const c=new C_(C_.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(c(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new O_(O_.BEFORE_SKEW,u));const g=new O_(O_.SKEW,u);this.doSkew(g),this.emitEvent(g)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ar.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let P_=class extends Il{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new vh,this.openedGroupList=new vh,this.simulateTarget=new B_(this),this.editBox=new r_(this),this.editToolList={},this.selector=new zp(this),this.editMask=new h_(this),this.targetEventIds=[];let i=p.clone(d_);t&&(i=p.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),re.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>p.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&u_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||v_.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(o(s))e=s;else if(!1===s)return}if(v_.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(b_.BEFORE_GROUP),this.target=__.group(this.list,this.element,t),this.emitGroupEvent(b_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(b_.BEFORE_UNGROUP,t)),this.target=__.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(b_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(b_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(b_.OPEN,t)}closeGroup(t){this.emitGroupEvent(b_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(b_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ar.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new b_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||v_.get(t,this)}openInnerEditor(t,e,i){let s;if(o(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(o(i))s=i;else if(!1===i)return}v_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(x_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(x_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(x_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(x_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new x_(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(__.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(__.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Jr.START,this.onRenderStart,this),i&&i.on_(zr.SCROLL,this.onChildScroll,this),t.on_(Jr.CHILD_START,this.onAppRenderStart,this),t.on_($r.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};_e([(t,e)=>{oo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:o,app:r}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return o.config&&Object.assign(a,o.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),n(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],P_.prototype,"mergeConfig",void 0),_e([Bp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof vh?i:new vh(i),t.multiple&&u_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Ep(Ep.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Ep(Ep.AFTER_SELECT,s))})],P_.prototype,"target",void 0),_e([Bp(function(t,e){t.emitEvent(new Ep(Ep.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],P_.prototype,"hoverTarget",void 0),P_=_e([Go(L_,["editBox","editTool","emitEvent"])],P_);class A_{static registerInnerEditor(){v_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Il,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let D_=class extends A_{static registerEditTool(){v_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};D_=_e([m_()],D_);const{left:M_,right:F_}=bt,{move:I_,copy:W_,toNumberPoints:z_}=dt;let Y_=class extends D_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===M_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=z_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(I_(t,o,r),s&&I_(e,-o,-r)):(s&&I_(t,-o,-r),I_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),W_(s[7],i),W_(e[7],i),W_(s[3],a),W_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===M_||t===F_,s[t].visible=a,e[t].visible=!r&&a}};Y_=_e([m_()],Y_);const{M:N_,L:X_,C:H_,Q:V_,Z:j_,N:U_,D:G_,X:q_,G:K_,F:Z_,O:J_,P:$_,U:Q_}=Ae,tf={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case N_:case X_:ef(t,e,i,n,1),n+=3;break;case H_:ef(t,e,i,n,3),n+=7;break;case V_:ef(t,e,i,n,2),n+=5;break;case j_:n+=1;break;case U_:ef(t,e,i,n,2),n+=5;break;case G_:ef(t,e,i,n,2),n+=9;break;case q_:ef(t,e,i,n,2),n+=6;break;case K_:ef(t,e,i,n,2),n+=9;break;case Z_:ef(t,e,i,n,2),n+=5;break;case J_:t[n]=K_,t.splice(n+4,0,t[n+3],0),ef(t,e,i,n,2),n+=9,o+=2;break;case $_:t[n]=Z_,t.splice(n+4,0,t[n+3]),ef(t,e,i,n,2),n+=5,o+=1;break;case Q_:ef(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:ef}=tf,sf=Q.get(),{topLeft:nf,top:of,topRight:rf,right:af,bottom:hf,left:lf}=bt;function df(t,e,i){t.pathInputed?uf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function cf(t,e,i,n){let o=e;if(!s(n)){const s=t.__layout;let{width:r,height:a}=s.boxBounds;switch(r*=i-e,a*=e-i,n){case of:case hf:o=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case lf:case af:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case nf:case rf:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=d(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function uf(t,e,i){tf.scale(t.__.path,e,i),t.path=t.__.path}function gf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):tf.scalePoints(s,e,i),t.points=s}function pf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)sf.a=e,sf.d=i,s[t].transform(sf,!0)}const _f=hh.prototype;_f.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},_f.__scaleResize=function(t,e){df(this,t,e)},_f.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},_f.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Od.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)cf(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),df(this,t,e)}},Ld.prototype.__scaleResize=function(t,e){uf(this,t,e)},xd.prototype.__scaleResize=function(t,e){this.pathInputed?uf(this,t,e):this.points?gf(this,t,e):this.width*=t},rd.prototype.__scaleResize=function(t,e){this.pathInputed?uf(this,t,e):this.points?gf(this,t,e):df(this,t,e)},Il.prototype.__scaleResize=function(t,e){pf(this,t,e)},Gl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||df(this,t,e),i&&pf(this,t,e)},re.add("resize"),re.add("editor","resize"),ae.editor=function(t,e){const i=new P_(t);return e&&e.sky.add(e.editor=i),i},Gl.addAttr("textBox",!1,uo),Fl.addAttr("editConfig",void 0,uo),Fl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),uo),Fl.addAttr("editInner","PathEditor",uo),Il.addAttr("editInner","",uo),Od.addAttr("editInner","TextEditor",uo),Fl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Fl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Fl.setEditInner=function(t){this.changeAttr("editInner",t)};const ff={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},mf={top:"flex-start",middle:"center",bottom:"flex-end"},yf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function vf(t,e,i){const{style:n}=t,{fill:r,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let g;n.fontFamily=e.fontFamily,n.fontSize=e.fontSize*i+"px",function(t,e){let i="black";d(e)&&(e=e[0]);if(c(e))switch(e.type){case"solid":i=qh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=qh.string(o(t)?t:t.color);break;default:s(e.r)||(i=qh.string(e))}else i=e;t.color=i}(n,r),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,c(u)?(g=u.type,u.color&&(n.textDecorationColor=qh.string(u.color))):g=u,n.textDecoration=yf[g],n.textTransform=ff[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=mf[e.verticalAlign],n.lineHeight=(e.__.__lineHeight||0)*i+"px",n.letterSpacing=(e.__.__letterSpacing||0)*i+"px",n.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",n.wordBreak="break"===h?"break-all":"normal",n.textIndent=(e.paraIndent||0)*i+"px",n.padding=d(a)?a.map(t=>t*i+"px").join(" "):(a||0)*i+"px",n.textOverflow="show"===l?"":"hide"===l?"clip":l}let wf=class extends A_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Od),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(Jd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new mt(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||vf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function xf(t,e,i){bf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(sc.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(sc.END,e=>{ar.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(hc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function bf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&p.assign(i,e),p.assign(t.config,i,t.userConfig)}wf=_e([y_()],wf),re.add("text-editor","editor");const kf=Qt.get("LeaferTypeCreator"),Sf={list:{},register(t,e){Ef[t]&&kf.repeat(t),Ef[t]=e},run(t,e){const i=Ef[t];i&&i(e)}},{list:Ef,register:Bf}=Sf;Bf("viewport",xf),Bf("custom",function(t){xf(t,null,!0)}),Bf("design",function(t){xf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Bf("document",function(t){xf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Tf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),n=dt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=dt.getDistance(e.from,i.from);return{move:o,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Rf,s=Rf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Rf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Rf.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Rf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Rf=Tf,{abs:Cf,max:Of}=Math,{sign:Lf,within:Pf}=W,Af={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Cf(s),r=Cf(n);return o>50&&(s=Of(50,o/3)*Lf(s)),r>50&&(n=Of(50,r/3)*Lf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(v.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=Pf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Pf(1-Cf(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Df,Mf,Ff,If;class Wf{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Df=0,Mf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Df,totalY:Mf}),e.emit(sc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Df+=t.moveX,t.totalY=Mf+=t.moveY,e.emit(sc.BEFORE_MOVE,t),e.emit(sc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Ff=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Ff}),e.emit(hc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Ff*=t.scale,e.emit(hc.BEFORE_ZOOM,t),e.emit(hc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),If=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:If}),e.emit(rc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=If+=t.rotation,e.emit(rc.BEFORE_ROTATE,t),e.emit(rc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(sc.END,Object.assign(Object.assign({},e),{totalX:Df,totalY:Mf})),i&&t.emit(hc.END,Object.assign(Object.assign({},i),{totalScale:Ff})),s&&t.emit(rc.END,Object.assign(Object.assign({},s),{totalRotation:If})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const zf=Yl.prototype,Yf=new qt,Nf=new _t;function Xf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Hf(t,e){return Object.assign(Object.assign({},e),{scale:t})}zf.initType=function(t){Sf.run(t,this)},zf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(Nf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Nf.y=0:t.includes("y")?Nf.x=0:Math.abs(Nf.x)>Math.abs(Nf.y)?Nf.y=0:Nf.x=0,i&&t.includes("limit")&&(Yf.set(this.__world).addPoint(this.zoomLayer),Kd.getValidMove(Yf,this.canvas.bounds,"inner",Nf,!0),t.includes("x")?Nf.y=0:t.includes("y")&&(Nf.x=0))}return{x:n?0:Nf.x,y:n?0:Nf.y}},zf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const Vf=Bc.prototype;Vf.createTransformer=function(){this.transformer=new Wf(this)},Vf.move=function(t){this.transformer.move(t)},Vf.zoom=function(t){this.transformer.zoom(t)},Vf.rotate=function(t){this.transformer.rotate(t)},Vf.transformEnd=function(){this.transformer.transformEnd()},Vf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Af.getScale(t,e);if(1!==o)this.zoom(Hf(o,t));else{const s=e.getMove?e.getMove(t,e):Af.getMove(t,e);i.snap&&dt.round(s),this.move(Xf(s,t))}},Vf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Tf.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Tf.detect(n,c(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Tf.reset()}o||(n.center=Tf.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Hf(n.scale,t)),o&&this.move(Xf(n.move,t))};const jf=fc.prototype,{abs:Uf}=Math;function Gf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}jf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=Uf(i),o=Uf(s),r=e?1:.1,h=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(h){const r="touch"===t.pointerType?3:1,l=70;n*(e=e?a(h)?h:.95:r)>l?e=l/n:o*e>l&&(e=l/o),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},jf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},jf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},jf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Vt.maxX(r),d=Vt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},jf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},re.add("viewport"),re.add("view"),Yl.prototype.zoom=function(t,e,i,s){let r;this.killAnimate(),u(e)?(r=e.padding,i=e.scroll,s=e.transition):r=e;const{zoomLayer:h}=this,l=this.canvas.bounds.clone().shrink(n(r)?30:r),g=new qt,p={x:l.x+l.width/2,y:l.y+l.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(o(t))switch(t){case"in":_=Gf(y,"in");break;case"out":_=Gf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new qt(this.boxBounds)).height=0;break;case"fit-height":(t=new qt(this.boxBounds)).width=0}else a(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(p,_,_,!1,s);else if(c(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=d(t);if(n||t.tag){const e=n?t:[t];g.setListWithFn(e,_r.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,l);g.set(h.getWorldBounds(e))}const{width:o,height:r}=g;let a=l.x-g.x,c=l.y-g.y;return i?(a+=Math.max((l.width-o)/2,0),c+=Math.max((l.height-r)/2,0)):(_=this.getValidScale(Math.min(l.width/o,l.height/r)),a+=(l.width-o*_)/2,c+=(l.height-r*_)/2,dt.scaleOf(e,g,_),g.scaleOf(g,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(a=0),dt.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class qf extends Il{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&p.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;o(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Gl,this.scrollYBar=new Gl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new qt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(tc.DRAG,this.onDrag,this),e.on_(tc.DRAG,this.onDrag,this),t.on_(tc.END,this.onDragEnd,this),e.on_(tc.END,this.onDragEnd,this),this.target.on_(Jr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(qr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class Kf extends Bl{setText(t){this._text=t,this.__htmlChanged=!0}}const Zf={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let Jf=class extends bd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=Zf[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){o(t)?Zf[t]=e:Object.assign(Zf,t)}};_e([Wo(Kf)],Jf.prototype,"__",void 0),_e([yo("")],Jf.prototype,"text",void 0),_e([uo("TextEditor")],Jf.prototype,"editInner",void 0),_e([To(!1)],Jf.prototype,"textEditing",void 0),Jf=_e([qo()],Jf),re.add("html");class $f extends ml{}function Qf(t){return ho(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wo(this),t.__useArrow=e,So(this)}}}))}let tm=class extends xd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Zh.register(t,e)}};_e([Wo($f)],tm.prototype,"__",void 0),_e([Qf("angle")],tm.prototype,"endArrow",void 0),tm=_e([qo()],tm);const{M:em,L:im,C:sm,Q:nm,O:om}=Ae,{rotate:rm,copyFrom:am,scale:hm}=dt,lm={},dm={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case em:case im:cm(t,l+1,e,i,s,n,o,r),l+=3;break;case sm:for(h=1;h<6;h+=2)cm(t,l+h,e,i,s,n,o,r);l+=7;break;case nm:for(h=1;h<4;h+=2)cm(t,l+h,e,i,s,n,o,r);l+=5;break;case om:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){dm.layout(t,0,0,1,1,e,i)}};function cm(t,e,i,s,n,o,r,a){am(lm,t[e],t[e+1]),r&&rm(lm,r,a),n&&hm(lm,n,o),t[e]=i+lm.x,t[e+1]=s+lm.y}const{layout:um,rotate:gm}=dm,{getAngle:pm}=dt,_m={x:-.5},fm={connect:_m,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},mm={connect:_m,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},ym={connect:_m,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},vm={connect:_m,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},wm={offset:_m,path:[...ym.path],dashPath:[1,-2.5,0,2,-1,0]};gm(wm.path,180,{x:-1.5,y:0});const xm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},bm={connect:{x:.5},path:[...xm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},km={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},Sm={path:[...km.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Em=p.clone(km),Bm=p.clone(Sm);gm(Em.path,45),gm(Bm.path,45);const Tm={angle:fm,"angle-side":mm,arrow:vm,triangle:ym,"triangle-flip":wm,circle:bm,"circle-line":xm,square:Sm,"square-line":km,diamond:Bm,"diamond-line":Em,mark:{offset:_m,path:[1,0,-2,2,0,2]}};function Rm(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Tm[e.type]):a=e:a=Tm[e];const{offset:u,connect:g,path:p,dashPath:_}=a;let f=g?g.x:0,m=u?u.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&um(y,0,0,h,h),m&&um(y,m,0),um(y,s.x,s.y,n,n,pm(i,s)),o.x=(f+m)*n,y}const{M:Cm,L:Om,C:Lm,Q:Pm,Z:Am,N:Dm,D:Mm,X:Fm,G:Im,F:Wm,O:zm,P:Ym,U:Nm}=Ae,{copy:Xm,copyFrom:Hm,getDistancePoint:Vm}=dt,jm={},Um={},Gm={},qm={},Km={},Zm={list:Tm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case Cm:case Om:(c<2||l+6>=d)&&(Hm(Km,o[l+1],o[l+2]),!c&&u&&Xm(Um,Km)),l+=3;break;case Lm:(1===c||l+7>=d-3)&&Jm(o,qm,Km,l+3),l+=7;break;case Pm:(1===c||l+5>=d-3)&&Jm(o,qm,Km,l+1),l+=5;break;case Am:return;case Dm:l+=5;break;case Mm:l+=9;break;case Fm:l+=6;break;case Im:l+=9;break;case Wm:l+=5;break;case zm:l+=7;break;case Ym:l+=4;break;case Nm:(1===c||l+6>=d-3)&&(Jm(o,qm,Km,l+1),l+6!==d&&(Km.x-=(Km.x-qm.x)/10,Km.y-=(Km.y-qm.y)/10)),l+=6}if(c++,1===c&&h!==Cm)return;if(2===c&&u&&Xm(Gm,h===Om?Km:qm),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Rm(t,e,Gm,Um,s,jm,!!n);n?d.push(...i):r.push(...i),jm.x&&(Vm(Um,Gm,-jm.x,!0),r[1]=Gm.x,r[2]=Gm.y)}if(i&&"none"!==i){const e=Rm(t,i,qm,Km,s,jm,!!n);if(n?d.push(...e):r.push(...e),jm.x){let t;switch(Vm(Km,qm,-jm.x,!0),h){case Om:t=l-3+1;break;case Lm:t=l-7+5;break;case Pm:t=l-5+3;break;case Nm:t=l-6+3}t&&$m(r,qm,t)}}}else Xm(qm,Km)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Jm(t,e,i,s){Hm(e,t[s],t[s+1]),Hm(i,t[s+2],t[s+3])}function $m(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),Fl.addAttr("startArrow","none",Qf),Fl.addAttr("endArrow","none",Qf),Object.assign(Zh,Zm),Object.assign(Jh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Qm=class extends Gl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};_e([Wo(class extends pl{})],Qm.prototype,"__",void 0),_e([_o("x")],Qm.prototype,"flow",void 0),Qm=_e([qo()],Qm);const ty={},ey={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},iy={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function sy(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Tt.toPoint(i,e,n,ty),e.x=s.__autoWidth?n.x:ty.x,e.y=s.__autoHeight?n.y:ty.y}const{move:ny}=dt;function oy(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),ny(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function ry(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const ay={};function hy(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:r,__autoHeight:a}=t.__,h=n&&(e?!r:!a);return c(i)?(ay.xGap=i.x||0,ay.yGap=i.y||0):ay.xGap=ay.yGap=l(i),ay.isAutoXGap=o(ay.xGap)&&!r,ay.isAutoYGap=o(ay.yGap)&&!a,ay.complex=h||"top-left"!==s||t.__hasGrow||ay.isAutoXGap||ay.isAutoYGap,ay.wrap=h,ay.complex&&(ay.isFitXGap="fit"===ay.xGap&&!r,ay.isFitYGap="fit"===ay.yGap&&!a,c(s)?(ay.contentAlign=s.content||"top-left",ay.rowXAlign=s.x||"from",ay.rowYAlign=s.y||"from"):(ay.contentAlign=s,ay.rowXAlign=ey[s],ay.rowYAlign=iy[s])),ay}function ly(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function dy(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function cy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:uy}=W;function gy(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=py(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=py(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function py(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?uy(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:_y}=W;function fy(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=my(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=my(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function my(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?_y(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:yy}=dt;function vy(t,e){const i="width",{children:s,itemBox:n}=t,o=hy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=cy(p,n),r?(p.__flowBounds=_,y||(y=ly(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?gy(t,y,x,e):d&&dy(y,i,x,c),ry(u,y,i),y=ly(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&my(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(yy(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?gy(t,y,x,e):d&&dy(y,i,x,c),a&&ry(u,y,i)),a?(s?dy(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){sy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=ey[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],oy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(sy(t,y,r),oy(t,y,0,y.y,g,e))}}const{move:wy}=dt;function xy(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),wy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:by}=dt;function ky(t,e){const i="height",{children:s,itemBox:n}=t,o=hy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=cy(p,n),r?(p.__flowBounds=_,y||(y=ly(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&fy(t,y,b,e),d&&dy(y,i,b,c),ry(u,y,i),y=ly(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&py(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(by(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&fy(t,y,b,e),d&&dy(y,i,b,c),a&&ry(u,y,i)),a?(s?dy(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){sy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=iy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],xy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(sy(t,y,r),xy(t,y,y.x,0,l,e))}}function Sy(t){return ho(t,t=>({set(e){const i=a(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&wo(this)}}))}re.add("flow","resize");const Ey=Gl.prototype,{__updateBoxBounds:By}=Il.prototype;Fl.addAttr("flow",!1,_o),Fl.addAttr("gap",0,yo),Fl.addAttr("flowAlign","top-left",yo),Fl.addAttr("flowWrap",!1,yo),Fl.addAttr("itemBox","box",yo),Fl.addAttr("inFlow",!0,yo),Fl.addAttr("autoWidth",void 0,Sy),Fl.addAttr("autoHeight",void 0,Sy),Fl.addAttr("autoBox",void 0,yo);const{copyAndSpread:Ty}=Vt;Ey.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:vy(this);break;case"y":ky(this);break;case"x-reverse":vy(this,!0);break;case"y-reverse":ky(this,!0)}t&&(this.leafer.created=!0)},Ey.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Ty(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Ey.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():By.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Ty(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Ry,sin:Cy,pow:Oy,sqrt:Ly,abs:Py,ceil:Ay,floor:Dy,round:My,PI:Fy}=Math,Iy=5*Fy,Wy=1.70158,zy=2.5949095,Yy=7.5625,Ny=2.75;function Xy(t){return e=>Oy(e,t)}function Hy(t){return e=>1-Oy(1-e,t)}function Vy(t){return e=>e<.5?.5*Oy(2*e,t):1-.5*Oy(2-2*e,t)}function jy(t){return t<1/Ny?Yy*t*t:t<2/Ny?Yy*(t-=1.5/Ny)*t+.75:t<2.5/Ny?Yy*(t-=2.25/Ny)*t+.9375:Yy*(t-=2.625/Ny)*t+.984375}function Uy(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=Gy(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Py(l)<1e-6));e++)c-=d/l;return n[r]=Gy(c,e,s)}}function Gy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const qy={get(t){const{list:e}=qy;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){qy.list[t]=e},list:{linear:t=>t,ease:Uy(.25,.1,.25,1),"ease-in":Uy(.42,0,1,1),"ease-out":Uy(0,0,.58,1),"ease-in-out":Uy(.42,0,.58,1),"sine-in":t=>1-Ry(t*Fy*.5),"sine-out":t=>Cy(t*Fy*.5),"sine-in-out":t=>.5*(1-Ry(t*Fy)),"quad-in":Xy(2),"quad-out":Hy(2),"quad-in-out":Vy(2),"cubic-in":Xy(3),"cubic-out":Hy(3),"cubic-in-out":Vy(3),"quart-in":Xy(4),"quart-out":Hy(4),"quart-in-out":Vy(4),"quint-in":Xy(5),"quint-out":Hy(5),"quint-in-out":Vy(5),"expo-in":t=>t?Oy(2,10*t-10):0,"expo-out":t=>1===t?1:1-Oy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Oy(2,2*t*10-10):.5*(2-Oy(2,10-2*t*10)),"circ-in":t=>1-Ly(1-Oy(t,2)),"circ-out":t=>Ly(1-Oy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Ly(1-Oy(2*t,2))):.5*(Ly(1-Oy(2-2*t,2))+1),"back-in":t=>((Wy+1)*t-Wy)*t*t,"back-out":t=>(t-=1)*t*((Wy+1)*t+Wy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((zy+1)*t-zy)*.5:.5*((t=2*t-2)*t*((zy+1)*t+zy)+2),"elastic-in":t=>0===t||1===t?t:-Oy(2,10*(t-1))*Cy((t-1.1)*Iy),"elastic-out":t=>0===t||1===t?t:Oy(2,-10*t)*Cy((t-.1)*Iy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Oy(2,10*((t*=2)-1))*Cy((t-1.1)*Iy)*.5:Oy(2,10*(1-(t*=2)))*Cy((t-1.1)*Iy)*.5+1,"bounce-in":t=>1-jy(1-t),"bounce-out":jy,"bounce-in-out":t=>t<.5?.5*(1-jy(1-2*t)):.5*(1+jy(2*t-1)),"cubic-bezier":Uy,steps:function(t,e="floor"){return i=>("floor"===e?Dy(i*t):"ceil"===e?Ay(i*t):My(i*t))/t}}};function Ky(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 Zy{}Zy.CREATED="created",Zy.PLAY="play",Zy.PAUSE="pause",Zy.STOP="stop",Zy.SEEK="seek",Zy.UPDATE="update",Zy.COMPLETED="completed";let Jy=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&&a(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),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:o}=this;this.easingFn=qy.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.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.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Zy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Zy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Zy.STOP))}seek(t){this.destroyed||(c(t)&&(t=Kh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(Zy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:n}=this,{length:o}=i,r=!(o>1)||this.join;let h,l,d,c,u,g=0,p=0;o>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<o;n++){if(l=i[n],c=l.style||l,h||(h=r?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=l;o&&(d.swing=a(o)?o:2,u=2*d.swing-1),r&&(d.loop=u=a(r)?r:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=qy.get(n))}if(!d.autoDuration&&s(d.duration)&&(o>1?n>0||r?p+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=g||!n||!n.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(Zy.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:n,toStyle:o,target:r}=this;for(let a in e)s(n[a])&&(n[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=s(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:n}=i;for(let o=0;o<n;o++)e=i[o],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),v.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}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}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?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.requestAnimate()}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(Zy.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:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),nl.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(Zy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return a(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};_e([Ky("ease")],Jy.prototype,"easing",void 0),_e([Ky(0)],Jy.prototype,"delay",void 0),_e([Ky(.2)],Jy.prototype,"duration",void 0),_e([Ky("auto")],Jy.prototype,"ending",void 0),_e([Ky(!1)],Jy.prototype,"reverse",void 0),_e([Ky(!1)],Jy.prototype,"swing",void 0),_e([Ky(!1)],Jy.prototype,"loop",void 0),_e([Ky(0)],Jy.prototype,"loopDelay",void 0),_e([Ky(1)],Jy.prototype,"speed",void 0),_e([Ky(!0)],Jy.prototype,"autoplay",void 0),_e([Ky()],Jy.prototype,"join",void 0),_e([Ky()],Jy.prototype,"attrs",void 0),Jy=_e([Go(fa)],Jy);let $y=class extends Jy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Jy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Zy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Zy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Zy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Zy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Zy.COMPLETED:this.completed&&this.emitType(t);break;case Zy.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)}};$y=_e([Go(fa)],$y);const Qy={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"},tv=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,ev=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,iv=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,sv=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,nv=parseInt,ov=parseFloat,{round:rv}=Math;let av={},hv=0;function lv(t){let e,i,s,n=1;switch(t.length){case 9:e=nv(t.slice(1,3),16),i=nv(t.slice(3,5),16),s=nv(t.slice(5,7),16),n=nv(t.slice(7,9),16)/255;break;case 7:e=nv(t.slice(1,3),16),i=nv(t.slice(3,5),16),s=nv(t.slice(5,7),16);break;case 5:e=nv(t[1]+t[1],16),i=nv(t[2]+t[2],16),s=nv(t[3]+t[3],16),n=nv(t[4]+t[4],16)/255;break;case 4:e=nv(t[1]+t[1],16),i=nv(t[2]+t[2],16),s=nv(t[3]+t[3],16);break;case 3:e=i=s=nv(t[1]+t[2],16);break;case 2:e=i=s=nv(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const dv=1/6,cv=.5,uv=2/3,gv=1/3;function pv(t,e,i){return i<0?i++:i>1&&i--,i<dv?t+6*(e-t)*i:i<cv?e:i<uv?t+(e-t)*(uv-i)*6:t}function _v(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=pv(a,s,t+gv),o=pv(a,s,t),r=pv(a,s,t-gv)}return{r:rv(255*n),g:rv(255*o),b:rv(255*r),a:s}}re.add("color"),qh.object=function(t,e){let i,n=!s(e)&&e<1;if(o(t)){const e=av[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=lv(t);break;case"R":case"r":"("===t[4]&&ev.test(t)?i=function(t){const e=ev.exec(t);return{r:nv(e[1]),g:nv(e[2]),b:nv(e[3]),a:ov(e[4])}}(t):"("===t[3]&&tv.test(t)&&(i=function(t){const e=tv.exec(t);return{r:nv(e[1]),g:nv(e[2]),b:nv(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&sv.test(t)?i=function(t){const e=sv.exec(t);return _v(ov(e[1]),ov(e[2]),ov(e[3]),ov(e[4]))}(t):"("===t[3]&&iv.test(t)&&(i=function(t){const e=iv.exec(t);return _v(ov(e[1]),ov(e[2]),ov(e[3]),1)}(t))}if(!i){const e=Qy[t.toLowerCase()];e&&(i=lv("#"+e))}i&&(hv++,hv>1e4&&(av={},hv=0),av[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),n&&(i.a*=e),i};const{round:fv}=Math,{fourNumber:mv}=W,yv={fill:kv,stroke:kv,cornerRadius:(t,e,i)=>a(t)&&a(e)?xv(t,e,i):(t=mv(t),e=mv(e),t.map((t,s)=>xv(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,n=e.length,o=xv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return a(t)||a(e)?W.float(xv(t,e,i),Math.max(wv(t),wv(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:Sv,innerShadow:Sv},vv={value:function(t,e,i){const s=a(t),n=a(e);return s&&n?t+(e-t)*i:n||s?xv(t,e,i):t},number:xv,color:bv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=nl;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function wv(t){const e=String(t).split(".")[1];return e?e.length:0}function xv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?fv(n):n}function bv(t,e,i){t=qh.object(t),e=qh.object(e);const s=xv(t.r,e.r,i,1)+","+xv(t.g,e.g,i,1)+","+xv(t.b,e.b,i,1),n=xv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function kv(t,e,i){return o(t)&&o(e)?bv(t,e,i):e}function Sv(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:xv((t=t||{}).x,e.x,i),y:xv(t.y,e.y,i),blur:xv(t.blur,e.blur,i),spread:xv(t.spread,e.spread,i),color:bv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}re.add("animate","color"),sl.canAnimate=!0,Object.assign(nl.list,yv),Object.assign(nl,vv);const Ev=Fl.prototype;Fl.addAttr("animation",void 0,function(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Fl.addAttr("animationOut",void 0,uo),Fl.addAttr("transition",!0,uo),Fl.addAttr("transitionOut",void 0,uo),Ev.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))},Ev.animate=function(t,e,i,n){if(s(t))return this.__animate;let o=d(t)&&!e&&i?new $y(this,t,n):new Jy(this,t,e,n);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof $y?o.list.unshift(r):o=new $y(this,[r,o])),this.__animate=o},Ev.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof $y&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Ev.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Zy.COMPLETED,e)};const Bv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Tv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Rv}=Math,{getDerivative:Cv}=ri,Ov={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<Bv.length;h++)l=f*(1+Bv[h]),d=f*(1-Bv[h]),c=Cv(l,t,i,n,r),u=Cv(l,e,s,o,a),g=Cv(d,t,i,n,r),p=Cv(d,e,s,o,a),_+=Tv[h]*(Rv(c*c+u*u)+Rv(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Cv(t,e,s,o,a),d=Cv(t,i,n,r,h);return Math.atan2(d,l)/Y},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)Lv(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Ae.C,c,u,_,f,m,y)}},{getDistance:Lv}=Ov,{M:Pv,L:Av,C:Dv,Z:Mv}=Ae,Fv={},Iv={},Wv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Pv:case Av:Wv.transformPoints(t,e,s,1),s+=3;break;case Dv:Wv.transformPoints(t,e,s,3),s+=7;break;case Mv:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Fv.x=t[n],Fv.y=t[n+1],Q.toOuterPoint(e,Fv),t[n]=Fv.x,t[n+1]=Fv.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Pv:case Av:i=t[a+1],s=t[a+2],e=n===Av&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Dv:i=t[a+5],s=t[a+6],e=Ov.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 Mv:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Kh.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Pv:case Av:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),Iv.x=y,Iv.y=v,_.x=r,_.y=a,dt.getDistancePoint(Iv,_,e-p,!0),_.rotation=dt.getAngle(Iv,_),_;y=r,v=a,f+=3;break;case Dv:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Ov.getT(e-p,o,y,v,l,d,c,u,r,a,i),ri.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=Ov.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Mv:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Kh.number(e,t.total);let r,a,h,l,d,c,u,g,p,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case Pv:case Av:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),Iv.x=v,Iv.y=w,f.x=a,f.y=h,dt.getDistancePoint(Iv,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case Dv:if(d=n[m+1],c=n[m+2],u=n[m+3],g=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return p=Ov.getT(e-_,r,v,w,d,c,u,g,a,h,i),Ov.cut(o,p,v,w,d,c,u,g,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,g,a,h);break;case Mv:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function zv(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}re.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 Yv=Fl.prototype,{updateMatrix:Nv,updateAllMatrix:Xv}=ar,{updateBounds:Hv}=vr;function Vv(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Uv(t);i.total&&(t.__.__pathForRender=Wv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Xv(t),Hv(t,t)):Nv(t));i&&(t.leafer.created=!0)}}function jv(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 Uv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Wv.getMotionPathData(t.getPath(!0,!0))}function Gv(t,e){return ho(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 qv(t){return ho(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Kv(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 Zv(t,e){c(e)||(e=void 0),Qv(t,e,"in")}function Jv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),Qv(t,e,"out"))}Fl.addAttr("motionPath",void 0,zv),Fl.addAttr("motionPrecision",1,zv),Fl.addAttr("motion",void 0,zv),Fl.addAttr("motionRotation",!0,zv),Yv.getMotionPathData=function(){return Uv(jv(this))},Yv.getMotionPoint=function(t){const e=jv(this),i=Uv(e);if(!i.total)return{};const s=Wv.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:a(n)&&(s.rotation+=n),s},Yv.getMotionTotal=function(){return this.getMotionPathData().total},Yv.__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],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Vv(t))}else Vv(this)};const $v={};function Qv(t,e,i){const{normalStyle:s}=t;e||(e=$v),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==$v&&sl.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const r=o?function(t,e){const i=iw(e,t),s=t.animate();s&&iw(i,t,s.fromStyle);return i}(t,e):void 0;sl.canAnimate&&tw(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=tw(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=ew(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=ew(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function tw(t){let e;const i={},s=Kv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&sl.isState(n,t,s)&&(e=sw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&sl.isSelected(t,s)&&(e=sw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&sl.isPlacehold(t,s)&&(e=sw(i,a)),sl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=sw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&sl.isFocus(t,s)&&(e=sw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&sl.isHover(t,s)&&(e=sw(i,o));const r=i.pressStyle||t.pressStyle;r&&sl.isPress(t,s)&&(e=sw(i,r))}return e?i:void 0}function ew(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&sl.animateExcludes[t]||(n[t]=e[t]);return n}function iw(t,e,i){return ew(t,e,i,!0)}function sw(t,e){return Object.assign(t,e),!0}function nw(t,e){const i=t[e];i&&Zv(t,i),t.button&&rw(t.children,e)}function ow(t,e,i){i||(i=t.states[e]),Zv(t,i),t.button&&rw(t.children,null,e)}function rw(t,e,i){if(!t)return;let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],e){switch(o=!0,e){case"hoverStyle":sl.isHover(n)&&(o=!1);break;case"pressStyle":sl.isPress(n)&&(o=!1);break;case"focusStyle":sl.isFocus(n)&&(o=!1)}o&&nw(n,e)}else s(i)||ow(n,i);n.isBranch&&rw(n.children,e,i)}}function aw(t,e){const i=t[e];i&&Jv(t,i),t.button&&lw(t.children,e)}function hw(t,e,i){Jv(t,i),t.button&&lw(t.children,null,e)}function lw(t,e,i){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?aw(n,e):s(i)||hw(n,i),n.isBranch&&lw(n.children,e,i)}function dw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Kv(e,i);o&&(s=n[t](o))}return s}function cw(t,e,i){let s=e[t];if(!s&&i){const n=Kv(e,i);n&&(s=n[t])}return s}re.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=Kv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},sl.isSelected=function(t,e){return cw("selected",t,e)},sl.isDisabled=function(t,e){return cw("disabled",t,e)},sl.isFocus=function(t,e){return dw("isFocus",t,e)},sl.isHover=function(t,e){return dw("isHover",t,e)},sl.isPress=function(t,e){return dw("isPress",t,e)},sl.isPlacehold=function(t,e){return t.__.__isPlacehold},sl.isDrag=function(t,e){return dw("isDrag",t,e)},sl.setStyleName=function(t,e,i){i?ow(t,e,t[e]):hw(t,e,t[e])},sl.set=function(t,e){const i=t.states[e];i?ow(t,e,i):hw(t,e,i)},sl.getStyle=tw,sl.updateStyle=Qv,sl.updateEventStyle=function(t,e){switch(e){case Jd.ENTER:nw(t,"hoverStyle");break;case Jd.LEAVE:aw(t,"hoverStyle");break;case Jd.DOWN:nw(t,"pressStyle");break;case Jd.UP:aw(t,"pressStyle")}};const uw=Fl.prototype;Fl.addAttr("selected",!1,Gv,"selectedStyle"),Fl.addAttr("disabled",!1,Gv,"disabledStyle"),Fl.addAttr("states",{},qv),Fl.addAttr("state","",Gv),Fl.addAttr("normalStyle",void 0,uo),Fl.addAttr("hoverStyle",void 0,qv),Fl.addAttr("pressStyle",void 0,qv),Fl.addAttr("focusStyle",void 0,qv),Fl.addAttr("selectedStyle",void 0,qv),Fl.addAttr("disabledStyle",void 0,qv),Fl.addAttr("placeholderStyle",void 0,qv),Fl.addAttr("button",!1,uo),uw.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))},uw.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?nw(this,"focusStyle"):aw(this,"focusStyle")})},uw.updateState=function(){sl.updateStyle(this,void 0,"in")};const gw=Od.prototype,pw="text";oo(gw,pw,Object.assign(Object.assign({},ro(gw,pw)),{set(t){const e=this,i=e.text;e.__setAttr(pw,t)&&(wo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class _w extends cl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let fw=class extends Fl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=to.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:o,total:r}=e,{width:h,height:l}=o&&(a(o)?{width:o,height:o}:o)||(r>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:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Nr(Nr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:n,__action:o}=this;o&&(o.FPS&&(i=o.FPS),s(o.loop)||(n=o.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!n)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()}};_e([Wo(_w)],fw.prototype,"__",void 0),_e([yo()],fw.prototype,"robot",void 0),_e([uo()],fw.prototype,"actions",void 0),_e([uo("")],fw.prototype,"action",void 0),_e([To(0)],fw.prototype,"now",void 0),_e([uo(12)],fw.prototype,"FPS",void 0),_e([uo(!0)],fw.prototype,"loop",void 0),fw=_e([qo()],fw),re.add("robot");const{Yes:mw,NoAndSkip:yw,YesAndSkip:vw}=e,ww={},xw={},bw={};class kw{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,n){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":ww.id=t.substring(1),t=ww;break;case".":xw.className=t.substring(1),t=xw;break;default:bw.tag=t,t=bw}case"object":if(s(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?p.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,n)}}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&&ar.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,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===mw||o===vw){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<yw&&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_(Ir.REMOVE,this.__onRemoveChild,this),this.target.on_(zr.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 Sw=Fl.prototype;function Ew(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}Sw.find=function(t,e){return Ew(this).getBy(t,this,!1,e)},Sw.findOne=function(t,e){return Ew(this).getBy(t,this,!0,e)},re.add("find"),ae.finder=function(t){return new kw(t)};const{setPoint:Bw,addPoint:Tw,toBounds:Rw}=vt;const Cw={syncExport(t,e,i){let n;il.running=!0;try{const o=Un.fileType(e),r=e.includes(".");i=Un.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===o)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),n={data:!!r||t.toJSON(i.json)};else if("svg"===o)r&&h(a(t.toSVG(),"svg"),e),n={data:!!r||t.toSVG()};else{let o,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:y}=i,w=s(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,k=Un.isOpaqueImage(e)||b,S=new mt;if(f)o=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}o=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,o,E);let B=i.pixelRatio||1,{x:T,y:R,width:C,height:O}=new qt(o).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const L={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let P,A=ae.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(P=t,P.__worldOpacity=0,t=c||t,L.bounds=A.bounds),A.save();const D=u&&!s(b),M=t.get("fill");if(D&&(t.fill=""),v.render(t,A,L),D&&(t.fill=M),A.restore(),P&&P.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Tw(r,n,o):Bw(r={},n,o)),a++;const h=new qt;return r&&(Rw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=ae.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=W.fourNumber(m),n=A,{width:o,height:r}=n;A=ae.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),y&&y(A);n={data:"canvas"===e?A:A.export(e,i),width:A.pixelWidth,height:A.pixelHeight,renderBounds:o,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return il.running=!1,n},export(t,e,i){return il.running=!0,function(t){Ow||(Ow=new Zn);return new Promise(e=>{Ow.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>fe(this,void 0,void 0,function*(){if(!$n.isComplete)return v.requestRender(o);const r=il.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Lw(t);const{leafer:r}=t;r?r.waitViewCompleted(o):o()}))}};let Ow;function Lw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Lw(t))}const Pw=Oe.prototype,Aw=Qt.get("@leafer-in/export");Pw.export=function(t,e){const{quality:i,blob:s}=Un.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Pw.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Aw.error(t),i(null)})})},Pw.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Pw.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Aw.error(t),i(!1)})})},re.add("export"),Object.assign(il,Cw),Fl.prototype.export=function(t,e){return il.export(this,t,e)},Fl.prototype.syncExport=function(t,e){return il.syncExport(this,t,e)},re.add("filter"),Object.assign(el,{list:{},register(t,e){el.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=el.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=el.list[t.type],e&&(i+=e.getSpread(t))}),i}}),re.add("bright"),Fl.addAttr("bright",!1,Ro);export{Tt as AlignHelper,Jy as Animate,qy as AnimateEasing,Zy as AnimateEvent,$y as AnimateList,e as Answer,Ad as App,St as AroundHelper,tm as Arrow,$f as ArrowData,Zt as AutoBounds,ri as BezierHelper,qt as Bounds,Xr as BoundsEvent,Vt as BoundsHelper,Gl as Box,pl as BoxData,yh as Branch,vr as BranchHelper,Fa as BranchRender,Sd as Canvas,Tl as CanvasData,pe as CanvasManager,Ir as ChildEvent,qh as ColorConvert,ae as Creator,Tc as Cursor,p as DataHelper,Qt as Debug,xt as Direction4,bt as Direction9,Kd as DragBoundsHelper,tc as DragEvent,fc as Dragger,ic as DropEvent,r_ as EditBox,$p as EditDataHelper,s_ as EditPoint,zp as EditSelect,Mp as EditSelectHelper,D_ as EditTool,v_ as EditToolCreator,P_ as Editor,Ep as EditorEvent,b_ as EditorGroupEvent,__ as EditorHelper,T_ as EditorMoveEvent,C_ as EditorRotateEvent,R_ as EditorScaleEvent,O_ as EditorSkewEvent,tl as Effect,$l as Ellipse,vl as EllipseData,_i as EllipseHelper,Fr as Event,ue as EventCreator,oa as Eventer,il as Export,Un as FileHelper,el as Filter,kw as Finder,Qm as Flow,R as FourNumberHelper,ql as Frame,fl as FrameData,Il as Group,gl as GroupData,Jf as HTMLText,Kf as HTMLTextData,Ov as HighBezierHelper,Wv as HighCurveHelper,Rc as HitCanvasManager,bd as Image,Bl as ImageData,Nr as ImageEvent,to as ImageManager,x as IncrementId,A_ as InnerEditor,x_ as InnerEditorEvent,Bc as InteractionBase,dc as InteractionHelper,lc as KeyEvent,Md as Keyboard,Zr as LayoutEvent,Ih as Layouter,hh as Leaf,Aa as LeafBounds,_r as LeafBoundsHelper,f as LeafData,ya as LeafDataProxy,fa as LeafEventer,ar as LeafHelper,Mr as LeafLayout,wh as LeafLevelList,vh as LeafList,Ea as LeafMatrix,Da as LeafRender,Yl as Leafer,bh as LeaferCanvas,Oe as LeaferCanvasBase,_l as LeaferData,$r as LeaferEvent,no as LeaferImage,Sf as LeaferTypeCreator,xd as Line,ml as LineData,Y_ as LineEditTool,W as MathHelper,mt as Matrix,Q as MatrixHelper,sc as MoveEvent,Tf as MultiTouchHelper,ec as MyDragEvent,kd as MyImage,$d as MyPointerEvent,oc as MyTouchEvent,Me as NeedConvertToCanvasCommandMap,Y as OneRadian,N as PI2,X as PI_2,Jh as Paint,Qh as PaintGradient,$h as PaintImage,Ld as Path,Zh as PathArrow,Zm as PathArrowModule,Dn as PathBounds,ks as PathCommandDataHelper,Ae as PathCommandMap,fi as PathCommandNodeHelper,ts as PathConvert,Nn as PathCorner,Ys as PathCreator,bl as PathData,en as PathDrawer,Le as PathHelper,dm as PathMatrixHelper,t as PathNodeHandleType,ze as PathNumberCommandLengthMap,We as PathNumberCommandMap,tf as PathScaler,Pd as Pen,kl as PenData,Nh as Picker,v as Platform,re as Plugin,_t as Point,dt as PointHelper,Fd as PointerButton,Jd as PointerEvent,rd as Polygon,wl as PolygonData,zr as PropertyEvent,Nl as Rect,yl as RectData,Ye as RectHelper,Dl as RectRender,Jr as RenderEvent,zh as Renderer,qr as ResizeEvent,$n as Resource,fw as Robot,_w as RobotData,rc as RotateEvent,se as Run,qf as ScrollBar,Dp as SelectArea,Xh as Selector,gd as Star,xl as StarData,sl as State,Jt as StringNumberMap,Ap as Stroker,ac as SwipeEvent,Kn as TaskItem,Zn as TaskProcessor,Od as Text,Gh as TextConvert,El as TextData,wf as TextEditor,nc as TouchEvent,L_ as TransformTool,Wf as Transformer,nl as Transition,vt as TwoPointBoundsHelper,Fl as UI,Ol as UIBounds,le as UICreator,cl as UIData,Id as UIEvent,Pl as UIRender,Kh as UnitConvert,Er as WaitHelper,Kr as WatchEvent,Bh as Watcher,Af as WheelEventHelper,hc as ZoomEvent,xf as addViewport,bf as addViewportConfig,Bo as affectRenderBoundsType,ko as affectStrokeBoundsType,Qf as arrowType,lo as attr,_o as autoLayoutType,yo as boundsType,jn as canvasPatch,Ce as canvasSizeAttrs,Uh as createAttr,ao as createDescriptor,Io as cursorType,Wo as dataProcessor,uo as dataType,ho as decorateLeafAttr,Yo as defineDataProcessor,oo as defineKey,co as defineLeafAttr,Ro as dimType,wo as doBoundsType,So as doStrokeType,Hh as effectType,i as emptyData,Mo as eraserType,Yr as extraPropertyEventMap,V as getBoundsData,ro as getDescriptor,j as getMatrixData,H as getPointData,Fo as hitType,d as isArray,u as isData,g as isEmptyData,r as isFinite,n as isNull,a as isNumber,c as isObject,o as isString,s as isUndefined,zo as layoutProcessor,sa as leaferTransformAttrMap,Do as maskType,zv as motionPathType,vo as naturalBoundsType,Co as opacityType,Xn as path,xo as pathInputType,bo as pathType,Hn as pen,go as positionType,m_ as registerEditTool,y_ as registerInnerEditor,qo as registerUI,Ko as registerUIEvent,Vh as resizeType,Vo as rewrite,jo as rewriteAble,mo as rotationType,df as scaleResize,cf as scaleResizeFontSize,pf as scaleResizeGroup,uf as scaleResizePath,gf as scaleResizePoints,fo as scaleType,po as scrollType,Ao as sortType,qv as stateStyleType,Gv as stateType,Eo as strokeType,To as surfaceType,Kt as tempBounds,yt as tempMatrix,ft as tempPoint,l as tryToNumber,Sh as useCanvas,Go as useModule,xh as version,Oo as visibleType,jh as zoomLayerType};
2
2
  //# sourceMappingURL=worker.module.min.js.map