@leafer/miniapp 1.12.1 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function o(t){return null==t}function n(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 _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return p(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&p(t[o]={},e[o],i[o]):t[o]=e[o]})},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 o in this)"_"!==o[0]&&(i=e?e[o]:void 0,t[o]=s(i)?this[o]: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:o}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=o?o[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,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,o,n,r,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(o||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,n){const s=e/n.width,o=i/n.height;d.setTransform(s,0,0,o,-n.x*s,-n.y*o),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image: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,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,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 o=s?t:[],[n,r,h,l]=4===t.length?t:O(t);return C(o,h*i,l*e,n*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,o=(a(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||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,X=2*I,N=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:K,sqrt:q}=Math,{float:Z}=W,J={};function Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:j,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,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:o,d:n}=t,r=G(e*=Y),a=U(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*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:o,c:n,d:r}=t;i&&(i*=Y,t.a=s+n*i,t.b=o+r*i),e&&(e*=Y,t.c=n+s*e,t.d=r+o*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:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,o,n){const{e:r,f:a}=t;if(i||(i=t),s(o)&&(o=1!==t.a||t.b||t.c||1!==t.d),o){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=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:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,o,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:o}=e,n=i*Y,r=G(n),a=U(n);if(s||o){const e=s*Y,i=o*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||o)&&tt.translateInner(t,-i.x,-i.y,!o)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=q(o*o+n*n),c=t/d;const e=o/d;u=n>0?K(e):-K(e)}else{c=q(r*r+a*a),d=t/c;const e=r/c;u=N-(a>0?K(-e):-K(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,_=e?Z((n/d-i)/e/Y,9):0,u=Z(u/Y)}else d=o,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=q(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=$,{toInnerPoint:et,toOuterPoint:it}=$,{sin:st,cos:ot,abs:nt,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=ot(e*=Y),o=st(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+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 o=nt(i-t),n=nt(s-e);return rt(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>ht(ut(t,e,i,s),ut(i,s,o,n)),getAngle:(t,e)=>_t(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,o,n,r,a,h){s(a)&&(a=i,h=o);const l=t-i,d=e-o,c=n-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,o){const n=_t(t,e);return o&&(t=e),s||(e={}),e.x=t.x+ot(n)*i,e.y=t.y+st(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:gt,getAtan2:_t}=ct;class pt{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 pt(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 pt(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(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 pt;class mt{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return c(t)?$.copy(this,t):$.set(this,t,e,i,s,o,n),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new mt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.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,o){wt(t,e,i),wt(t,e+s,i+o)},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,o,n){const r=Et(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.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 n(t)?kt[bt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,o,n){Bt(t,i,s,o,e,n)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Ot,toBounds:Pt}=vt,{toOuterPoint:Lt}=$,{float:At,fourNumber:Dt}=W,{floor:Mt,ceil:Ft}=Math;let It,Wt,zt,Yt;const Xt={},Nt={},Ht={},Vt={tempBounds:Ht,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(d(i)){const e=Dt(i);s?jt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?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:o,e:n,f:r}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=r+t.y*o):(i.height=t.height*-o,i.y=r+t.y*o-i.height)}else Xt.x=t.x,Xt.y=t.y,Lt(e,Xt,Nt),Ct(Rt,Nt.x,Nt.y),Xt.x=t.x+t.width,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.y=t.y+t.height,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.x=t.x,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.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,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,r){r||(r=e),n(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Ht.width=o?e.width*=s:e.width*s,Ht.height=o?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 o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Gt(t,o)):Ut(t,o));n&&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:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},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:o,width:n,height:r}=e;return It=s+n,Wt=o+r,zt=t.x+t.width,Yt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,It=It<zt?It:zt,Wt=Wt<Yt?Wt:Yt,n=It-s,r=Wt-o,{x:s,y:o,width:n,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 Kt{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 Kt(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 Kt(Vt.getIntersectData(this,t,e))}isSame(t){return Vt.isSame(this,t)}isEmpty(){return Vt.isEmpty(this)}reset(){Vt.reset(this)}}const qt=new Kt;class Zt{constructor(t,e,i,s,o,n){c(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Kt(o,e,n||t.width-o-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:Qt}=W;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=Qt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===$t.showBounds,o=t.__nowWorld,n=Qt();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}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?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const ee=$t,ie=$t.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ie.log(s,o,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=se,ne=[],re={list:{},add(t,...e){this.list[t]=!0,ne.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(()=>ne.forEach(t=>re.has(t,!0)));const ae={editor:t=>re.need("editor")},he=$t.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,o,n,r){de[t]||he.error("not register "+t);const a=new de[t](e);return s(i)||(a.x=i,o&&(a.y=o),n&&(a.width=n),r&&(a.height=r)),a}},{list:de}=le,ce=$t.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(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 _e{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;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 pe(t,e,i,s){var o,n=arguments.length,r=n<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--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function fe(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(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,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};pe([me("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),pe([me("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),pe([me("globalAlpha")],xe.prototype,"opacity",void 0),pe([me()],xe.prototype,"fillStyle",void 0),pe([me()],xe.prototype,"strokeStyle",void 0),pe([me("lineWidth")],xe.prototype,"strokeWidth",void 0),pe([me("lineCap")],xe.prototype,"strokeCap",void 0),pe([me("lineJoin")],xe.prototype,"strokeJoin",void 0),pe([me("lineDashOffset")],xe.prototype,"dashOffset",void 0),pe([me()],xe.prototype,"miterLimit",void 0),pe([me()],xe.prototype,"shadowBlur",void 0),pe([me()],xe.prototype,"shadowColor",void 0),pe([me()],xe.prototype,"shadowOffsetX",void 0),pe([me()],xe.prototype,"shadowOffsetY",void 0),pe([me()],xe.prototype,"filter",void 0),pe([me()],xe.prototype,"font",void 0),pe([me()],xe.prototype,"fontKerning",void 0),pe([me()],xe.prototype,"fontStretch",void 0),pe([me()],xe.prototype,"fontVariantCaps",void 0),pe([me()],xe.prototype,"textAlign",void 0),pe([me()],xe.prototype,"textBaseline",void 0),pe([me()],xe.prototype,"textRendering",void 0),pe([me()],xe.prototype,"wordSpacing",void 0),pe([me()],xe.prototype,"letterSpacing",void 0),pe([me()],xe.prototype,"direction",void 0),pe([ve()],xe.prototype,"setTransform",null),pe([ve()],xe.prototype,"resetTransform",null),pe([ve()],xe.prototype,"getTransform",null),pe([ve()],xe.prototype,"save",null),pe([ve()],xe.prototype,"restore",null),pe([ve()],xe.prototype,"translate",null),pe([ve()],xe.prototype,"scale",null),pe([ve()],xe.prototype,"rotate",null),pe([ve()],xe.prototype,"fill",null),pe([ve()],xe.prototype,"stroke",null),pe([ve()],xe.prototype,"clip",null),pe([ve()],xe.prototype,"fillRect",null),pe([ve()],xe.prototype,"strokeRect",null),pe([ve()],xe.prototype,"clearRect",null),pe([ve()],xe.prototype,"beginPath",null),pe([ve()],xe.prototype,"moveTo",null),pe([ve()],xe.prototype,"lineTo",null),pe([ve()],xe.prototype,"bezierCurveTo",null),pe([ve()],xe.prototype,"quadraticCurveTo",null),pe([ve()],xe.prototype,"closePath",null),pe([ve()],xe.prototype,"arc",null),pe([ve()],xe.prototype,"arcTo",null),pe([ve()],xe.prototype,"ellipse",null),pe([ve()],xe.prototype,"rect",null),pe([ve()],xe.prototype,"roundRect",null),pe([ve()],xe.prototype,"createConicGradient",null),pe([ve()],xe.prototype,"createLinearGradient",null),pe([ve()],xe.prototype,"createPattern",null),pe([ve()],xe.prototype,"createRadialGradient",null),pe([ve()],xe.prototype,"fillText",null),pe([ve()],xe.prototype,"measureText",null),pe([ve()],xe.prototype,"strokeText",null);const{copy:be,multiplyParent:ke,pixelScale:Se}=$,{round:Ee}=Math,Be=new Kt,Te=new Kt,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:o}=t;this.autoLayout=!i||!s,this.size.pixelRatio=o||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;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&ke(t,e,o),Se(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=Ee(o.e-.5)+.5,o.f=Ee(o.f-.5)+.5):(o.e=Ee(o.e),o.f=Ee(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(o=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=o,this.dashPattern=n,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:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),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,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Vt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),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,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,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,o=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return o.save(),t&&(be(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}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,o,n){const r=W.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;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:Xe,cos:Ne,hypot:He,atan2:Ve,ceil:je,abs:Ue,PI:Ge,sqrt:Ke,pow:qe}=Math,{setPoint:Ze,addPoint:Je}=vt,{set:Qe,toNumberPoints:$e}=dt,{M:ti,L:ei,C:ii,Q:si,Z:oi}=Ae,ni={},ri={points(t,e,i,s){let o=$e(e);if(t.push(ti,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,_,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=Ke(qe(r-e,2)+qe(a-n,2)),p=Ke(qe(h-r,2)+qe(l-a,2)),(_||p)&&(f=_+p,_=y*_/f,p=y*p/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(si,d,c,r,a):t.push(ii,u,g,d,c,r,a),u=r+p*h,g=a+p*l);s||t.push(si,u,g,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(ei,o[e],o[e+1]);s&&t.push(oi)},rect(t,e,i,s,o){Pe.creator.path=t,Pe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Pe.creator.path=[],Ye.drawRoundRect(Pe.creator,e,i,s,o,n),t.push(...Pe.convertToCanvasData(Pe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,_=r-o;let p=Ve(u,c),f=Ve(_,g);const m=He(c,u),y=He(g,_);let v=f-p;if(v<0&&(v+=X),m<1e-12||y<1e-12||v<1e-12||Ue(v-Ge)<1e-12)return t&&t.push(ei,s,o),h&&(Ze(h,e,i),Je(h,s,o)),d&&Qe(d,e,i),void(l&&Qe(l,s,o));const w=c*_-g*u<0,x=w?-1:1,b=a/Ne(v/2),k=s+b*Ne(p+v/2+N*x),S=o+b*Xe(p+v/2+N*x);return p-=N*x,f-=N*x,li(t,k,S,a,a,0,p/Y,f/Y,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>li(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*Y,g=Xe(u),_=Ne(u);let p=r*Y,f=a*Y;p>Ge&&(p-=X),f<0&&(f+=X);let m=f-p;m<0?m+=X:m>X&&(m-=X),h&&(m-=X);const y=je(Ue(m/N)),v=m/y,w=Xe(v/4),x=8/3*w*w/Xe(v/2);f=p+v;let b,k,S,E,B,T,R,C,O=Ne(p),P=Xe(p),L=S=_*s*O-g*o*P,A=E=g*s*O+_*o*P,D=e+S,M=i+E;t&&t.push(t.length?ei:ti,D,M),l&&Ze(l,D,M),c&&Qe(c,D,M);for(let n=0;n<y;n++)b=Ne(f),k=Xe(f),S=_*s*b-g*o*k,E=g*s*b+_*o*k,B=e+L-x*(_*s*P+g*o*O),T=i+A-x*(g*s*P-_*o*O),R=e+S+x*(_*s*k+g*o*b),C=i+E+x*(g*s*k-_*o*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,p=f,f+=v;d&&Qe(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(ii,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),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,o,n,r,a,ni),Je(h,ni.x,ni.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*n+_*a,l.y=c*i+u*o+g*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ai(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ri,{sin:di,cos:ci,sqrt:ui,atan2:gi}=Math,{ellipse:_i}=ri,pi={ellipticalArc(t,e,i,s,o,n,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=n*Y,_=di(g),p=ci(g),f=-p*c-_*u,m=-p*u+_*c,y=s*s,w=o*o,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,o*=t}else S=(r===a?-1:1)*ui(k/(y*x+w*b));const E=S*s*m/o,B=-S*o*f/s,T=gi((m-B)/o,(f-E)/s),R=gi((-m-B)/o,(-f-E)/s);let C=R-T;0===a&&C>0?C-=X:1===a&&C<0&&(C+=X);const O=e+c+p*E-_*B,P=i+u+_*E+p*B,L=C<0?1:0;d||v.ellipseToCurve?_i(t,O,P,s,o,n,T/Y,R/Y,L):s!==o||n?t.push(Ae.G,O,P,s,o,n,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:Xi,O:Ni,P:Hi,U:Vi}=Ae,{rect:ji,roundRect:Ui,arcTo:Gi,arc:Ki,ellipse:qi,quadraticCurveTo:Zi}=ri,{ellipticalArc:Ji}=pi,Qi=$t.get("PathConvert"),$i={},ts={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=ze[s],a+=s===o?" ":We[s];for(let s=1;s<i;s++)a+=W.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";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,n),n=""),es.dot++),"0"===n&&"."!==s&&(is(r,n),n=""),n+=s):Ae[s]?(n&&(is(r,n),n=""),es.name=Ae[s],es.length=De[s],es.index=0,is(r,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&is(r,n),n=s):n&&(is(r,n),n=""),o=s;return n&&is(r,n),i?ts.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(o=t[c],o){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,o=Ti;case Ti:r=n===Ei||n===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,o=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,o=Pi;case Pi:r=n===Ci||n===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,o=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:qi(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,$i),a=$i.x,h=$i.y,c+=9;break;case Xi:e?qi(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 Ni:Ki(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,$i),a=$i.x,h=$i.y,c+=7;break;case Hi:e?Ki(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,$i),a=$i.x,h=$i.y,c+=6;break;default:return Qi.error(`command: ${o} [index:${c}]`,t),g}n=o}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 o=i,n=i+s;o<n;o++)t.push(e[o])},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:os,L:ns,C:rs,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:gs,O:_s,P:ps,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(os,e,i)},lineTo(t,e,i){t.push(ns,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(rs,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(as,e,i,s,o)},closePath(t){t.push(hs)},rect(t,e,i,s,o){t.push(ls,e,i,s,o)},roundRect(t,e,i,s,o,n){if(a(n))t.push(cs,e,i,s,o,n);else{const r=W.fourNumber(n);r?t.push(ds,e,i,s,o,...r):t.push(ls,e,i,s,o)}},ellipse(t,e,i,s,n,r,a,h,l){o(r)?t.push(gs,e,i,s,n):(o(a)&&(a=0),o(h)&&(h=360),t.push(us,e,i,s,n,r,a,h,l?1:0))},arc(t,e,i,s,n,r,a){o(n)?t.push(ps,e,i,s):(o(r)&&(r=360),t.push(_s,e,i,s,n,r,a?1:0))},arcTo(t,e,i,o,n,r,a,h){if(!s(a)){const t=ms(a,h,e,i,o,n);r=ws(r,ws(t/2,t/2*xs(vs(ys(a,h,e,i,o,n)/2))))}t.push(fs,e,i,o,n,r)},drawEllipse(t,e,i,s,n,r,a,h,l){ri.ellipse(null,e,i,s,n,o(r)?0:r,o(a)?0:a,o(h)?360:h,l,null,null,bs),t.push(os,bs.x,bs.y),Ss(t,e,i,s,n,r,a,h,l)},drawArc(t,e,i,s,n,r,a){ri.arc(null,e,i,s,o(n)?0:n,o(r)?360:r,a,null,null,bs),t.push(os,bs.x,bs.y),Es(t,e,i,s,n,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?n(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,o,n){return Cs(this.__path,t,e,i,s,o,n),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,o){return As(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return Ds(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return Ms(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Fs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Is(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Ws(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:Ns,C:Hs,Q:Vs,Z:js,N:Us,D:Gs,X:Ks,G:qs,F:Zs,O:Js,P:Qs,U:$s}=Ae,to=$t.get("PathDrawer"),eo={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ns: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 Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case qs: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,X,!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 Qs:t.arc(e[s+1],e[s+2],e[s+3],0,X,!1),s+=4;break;case $s:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void to.error(`command: ${i} [index:${s}]`,e)}}},{M:io,L:so,C:oo,Q:no,Z:ro,N:ao,D:ho,X:lo,G:co,F:uo,O:go,P:_o,U:po}=Ae,{toTwoPointBounds:fo,toTwoPointBoundsByQuadraticCurve:mo,arcTo:yo,arc:vo,ellipse:wo}=ri,{addPointBounds:xo,copy:bo,addPoint:ko,setPoint:So,addBounds:Eo,toBounds:Bo}=vt,To=$t.get("PathBounds");let Ro,Co,Oo;const Po={},Lo={},Ao={},Do={toBounds(t,e){Do.toTwoPointBounds(t,Lo),Bo(Lo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return So(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===ro||r===oo||r===no?So(e,h,l):So(e,t[a+1],t[a+2])),r){case io:case so:h=t[a+1],l=t[a+2],ko(e,h,l),a+=3;break;case oo:o=t[a+5],n=t[a+6],fo(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Po),xo(e,Po),h=o,l=n,a+=7;break;case no:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],mo(h,l,i,s,o,n,Po),xo(e,Po),h=o,l=n,a+=5;break;case ro:a+=1;break;case ao:h=t[a+1],l=t[a+2],Eo(e,h,l,t[a+3],t[a+4]),a+=5;break;case ho:case lo:h=t[a+1],l=t[a+2],Eo(e,h,l,t[a+3],t[a+4]),a+=r===ho?9:6;break;case co:wo(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],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=9;break;case uo:h=t[a+1],l=t[a+2],Co=t[a+3],Oo=t[a+4],Eo(e,h-Co,l-Oo,2*Co,2*Oo),h+=Co,a+=5;break;case go:vo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=7;break;case _o:h=t[a+1],l=t[a+2],Ro=t[a+3],Eo(e,h-Ro,l-Ro,2*Ro,2*Ro),h+=Ro,a+=4;break;case po:yo(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=6;break;default:return void To.error(`command: ${r} [index:${a}]`,t)}}},{M:Mo,L:Fo,Z:Io}=Ae,{getCenterX:Wo,getCenterY:zo}=dt,{arcTo:Yo}=ks,Xo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,_=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case Mo:l=g=t[r+1],d=_=t[r+2],r+=3,t[r]===Fo?(c=t[r+1],u=t[r+2],f.push(Mo,Wo(l,c),zo(d,u))):f.push(Mo,l,d);break;case Fo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Fo:Yo(f,a,h,t[r+1],t[r+2],e,g,_);break;case Io:Yo(f,a,h,l,d,e,g,_);break;default:f.push(Fo,a,h)}g=a,_=h;break;case Io:o!==Io&&(Yo(f,l,d,c,u,e,g,_),f.push(Io)),r+=1;break;default:n=ze[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==Io&&(f[1]=l,f[2]=d),f}};function No(t){return new Ys(t)}const Ho=No();Pe.creator=No(),Pe.parse=ts.parse,Pe.convertToCanvasData=ts.toCanvasData;const{drawRoundRect:Vo}=Ye;function jo(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Vo(this,t,e,i,s,o)})}(t)}const Uo={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=Go.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{}}}},Go=Uo;Go.alphaPixelTypes.forEach(t=>Go.upperCaseTypeMap[t]=t.toUpperCase());const Ko=$t.get("TaskProcessor");class qo{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){Ko.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zo{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&_.assign(this.config,t),this.empty()}add(t,e,i){let o,n,r,h;const l=new qo(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,o=e.start,r=e.time,h=e.delay,i||(i=e.canUse)),r&&(l.time=r),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,o):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,o))},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 o=s+e.parallel;if(o>i.length&&(o=i.length),e.parallel>1)for(let e=s;e<o&&(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 Jo=$t.get("Resource"),Qo={tasker:new Zo,map:{},get isComplete(){return $o.tasker.isComplete},set(t,e){$o.map[t]&&Jo.repeat(t),$o.map[t]=e},get:t=>$o.map[t],remove(t){const e=$o.map[t];e&&(e.destroy&&e.destroy(),delete $o.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),$o.set(t,e),e},destroy(){$o.map={}}},$o=Qo,tn={maxRecycled:10,recycledList:[],patternTasker:new Zo,get(t){let e=Qo.get(t.url);return e||Qo.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(v.image.isLarge(t)?t.url&&Qo.remove(t.url):(t.clearLevels(),en.recycledList.push(t)))})},recyclePaint(t){en.recycle(t.image)},clearRecycled(t){const e=en.recycledList;(e.length>en.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Qo.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Uo.alphaPixelTypes.some(e=>en.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:"+Uo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Uo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},en=tn,{IMAGE:sn,create:on}=x;class nn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=on(sn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}tn.isFormat("svg",t)&&(this.isSVG=!0),tn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Qo.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,o,n,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,o,n,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const o=v.canvas.createPattern(t,e);return v.image.setPatternTransform(o,i,s),o}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 rn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function an(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ln(t,e){return(i,s)=>cn(i,s,t,e&&e(s))}function dn(t){return t}function cn(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};rn(t,e,Object.assign(o,s||{})),Yn(t,e,i)}function un(t){return ln(t)}function gn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function _n(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function pn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wn(this))}}))}function fn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function yn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&wn(this)}}))}function vn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(wn(this),this.__.__removeNaturalSize())}}))}function wn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xn(t){return ln(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wn(this)}}))}const bn=yn;function kn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i)&&(Sn(this),e&&(this.__.__useStroke=!0))}}))}function Sn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wn(t)}const En=kn;function Bn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Tn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rn(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Cn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Pn(this)}}))}function On(t){return ln(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ln(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ln(this,t,e,i),this.mask&&Pn(this)}}))}function Pn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ln(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wn(t))}function An(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Dn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function In(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wn(t){return(e,i)=>{rn(e,"__DataProcessor",{get:()=>t})}}function zn(t){return(e,i)=>{rn(e,"__LayoutProcessor",{get:()=>t})}}function Yn(t,e,i){const o=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=hn(e,i);if(s(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=g(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=o;for(;!l&&d;)l=an(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),o[r]&&(a.set=o[r],delete o[r]),rn(o,e,a)}const Xn=new $t("rewrite"),Nn=[],Hn=["destroy","constructor"];function Vn(t){return(e,i)=>{Nn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jn(){return t=>{Un()}}function Un(t){Nn.length&&(Nn.forEach(e=>{t&&Xn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Nn.length=0)}function Gn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Hn.includes(s)||e&&e.includes(s)))if(t.prototype){an(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Kn(){return t=>{le.register(t)}}function qn(){return t=>{ue.register(t)}}setTimeout(()=>Un(!0));const{copy:Zn,toInnerPoint:Jn,toOuterPoint:Qn,scaleOfOuter:$n,rotateOfOuter:tr,skewOfOuter:er,multiplyParent:ir,divideParent:sr,getLayout:or}=$,nr={},{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,o=s.length;t<o;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,o,n){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,o,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,o){const n=c(e)?Object.assign({},e):{x:e,y:i};s?Qn(t.localTransform,n,n,!0):t.parent&&Jn(t.parent.scrollWorldTransform,n,n,!0),hr.moveLocal(t,n.x,n.y,o)},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,o,n){hr.zoomOfLocal(t,_r(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(a(s)||(s&&(n=s),s=i),Zn(nr,r),$n(nr,e,i,s),hr.hasHighPosition(t))hr.setTransform(t,nr,o,n);else{const e=t.x+nr.e-r.e,a=t.y+nr.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){hr.rotateOfLocal(t,_r(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;Zn(nr,o),tr(nr,e,i),hr.hasHighPosition(t)?hr.setTransform(t,nr,!1,s):t.set({x:t.x+nr.e-o.e,y:t.y+nr.f-o.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){hr.skewOfLocal(t,_r(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){Zn(nr,t.__localMatrix),er(nr,e,i,s),hr.setTransform(t,nr,o,n)},transformWorld(t,e,i,s){Zn(nr,t.worldTransform),ir(nr,e),t.parent&&sr(nr,t.parent.scrollWorldTransform),hr.setTransform(t,nr,i,s)},transform(t,e,i,s){Zn(nr,t.localTransform),ir(nr,e),hr.setTransform(t,nr,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&hr.getInnerOrigin(t,o.origin),r=or(e,n,o.around&&hr.getInnerOrigin(t,o.around));if(hr.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=hr.getInnerOrigin(t,o.origin);dt.move(r,n.x-s.x,n.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 $n(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)=>(Zn(nr,t.worldTransform),sr(nr,e.scrollWorldTransform),i?nr:Object.assign({},nr)),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,o=e.y*i;e.x-=s,e.y-=o,t.move(s,o),v.requestRender(()=>hr.animateMove(t,e,i))}}},hr=ar,{updateAllMatrix:lr,updateMatrix:dr,updateAllWorldOpacity:cr,updateAllChange:ur,updateChange:gr}=hr;function _r(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const pr={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,o=i.length;s<o;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 o=t.length-1;o>-1;o--){i=t[o],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:o}=t;for(let n=0,r=o.length;n<r;n++)s=(t=o[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&kr(t,e,i)},scale(t,e,i,s,o,n,r){let a;const{children:h}=t,l=s-1,d=o-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=o,(a.b||a.c)&&(a.b*=s,a.c*=o),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-n)*l+e,a.y=a.f+=(a.f-r)*d+i):(a.e+=(a.e-n)*l+e,a.f+=(a.f-r)*d+i,a.x+=(a.x-n)*l+e,a.y+=(a.y-r)*d+i),a.width*=s,a.height*=o,a.scaleX*=s,a.scaleY*=o,t.isBranch&&Sr(t,e,i,s,o,n,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,Pr="_localContentBounds",Lr="_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[Pr]||(this[Pr]={})),this[Pr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Rr(this.contentBounds,this.leaf.__world,this[Lr]||(this[Lr]={})),this[Lr]}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 $.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 Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=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},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=Br(s,e,!0)}if(r||(r=$.getLayout(n)),Or(r,a),dt.copy(r,o),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,o=Cr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||o.forEach(t=>i.innerToWorld(t,null,!1,n)),o}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,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}zr.CHANGE="property.change",zr.LEAFER_CHANGE="property.leafer_change",zr.SCROLL=Wr;const Yr={scrollX:Wr,scrollY:Wr};class Xr extends Fr{constructor(t,e){super(t),Object.assign(this,e)}}Xr.LOAD="image.load",Xr.LOADED="image.loaded",Xr.ERROR="image.error";class Nr 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)}}Nr.RESIZE="bounds.resize",Nr.INNER="bounds.inner",Nr.LOCAL="bounds.local",Nr.WORLD="bounds.world";const{RESIZE:Hr,INNER:Vr,LOCAL:jr,WORLD:Ur}=Nr,Gr={};[Hr,Vr,jr,Ur].forEach(t=>Gr[t]=1);class Kr 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(Kr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Kr.RESIZE="resize";class qr extends Fr{constructor(t,e){super(t),this.data=e}}qr.REQUEST="watch.request",qr.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 Qr extends Fr{}Qr.START="leafer.start",Qr.BEFORE_READY="leafer.before_ready",Qr.READY="leafer.ready",Qr.AFTER_READY="leafer.after_ready",Qr.VIEW_READY="leafer.view_ready",Qr.VIEW_COMPLETED="leafer.view_completed",Qr.STOP="leafer.stop",Qr.RESTART="leafer.restart",Qr.END="leafer.end",Qr.UPDATE_MODE="leafer.update_mode",Qr.TRANSFORM="leafer.transform",Qr.MOVE="leafer.move",Qr.SCALE="leafer.scale",Qr.ROTATE="leafer.rotate",Qr.SKEW="leafer.skew";const{MOVE:$r,SCALE:ta,ROTATE:ea,SKEW:ia}=Qr,sa={x:$r,y:$r,scaleX:ta,scaleY:ta,rotation:ea,skewX:ia,skewY:ia},oa={};class na{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,o,r;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const a=ra(this,s,!0),h=n(t)?t.split(" "):t,l=o?{listener:e,once:o}:{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]&&Nr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ra(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Gr[t]&&Nr.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 o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:o}=this,n=i&&i[t],r=o&&o[t];return!!(s(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ra(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:oa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:oa)}}const{on:aa,on_:ha,off:la,off_:da,once:ca,emit:ua,emitEvent:ga,hasEvent:_a,destroy:pa}=na.prototype,fa={on:aa,on_:ha,off:la,off_:da,once:ca,emit:ua,emitEvent:ga,hasEvent:_a,destroyEventer:pa},ma=$t.get("setAttr"),ya={__setAttr(t,e,i){if(this.leaferIsCreated){const o=this.__.__getInput(t);if(!i||r(e)||s(e)||(ma.warn(this.innerName,t,e),e=void 0),c(e)||o!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new zr(zr.LEAFER_CHANGE,this,t,o,e));const i=sa[t];i&&(this.emitEvent(new Qr(i,this)),this.emitEvent(new Qr(Qr.TRANSFORM,this)))}this.emitPropertyEvent(zr.CHANGE,t,o,e);const i=Yr[t];return i&&this.emitPropertyEvent(i,t,o,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new zr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__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}=$,{toPoint:ka,tempPoint:Sa}=St,Ea={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;wa(this.__local||e,t?t.__scrollWorld||t.__world:ba,i,!!e.affectScaleOrRotation,o),s&&xa(Object.assign(s,i),o.scrollX,o.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:Pa}=Vt,{toBounds:La}=Do,Aa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Nr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Nr.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?La(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?Pa(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);$t.showBounds&&$t.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}=pr,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 o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ma(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Ma(i[s],e)||i[s].__clip(t,e)}}},Ia={},{LEAF:Wa,create:za}=x,{stintSet:Ya}=_,{toInnerPoint:Xa,toOuterPoint:Na,multiplyParent:Ha}=$,{toOuterOf:Va}=Vt,{copy:ja,move:Ua}=dt,{moveLocal:Ga,zoomOfLocal:Ka,rotateOfLocal:qa,skewOfLocal:Za,moveWorld:Ja,zoomOfWorld:Qa,rotateOfWorld:$a,skewOfWorld:th,transform:eh,transformWorld:ih,setTransform:sh,getFlipTransform:oh,getLocalOrigin:nh,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}=tn.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,o=i?t:{};return Va(t,s,o),o}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),Xa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Na(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 o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ua(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ua(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}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 o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}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,o){Ka(this,nh(this,t),e,i,s,o)}rotateOf(t,e,i){qa(this,nh(this,t),e,i)}skewOf(t,e,i,s,o){Za(this,nh(this,t),e,i,s,o)}transformWorld(t,e,i){ih(this,t,e,i)}moveWorld(t,e,i){Ja(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){Qa(this,t,e,i,s,o)}rotateOfWorld(t,e){$a(this,t,e)}skewOfWorld(t,e,i,s,o){th(this,t,e,i,s,o)}flip(t,e){eh(this,oh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return 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):Yn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=yn),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=pe([Gn(ya),Gn(Ea),Gn(Aa),Gn(fa),Gn(Da)],hh);const{setListWithFn:lh}=Vt,{sort:dh}=vr,{localBoxBounds:ch,localStrokeBounds:uh,localRenderBounds:gh,maskLocalBoxBounds:_h,maskLocalStrokeBounds:ph,maskLocalRenderBounds:fh}=pr,mh=new $t("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?_h:ch)}__updateStrokeBounds(t){lh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ph: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 o=t.__layout;o.boxChanged||o.boxChange(),o.matrixChanged||o.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=pe([Gn(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,o=s.length;t<o;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 o=0,n=e.length;o<n;o++)s(i)?e[o].innerId===t.innerId&&(i=o,delete this.keys[t.innerId]):this.keys[e[o].innerId]=o-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!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(n(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=v.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&v.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,o={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(o),this.context&&(this.viewSelect&&(v.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,a(o)?[o]:o)}),jo(this.context.__proto__))}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&v.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),v.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,v.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};_.copyAttrs(e,this,Ce),this.resize(t),s(this.width)||this.resizeListener(new Kr(t,e))}}const{mineType:kh,fileType:Sh}=Uo;function Eh(t,e){v.origin={createCanvas:(t,i,s)=>{const o={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(o):e.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(kh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(kh(Sh(e)),i);return s=s.substring(s.indexOf("64,")+3),v.origin.download(s,e)},download:(t,i)=>new Promise((s,o)=>{let n;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,n=!0);const r=e.getFileSystemManager();r.writeFile({filePath:i,data:t,encoding:"base64",success(){n?v.miniapp.saveToAlbum(i).then(()=>{r.unlink({filePath:i}),s()}):s()},fail(t){o(t)}})}),loadImage:t=>new Promise((e,i)=>{const s=v.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=v.image.getRealURL(t)}),noRepeat:"repeat-x"},v.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},v.event={stopDefault(t){},stopNow(t){},stop(t){}},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new bh(t,e),image:t=>new nn(t)}),v.name="miniapp",v.requestRender=function(t){const{view:e}=v.renderCanvas||v.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},rn(v,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});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=_.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 qr(qr.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],[qr.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:Ph}=vr;const{worldBounds:Lh}=pr;class Ah{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new vh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Lh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Lh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Dh,updateAllChange:Mh}=ar,Fh=$t.get("Layouter");class Ih{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new wh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(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(qr.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:o,LAYOUT:n,AFTER:r}=Zr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Zr(o,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),Ph(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ph(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;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(n,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:o}=Zr,n=this.getBlocks(new vh(e));e.emitEvent(new Zr(i,n,this.times)),Ih.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Zr(s,n,this.times)),e.emitEvent(new Zr(o,n,this.times)),this.addBlocks(n),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],[qr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Wh=$t.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=_.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 Kt,Wh.log(e.innerName,"---\x3e");try{this.emitRender(Jr.START),this.renderOnce(t),this.emitRender(Jr.END,this.totalBounds),tn.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 Kt,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),o=new Kt(s);i.save(),s.spread(zh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),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,o=t.includes(s.__world),n=o?{includes:o}:{bounds:t,includes:o};this.needFill&&i.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),v.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return 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 Kt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||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],[Kr.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 Xh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new vh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o,!!i.findList),h=o?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 o=this.findList=new vh;if(t.length){let e;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ar.worldHittable(e))&&(this.hitChild(e,r),o.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ar.hasParent(t,e))){o.reset();break}return o.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),o.length)return o.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,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Yh(i.__world,o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else s&&this.hitChild(i,o)}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,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.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 Nh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Xh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:o}=this;return v.backgrounder&&s&&s.updateLayout(),o.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 ln(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Vh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function jh(){return(t,e)=>{const i="_"+e;rn(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)=>{rn(e,i,hn(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 Nh(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={},Kh={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}},qh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Zh={},Jh={},Qh={},$h={},tl={},el={apply(){re.need("filter")}},il={},sl={setStyleName:()=>re.need("state"),set:()=>re.need("state")},ol={list:{},register(t,e){ol.list[t]=e},get:t=>ol.list[t]},{parse:nl,objectToCanvasData:rl}=ts,{stintSet:al}=_,{hasTransparent:hl}=Kh,ll={originPaint:{}},dl=$t.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(),n(t)||!t?(al(this,"__isTransparentFill",hl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(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=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?nl(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),Qh.recycleImage(t,this),"fill"===t?(al(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(al(this,"__isAlphaPixelStroke",void 0),al(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ul(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class gl extends cl{}class _l 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 pl extends gl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class fl extends _l{}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){n(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 o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.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:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Rl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=tl.getShadowRenderSpread(this,e)),s&&(t=Rl(t,s)),n&&(t=Cl(t,el.getSpread(n))),r&&(t=Cl(t,r)),a&&(t=Cl(t,a));let l=t;return i&&(l=Rl(l,tl.getInnerShadowSpread(this,i))),o&&(l=Rl(l,o)),this.__layout.renderShapeSpread=l,h?Rl(h.__updateRenderSpread(),t):t}},{stintSet:Pl}=_,Ll={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Pl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Pl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Pl(t,"__isFastShadow",e&&!o&&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&&!o)}t.__checkSingle(),Pl(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:o,stroke:n,__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(n,this,t,e):Jh.stroke(n,this,t,e)),o&&(s.__isFills?Jh.fills(o,this,t,e):Jh.fill(o,this,t,e)),r&&this.__drawAfterFill(t,e),d&&tl.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Jh.strokes(n,this,t,e):Jh.stroke(n,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(n,this,t,e):Jh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Kh.string(e.color))}o&&(s.__isFills?Jh.fills(o,this,t,e):Jh.fill(o,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Jh.strokes(n,this,t,e):Jh.stroke(n,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:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Jh.fills(s,this,t,e):Jh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Jh.strokes(o,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:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Jh.stroke(o,t,e,i),s&&Jh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),o&&!r&&Jh.stroke(o,t,e,i)}const Dl={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),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,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+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 Ho.set(this.path=t||[]),t||this.__drawPathByBox(Ho),Ho}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return 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||(Ho.set(i=[]),this.__drawPathByBox(Ho)),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?Xo.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?eo.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,a(n)?[n]:n)}else t.rect(e,i,s,o)}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=_.clone(this.toJSON());return t&&Object.assign(e,t),Ml.one(e)}static one(t,e,i,s,o){return le.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){Kn()(this)}static registerData(t){Wn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};pe([Wn(cl)],Fl.prototype,"__",void 0),pe([jh()],Fl.prototype,"zoomLayer",void 0),pe([un("")],Fl.prototype,"id",void 0),pe([un("")],Fl.prototype,"name",void 0),pe([un("")],Fl.prototype,"className",void 0),pe([Tn("pass-through")],Fl.prototype,"blendMode",void 0),pe([Cn(1)],Fl.prototype,"opacity",void 0),pe([On(!0)],Fl.prototype,"visible",void 0),pe([Tn(!1)],Fl.prototype,"locked",void 0),pe([Rn(!1)],Fl.prototype,"dim",void 0),pe([Rn(!1)],Fl.prototype,"dimskip",void 0),pe([An(0)],Fl.prototype,"zIndex",void 0),pe([Dn(!1)],Fl.prototype,"mask",void 0),pe([Mn(!1)],Fl.prototype,"eraser",void 0),pe([gn(0,!0)],Fl.prototype,"x",void 0),pe([gn(0,!0)],Fl.prototype,"y",void 0),pe([yn(100,!0)],Fl.prototype,"width",void 0),pe([yn(100,!0)],Fl.prototype,"height",void 0),pe([fn(1,!0)],Fl.prototype,"scaleX",void 0),pe([fn(1,!0)],Fl.prototype,"scaleY",void 0),pe([mn(0,!0)],Fl.prototype,"rotation",void 0),pe([mn(0,!0)],Fl.prototype,"skewX",void 0),pe([mn(0,!0)],Fl.prototype,"skewY",void 0),pe([gn(0,!0)],Fl.prototype,"offsetX",void 0),pe([gn(0,!0)],Fl.prototype,"offsetY",void 0),pe([_n(0,!0)],Fl.prototype,"scrollX",void 0),pe([_n(0,!0)],Fl.prototype,"scrollY",void 0),pe([pn()],Fl.prototype,"origin",void 0),pe([pn()],Fl.prototype,"around",void 0),pe([un(!1)],Fl.prototype,"lazy",void 0),pe([vn(1)],Fl.prototype,"pixelRatio",void 0),pe([Bn(0)],Fl.prototype,"renderSpread",void 0),pe([xn()],Fl.prototype,"path",void 0),pe([bn()],Fl.prototype,"windingRule",void 0),pe([bn(!0)],Fl.prototype,"closed",void 0),pe([yn(0)],Fl.prototype,"padding",void 0),pe([yn(!1)],Fl.prototype,"lockRatio",void 0),pe([yn()],Fl.prototype,"widthRange",void 0),pe([yn()],Fl.prototype,"heightRange",void 0),pe([un(!1)],Fl.prototype,"draggable",void 0),pe([un()],Fl.prototype,"dragBounds",void 0),pe([un("auto")],Fl.prototype,"dragBoundsType",void 0),pe([un(!1)],Fl.prototype,"editable",void 0),pe([Fn(!0)],Fl.prototype,"hittable",void 0),pe([Fn("path")],Fl.prototype,"hitFill",void 0),pe([En("path")],Fl.prototype,"hitStroke",void 0),pe([Fn(!1)],Fl.prototype,"hitBox",void 0),pe([Fn(!0)],Fl.prototype,"hitChildren",void 0),pe([Fn(!0)],Fl.prototype,"hitSelf",void 0),pe([Fn()],Fl.prototype,"hitRadius",void 0),pe([In("")],Fl.prototype,"cursor",void 0),pe([Tn()],Fl.prototype,"fill",void 0),pe([En(void 0,!0)],Fl.prototype,"stroke",void 0),pe([En("inside")],Fl.prototype,"strokeAlign",void 0),pe([En(1,!0)],Fl.prototype,"strokeWidth",void 0),pe([En(!1)],Fl.prototype,"strokeWidthFixed",void 0),pe([En("none")],Fl.prototype,"strokeCap",void 0),pe([En("miter")],Fl.prototype,"strokeJoin",void 0),pe([En()],Fl.prototype,"dashPattern",void 0),pe([En(0)],Fl.prototype,"dashOffset",void 0),pe([En(10)],Fl.prototype,"miterLimit",void 0),pe([bn(0)],Fl.prototype,"cornerRadius",void 0),pe([bn()],Fl.prototype,"cornerSmoothing",void 0),pe([Hh()],Fl.prototype,"shadow",void 0),pe([Hh()],Fl.prototype,"innerShadow",void 0),pe([Hh()],Fl.prototype,"blur",void 0),pe([Hh()],Fl.prototype,"backgroundBlur",void 0),pe([Hh()],Fl.prototype,"grayscale",void 0),pe([Hh()],Fl.prototype,"filter",void 0),pe([Tn()],Fl.prototype,"placeholderColor",void 0),pe([un(100)],Fl.prototype,"placeholderDelay",void 0),pe([un({})],Fl.prototype,"data",void 0),pe([Vn(hh.prototype.reset)],Fl.prototype,"reset",null),Fl=Ml=pe([Gn(Ol),Gn(Ll),jn()],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;pe([Wn(gl)],Il.prototype,"__",void 0),pe([yn(0)],Il.prototype,"width",void 0),pe([yn(0)],Il.prototype,"height",void 0),Il=pe([Gn(yh),Kn()],Il);const zl=$t.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&&Qo.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,_.assign(s,t));const o=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,o,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new _e,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),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(Qr.RESTART):this.emitLeafer(Qr.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(Qr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Kr(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new 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(Qr.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,o=_.copyAttrs({},s,Ce);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(Qr.BEFORE_READY),this.emitLeafer(Qr.READY),this.emitLeafer(Qr.AFTER_READY),Er.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Qr.VIEW_READY),Er.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}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(Qr.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 Qr(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[Qr.START,()=>se.end(t)],[Zr.START,this.updateLazyBounds,this],[Jr.START,this.__onCreated,this],[Jr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[qr.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(Qr.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(()=>{tn.clearRecycled()},100)}catch(t){zl.error(t)}}};t?e():setTimeout(e)}};Yl.list=new vh,pe([Wn(pl)],Yl.prototype,"__",void 0),pe([yn()],Yl.prototype,"pixelRatio",void 0),pe([un("normal")],Yl.prototype,"mode",void 0),Yl=Wl=pe([Kn()],Yl);let Xl=class extends Fl{get __tag(){return"Rect"}};pe([Wn(yl)],Xl.prototype,"__",void 0),Xl=pe([Gn(Dl),jn(),Kn()],Xl);const{add:Nl,includes:Hl,scroll:Vl}=Vt,jl=Xl.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:o,boxBounds:n}=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"))&&(Nl(a,n),Vl(a,i)),this.__updateRectRenderBounds(),t=!Hl(n,a),t&&"show"===r&&Nl(o,a)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};pe([Wn(_l)],Gl.prototype,"__",void 0),pe([yn(100)],Gl.prototype,"width",void 0),pe([yn(100)],Gl.prototype,"height",void 0),pe([un(!1)],Gl.prototype,"resizeChildren",void 0),pe([Bn("show")],Gl.prototype,"overflow",void 0),pe([Vn(jl.__updateStrokeSpread)],Gl.prototype,"__updateStrokeSpread",null),pe([Vn(jl.__updateRenderSpread)],Gl.prototype,"__updateRectRenderSpread",null),pe([Vn(jl.__updateBoxBounds)],Gl.prototype,"__updateRectBoxBounds",null),pe([Vn(jl.__updateStrokeBounds)],Gl.prototype,"__updateStrokeBounds",null),pe([Vn(jl.__updateRenderBounds)],Gl.prototype,"__updateRectRenderBounds",null),pe([Vn(jl.__updateChange)],Gl.prototype,"__updateRectChange",null),pe([Vn(jl.__render)],Gl.prototype,"__renderRect",null),pe([Vn(Ul.__render)],Gl.prototype,"__renderGroup",null),Gl=pe([jn(),Kn()],Gl);let Kl=class extends Gl{get __tag(){return"Frame"}get isFrame(){return!0}};pe([Wn(fl)],Kl.prototype,"__",void 0),pe([Tn("#FFFFFF")],Kl.prototype,"fill",void 0),pe([Bn("hide")],Kl.prototype,"overflow",void 0),Kl=pe([Kn()],Kl);const{moveTo:ql,closePath:Zl,ellipse:Jl}=ks;let Ql=class extends Fl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,n=t/2,r=e/2,a=this.__.path=[];i?(s||o?(i<1&&Jl(a,n,r,n*i,r*i,0,s,o,!1),Jl(a,n,r,n,r,0,o,s,!0),i<1&&Zl(a)):(i<1&&(Jl(a,n,r,n*i,r*i),ql(a,t,r)),Jl(a,n,r,n,r,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(ql(a,n,r),Jl(a,n,r,n,r,0,s,o,!1),Zl(a)):Jl(a,n,r,n,r)}};pe([Wn(vl)],Ql.prototype,"__",void 0),pe([bn(0)],Ql.prototype,"innerRadius",void 0),pe([bn(0)],Ql.prototype,"startAngle",void 0),pe([bn(0)],Ql.prototype,"endAngle",void 0),Ql=pe([Kn()],Ql);const{sin:$l,cos:td,PI:ed}=Math,{moveTo:id,lineTo:sd,closePath:od,drawPoints:nd}=ks;let rd=class extends Fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)nd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;id(e,n,0);for(let t=1;t<o;t++)sd(e,n+n*$l(2*t*ed/o),r-r*td(2*t*ed/o));od(e)}}};pe([Wn(wl)],rd.prototype,"__",void 0),pe([bn(3)],rd.prototype,"sides",void 0),pe([bn()],rd.prototype,"points",void 0),pe([bn(0)],rd.prototype,"curve",void 0),rd=pe([jn(),Kn()],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.__,o=t/2,n=e/2,r=this.__.path=[];dd(r,o,0);for(let t=1;t<2*i;t++)cd(r,o+(t%2==0?o:o*s)*ad(t*ld/i),n-(t%2==0?n:n*s)*hd(t*ld/i));ud(r)}};pe([Wn(xl)],gd.prototype,"__",void 0),pe([bn(5)],gd.prototype,"corners",void 0),pe([bn(.382)],gd.prototype,"innerRadius",void 0),gd=pe([Kn()],gd);const{moveTo:_d,lineTo:pd,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):(_d(e,0,0),pd(e,this.width,0))}};pe([Wn(ml)],xd.prototype,"__",void 0),pe([kn("center")],xd.prototype,"strokeAlign",void 0),pe([yn(0)],xd.prototype,"height",void 0),pe([bn()],xd.prototype,"points",void 0),pe([bn(0)],xd.prototype,"curve",void 0),pe([bn(!1)],xd.prototype,"closed",void 0),xd=pe([Kn()],xd);let bd=class extends Xl{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}};pe([Wn(Bl)],bd.prototype,"__",void 0),pe([yn("")],bd.prototype,"url",void 0),bd=pe([Kn()],bd);const kd=bd;let Sd=class extends Xl{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 nn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Xr(Xr.LOADED,{image:t}))})}draw(t,e,i,s){const o=new mt(t.worldTransform).invert(),n=new mt;e&&n.translate(e.x,e.y),i&&(a(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.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()}};pe([Wn(Tl)],Sd.prototype,"__",void 0),pe([Vh(100)],Sd.prototype,"width",void 0),pe([Vh(100)],Sd.prototype,"height",void 0),pe([Vh(1)],Sd.prototype,"pixelRatio",void 0),pe([Vh(!0)],Sd.prototype,"smooth",void 0),pe([un(!1)],Sd.prototype,"safeResize",void 0),pe([Vh()],Sd.prototype,"contextSettings",void 0),Sd=pe([Kn()],Sd);const{copyAndSpread:Ed,includes:Bd,spread:Td,setList:Rd}=Vt,{stintSet:Cd}=_;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:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=qh.number(e,o),t.__letterSpacing=qh.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||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:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Td(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.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()}};pe([Wn(El)],Od.prototype,"__",void 0),pe([yn(0)],Od.prototype,"width",void 0),pe([yn(0)],Od.prototype,"height",void 0),pe([Tn()],Od.prototype,"boxStyle",void 0),pe([un(!1)],Od.prototype,"resizeFontSize",void 0),pe([Tn("#000000")],Od.prototype,"fill",void 0),pe([kn("outside")],Od.prototype,"strokeAlign",void 0),pe([Fn("all")],Od.prototype,"hitFill",void 0),pe([yn("")],Od.prototype,"text",void 0),pe([yn("")],Od.prototype,"placeholder",void 0),pe([yn("caption")],Od.prototype,"fontFamily",void 0),pe([yn(12)],Od.prototype,"fontSize",void 0),pe([yn("normal")],Od.prototype,"fontWeight",void 0),pe([yn(!1)],Od.prototype,"italic",void 0),pe([yn("none")],Od.prototype,"textCase",void 0),pe([yn("none")],Od.prototype,"textDecoration",void 0),pe([yn(0)],Od.prototype,"letterSpacing",void 0),pe([yn({type:"percent",value:1.5})],Od.prototype,"lineHeight",void 0),pe([yn(0)],Od.prototype,"paraIndent",void 0),pe([yn(0)],Od.prototype,"paraSpacing",void 0),pe([yn("x")],Od.prototype,"writingMode",void 0),pe([yn("left")],Od.prototype,"textAlign",void 0),pe([yn("top")],Od.prototype,"verticalAlign",void 0),pe([yn(!0)],Od.prototype,"autoSizeAlign",void 0),pe([yn("normal")],Od.prototype,"textWrap",void 0),pe([yn("show")],Od.prototype,"textOverflow",void 0),pe([Tn(!1)],Od.prototype,"textEditing",void 0),Od=pe([Kn()],Od);let Pd=class extends Fl{get __tag(){return"Path"}};pe([Wn(bl)],Pd.prototype,"__",void 0),pe([kn("center")],Pd.prototype,"strokeAlign",void 0),Pd=pe([Kn()],Pd);let Ld=class extends Il{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Pd(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,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};pe([Wn(kl)],Ld.prototype,"__",void 0),pe([(t,e)=>{rn(t,e,{get(){return this.__path}})}],Ld.prototype,"path",void 0),Ld=pe([Gn(Ys,["set","path","paint"]),Kn()],Ld);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:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&ae.editor(o,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&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[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=pe([Kn()],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:Xd,sign:Nd}=W,{minX:Hd,maxX:Vd,minY:jd,maxY:Ud}=Vt,Gd=new Kt,Kd=new Kt,qd={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:o,dragBoundsType:n}=t;o&&Zd.getValidScaleOf(t.__localBoxBounds,Zd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),Zd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),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=Xd(s.x),s.y=Xd(s.y),s},getValidScaleOf(t,e,i,s,o,n,a){a||(o=Object.assign({},o)),Kd.set(e),Gd.set(t).scaleOf(s,o.x,o.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")?(o.x<0&&Gd.scaleOf(s,f=1/o.x,1),_=Xd(Gd.minX-Kd.minX),p=Xd(Kd.maxX-Gd.maxX),u=h&&_>0?1+_/(h*Gd.width):1,g=l&&p>0?1+p/(l*Gd.width):1,f*=zd(u,g)):(o.x<0&&((Xd(Hd(t)-Hd(e))<=0||Xd(Vd(e)-Vd(t))<=0)&&Gd.scaleOf(s,f=1/o.x,1),Gd.unsign()),_=Xd(Kd.minX-Gd.minX),p=Xd(Gd.maxX-Kd.maxX),u=h&&_>0?1-_/(h*Gd.width):1,g=l&&p>0?1-p/(l*Gd.width):1,f*=Wd(u,g)),Zd.isInnerMode(t,e,i,"height")?(o.y<0&&Gd.scaleOf(s,1,m=1/o.y),_=Xd(Gd.minY-Kd.minY),p=Xd(Kd.maxY-Gd.maxY),u=d&&_>0?1+_/(d*Gd.height):1,g=c&&p>0?1+p/(c*Gd.height):1,m*=zd(u,g),n&&(u=zd(Yd(f),Yd(m)),f=Nd(f)*u,m=Nd(m)*u)):(o.y<0&&((Xd(jd(t)-jd(e))<=0||Xd(Ud(e)-Ud(t))<=0)&&Gd.scaleOf(s,1,m=1/o.y),Gd.unsign()),_=Xd(Kd.minY-Gd.minY),p=Xd(Gd.maxY-Kd.maxY),u=d&&_>0?1-_/(d*Gd.height):1,g=c&&p>0?1-p/(c*Gd.height):1,m*=Wd(u,g)),o.x*=r(f)?f:1,o.y*=r(m)?m:1,o}},Zd=qd;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=pe([qn()],Jd);const Qd=Jd,$d={};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 o=t.getLocalPoint(i,null,!0);return dt.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),qd.axisMove(t,o),o}static limitMove(t,e){qd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint($d,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint($d,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint($d,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){$d.x=t?this.totalX:this.moveX,$d.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=pe([qn()],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=pe([qn()],ic);let sc=class extends tc{};sc.BEFORE_MOVE="move.before_move",sc.START="move.start",sc.MOVE="move",sc.END="move.end",sc=pe([qn()],sc);let oc=class extends Id{};oc=pe([qn()],oc);const nc=oc;let rc=class extends Jd{};rc.BEFORE_ROTATE="rotate.before_rotate",rc.START="rotate.start",rc.ROTATE="rotate",rc.END="rotate.end",rc=pe([qn()],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=pe([qn()],ac);let hc=class extends Jd{};hc.BEFORE_ZOOM="zoom.before_zoom",hc.START="zoom.start",hc.ZOOM="zoom",hc.END="zoom.end",hc=pe([qn()],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=pe([qn()],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,o=s.length;t<o;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:_c,getSwipeEventData:pc}=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,o=tc.list||this.draggableList||uc;return this.dragging&&(s?t?uc:new vh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}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:o,throughPath:n}=s;this.dragData=gc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,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:o}=this.dragData,{dragLimitAnimate:r}=e.p,h=!r||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=tc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},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:o,throughPath:n}=i,r=gc(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(sc.END,r)),this.dragging){const o=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,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(dt.getDistance(e,t)>o.config.pointer.swipeDistance){const t=pc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=_c(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=$t.get("emit");const yc=["move","zoom","rotate","key"];function vc(t,e,i,s,o){if(yc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!xc(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&wc(n,e,i,s,o)}}function wc(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!xc(t,o)&&(sl.updateEventStyle&&!s&&sl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=ue.get(e,i);if(t.emitEvent(o,s),o.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=_.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=_.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,o=[Jd.DOUBLE_TAP,Jd.DOUBLE_CLICK].some(e=>kc(t.path,e));s<e.tapTime+50&&o?(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:o,target:n}=this;v.backgrounder||t.origin||n&&n.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:o,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,o=s.length;t<o&&(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:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.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 Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Kr.RESIZE,this.__onResize,this)],t.once(Qr.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 o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],wc(o,t,e,!0,s))return;o.isApp&&vc(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&vc(o,t,e,!1,s),wc(o,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 _e{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:Pc}=dt,{hitRadiusPoint:Lc,hitPoint:Ac}=Vt,Dc={},Mc={},Fc=hh.prototype;Fc.hit=function(t,e=0){this.updateLayout(),Oc(Mc,t),Pc(Mc,e);const i=this.__world;return!!(e?Lc(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,o=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(Oc(Dc,t),Pc(t=Dc,i.hitRadius)),Cc(t,s,Dc),i.hitBox||n){if(Vt.hitRadiusPoint(o.boxBounds,Dc))return!0;if(n)return!1}return!o.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),o.boundsChanged||(o.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,o=i||s;this.__hitCanvas||(this.__hitCanvas=o?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,o=v.image.hitCanvasSize,r=n.hitScale=qt.set(0,0,o,o).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=qt.set(t).scale(r);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),tn.patternLocked=!0,this.__renderShape(n,{matrix:Ic.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),tn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.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,o=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(o&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=i,a=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!o&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*r,!o&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=r;break;case"outside":if(l+=2*r,!o){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const zc=Fl.prototype,Yc=Xl.prototype,Xc=Gl.prototype;Yc.__updateHitCanvas=Xc.__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=Xc.__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:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.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 Nc=Oe.prototype;Nc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Nc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Nc.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),qt.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.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 Hc={convertTouch(t,e){const i=Hc.getTouch(t),s=dc.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Vc extends Bc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return s(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Hc.getTouch(t);this.pointerDown(Hc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Hc.getTouch(t);this.pointerMove(Hc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Hc.getTouch(t);this.pointerUp(Hc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(dc.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function jc(t,e,i){t.__.__font?Jh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Uc(t,e,i,s,o){const n=i.__;c(t)?Jh.drawStrokesStyle(t,e,!1,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Jh.strokeArrow(t,i,s,o)}function Gc(t,e,i,s,o){const n=i.__;c(t)?Jh.drawStrokesStyle(t,e,!0,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),Jh.drawTextStroke(i,s,o))}function Kc(t,e,i,s,o){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Gc(t,2,i,n,o),n.blendMode="outside"===e?"destination-out":"destination-in",Jh.fillText(i,n,o),n.blendMode="normal",ar.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}const{getSpread:qc,copyAndSpread:Zc,toOuterOf:Jc,getOuterOf:Qc,getByMove:$c,move:tu,getIntersectData:eu}=Vt,iu={};let su;const{stintSet:ou}=_,{hasTransparent:nu}=Kh;function ru(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:r}=i.__layout;switch(e.type){case"image":if(!e.url)return;o=Qh.image(i,t,e,r,!su||!su[e.url]);break;case"linear":o=$h.linearGradient(e,r);break;case"radial":o=$h.radialGradient(e,r);break;case"angular":o=$h.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;o={type:n,style:Kh.string(a,h)};break;default:s(e.r)||(o={type:"solid",style:Kh.string(e)})}if(o&&(o.originPaint=e,n(o.style)&&nu(o.style)&&(o.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}return o}const au={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];d(a)||(a=[a]),su=Qh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=ru(t,a[o],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)&&(o=!0),n=!0),"fill"===t?(ou(i,"__isAlphaPixelFill",o),ou(i,"__isTransparentFill",n)):(ou(i,"__isAlphaPixelStroke",o),ou(i,"__isTransparentStroke",n),ou(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,jc(e,i,s)},fills:function(t,e,i,s){let o,n,r;for(let a=0,h=t.length;a<h;a++){if(o=t[a],n=o.originPaint,o.image){if(r?r++:r=1,Qh.checkImage(o,!e.__.__font,e,i,s))continue;if(!o.style){1===r&&o.image.isPlacehold&&e.drawImagePlaceholder(o,i,s);continue}}if(i.fillStyle=o.style,o.transform||n.scaleFixed){if(i.save(),o.transform&&i.transform(o.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),jc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),jc(e,i,s),i.restoreBlendMode()):jc(e,i,s)}},fillPathOrText:jc,fillText:function(t,e,i){const s=t.__,{rows:o,decorationY:n}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=o.length;t<i;t++)r=o[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(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),o.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const o=e.__;if(o.__strokeWidth)if(o.__font)Jh.strokeText(t,e,i,s);else switch(o.strokeAlign){case"center":Uc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Uc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const o=e.__;if(o.__fillAfterStroke)Uc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Uc(t,2,e,r,s),r.clipUI(o),r.clearWorld(n),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":Gc(t,1,e,i,s);break;case"inside":Kc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Gc(t,2,e,i,s):Kc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,o=t.__.__textDrawData;const{rows:n,decorationY:r}=o;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=o;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,o,n){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||o.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!Qh.checkImage(r,!1,s,o,n))&&r.style){if(h){const{strokeStyle:t}=r;t?o.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):o.setStroke(r.style,a.__strokeWidth*e,a)}else o.strokeStyle=r.style;r.originPaint.blendMode?(o.saveBlendMode(r.originPaint.blendMode),i?Jh.drawTextStroke(s,o,n):o.stroke(),o.restoreBlendMode()):i?Jh.drawTextStroke(s,o,n):o.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),o=e.bounds,n=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;Jc(r.strokeSpread?(Zc(iu,r.boxBounds,r.strokeSpread),iu):r.boxBounds,n,a);let{scaleX:_,scaleY:p}=t.getRenderScaleData(!0);if(o.includes(a))g=s,h=u=a,l=n;else{let s;if(v.fullImageShadow)s=a;else{const t=r.renderShapeSpread?qc(o,R.swapAndScale(r.renderShapeSpread,_,p)):o;s=eu(t,a)}c=o.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),_*=f,p*=m),u=Qc(a,c),h=$c(u,-c.e,-c.f),l=Qc(n,c),tu(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:_,scaleY:p}}};let hu,lu=new Kt;const{isSame:du}=Vt;function cu(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||Qh.createData(o,s,i,n),!0}function uu(t,e){pu(t,Xr.LOAD,e)}function gu(t,e){pu(t,Xr.LOADED,e)}function _u(t,e,i){e.error=i,t.forceUpdate("surface"),pu(t,Xr.ERROR,e)}function pu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Xr(e,i))}function fu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:mu,translate:yu}=$,vu=new Kt,wu={},xu={};function bu(t,e,i,s){const o=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let ku={},Su={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Eu,set:Bu,rotateOfOuter:Tu,translate:Ru,scaleOfOuter:Cu,multiplyParent:Ou,scale:Pu,rotate:Lu,skew:Au}=$;function Du(t,e,i,s,o,n,r,a){r&&Lu(t,r),a&&Au(t,a.x,a.y),o&&Pu(t,o,n),Ru(t,e.x+i,e.y+s)}const{get:Mu,scale:Fu,copy:Iu}=$,{getFloorScale:Wu}=W,{abs:zu}=Math;const Yu={image:function(t,e,i,s,o){let n,r;const a=tn.get(i);return hu&&i===hu.paint&&du(s,hu.boxBounds)?n=hu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),hu=a.use>1?{leafPaint:n,paint:i,boxBounds:lu.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(cu(t,e,i,a,n,s),o&&(uu(t,r),gu(t,r))):a.error?o&&_u(t,r,a.error):(o&&(fu(t,!0),uu(t,r)),n.loadId=a.load(()=>{fu(t,!1),t.destroyed||(cu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),gu(t,r)),n.loadId=void 0},e=>{fu(t,!1),_u(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,o){const{scaleX:n,scaleY:r}=Qh.getImageRenderScaleData(t,i,s,o),{image:a,data:h,originPaint:l}=t,{exporting:d}=o;return!(!h||t.patternId===n+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&Kr.isResizing(i)||d||(e=v.image.isLarge(a,n,r)||a.width*n>8096||a.height*r>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Qh.drawImage(t,n,r,i,s,o),!0):(!t.style||l.sync||d?Qh.createPattern(t,i,s,o):Qh.createPatternTask(t,i,s,o),!1))},drawImage:function(t,e,i,s,o,n){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:_,height:p}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(o.save(),g&&o.clipUI(s),h&&(o.blendMode=h),l&&(o.opacity*=l),d&&o.transform(d),o.drawImage(c,0,0,_,p),o.restore()):(r.scaleX&&(_*=r.scaleX,p*=r.scaleY),o.drawImage(c,0,0,_,p))},getImageRenderScaleData:function(t,e,i,s){const o=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;o.scaleX*=t,o.scaleY*=t}return n&&n.scaleX&&(o.scaleX*=Math.abs(n.scaleX),o.scaleY*=Math.abs(n.scaleY)),o},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,tn.recyclePaint(s),o.loading&&(r||(r=e.__input&&e.__input[t]||[],d(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=tn.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Qh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:o,scaleY:n}=Qh.getImageRenderScaleData(t,e,i,s),r=o+"-"+n;if(t.patternId!==r&&!e.destroyed&&(!v.image.isLarge(t.image,o,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Qh.getPatternFixScale(t,o,n);let d,c,u,{width:g,height:_}=i;l&&(o*=l,n*=l),g*=o,_*=n,h&&(c=h.x*o/zu(s.scaleX||1),u=h.y*n/zu(s.scaleY||1)),(a||1!==o||1!==n)&&(o*=Wu(g+(c||0)),n*=Wu(_+(u||0)),d=Mu(),a&&Iu(d,a),Fu(d,1/o,1/n));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,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 o,n=v.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(o=Math.ceil(e)/e):n>r&&(n=r),(r*=e*i)>n&&(o=Math.sqrt(n/r)),o},createData:function(t,e,i,s){t.data=Qh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=vu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:o}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:g,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Vt.set(xu,0,0,x?o:s,x?s:o),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,wu),b=wu.scaleX,k=wu.scaleY),(h||m||f)&&(b&&Vt.scale(xu,b,k,!0),h&&Tt.toPoint(h,xu,e,xu,!0,!0))):v&&!g||(b=k=Vt.getFitScale(e,xu,"fit"!==a),Vt.put(e,i,h,b,!1,xu),Vt.scale(xu,b,k,!0)),l&&dt.move(xu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/o,Qh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(xu.x||xu.y||b||p||g||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),Qh.clipMode(w,e,xu.x,xu.y,b,k,g,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||_)&&Qh.repeatMode(w,e,s,o,xu.x,xu.y,b,k,g,_,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;c(t)?(n=t.x,r=t.y):n=r=t;return{x:bu(n,i,o.width,e&&e.x),y:bu(r,s,o.height,e&&e.y)}}(m,i&&f,xu.width,xu.height,e));break;default:b&&Qh.fillOrFitMode(w,e,xu.x,xu.y,b,k,g)}return w.transform||(e.x||e.y)&&yu(w.transform=mu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const o=Eu(),{x:n,y:r}=e;n||r?Ru(o,n,r):o.onlyScale=!0,Pu(o,i,s),t.transform=o},fillOrFitMode:function(t,e,i,s,o,n,r){const a=Eu();Ru(a,e.x+i,e.y+s),Pu(a,o,n),r&&Tu(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,o,n,r,a,h,l){const d=Eu();Du(d,e,i,s,o,n,r,a),h&&(r||a?(Bu(Su),Cu(Su,e,h,l),Ou(d,Su)):Cu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,o,n,r,a,h,l,d,c){const u=Eu();if(c)Du(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)Tu(u,{x:i/2,y:s/2},h);else switch(Lu(u,h),h){case 90:Ru(u,s,0);break;case 180:Ru(u,i,s);break;case 270:Ru(u,0,i)}ku.x=e.x+o,ku.y=e.y+n,Ru(u,ku.x,ku.y),r&&Cu(u,ku,r,a)}t.transform=u}},{toPoint:Xu}=St,{hasTransparent:Nu}=Kh,Hu={},Vu={};function ju(t,e,i,s){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],n(o)?(a=t/(l-1),r=Kh.string(o,s)):(a=o.offset,r=Kh.string(o.color,s)),e.addColorStop(a,r),!h&&Nu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Uu,getDistance:Gu}=dt,{get:Ku,rotateOfOuter:qu,scaleOfOuter:Zu}=$,{toPoint:Ju}=St,Qu={},$u={};function tg(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Uu(e,i);n=Ku(),o?(Zu(n,e,r/a*(s||1),1),qu(n,e,t+90)):(Zu(n,e,1,r/a*(s||1)),qu(n,e,t))}return n}const{getDistance:eg}=dt,{toPoint:ig}=St,sg={},og={};const ng={linearGradient:function(t,e){let{from:i,to:s,type:o,opacity:n}=t;Xu(i||"top",e,Hu),Xu(s||"bottom",e,Vu);const r=v.canvas.createLinearGradient(Hu.x,Hu.y,Vu.x,Vu.y),a={type:o,style:r};return ju(a,r,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;Ju(i||"center",e,Qu),Ju(s||"bottom",e,$u);const a=v.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Gu(Qu,$u)),h={type:o,style:a};ju(h,a,t.stops,n);const l=tg(e,Qu,$u,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;ig(i||"center",e,sg),ig(s||"bottom",e,og);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,sg.x,sg.y):v.canvas.createRadialGradient(sg.x,sg.y,0,sg.x,sg.y,eg(sg,og)),h={type:o,style:a};ju(h,a,t.stops,n);const l=tg(e,sg,og,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:tg},{copy:rg,move:ag,toOffsetOutBounds:hg}=Vt,{max:lg,abs:dg}=Math,cg={},ug=new mt,gg={};function _g(t,e){let i,s,o,n,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),o=dg(t.spread||0),r=lg(r,o+n-s),a=lg(a,o+n+i),h=lg(h,o+n+s),l=lg(l,o+n-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function pg(t,e,i){const{shapeBounds:s}=i;let o,n;v.fullImageShadow?(rg(cg,t.bounds),ag(cg,e.x-s.x,e.y-s.y),o=t.bounds,n=cg):(o=s,n=e),t.copyWorld(i.canvas,o,n)}const{toOffsetOutBounds:fg}=Vt,mg={};const yg=_g;const vg={shadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;hg(h,gg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.setWorldShadow(gg.offsetX+(r.x||0)*c*f,gg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Kh.string(r.color)),o=tl.getShadowTransform(t,g,i,r,gg,f),o&&g.setTransform(o),pg(g,gg,i),o&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,n,"copy"),s=n),a?g.copyWorld(a,n,n,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;fg(h,mg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(mg.offsetX+(r.x||0)*c*f,mg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),o=tl.getShadowTransform(t,g,i,r,mg,f,!0),o&&g.setTransform(o),pg(g,mg,i),g.restore(),a?(g.copyWorld(g,l,n,"copy"),g.copyWorld(a,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Kh.string(r.color),"source-in"),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&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:_g,getShadowTransform:function(t,e,i,s,o,n,r){if(s.spread){const i=2*s.spread*n*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return ug.set().scaleOfOuter({x:(o.x+o.width/2)*e.pixelRatio,y:(o.y+o.height/2)*e.pixelRatio},1+i/a,1+i/h),ug}},isTransformShadow(t){},getInnerShadowSpread:yg},{excludeRenderBounds:wg}=pr;let xg;function bg(t,e,i,s,o,n,r,a){switch(e){case"grayscale":xg||(xg=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);Sg(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":Sg(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function kg(t){return t.getSameCanvas(!1,!0)}function Sg(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}Il.prototype.__renderMask=function(t,e){let i,s,o,n,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&&(bg(this,r,t,o,s,n,void 0,!0),s=o=null),"clipping"!==a&&"clipping-path"!==a||wg(i,e)||i.__render(t,e),n=i.__.opacity,xg=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=kg(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=kg(t)),o||(o=kg(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&bg(this,r,t,o,s,n,void 0,!1),wg(i,e)||i.__render(o||t,e),d&&bg(this,r,t,o,s,n,d,!1)}bg(this,r,t,o,s,n,void 0,!0)};const Eg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Bg=Eg+"_#~&*+\\=|≮≯≈≠=…",Tg=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 Rg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Cg=Rg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Og=Rg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Pg=Rg(Eg),Lg=Rg(Bg),Ag=Rg("- —/~|┆·");var Dg;!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"}(Dg||(Dg={}));const{Letter:Mg,Single:Fg,Before:Ig,After:Wg,Symbol:zg,Break:Yg}=Dg;function Xg(t){return Cg[t]?Mg:Ag[t]?Yg:Og[t]?Ig:Pg[t]?Wg:Lg[t]?zg:Tg.test(t)?Fg:Mg}const Ng={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Hg(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:Vg}=Ng,{Letter:jg,Single:Ug,Before:Gg,After:Kg,Symbol:qg,Break:Zg}=Dg;let Jg,Qg,$g,t_,e_,i_,s_,o_,n_,r_,a_,h_,l_,d_,c_,u_,g_,__=[];function p_(t,e){n_&&!o_&&(o_=n_),Jg.data.push({char:t,width:e}),$g+=e}function f_(){t_+=$g,Jg.width=$g,Qg.words.push(Jg),Jg={data:[]},$g=0}function m_(){d_&&(c_.paraNumber++,Qg.paraStart=!0,d_=!1),n_&&(Qg.startCharSize=o_,Qg.endCharSize=n_,o_=0),Qg.width=t_,u_.width?Vg(Qg):g_&&y_(),__.push(Qg),Qg={words:[]},t_=0}function y_(){t_>(c_.maxWidth||0)&&(c_.maxWidth=t_)}const{top:v_,right:w_,bottom:x_,left:b_}=xt;function k_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const S_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,o=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(i=a[b_],o-=a[w_]+a[b_],!o&&(o=.01)):e.autoSizeAlign||(i=a[b_]),r?(s=a[v_],r-=a[v_]+a[x_],!r&&(r=.01)):e.autoSizeAlign||(s=a[v_]));const h={bounds:{x:i,y:s,width:o,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){c_=t,__=t.rows,u_=t.bounds,g_=!u_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:n}=i,{canvas:r}=v,{width:a}=u_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;d_=!0,a_=null,o_=s_=n_=$g=t_=0,Jg={data:[]},Qg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)i_=e[i],"\n"===i_?($g&&f_(),Qg.paraEnd=!0,m_(),d_=!0):(r_=Xg(i_),r_===jg&&"none"!==n&&(i_=Hg(i_,n,!$g)),s_=r.measureText(i_).width,s&&(s<0&&(n_=s_),s_+=s),h_=r_===Ug&&(a_===Ug||a_===jg)||a_===Ug&&r_!==Kg,l_=!(r_!==Gg&&r_!==Ug||a_!==qg&&a_!==Kg),e_=d_&&o?a-o:a,t&&a&&t_+$g+s_>e_&&(h?($g&&f_(),t_&&m_()):(l_||(l_=r_===jg&&a_==Kg),h_||l_||r_===Zg||r_===Gg||r_===Ug||$g+s_>e_?($g&&f_(),t_&&m_()):t_&&m_()))," "===i_&&!0!==d_&&t_+$g===0||(r_===Zg?(" "===i_&&$g&&f_(),p_(i_,s_),f_()):h_||l_?($g&&f_(),p_(i_,s_)):p_(i_,s_)),a_=r_);$g&&f_(),t_&&m_(),__.length>0&&(__[__.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{c_.paraNumber++,t_=r.measureText(t).width,__.push({x:o||0,text:t,width:t_,paraStart:!0}),g_&&y_()})}(h,t,e),a&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":k_(e,"x",t[b_]);break;case"right":k_(e,"x",-t[w_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":k_(e,"y",t[v_]);break;case"bottom":k_(e,"y",-t[x_])}}(a,h,e,o,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!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+=n,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&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e,a=i&&o.includes("both"),h=a||i&&o.includes("justify"),l=h&&o.includes("letter");let d,c,u,g,_,p,f,m,y,v;s.forEach(t=>{t.words&&(_=n&&t.paraStart?n:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===p?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===p?(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,o){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,o&&(e+=o)}),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,o),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:o,overflow:n}=t;let{textOverflow:r}=e;if(o.splice(n),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?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,o),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,c(n)?(i=n.type,n.color&&(t.decorationColor=Kh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(h,e),h}};const E_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(n(t)){if(!i||!Kh.object)return t;t=Kh.object(t)}let o=s(t.a)?1:t.a;i&&(o*=e);const r=t.r+","+t.g+","+t.b;return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}};Object.assign(Gh,S_),Object.assign(Kh,E_),Object.assign(Jh,au),Object.assign(Qh,Yu),Object.assign($h,ng),Object.assign(tl,vg),Object.assign(ae,{interaction:(t,e,i,s)=>new Vc(t,e,i,s),hitCanvas:(t,e)=>new bh(t,e),hitCanvasManager:()=>new Rc}),Yl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Eh(0,wx)}catch(t){}function B_(t){return t?d(t)?t:[t]:[]}class T_ extends Fr{get list(){return B_(this.value)}get oldList(){return B_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function R_(t){return(e,i)=>{const s="_"+i;rn(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}n.setDimOthers(!1),n.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(delete n.element.syncEventer,delete n.element.__world.ignorePixelSnap)}const s=t?T_.BEFORE_SELECT:T_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new T_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}T_.BEFORE_SELECT="editor.before_select",T_.SELECT="editor.select",T_.AFTER_SELECT="editor.after_select",T_.BEFORE_HOVER="editor.before_hover",T_.HOVER="editor.hover";const{abs:C_}=Math,{copy:O_}=$,{setListWithFn:P_}=Vt,{worldBounds:L_}=pr,A_={a:1,b:0,c:0,d:1,e:0,f:0},D_={x:0,y:0,width:0,height:0};class M_ 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?(P_(D_,e,L_),t&&this.set(t),this.set(D_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:r,strokeWidth:a,fill:h}=o,{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=C_(c.scaleX),l=C_(c.scaleY);O_(A_,c),A_.half=a%2,t.setWorld(A_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=a/Math.max(i,l),r&&(n(r)?Jh.stroke(r,this,t,e):Jh.strokes(r,this,t,e)),h&&(n(h)?Jh.fill(h,this,t,e):Jh.fills(h,this,t,e))}}o.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}pe([R_(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],M_.prototype,"target",void 0);class F_ extends Il{constructor(t){super(t),this.strokeArea=new Xl({strokeAlign:"center"}),this.fillArea=new Xl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const I_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return W_([t],i,e),i}};function W_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.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)&&o.hitSelf&&e.push(s)}s.isBranch&&W_(s.children,e,i)}}const{findOne:z_,findByBounds:Y_}=I_;class X_ 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 M_,this.targetStroker=new M_,this.bounds=new Kt,this.selectArea=new F_,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:o,strokeWidth:n,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:o,strokeWidth:n},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:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},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(),o=new vh(Y_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.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)&&!z_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new vh(this.editor.editBox.rect)};return z_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):z_(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_([[T_.HOVER,this.onHover,this],[T_.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:N_,top:H_,topRight:V_,right:j_,bottomRight:U_,bottom:G_,bottomLeft:K_,left:q_}=bt,{toPoint:Z_}=St,{within:J_,sign:Q_}=W,{abs:$_}=Math,tp={getScaleData(t,e,i,s,o,n,r,h){let l,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Q_(x),S=Q_(b),E=h?x:k*_.width/v,B=h?b:S*_.height/w;if(a(s))u=g=Math.sqrt(s);else{n&&(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 H_:g=t,l="bottom";break;case j_:u=e,l="left";break;case G_:g=r,l="top";break;case q_:u=a,l="right";break;case N_:g=t,u=a,l="bottom-right";break;case V_:g=t,u=e,l="bottom-left";break;case U_:g=r,u=e,l="top-left";break;case K_:g=r,u=a,l="top-right"}if(o)if("corner"===o&&i%2)o=!1;else switch(i){case H_:case G_:u=g;break;case q_:case j_:g=u;break;default:d=Math.sqrt($_(u*g)),u=Q_(u)*d,g=Q_(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/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(Z_(n||l,_,c,!0),m){const e={x:u,y:g};qd.limitScaleOf(t,c,e,o),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=J_(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=J_(e*g,f)/e}return T&&$_(u*y.width)<1&&(u=Q_(u)/y.width),R&&$_(g*y.height)<1&&(g=Q_(g)/y.height),o&&u!==g&&(d=Math.min($_(u),$_(g)),u=Q_(u)*d,g=Q_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case N_:n="bottom-right";break;case V_:n="bottom-left";break;case U_:n="top-left";break;case K_:n="top-right";break;default:n="center"}return Z_(o||n,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case H_:case N_:n={x:.5,y:0},o="bottom",a=1;break;case G_:case U_:n={x:.5,y:1},o="top",a=1;break;case q_:case K_:n={x:0,y:.5},o="right",h=1;break;case j_:case V_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,Z_(s||o,t,r,!0);const c=dt.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.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 q_:t=j_;break;case N_:t=V_;break;case K_:t=U_;break;case j_:t=q_;break;case V_:t=N_;break;case U_:t=K_}if(i)switch(t){case H_:t=G_;break;case N_:t=K_;break;case V_:t=U_;break;case G_:t=H_;break;case K_:t=N_;break;case U_:t=V_}return t}},ep={};function ip(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return sp(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?g:n?c:u:v?g:y?c:u;h+=45*(tp.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;ep[S]?i.cursor=ep[S]:ep[S]=i.cursor={url:op(x,h),x:b,y:k}}function sp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function op(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class np extends Gl{constructor(t){super(t),this.useFastShadow=!0}}const rp=["top","right","bottom","left"],ap=void 0;class hp 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 n(t)||n(e)||n(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Il,this.rect=new np({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new np({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:o,rotatePoints:n,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 np({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new np({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new np({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let p;this.visible=!t.locked;for(let t=0;t<8;t++)p=r[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.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]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:ap},e.rect||{}));const f=o(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&_.stintSet(t.__world,"ignorePixelSnap",d),sp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,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:o,rotation:n,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:o,circle:n,buttons:r,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,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(p)?p:10,y=f&&!(p&&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&&!_),v.visible=y&&_&&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,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=rp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=rp.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?tp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:ap};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:o,rotateable:n,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!o?(n&&(this.rotating=!0),"resize-rotate"===i?o&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&o&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}ip(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&&(Kr.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&&(Kr.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(),n(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(),n(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(),n(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){ip(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,ip(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 lp={x:0,y:0,width:1e5,height:1e5};class dp extends Fl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,lp),Object.assign(this.__world,lp)}__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 cp='\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"/>',up={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${cp}\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${cp}\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${cp}\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},gp=new Kt;function _p(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{gp.setListWithFn(i,t=>t.getBounds("box","page")),0===gp.width&&(gp.width=.1),0===gp.height&&(gp.height=.1),e.reset(gp.get())}),s.add(e)}const pp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),fp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),mp={group(t,e,i){t.sort(fp);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Il(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(pp);const r=new mt(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},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(pp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(fp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},yp=$t.get("EditToolCreator");function vp(){return t=>{xp.register(t)}}const wp=vp,xp={list:{},register(t){const{tag:e}=t.prototype;bp[e]&&yp.repeat(e),bp[e]=t},get:(t,e)=>new bp[t](e)},{list:bp}=xp;class kp extends T_{constructor(t,e){super(t,e)}}kp.BEFORE_OPEN="innerEditor.before_open",kp.OPEN="innerEditor.open",kp.BEFORE_CLOSE="innerEditor.before_close",kp.CLOSE="innerEditor.close";class Sp extends T_{constructor(t,e){super(t,e)}}Sp.BEFORE_GROUP="editor.before_group",Sp.GROUP="editor.group",Sp.BEFORE_UNGROUP="editor.before_ungroup",Sp.UNGROUP="editor.ungroup",Sp.BEFORE_OPEN="editor.before_open_group",Sp.OPEN="editor.open_group",Sp.BEFORE_CLOSE="editor.before_close_group",Sp.CLOSE="editor.close_group";const{updateMatrix:Ep}=ar,Bp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Tp="top-left";class Rp extends Xl{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&&Bp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Ep(this.parent),Ep(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Ep(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(Tp,n);break;case"scaleX":t.scaleOf(Tp,n,1);break;case"scaleY":t.scaleOf(Tp,1,n);break;case"skewX":t.skewOf(Tp,n,0);break;case"skewY":t.skewOf(Tp,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Cp extends T_{constructor(t,e){super(t,e)}}Cp.BEFORE_MOVE="editor.before_move",Cp.MOVE="editor.move";class Op extends T_{constructor(t,e){super(t,e)}}Op.BEFORE_SCALE="editor.before_scale",Op.SCALE="editor.scale";class Pp extends T_{constructor(t,e){super(t,e)}}Pp.BEFORE_ROTATE="editor.before_rotate",Pp.ROTATE="editor.rotate";class Lp extends T_{constructor(t,e){super(t,e)}}Lp.BEFORE_SKEW="editor.before_skew",Lp.SKEW="editor.skew";class Ap{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:r}=i;const h=t.type===sc.END||t.type===tc.END,l=n(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),o=tc.getValidMove(e,s.point,c,d),(o.x||o.y)&&(r&&!l&&h?ar.animateMove(this,o,a(r)?r:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let n,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof hc?(r=e.getBoxPoint(t),n=t.totalScale):n=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=tp.getScaleData(e,o.bounds,d,n,a,tp.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(o.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof rc)d=t.rotation,l=n?St.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=tp.getRotateData(e,h,t,s,i?null:n||e.around||e.origin||o||"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:o,skewX:n,skewY:r}=tp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),tp.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=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);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Cp(Cp.BEFORE_MOVE,h));const l=new Cp(Cp.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:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Op(Op.BEFORE_SCALE,t));const n=new Op(Op.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,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(()=>o.safeChange(()=>o.scaleOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Op(Op.BEFORE_SCALE,u));const g=new Op(Op.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new mt(ar.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Op(Op.BEFORE_SCALE,r));const a=new Op(Op.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=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=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Pp(Pp.BEFORE_ROTATE,d));const c=new Pp(Pp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,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(()=>o.safeChange(()=>o.skewOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Lp(Lp.BEFORE_SKEW,u));const g=new Lp(Lp.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 Dp=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 Rp(this),this.editBox=new hp(this),this.editToolList={},this.selector=new X_(this),this.editMask=new dp(this),this.targetEventIds=[];let i=_.clone(up);t&&(i=_.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=>_.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&&_p(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||xp.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(n(s))e=s;else if(!1===s)return}if(xp.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(Sp.BEFORE_GROUP),this.target=mp.group(this.list,this.element,t),this.emitGroupEvent(Sp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.BEFORE_UNGROUP,t)),this.target=mp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Sp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Sp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Sp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Sp.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 Sp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||xp.get(t,this)}openInnerEditor(t,e,i){let s;if(n(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(n(i))s=i;else if(!1===i)return}xp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(kp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(kp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(kp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(kp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new kp(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&&(mp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(mp.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_(Qr.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())}};pe([(t,e)=>{rn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:n,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 n.config&&Object.assign(a,n.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"),o(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Dp.prototype,"mergeConfig",void 0),pe([R_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof vh?i:new vh(i),t.multiple&&_p(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new T_(T_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new T_(T_.AFTER_SELECT,s))})],Dp.prototype,"target",void 0),pe([R_(function(t,e){t.emitEvent(new T_(T_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Dp.prototype,"hoverTarget",void 0),Dp=pe([Gn(Ap,["editBox","editTool","emitEvent"])],Dp);class Mp{static registerInnerEditor(){xp.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 Fp=class extends Mp{static registerEditTool(){xp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,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()}};Fp=pe([vp()],Fp);const{left:Ip,right:Wp}=bt,{move:zp,copy:Yp,toNumberPoints:Xp}=dt;let Np=class extends Fp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Ip;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.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=Xp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(zp(t,n,r),s&&zp(e,-n,-r)):(s&&zp(t,-n,-r),zp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),Yp(s[7],i),Yp(e[7],i),Yp(s[3],a),Yp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Ip||t===Wp,s[t].visible=a,e[t].visible=!r&&a}};Np=pe([vp()],Np);const{M:Hp,L:Vp,C:jp,Q:Up,Z:Gp,N:Kp,D:qp,X:Zp,G:Jp,F:Qp,O:$p,P:tf,U:ef}=Ae,sf={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Hp:case Vp:of(t,e,i,o,1),o+=3;break;case jp:of(t,e,i,o,3),o+=7;break;case Up:of(t,e,i,o,2),o+=5;break;case Gp:o+=1;break;case Kp:of(t,e,i,o,2),o+=5;break;case qp:of(t,e,i,o,2),o+=9;break;case Zp:of(t,e,i,o,2),o+=6;break;case Jp:of(t,e,i,o,2),o+=9;break;case Qp:of(t,e,i,o,2),o+=5;break;case $p:t[o]=Jp,t.splice(o+4,0,t[o+3],0),of(t,e,i,o,2),o+=9,n+=2;break;case tf:t[o]=Qp,t.splice(o+4,0,t[o+3]),of(t,e,i,o,2),o+=5,n+=1;break;case ef:of(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:of}=sf,nf=$.get(),{topLeft:rf,top:af,topRight:hf,right:lf,bottom:df,left:cf}=bt;function uf(t,e,i){t.pathInputed?_f(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function gf(t,e,i,o){let n=e;if(!s(o)){const s=t.__layout;let{width:r,height:a}=s.boxBounds;switch(r*=i-e,a*=e-i,o){case af:case df:n=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case cf:case lf:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case rf:case hf:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=d(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function _f(t,e,i){sf.scale(t.__.path,e,i),t.path=t.__.path}function pf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):sf.scalePoints(s,e,i),t.points=s}function ff(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)nf.a=e,nf.d=i,s[t].transform(nf,!0)}const mf=hh.prototype;function yf(t,e,i){vf(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 vf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&_.assign(i,e),_.assign(t.config,i,t.userConfig)}mf.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))},mf.__scaleResize=function(t,e){uf(this,t,e)},mf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},mf.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,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)gf(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),uf(this,t,e)}},Pd.prototype.__scaleResize=function(t,e){_f(this,t,e)},xd.prototype.__scaleResize=function(t,e){this.pathInputed?_f(this,t,e):this.points?pf(this,t,e):this.width*=t},rd.prototype.__scaleResize=function(t,e){this.pathInputed?_f(this,t,e):this.points?pf(this,t,e):uf(this,t,e)},Il.prototype.__scaleResize=function(t,e){ff(this,t,e)},Gl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||uf(this,t,e),i&&ff(this,t,e)},re.add("resize"),re.add("editor","resize"),ae.editor=function(t,e){const i=new Dp(t);return e&&e.sky.add(e.editor=i),i},Gl.addAttr("textBox",!1,un),Fl.addAttr("editConfig",void 0,un),Fl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),un),Fl.addAttr("editInner","PathEditor",un),Il.addAttr("editInner","",un),Od.addAttr("editInner","TextEditor",un),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 wf=$t.get("LeaferTypeCreator"),xf={list:{},register(t,e){bf[t]&&wf.repeat(t),bf[t]=e},run(t,e){const i=bf[t];i&&i(e)}},{list:bf,register:kf}=xf;kf("viewport",yf),kf("custom",function(t){yf(t,null,!0)}),kf("design",function(t){yf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),kf("document",function(t){yf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Sf={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),o=dt.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=dt.getDistance(e.from,i.from);return{move:n,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:o}},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),o=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&o<1?"none":i>=s&&i>=o?"move":s>=o?"zoom":"rotate"},detect(t,e){const{state:i}=Ef,s=Ef.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Ef.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)?Ef.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}=Ef;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Ef=Sf,{abs:Bf,max:Tf}=Math,{sign:Rf,within:Cf}=W,Of={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=Bf(s),r=Bf(o);return n>50&&(s=Tf(50,n/3)*Rf(s)),r>50&&(o=Tf(50,r/3)*Rf(o)),{x:-s*i*2,y:-o*i*2}},getScale(t,e){let i,s=1,{zoomMode:o,zoomSpeed:n}=e;const r=t.deltaY||t.deltaX;if(o?(i="mouse"===o||!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){n=Cf(n,0,1);const i=t.deltaY?e.delta.y:e.delta.x,o=Cf(1-Bf(r)/(4*i)*n,.5,2);s=r>0?o:1/o}return s}};let Pf,Lf,Af,Df;class Mf{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),Pf=0,Lf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Pf,totalY:Lf}),e.emit(sc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Pf+=t.moveX,t.totalY=Lf+=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),Af=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Af}),e.emit(hc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Af*=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),Df=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Df}),e.emit(rc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Df+=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:Pf,totalY:Lf})),i&&t.emit(hc.END,Object.assign(Object.assign({},i),{totalScale:Af})),s&&t.emit(rc.END,Object.assign(Object.assign({},s),{totalRotation:Df})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Ff=Yl.prototype,If=new Kt,Wf=new pt;function zf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Yf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Ff.initType=function(t){xf.run(t,this)},Ff.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(Wf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Wf.y=0:t.includes("y")?Wf.x=0:Math.abs(Wf.x)>Math.abs(Wf.y)?Wf.y=0:Wf.x=0,i&&t.includes("limit")&&(If.set(this.__world).addPoint(this.zoomLayer),qd.getValidMove(If,this.canvas.bounds,"inner",Wf,!0),t.includes("x")?Wf.y=0:t.includes("y")&&(Wf.x=0))}return{x:o?0:Wf.x,y:o?0:Wf.y}},Ff.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const Xf=Bc.prototype;Xf.createTransformer=function(){this.transformer=new Mf(this)},Xf.move=function(t){this.transformer.move(t)},Xf.zoom=function(t){this.transformer.zoom(t)},Xf.rotate=function(t){this.transformer.rotate(t)},Xf.transformEnd=function(){this.transformer.transformEnd()},Xf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):Of.getScale(t,e);if(1!==n)this.zoom(Yf(n,t));else{const s=e.getMove?e.getMove(t,e):Of.getMove(t,e);i.snap&&dt.round(s),this.move(zf(s,t))}},Xf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let o=Sf.getData(e),{moving:n,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Sf.detect(o,c(s)?s:{})){case"move":n=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Sf.reset()}n||(o.center=Sf.state.center)}else n=r=a=!0;var h,l;Object.assign(t,o.center),t.multiTouch=!0,a&&this.rotate((h=o.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Yf(o.scale,t)),n&&this.move(zf(o.move,t))};const Nf=fc.prototype,{abs:Hf}=Math;function Vf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}Nf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=Hf(i),n=Hf(s),r=e?1:.1,h=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(h){const r="touch"===t.pointerType?3:1,l=70;o*(e=e?a(h)?h:.95:r)>l?e=l/o:n*e>l&&(e=l/n),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Nf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Nf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Nf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Vt.maxX(r),d=Vt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let g=0,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=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:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Nf.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(o(r)?30:r),g=new Kt,_={x:l.x+l.width/2,y:l.y+l.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(n(t))switch(t){case"in":p=Vf(y,"in");break;case"out":p=Vf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Kt(this.boxBounds)).height=0;break;case"fit-height":(t=new Kt(this.boxBounds)).width=0}else a(t)&&(p=t/y);if(p)p=this.getValidScale(p),h.scaleOfWorld(_,p,p,!1,s);else if(c(t)){const e={x:f,y:m,scaleX:y,scaleY:v},o=d(t);if(o||t.tag){const e=o?t:[t];g.setListWithFn(e,pr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,l);g.set(h.getWorldBounds(e))}const{width:n,height:r}=g;let a=l.x-g.x,c=l.y-g.y;return i?(a+=Math.max((l.width-n)/2,0),c+=Math.max((l.height-r)/2,0)):(p=this.getValidScale(Math.min(l.width/n,l.height/r)),a+=(l.width-n*p)/2,c+=(l.height-r*p)/2,dt.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"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 jf 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&&_.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;n(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:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Kt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),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:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.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_(Kr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class Uf extends ml{}function Gf(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wn(this),t.__useArrow=e,Sn(this)}}}))}let Kf=class extends xd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Zh.register(t,e)}};pe([Wn(Uf)],Kf.prototype,"__",void 0),pe([Gf("angle")],Kf.prototype,"endArrow",void 0),Kf=pe([Kn()],Kf);const{M:qf,L:Zf,C:Jf,Q:Qf,O:$f}=Ae,{rotate:tm,copyFrom:em,scale:im}=dt,sm={},om={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case qf:case Zf:nm(t,l+1,e,i,s,o,n,r),l+=3;break;case Jf:for(h=1;h<6;h+=2)nm(t,l+h,e,i,s,o,n,r);l+=7;break;case Qf:for(h=1;h<4;h+=2)nm(t,l+h,e,i,s,o,n,r);l+=5;break;case $f:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){om.layout(t,0,0,1,1,e,i)}};function nm(t,e,i,s,o,n,r,a){em(sm,t[e],t[e+1]),r&&tm(sm,r,a),o&&im(sm,o,n),t[e]=i+sm.x,t[e+1]=s+sm.y}const{layout:rm,rotate:am}=om,{getAngle:hm}=dt,lm={x:-.5},dm={connect:lm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},cm={connect:lm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},um={connect:lm,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]},gm={connect:lm,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]},_m={offset:lm,path:[...um.path],dashPath:[1,-2.5,0,2,-1,0]};am(_m.path,180,{x:-1.5,y:0});const pm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},fm={connect:{x:.5},path:[...pm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},mm={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]},ym={path:[...mm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},vm=_.clone(mm),wm=_.clone(ym);am(vm.path,45),am(wm.path,45);const xm={angle:dm,"angle-side":cm,arrow:gm,triangle:um,"triangle-flip":_m,circle:fm,"circle-line":pm,square:ym,"square-line":mm,diamond:wm,"diamond-line":vm,mark:{offset:lm,path:[1,0,-2,2,0,2]}};function bm(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=xm[e.type]):a=e:a=xm[e];const{offset:u,connect:g,path:_,dashPath:p}=a;let f=g?g.x:0,m=u?u.x:0;const y=[..._];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&rm(y,0,0,h,h),m&&rm(y,m,0),rm(y,s.x,s.y,o,o,hm(i,s)),n.x=(f+m)*o,y}const{M:km,L:Sm,C:Em,Q:Bm,Z:Tm,N:Rm,D:Cm,X:Om,G:Pm,F:Lm,O:Am,P:Dm,U:Mm}=Ae,{copy:Fm,copyFrom:Im,getDistancePoint:Wm}=dt,zm={},Ym={},Xm={},Nm={},Hm={},Vm={list:xm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case km:case Sm:(c<2||l+6>=d)&&(Im(Hm,n[l+1],n[l+2]),!c&&u&&Fm(Ym,Hm)),l+=3;break;case Em:(1===c||l+7>=d-3)&&jm(n,Nm,Hm,l+3),l+=7;break;case Bm:(1===c||l+5>=d-3)&&jm(n,Nm,Hm,l+1),l+=5;break;case Tm:return;case Rm:l+=5;break;case Cm:l+=9;break;case Om:l+=6;break;case Pm:l+=9;break;case Lm:l+=5;break;case Am:l+=7;break;case Dm:l+=4;break;case Mm:(1===c||l+6>=d-3)&&(jm(n,Nm,Hm,l+1),l+6!==d&&(Hm.x-=(Hm.x-Nm.x)/10,Hm.y-=(Hm.y-Nm.y)/10)),l+=6}if(c++,1===c&&h!==km)return;if(2===c&&u&&Fm(Xm,h===Sm?Hm:Nm),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=bm(t,e,Xm,Ym,s,zm,!!o);o?d.push(...i):r.push(...i),zm.x&&(Wm(Ym,Xm,-zm.x,!0),r[1]=Xm.x,r[2]=Xm.y)}if(i&&"none"!==i){const e=bm(t,i,Nm,Hm,s,zm,!!o);if(o?d.push(...e):r.push(...e),zm.x){let t;switch(Wm(Hm,Nm,-zm.x,!0),h){case Sm:t=l-3+1;break;case Em:t=l-7+5;break;case Bm:t=l-5+3;break;case Mm:t=l-6+3}t&&Um(r,Nm,t)}}}else Fm(Nm,Hm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function jm(t,e,i,s){Im(e,t[s],t[s+1]),Im(i,t[s+2],t[s+3])}function Um(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),Fl.addAttr("startArrow","none",Gf),Fl.addAttr("endArrow","none",Gf),Object.assign(Zh,Vm),Object.assign(Jh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Gm=class extends Gl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};pe([Wn(class extends _l{})],Gm.prototype,"__",void 0),pe([pn("x")],Gm.prototype,"flow",void 0),Gm=pe([Kn()],Gm);const Km={},qm={"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"},Zm={"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 Jm(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;Tt.toPoint(i,e,o,Km),e.x=s.__autoWidth?o.x:Km.x,e.y=s.__autoHeight?o.y:Km.y}const{move:Qm}=dt;function $m(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),Qm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function ty(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 ey={};function iy(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:r,__autoHeight:a}=t.__,h=o&&(e?!r:!a);return c(i)?(ey.xGap=i.x||0,ey.yGap=i.y||0):ey.xGap=ey.yGap=l(i),ey.isAutoXGap=n(ey.xGap)&&!r,ey.isAutoYGap=n(ey.yGap)&&!a,ey.complex=h||"top-left"!==s||t.__hasGrow||ey.isAutoXGap||ey.isAutoYGap,ey.wrap=h,ey.complex&&(ey.isFitXGap="fit"===ey.xGap&&!r,ey.isFitYGap="fit"===ey.yGap&&!a,c(s)?(ey.contentAlign=s.content||"top-left",ey.rowXAlign=s.x||"from",ey.rowYAlign=s.y||"from"):(ey.contentAlign=s,ey.rowXAlign=qm[s],ey.rowYAlign=Zm[s])),ey}function sy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function oy(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function ny(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:ry}=W;function ay(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=hy(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=hy(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function hy(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?ry(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:ly}=W;function dy(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=cy(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=cy(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function cy(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?ly(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:uy}=dt;function gy(t,e){const i="width",{children:s,itemBox:o}=t,n=iy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;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 n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ny(_,o),r?(_.__flowBounds=p,y||(y=sy(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?ay(t,y,x,e):d&&oy(y,i,x,c),ty(u,y,i),y=sy(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&cy(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(uy(_,v-p.x,w-p.y),v+=p.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:g}=n;y.count&&(y.grow?ay(t,y,x,e):d&&oy(y,i,x,c),a&&ty(u,y,i)),a?(s?oy(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Jm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=qm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],$m(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(Jm(t,y,r),$m(t,y,0,y.y,g,e))}}const{move:_y}=dt;function py(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),_y(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:fy}=dt;function my(t,e){const i="height",{children:s,itemBox:o}=t,n=iy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;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 n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=ny(_,o),r?(_.__flowBounds=p,y||(y=sy(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&dy(t,y,b,e),d&&oy(y,i,b,c),ty(u,y,i),y=sy(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&hy(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(fy(_,v-p.x,w-p.y),w+=p.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:g}=n;y.count&&(y.grow&&dy(t,y,b,e),d&&oy(y,i,b,c),a&&ty(u,y,i)),a?(s?oy(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Jm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Zm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],py(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Jm(t,y,r),py(t,y,y.x,0,l,e))}}function yy(t){return ln(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)&&wn(this)}}))}re.add("flow","resize");const vy=Gl.prototype,{__updateBoxBounds:wy}=Il.prototype;Fl.addAttr("flow",!1,pn),Fl.addAttr("gap",0,yn),Fl.addAttr("flowAlign","top-left",yn),Fl.addAttr("flowWrap",!1,yn),Fl.addAttr("itemBox","box",yn),Fl.addAttr("inFlow",!0,yn),Fl.addAttr("autoWidth",void 0,yy),Fl.addAttr("autoHeight",void 0,yy),Fl.addAttr("autoBox",void 0,yn);const{copyAndSpread:xy}=Vt;vy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:gy(this);break;case"y":my(this);break;case"x-reverse":gy(this,!0);break;case"y-reverse":my(this,!0)}t&&(this.leafer.created=!0)},vy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),xy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},vy.__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():wy.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&&xy(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:by,sin:ky,pow:Sy,sqrt:Ey,abs:By,ceil:Ty,floor:Ry,round:Cy,PI:Oy}=Math,Py=5*Oy,Ly=1.70158,Ay=2.5949095,Dy=7.5625,My=2.75;function Fy(t){return e=>Sy(e,t)}function Iy(t){return e=>1-Sy(1-e,t)}function Wy(t){return e=>e<.5?.5*Sy(2*e,t):1-.5*Sy(2-2*e,t)}function zy(t){return t<1/My?Dy*t*t:t<2/My?Dy*(t-=1.5/My)*t+.75:t<2.5/My?Dy*(t-=2.25/My)*t+.9375:Dy*(t-=2.625/My)*t+.984375}function Yy(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Xy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(By(l)<1e-6));e++)c-=d/l;return o[r]=Xy(c,e,s)}}function Xy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Ny={get(t){const{list:e}=Ny;return n(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Ny.list[t]=e},list:{linear:t=>t,ease:Yy(.25,.1,.25,1),"ease-in":Yy(.42,0,1,1),"ease-out":Yy(0,0,.58,1),"ease-in-out":Yy(.42,0,.58,1),"sine-in":t=>1-by(t*Oy*.5),"sine-out":t=>ky(t*Oy*.5),"sine-in-out":t=>.5*(1-by(t*Oy)),"quad-in":Fy(2),"quad-out":Iy(2),"quad-in-out":Wy(2),"cubic-in":Fy(3),"cubic-out":Iy(3),"cubic-in-out":Wy(3),"quart-in":Fy(4),"quart-out":Iy(4),"quart-in-out":Wy(4),"quint-in":Fy(5),"quint-out":Iy(5),"quint-in-out":Wy(5),"expo-in":t=>t?Sy(2,10*t-10):0,"expo-out":t=>1===t?1:1-Sy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Sy(2,2*t*10-10):.5*(2-Sy(2,10-2*t*10)),"circ-in":t=>1-Ey(1-Sy(t,2)),"circ-out":t=>Ey(1-Sy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Ey(1-Sy(2*t,2))):.5*(Ey(1-Sy(2-2*t,2))+1),"back-in":t=>((Ly+1)*t-Ly)*t*t,"back-out":t=>(t-=1)*t*((Ly+1)*t+Ly)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Ay+1)*t-Ay)*.5:.5*((t=2*t-2)*t*((Ay+1)*t+Ay)+2),"elastic-in":t=>0===t||1===t?t:-Sy(2,10*(t-1))*ky((t-1.1)*Py),"elastic-out":t=>0===t||1===t?t:Sy(2,-10*t)*ky((t-.1)*Py)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Sy(2,10*((t*=2)-1))*ky((t-1.1)*Py)*.5:Sy(2,10*(1-(t*=2)))*ky((t-1.1)*Py)*.5+1,"bounce-in":t=>1-zy(1-t),"bounce-out":zy,"bounce-in-out":t=>t<.5?.5*(1-zy(1-2*t)):.5*(1+zy(2*t-1)),"cubic-bezier":Yy,steps:function(t,e="floor"){return i=>("floor"===e?Ry(i*t):"ceil"===e?Ty(i*t):Cy(i*t))/t}}};function Hy(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 Vy{}Vy.CREATED="created",Vy.PLAY="play",Vy.PAUSE="pause",Vy.STOP="stop",Vy.SEEK="seek",Vy.UPDATE="update",Vy.COMPLETED="completed";let jy=class extends na{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:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&a(o)&&(t+=o-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:o,attrs:n}=this;this.easingFn=Ny.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Vy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Vy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Vy.STOP))}seek(t){this.destroyed||(c(t)&&(t=qh.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(Vy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:o}=this,{length:n}=i,r=!(n>1)||this.join;let h,l,d,c,u,g=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let o=0;o<n;o++){if(l=i[o],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:o,swing:n,loop:r}=l;n&&(d.swing=a(n)?n: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,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),o&&(d.easingFn=Ny.get(o))}if(!d.autoDuration&&s(d.duration)&&(n>1?o>0||r?_+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}_?((this.duration<=g||!o||!o.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):g&&this.changeDuration(g),this.emitType(Vy.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:o,toStyle:n,target:r}=this;for(let a in e)s(o[a])&&(o[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=s(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:o}=i;for(let n=0;n<o;n++)e=i[n],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}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(Vy.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,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),ol.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(Vy.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)}};pe([Hy("ease")],jy.prototype,"easing",void 0),pe([Hy(0)],jy.prototype,"delay",void 0),pe([Hy(.2)],jy.prototype,"duration",void 0),pe([Hy("auto")],jy.prototype,"ending",void 0),pe([Hy(!1)],jy.prototype,"reverse",void 0),pe([Hy(!1)],jy.prototype,"swing",void 0),pe([Hy(!1)],jy.prototype,"loop",void 0),pe([Hy(0)],jy.prototype,"loopDelay",void 0),pe([Hy(1)],jy.prototype,"speed",void 0),pe([Hy(!0)],jy.prototype,"autoplay",void 0),pe([Hy()],jy.prototype,"join",void 0),pe([Hy()],jy.prototype,"attrs",void 0),jy=pe([Gn(fa)],jy);let Uy=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(Vy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Vy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Vy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Vy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Vy.COMPLETED:this.completed&&this.emitType(t);break;case Vy.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)}};Uy=pe([Gn(fa)],Uy);const Gy={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"},Ky=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,qy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Zy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Jy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Qy=parseInt,$y=parseFloat,{round:tv}=Math;let ev={},iv=0;function sv(t){let e,i,s,o=1;switch(t.length){case 9:e=Qy(t.slice(1,3),16),i=Qy(t.slice(3,5),16),s=Qy(t.slice(5,7),16),o=Qy(t.slice(7,9),16)/255;break;case 7:e=Qy(t.slice(1,3),16),i=Qy(t.slice(3,5),16),s=Qy(t.slice(5,7),16);break;case 5:e=Qy(t[1]+t[1],16),i=Qy(t[2]+t[2],16),s=Qy(t[3]+t[3],16),o=Qy(t[4]+t[4],16)/255;break;case 4:e=Qy(t[1]+t[1],16),i=Qy(t[2]+t[2],16),s=Qy(t[3]+t[3],16);break;case 3:e=i=s=Qy(t[1]+t[2],16);break;case 2:e=i=s=Qy(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const ov=1/6,nv=.5,rv=2/3,av=1/3;function hv(t,e,i){return i<0?i++:i>1&&i--,i<ov?t+6*(e-t)*i:i<nv?e:i<rv?t+(e-t)*(rv-i)*6:t}function lv(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=hv(a,s,t+av),n=hv(a,s,t),r=hv(a,s,t-av)}return{r:tv(255*o),g:tv(255*n),b:tv(255*r),a:s}}re.add("color"),Kh.object=function(t,e){let i,o=!s(e)&&e<1;if(n(t)){const e=ev[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=sv(t);break;case"R":case"r":"("===t[4]&&qy.test(t)?i=function(t){const e=qy.exec(t);return{r:Qy(e[1]),g:Qy(e[2]),b:Qy(e[3]),a:$y(e[4])}}(t):"("===t[3]&&Ky.test(t)&&(i=function(t){const e=Ky.exec(t);return{r:Qy(e[1]),g:Qy(e[2]),b:Qy(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Jy.test(t)?i=function(t){const e=Jy.exec(t);return lv($y(e[1]),$y(e[2]),$y(e[3]),$y(e[4]))}(t):"("===t[3]&&Zy.test(t)&&(i=function(t){const e=Zy.exec(t);return lv($y(e[1]),$y(e[2]),$y(e[3]),1)}(t))}if(!i){const e=Gy[t.toLowerCase()];e&&(i=sv("#"+e))}i&&(iv++,iv>1e4&&(ev={},iv=0),ev[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),o&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),o&&(i.a*=e),i};const{round:dv}=Math,{fourNumber:cv}=W,uv={fill:mv,stroke:mv,cornerRadius:(t,e,i)=>a(t)&&a(e)?pv(t,e,i):(t=cv(t),e=cv(e),t.map((t,s)=>pv(t,e[s],i))),text(t,e,i){if(n(t)&&n(e)){const s=t.length,o=e.length,n=pv(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return a(t)||a(e)?W.float(pv(t,e,i),Math.max(_v(t),_v(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return ol.setBetweenStyle(o,t,e,o,i,s),o},shadow:yv,innerShadow:yv},gv={value:function(t,e,i){const s=a(t),o=a(e);return s&&o?t+(e-t)*i:o||s?pv(t,e,i):t},number:pv,color:fv,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=ol;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,o,n)))}};function _v(t){const e=String(t).split(".")[1];return e?e.length:0}function pv(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?dv(o):o}function fv(t,e,i){t=Kh.object(t),e=Kh.object(e);const s=pv(t.r,e.r,i,1)+","+pv(t.g,e.g,i,1)+","+pv(t.b,e.b,i,1),o=pv(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function mv(t,e,i){return n(t)&&n(e)?fv(t,e,i):e}function yv(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:pv((t=t||{}).x,e.x,i),y:pv(t.y,e.y,i),blur:pv(t.blur,e.blur,i),spread:pv(t.spread,e.spread,i),color:fv(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(ol.list,uv),Object.assign(ol,gv);const vv=Fl.prototype;Fl.addAttr("animation",void 0,function(t){return ln(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,un),Fl.addAttr("transition",!0,un),Fl.addAttr("transitionOut",void 0,un),vv.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))},vv.animate=function(t,e,i,o){if(s(t))return this.__animate;let n=d(t)&&!e&&i?new Uy(this,t,o):new jy(this,t,e,o);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof Uy?n.list.unshift(r):n=new Uy(this,[r,n])),this.__animate=n},vv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Uy&&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)}},vv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Vy.COMPLETED,e)};const wv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],xv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:bv}=Math,{getDerivative:kv}=ri,Sv={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,g,_,p=0,f=h/2;for(let h=0;h<wv.length;h++)l=f*(1+wv[h]),d=f*(1-wv[h]),c=kv(l,t,i,o,r),u=kv(l,e,s,n,a),g=kv(d,t,i,o,r),_=kv(d,e,s,n,a),p+=xv[h]*(bv(c*c+u*u)+bv(g*g+_*_));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=kv(t,e,s,n,a),d=kv(t,i,o,r,h);return Math.atan2(d,l)/Y},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,g=t/e,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)Ev(i,s,o,n,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,g=d*o+e*r,_=d*n+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Ae.C,c,u,p,f,m,y)}},{getDistance:Ev}=Sv,{M:Bv,L:Tv,C:Rv,Z:Cv}=Ae,Ov={},Pv={},Lv={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Bv:case Tv:Lv.transformPoints(t,e,s,1),s+=3;break;case Rv:Lv.transformPoints(t,e,s,3),s+=7;break;case Cv:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Ov.x=t[o],Ov.y=t[o+1],$.toOuterPoint(e,Ov),t[o]=Ov.x,t[o+1]=Ov.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Bv:case Tv:i=t[a+1],s=t[a+2],e=o===Tv&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Rv:i=t[a+5],s=t[a+6],e=Sv.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 Cv:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=qh.number(e,t.total);let n,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Bv:case Tv:if(r=o[f+1],a=o[f+2],n=s[m],_+n>=e||!t.total)return f||(y=r,v=a),Pv.x=y,Pv.y=v,p.x=r,p.y=a,dt.getDistancePoint(Pv,p,e-_,!0),p.rotation=dt.getAngle(Pv,p),p;y=r,v=a,f+=3;break;case Rv:if(r=o[f+5],a=o[f+6],n=s[m],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],g=Sv.getT(e-_,n,y,v,l,d,c,u,r,a,i),ri.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=Sv.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Cv:f+=1;default:n=0}m++,_+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=qh.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=o.length;for(;m<x;){switch(l=o[m],l){case Bv:case Tv:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Pv.x=v,Pv.y=w,f.x=a,f.y=h,dt.getDistancePoint(Pv,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case Rv:if(d=o[m+1],c=o[m+2],u=o[m+3],g=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return _=Sv.getT(e-p,r,v,w,d,c,u,g,a,h,i),Sv.cut(n,_,v,w,d,c,u,g,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,g,a,h);break;case Cv:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function Av(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!o(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}re.add("motion-path"),ol.register("motion",function(t,e,i,s){return c(t)&&(t=qh.number(t,s.getMotionTotal())),c(e)&&(e=qh.number(e,s.getMotionTotal())),ol.number(t||0,e||0,i)}),ol.register("motionRotation",function(t,e,i){return ol.number(t,e,i)});const Dv=Fl.prototype,{updateMatrix:Mv,updateAllMatrix:Fv}=ar,{updateBounds:Iv}=vr;function Wv(t){const{motion:e,leaferIsCreated:i}=t;if(!o(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Yv(t);i.total&&(t.__.__pathForRender=Lv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Fv(t),Iv(t,t)):Mv(t));i&&(t.leafer.created=!0)}}function zv(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 Yv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Lv.getMotionPathData(t.getPath(!0,!0))}function Xv(t,e){return ln(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 Nv(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Hv(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 Vv(t,e){c(e)||(e=void 0),Gv(t,e,"in")}function jv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),Gv(t,e,"out"))}Fl.addAttr("motionPath",void 0,Av),Fl.addAttr("motionPrecision",1,Av),Fl.addAttr("motion",void 0,Av),Fl.addAttr("motionRotation",!0,Av),Dv.getMotionPathData=function(){return Yv(zv(this))},Dv.getMotionPoint=function(t){const e=zv(this),i=Yv(e);if(!i.total)return{};const s=Lv.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:a(o)&&(s.rotation+=o),s},Dv.getMotionTotal=function(){return this.getMotionPathData().total},Dv.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],o(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Wv(t))}else Wv(this)};const Uv={};function Gv(t,e,i){const{normalStyle:s}=t;e||(e=Uv),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==Uv&&sl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&o(i[s])&&o(e[s])&&(s="transition");return o(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=Zv(e,t),s=t.animate();s&&Zv(i,t,s.fromStyle);return i}(t,e):void 0;sl.canAnimate&&Kv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Kv(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=qv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=qv(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Kv(t){let e;const i={},s=Hv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&sl.isState(o,t,s)&&(e=Jv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&sl.isSelected(t,s)&&(e=Jv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&sl.isPlacehold(t,s)&&(e=Jv(i,a)),sl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Jv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&sl.isFocus(t,s)&&(e=Jv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&sl.isHover(t,s)&&(e=Jv(i,n));const r=i.pressStyle||t.pressStyle;r&&sl.isPress(t,s)&&(e=Jv(i,r))}return e?i:void 0}function qv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&sl.animateExcludes[t]||(o[t]=e[t]);return o}function Zv(t,e,i){return qv(t,e,i,!0)}function Jv(t,e){return Object.assign(t,e),!0}function Qv(t,e){const i=t[e];i&&Vv(t,i),t.button&&tw(t.children,e)}function $v(t,e,i){i||(i=t.states[e]),Vv(t,i),t.button&&tw(t.children,null,e)}function tw(t,e,i){if(!t)return;let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],e){switch(n=!0,e){case"hoverStyle":sl.isHover(o)&&(n=!1);break;case"pressStyle":sl.isPress(o)&&(n=!1);break;case"focusStyle":sl.isFocus(o)&&(n=!1)}n&&Qv(o,e)}else s(i)||$v(o,i);o.isBranch&&tw(o.children,e,i)}}function ew(t,e){const i=t[e];i&&jv(t,i),t.button&&sw(t.children,e)}function iw(t,e,i){jv(t,i),t.button&&sw(t.children,null,e)}function sw(t,e,i){if(!t)return;let o;for(let n=0,r=t.length;n<r;n++)o=t[n],e?ew(o,e):s(i)||iw(o,i),o.isBranch&&sw(o.children,e,i)}function ow(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Hv(e,i);n&&(s=o[t](n))}return s}function nw(t,e,i){let s=e[t];if(!s&&i){const o=Hv(e,i);o&&(s=o[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 o=Hv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},sl.isSelected=function(t,e){return nw("selected",t,e)},sl.isDisabled=function(t,e){return nw("disabled",t,e)},sl.isFocus=function(t,e){return ow("isFocus",t,e)},sl.isHover=function(t,e){return ow("isHover",t,e)},sl.isPress=function(t,e){return ow("isPress",t,e)},sl.isPlacehold=function(t,e){return t.__.__isPlacehold},sl.isDrag=function(t,e){return ow("isDrag",t,e)},sl.setStyleName=function(t,e,i){i?$v(t,e,t[e]):iw(t,e,t[e])},sl.set=function(t,e){const i=t.states[e];i?$v(t,e,i):iw(t,e,i)},sl.getStyle=Kv,sl.updateStyle=Gv,sl.updateEventStyle=function(t,e){switch(e){case Jd.ENTER:Qv(t,"hoverStyle");break;case Jd.LEAVE:ew(t,"hoverStyle");break;case Jd.DOWN:Qv(t,"pressStyle");break;case Jd.UP:ew(t,"pressStyle")}};const rw=Fl.prototype;Fl.addAttr("selected",!1,Xv,"selectedStyle"),Fl.addAttr("disabled",!1,Xv,"disabledStyle"),Fl.addAttr("states",{},Nv),Fl.addAttr("state","",Xv),Fl.addAttr("normalStyle",void 0,un),Fl.addAttr("hoverStyle",void 0,Nv),Fl.addAttr("pressStyle",void 0,Nv),Fl.addAttr("focusStyle",void 0,Nv),Fl.addAttr("selectedStyle",void 0,Nv),Fl.addAttr("disabledStyle",void 0,Nv),Fl.addAttr("placeholderStyle",void 0,Nv),Fl.addAttr("button",!1,un),rw.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))},rw.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?Qv(this,"focusStyle"):ew(this,"focusStyle")})},rw.updateState=function(){sl.updateStyle(this,void 0,"in")};const aw=Od.prototype,hw="text";rn(aw,hw,Object.assign(Object.assign({},an(aw,hw)),{set(t){const e=this,i=e.text;e.__setAttr(hw,t)&&(wn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class lw extends cl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let dw=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=tn.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:o,size:n,total:r}=e,{width:h,height:l}=n&&(a(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.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 Xr(Xr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:o,__action:n}=this;n&&(n.FPS&&(i=n.FPS),s(n.loop)||(o=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!o)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:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};pe([Wn(lw)],dw.prototype,"__",void 0),pe([yn()],dw.prototype,"robot",void 0),pe([un()],dw.prototype,"actions",void 0),pe([un("")],dw.prototype,"action",void 0),pe([Tn(0)],dw.prototype,"now",void 0),pe([un(12)],dw.prototype,"FPS",void 0),pe([un(!0)],dw.prototype,"loop",void 0),dw=pe([Kn()],dw),re.add("robot");const{Yes:cw,NoAndSkip:uw,YesAndSkip:gw}=e,_w={},pw={},fw={};class mw{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,o){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":_w.id=t.substring(1),t=_w;break;case".":pw.className=t.substring(1),t=pw;break;default:fw.tag=t,t=fw}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,o=d(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?_.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,o)}}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 o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===cw||n===gw){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<uw&&this.eachFind(o.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 yw=Fl.prototype;function vw(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}yw.find=function(t,e){return vw(this).getBy(t,this,!1,e)},yw.findOne=function(t,e){return vw(this).getBy(t,this,!0,e)},re.add("find"),ae.finder=function(t){return new mw(t)};const{setPoint:ww,addPoint:xw,toBounds:bw}=vt;const kw={syncExport(t,e,i){let o;il.running=!0;try{const n=Uo.fileType(e),r=e.includes(".");i=Uo.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===n)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),o={data:!!r||t.toJSON(i.json)};else if("svg"===n)r&&h(a(t.toSVG(),"svg"),e),o={data:!!r||t.toSVG()};else{let n,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:_,trim:p,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=Uo.isOpaqueImage(e)||b,S=new mt;if(f)n=!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}n=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,n,E);let B=i.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Kt(n).scale(E.scaleX,E.scaleY);_&&(T+=_.x,R+=_.y,C=_.width,O=_.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(),p){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?xw(r,o,n):ww(r={},o,n)),a++;const h=new Kt;return r&&(bw(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),o=A,{width:n,height:r}=o;A=ae.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),y&&y(A);o={data:"canvas"===e?A:A.export(e,i),width:A.pixelWidth,height:A.pixelHeight,renderBounds:n,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return il.running=!1,o},export(t,e,i){return il.running=!0,function(t){Sw||(Sw=new Zo);return new Promise(e=>{Sw.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(o=>{const n=()=>fe(this,void 0,void 0,function*(){if(!Qo.isComplete)return v.requestRender(n);const r=il.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),o()});t.updateLayout(),Ew(t);const{leafer:r}=t;r?r.waitViewCompleted(n):n()}))}};let Sw;function Ew(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Ew(t))}const Bw=Oe.prototype,Tw=$t.get("@leafer-in/export");Bw.export=function(t,e){const{quality:i,blob:s}=Uo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Bw.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Tw.error(t),i(null)})})},Bw.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Bw.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Tw.error(t),i(!1)})})},re.add("export"),Object.assign(il,kw),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,o,n){let r;t.forEach(t=>{r=el.list[t.type],r&&r.apply(t,e,i,s,o,n)})},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,Rn);export{Tt as AlignHelper,jy as Animate,Ny as AnimateEasing,Vy as AnimateEvent,Uy as AnimateList,e as Answer,Ad as App,St as AroundHelper,Kf as Arrow,Uf as ArrowData,Zt as AutoBounds,ri as BezierHelper,Kt as Bounds,Nr as BoundsEvent,Vt as BoundsHelper,Gl as Box,_l as BoxData,yh as Branch,vr as BranchHelper,Fa as BranchRender,Sd as Canvas,Tl as CanvasData,_e as CanvasManager,Ir as ChildEvent,Kh as ColorConvert,ae as Creator,Tc as Cursor,_ as DataHelper,$t as Debug,xt as Direction4,bt as Direction9,qd as DragBoundsHelper,tc as DragEvent,fc as Dragger,ic as DropEvent,hp as EditBox,tp as EditDataHelper,np as EditPoint,X_ as EditSelect,I_ as EditSelectHelper,Fp as EditTool,xp as EditToolCreator,Dp as Editor,T_ as EditorEvent,Sp as EditorGroupEvent,mp as EditorHelper,Cp as EditorMoveEvent,Pp as EditorRotateEvent,Op as EditorScaleEvent,Lp as EditorSkewEvent,tl as Effect,Ql as Ellipse,vl as EllipseData,pi as EllipseHelper,Fr as Event,ue as EventCreator,na as Eventer,il as Export,Uo as FileHelper,el as Filter,mw as Finder,Gm as Flow,R as FourNumberHelper,Kl as Frame,fl as FrameData,Il as Group,gl as GroupData,Sv as HighBezierHelper,Lv as HighCurveHelper,Rc as HitCanvasManager,bd as Image,Bl as ImageData,Xr as ImageEvent,tn as ImageManager,x as IncrementId,Mp as InnerEditor,kp as InnerEditorEvent,Vc as Interaction,Bc as InteractionBase,dc as InteractionHelper,lc as KeyEvent,Md as Keyboard,Zr as LayoutEvent,Ih as Layouter,hh as Leaf,Aa as LeafBounds,pr 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,pl as LeaferData,Qr as LeaferEvent,nn as LeaferImage,xf as LeaferTypeCreator,xd as Line,ml as LineData,Np as LineEditTool,W as MathHelper,mt as Matrix,$ as MatrixHelper,sc as MoveEvent,Sf as MultiTouchHelper,ec as MyDragEvent,kd as MyImage,Qd as MyPointerEvent,nc as MyTouchEvent,Me as NeedConvertToCanvasCommandMap,Y as OneRadian,X as PI2,N as PI_2,Jh as Paint,$h as PaintGradient,Qh as PaintImage,Pd as Path,Zh as PathArrow,Vm as PathArrowModule,Do as PathBounds,ks as PathCommandDataHelper,Ae as PathCommandMap,fi as PathCommandNodeHelper,ts as PathConvert,Xo as PathCorner,Ys as PathCreator,bl as PathData,eo as PathDrawer,Pe as PathHelper,om as PathMatrixHelper,t as PathNodeHandleType,ze as PathNumberCommandLengthMap,We as PathNumberCommandMap,sf as PathScaler,Ld as Pen,kl as PenData,Xh as Picker,v as Platform,re as Plugin,pt as Point,dt as PointHelper,Fd as PointerButton,Jd as PointerEvent,rd as Polygon,wl as PolygonData,zr as PropertyEvent,Xl as Rect,yl as RectData,Ye as RectHelper,Dl as RectRender,Jr as RenderEvent,zh as Renderer,Kr as ResizeEvent,Qo as Resource,dw as Robot,lw as RobotData,rc as RotateEvent,se as Run,jf as ScrollBar,F_ as SelectArea,Nh as Selector,gd as Star,xl as StarData,sl as State,Jt as StringNumberMap,M_ as Stroker,ac as SwipeEvent,qo as TaskItem,Zo as TaskProcessor,Od as Text,Gh as TextConvert,El as TextData,oc as TouchEvent,Ap as TransformTool,Mf as Transformer,ol as Transition,vt as TwoPointBoundsHelper,Fl as UI,Ol as UIBounds,le as UICreator,cl as UIData,Id as UIEvent,Ll as UIRender,qh as UnitConvert,Er as WaitHelper,qr as WatchEvent,Bh as Watcher,Of as WheelEventHelper,hc as ZoomEvent,yf as addViewport,vf as addViewportConfig,Bn as affectRenderBoundsType,kn as affectStrokeBoundsType,Gf as arrowType,dn as attr,pn as autoLayoutType,yn as boundsType,jo as canvasPatch,Ce as canvasSizeAttrs,Uh as createAttr,hn as createDescriptor,In as cursorType,Wn as dataProcessor,un as dataType,ln as decorateLeafAttr,Yn as defineDataProcessor,rn as defineKey,cn as defineLeafAttr,Rn as dimType,wn as doBoundsType,Sn as doStrokeType,Hh as effectType,i as emptyData,Mn as eraserType,Yr as extraPropertyEventMap,V as getBoundsData,an as getDescriptor,j as getMatrixData,H as getPointData,Fn as hitType,d as isArray,u as isData,g as isEmptyData,r as isFinite,o as isNull,a as isNumber,c as isObject,n as isString,s as isUndefined,zn as layoutProcessor,sa as leaferTransformAttrMap,Dn as maskType,Av as motionPathType,vn as naturalBoundsType,Cn as opacityType,No as path,xn as pathInputType,bn as pathType,Ho as pen,gn as positionType,vp as registerEditTool,wp as registerInnerEditor,Kn as registerUI,qn as registerUIEvent,Vh as resizeType,Vn as rewrite,jn as rewriteAble,mn as rotationType,uf as scaleResize,gf as scaleResizeFontSize,ff as scaleResizeGroup,_f as scaleResizePath,pf as scaleResizePoints,fn as scaleType,_n as scrollType,An as sortType,Nv as stateStyleType,Xv as stateType,En as strokeType,Tn as surfaceType,qt as tempBounds,yt as tempMatrix,ft as tempPoint,l as tryToNumber,Eh as useCanvas,Gn as useModule,xh as version,On as visibleType,jh 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 _={default:(t,e)=>(p(e,t),p(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 p(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&p(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&&_.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=O(t),S=e):a(e)?(k=t,S=O(e)):(k=t,S=e),4!==k.length&&(k=P(k)),4!==S.length&&(S=P(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:P(t);return C(n,h*i,l*e,o*i,r*e)}},{set:C,get:P,setTemp:O,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 Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),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:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,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,_=e?Z((o/d-i)/e/Y,9):0,u=Z(u/Y)}else d=n,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},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=$,{float:et}=W,{toInnerPoint:it,toOuterPoint:st}=$,{sin:nt,cos:ot,abs:rt,sqrt:at,atan2:ht,min:lt,round:dt}=Math,ct={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?dt(t.x-.5)+.5:dt(t.x),t.y=e?dt(t.y-.5)+.5:dt(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=ut.defaultPoint);const s=ot(e*=Y),n=nt(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}=ut;return _t(i,t),it(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ut;return _t(i,t),st(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ut;return _t(i,t),ut.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(_t(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),it(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){it(e,t,i)},toOuterOf(t,e,i){st(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)=>gt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=rt(i-t),o=rt(s-e);return at(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>lt(gt(t,e,i,s),gt(i,s,n,o)),getAngle:(t,e)=>ft(t,e)/Y,getRotation:(t,e,i,s)=>(s||(s=e),ut.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)=>ht(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const o=ft(t,e);return n&&(t=e),s||(e={}),e.x=t.x+ot(o)*i,e.y=t.y+nt(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)=>et(t.x)===et(e.x)&&et(t.y)===et(e.y),reset(t){ut.reset(t)}},ut=ct,{getDistanceFrom:gt,copy:_t,setRadius:pt,getAtan2:ft}=ut;class mt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ct.copy(this,t):ct.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new mt(this)}move(t,e){return ct.move(this,t,e),this}scale(t,e){return ct.scale(this,t,e),this}scaleOf(t,e,i){return ct.scaleOf(this,t,e,i),this}rotate(t,e){return ct.rotate(this,t,e),this}rotateOf(t,e){return ct.rotate(this,e,t),this}getRotation(t,e,i){return ct.getRotation(this,t,e,i)}toInnerOf(t,e){return ct.toInnerOf(this,t,e),this}toOuterOf(t,e){return ct.toOuterOf(this,t,e),this}getCenter(t){return new mt(ct.getCenter(this,t))}getDistance(t){return ct.getDistance(this,t)}getDistancePoint(t,e,i,s){return new mt(ct.getDistancePoint(this,t,e,i,s))}getAngle(t){return ct.getAngle(this,t)}getAtan2(t){return ct.getAtan2(this,t)}isSame(t){return ct.isSame(this,t)}reset(){return ct.reset(this),this}}const yt=new mt;class vt{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)?$.copy(this,t):$.set(this,t,e,i,s,n,o),this}setWith(t){return $.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 vt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const wt=new vt,xt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){bt(t,e,i),bt(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:bt}=xt;var kt,St;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(kt||(kt={})),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"}(St||(St={}));const Et=[{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}];Et.forEach(t=>t.type="percent");const Bt={directionData:Et,tempPoint:{},get:Tt,toPoint(t,e,i,s,n,o){const r=Tt(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={}),Bt.toPoint(t,e,i,!0),i)};function Tt(t){return o(t)?Et[St[t]]:t}const{toPoint:Rt}=Bt,Ct={toPoint(t,e,i,s,n,o){Rt(t,i,s,n,e,o)}},{tempPointBounds:Pt,setPoint:Ot,addPoint:Lt,toBounds:At}=xt,{toOuterPoint:Dt}=$,{float:Mt,fourNumber:Ft}=W,{floor:It,ceil:Wt}=Math;let zt,Yt,Nt,Xt;const Ht={},Vt={},jt={},Ut={tempBounds:jt,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=Ft(i);s?Gt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Gt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Gt.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),Gt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Kt(e,t):e=t,i||(i=t),e.offsetX=Gt.maxX(i),e.offsetY=Gt.maxY(i),Gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ct.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ct.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Gt.copy(jt,t),Gt.toOuterOf(jt,e),jt),getOuterOf:(t,e)=>(t=Object.assign({},t),Gt.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 Ht.x=t.x,Ht.y=t.y,Dt(e,Ht,Vt),Ot(Pt,Vt.x,Vt.y),Ht.x=t.x+t.width,Dt(e,Ht,Vt),Lt(Pt,Vt.x,Vt.y),Ht.y=t.y+t.height,Dt(e,Ht,Vt),Lt(Pt,Vt.x,Vt.y),Ht.x=t.x,Dt(e,Ht,Vt),Lt(Pt,Vt.x,Vt.y),At(Pt,i)},toInnerOf(t,e,i){i||(i=t),Gt.move(i,-e.e,-e.f),Gt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Gt.getFitScale(t,e));return new vt(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=Gt.getFitScale(t,e,"cover"===s)),jt.width=n?e.width*=s:e.width*s,jt.height=n?e.height*=s:e.height*s,Ct.toPoint(i,jt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Gt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Gt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Gt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Wt(t.width+e-t.x):Wt(t.width),t.height=i>t.y?Wt(t.height+i-t.y):Wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Mt(t.x,e),t.y=Mt(t.y,e),t.width=Mt(t.width,e),t.height=Mt(t.height,e)},add(t,e,i){zt=t.x+t.width,Yt=t.y+t.height,Nt=e.x,Xt=e.y,i||(Nt+=e.width,Xt+=e.height),zt=zt>Nt?zt:Nt,Yt=Yt>Xt?Yt:Xt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=zt-t.x,t.height=Yt-t.y},addList(t,e){Gt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Gt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Gt.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||Kt(t,n)):qt(t,n));o&&Gt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ot(Pt,t.x,t.y):Lt(Pt,t.x,t.y)),At(Pt,t)},setPoint(t,e){Gt.set(t,e.x,e.y)},addPoint(t,e){qt(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=ct.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=ct.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=Gt.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=Gt.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=Gt.tempToOuterOf(e,i)),!Gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return zt=s+o,Yt=n+r,Nt=t.x+t.width,Xt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,zt=zt<Nt?zt:Nt,Yt=Yt<Xt?Yt:Xt,o=zt-s,r=Yt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Gt.copy(t,Gt.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){Gt.set(t)}},Gt=Ut,{add:qt,copy:Kt}=Gt;class Zt{get minX(){return Ut.minX(this)}get minY(){return Ut.minY(this)}get maxX(){return Ut.maxX(this)}get maxY(){return Ut.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Ut.copy(this,t):Ut.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Zt(this)}move(t,e){return Ut.move(this,t,e),this}scale(t,e,i){return Ut.scale(this,t,e,i),this}scaleOf(t,e,i){return Ut.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ut.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ut.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ut.getFitMatrix(this,t,e)}put(t,e,i){Ut.put(this,t,e,i)}spread(t,e){return Ut.spread(this,t,e),this}shrink(t,e){return Ut.shrink(this,t,e),this}ceil(){return Ut.ceil(this),this}unsign(){return Ut.unsign(this),this}float(t){return Ut.float(this,t),this}add(t){return Ut.add(this,t),this}addList(t){return Ut.setList(this,t,!0),this}setList(t){return Ut.setList(this,t),this}addListWithFn(t,e){return Ut.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ut.setListWithFn(this,t,e),this}setPoint(t){return Ut.setPoint(this,t),this}setPoints(t){return Ut.setPoints(this,t),this}addPoint(t){return Ut.addPoint(this,t),this}getPoints(){return Ut.getPoints(this)}hitPoint(t,e){return Ut.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ut.hitRadiusPoint(this,t,e)}hit(t,e){return Ut.hit(this,t,e)}includes(t,e){return Ut.includes(this,t,e)}intersect(t,e){return Ut.intersect(this,t,e),this}getIntersect(t,e){return new Zt(Ut.getIntersectData(this,t,e))}isSame(t){return Ut.isSame(this,t)}isEmpty(){return Ut.isEmpty(this)}reset(){Ut.reset(this)}}const Jt=new Zt;class Qt{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 Zt(n,e,o||t.width-n-i,r||t.height-e-s)}}const $t={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:te}=W;class ee{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ee(t)}static set filter(t){this.filterList=ie(t)}static set exclude(t){this.excludeList=ie(t)}static drawRepaint(t,e){const i=te();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ee.showBounds,n=t.__nowWorld,o=te();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(se.enable){if(se.filterList.length&&se.filterList.every(t=>t!==this.name))return;if(se.excludeList.length&&se.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){se.enable&&this.warn(...t)}warn(...t){se.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ie(t){return t?o(t)&&(t=[t]):t=[],t}ee.filterList=[],ee.excludeList=[],ee.showWarn=!0;const se=ee,ne=ee.get("RunTime"),oe={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return re.currentId=re.idMap[i]=e?performance.now():Date.now(),re.currentName=re.nameMap[i]=t,re.nameToIdMap[t]=i,i},end(t,e){const i=re.idMap[t],s=re.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;re.idMap[t]=re.nameMap[t]=re.nameToIdMap[s]=void 0,ne.log(s,n,"ms")},endOfName(t,e){const i=re.nameToIdMap[t];s(i)||re.end(i,e)}},re=oe,ae=[],he={list:{},add(t,...e){this.list[t]=!0,ae.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ae.forEach(t=>he.has(t,!0)));const le={editor:t=>he.need("editor")},de=ee.get("UICreator"),ce={list:{},register(t){const{__tag:e}=t.prototype;ue[e]&&de.repeat(e),ue[e]=t},get(t,e,i,n,o,r){ue[t]||de.error("not register "+t);const a=new ue[t](e);return s(i)||(a.x=i,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:ue}=ce,ge=ee.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(pe[e]&&ge.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class fe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=le.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function me(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 ye(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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const we=[];function xe(){return(t,e)=>{we.push(e)}}const be=[];let ke=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,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}};me([ve("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),me([ve("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),me([ve("globalAlpha")],ke.prototype,"opacity",void 0),me([ve()],ke.prototype,"fillStyle",void 0),me([ve()],ke.prototype,"strokeStyle",void 0),me([ve("lineWidth")],ke.prototype,"strokeWidth",void 0),me([ve("lineCap")],ke.prototype,"strokeCap",void 0),me([ve("lineJoin")],ke.prototype,"strokeJoin",void 0),me([ve("lineDashOffset")],ke.prototype,"dashOffset",void 0),me([ve()],ke.prototype,"miterLimit",void 0),me([ve()],ke.prototype,"shadowBlur",void 0),me([ve()],ke.prototype,"shadowColor",void 0),me([ve()],ke.prototype,"shadowOffsetX",void 0),me([ve()],ke.prototype,"shadowOffsetY",void 0),me([ve()],ke.prototype,"filter",void 0),me([ve()],ke.prototype,"font",void 0),me([ve()],ke.prototype,"fontKerning",void 0),me([ve()],ke.prototype,"fontStretch",void 0),me([ve()],ke.prototype,"fontVariantCaps",void 0),me([ve()],ke.prototype,"textAlign",void 0),me([ve()],ke.prototype,"textBaseline",void 0),me([ve()],ke.prototype,"textRendering",void 0),me([ve()],ke.prototype,"wordSpacing",void 0),me([ve()],ke.prototype,"letterSpacing",void 0),me([ve()],ke.prototype,"direction",void 0),me([xe()],ke.prototype,"setTransform",null),me([xe()],ke.prototype,"resetTransform",null),me([xe()],ke.prototype,"getTransform",null),me([xe()],ke.prototype,"save",null),me([xe()],ke.prototype,"restore",null),me([xe()],ke.prototype,"translate",null),me([xe()],ke.prototype,"scale",null),me([xe()],ke.prototype,"rotate",null),me([xe()],ke.prototype,"fill",null),me([xe()],ke.prototype,"stroke",null),me([xe()],ke.prototype,"clip",null),me([xe()],ke.prototype,"fillRect",null),me([xe()],ke.prototype,"strokeRect",null),me([xe()],ke.prototype,"clearRect",null),me([xe()],ke.prototype,"beginPath",null),me([xe()],ke.prototype,"moveTo",null),me([xe()],ke.prototype,"lineTo",null),me([xe()],ke.prototype,"bezierCurveTo",null),me([xe()],ke.prototype,"quadraticCurveTo",null),me([xe()],ke.prototype,"closePath",null),me([xe()],ke.prototype,"arc",null),me([xe()],ke.prototype,"arcTo",null),me([xe()],ke.prototype,"ellipse",null),me([xe()],ke.prototype,"rect",null),me([xe()],ke.prototype,"roundRect",null),me([xe()],ke.prototype,"createConicGradient",null),me([xe()],ke.prototype,"createLinearGradient",null),me([xe()],ke.prototype,"createPattern",null),me([xe()],ke.prototype,"createRadialGradient",null),me([xe()],ke.prototype,"fillText",null),me([xe()],ke.prototype,"measureText",null),me([xe()],ke.prototype,"strokeText",null);const{copy:Se,multiplyParent:Ee,pixelScale:Be}=$,{round:Te}=Math,Re=new Zt,Ce=new Zt,Pe={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class Le extends ke{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Pe),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;_.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Zt(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&&Ee(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin: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){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Ce):i=Re,this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ut.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o){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(Re.x,Re.y,Re.width,Re.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,Re.x,Re.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(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Re.x,Re.y,Re.width,Re.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Re.x,Re.y,Re.width,Re.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Re,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):le.canvas(Object.assign({},i));return n.save(),t&&(Se(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ae={creator:{},parse(t,e){},convertToCanvasData(t,e){}},De={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},De),Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ie={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},We=Object.assign(Object.assign({},Ie),De),ze=Me,Ye={};for(let t in ze)Ye[ze[t]]=t;const Ne={};for(let t in ze)Ne[ze[t]]=Fe[t];const Xe={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:He,cos:Ve,hypot:je,atan2:Ue,ceil:Ge,abs:qe,PI:Ke,sqrt:Ze,pow:Je}=Math,{setPoint:Qe,addPoint:$e}=xt,{set:ti,toNumberPoints:ei}=ct,{M:ii,L:si,C:ni,Q:oi,Z:ri}=Me,ai={},hi={points(t,e,i,s){let n=ei(e);if(t.push(ii,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,_,p,f,m,y,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=r-e,p=a-o,f=Ze(Je(_,2)+Je(p,2)),m=Ze(Je(h-r,2)+Je(l-a,2)),(f||m)&&(y=f+m,f=w*f/y,m=w*m/y,h-=e,l-=o,d=r-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,r,a):(_||p)&&t.push(ni,u,g,d,c,r,a),u=r+m*h,g=a+m*l);s||t.push(oi,u,g,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(si,n[e],n[e+1]);s&&t.push(ri)},rect(t,e,i,s,n){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){Ae.creator.path=[],Xe.drawRoundRect(Ae.creator,e,i,s,n,o),t.push(...Ae.convertToCanvasData(Ae.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,_=r-n;let p=Ue(u,c),f=Ue(_,g);const m=je(c,u),y=je(g,_);let v=f-p;if(v<0&&(v+=N),m<1e-12||y<1e-12||v<1e-12||qe(v-Ke)<1e-12)return t&&t.push(si,s,n),h&&(Qe(h,e,i),$e(h,s,n)),d&&ti(d,e,i),void(l&&ti(l,s,n));const w=c*_-g*u<0,x=w?-1:1,b=a/Ve(v/2),k=s+b*Ve(p+v/2+X*x),S=n+b*He(p+v/2+X*x);return p-=X*x,f-=X*x,ci(t,k,S,a,a,0,p/Y,f/Y,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>ci(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=He(u),_=Ve(u);let p=r*Y,f=a*Y;p>Ke&&(p-=N),f<0&&(f+=N);let m=f-p;m<0?m+=N:m>N&&(m-=N),h&&(m-=N);const y=Ge(qe(m/X)),v=m/y,w=He(v/4),x=8/3*w*w/He(v/2);f=p+v;let b,k,S,E,B,T,R,C,P=Ve(p),O=He(p),L=S=_*s*P-g*n*O,A=E=g*s*P+_*n*O,D=e+S,M=i+E;t&&t.push(t.length?si:ii,D,M),l&&Qe(l,D,M),c&&ti(c,D,M);for(let o=0;o<y;o++)b=Ve(f),k=He(f),S=_*s*b-g*n*k,E=g*s*b+_*n*k,B=e+L-x*(_*s*O+g*n*P),T=i+A-x*(g*s*O-_*n*P),R=e+S+x*(_*s*k+g*n*b),C=i+E+x*(g*s*k-_*n*b),t&&t.push(ni,B,T,R,C,e+S,i+E),l&&di(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,P=b,O=k,p=f,f+=v;d&&ti(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ni,(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){di(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;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?$e(h,t,e):Qe(h,t,e),$e(h,r,a);for(let l=0,c=d.length;l<c;l++)li(d[l],t,e,i,s,n,o,r,a,ai),$e(h,ai.x,ai.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,_=t*t*t;l.x=c*e+u*s+g*o+_*a,l.y=c*i+u*n+g*r+_*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return li(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:li,toTwoPointBounds:di,ellipse:ci}=hi,{sin:ui,cos:gi,sqrt:_i,atan2:pi}=Math,{ellipse:fi}=hi,mi={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*Y,_=ui(g),p=gi(g),f=-p*c-_*u,m=-p*u+_*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=_i(1-k/(y*w));s*=t,n*=t}else S=(r===a?-1:1)*_i(k/(y*x+w*b));const E=S*s*m/n,B=-S*n*f/s,T=pi((m-B)/n,(f-E)/s),R=pi((-m-B)/n,(-f-E)/s);let C=R-T;0===a&&C>0?C-=N:1===a&&C<0&&(C+=N);const P=e+c+p*E-_*B,O=i+u+_*E+p*B,L=C<0?1:0;d||v.ellipseToCurve?fi(t,P,O,s,n,o,T/Y,R/Y,L):s!==n||o?t.push(Me.G,P,O,s,n,o,T/Y,R/Y,L):t.push(Me.O,P,O,s,T/Y,R/Y,L)}},yi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:wi,L:xi,l:bi,H:ki,h:Si,V:Ei,v:Bi,C:Ti,c:Ri,S:Ci,s:Pi,Q:Oi,q:Li,T:Ai,t:Di,A:Mi,a:Fi,Z:Ii,z:Wi,N:zi,D:Yi,X:Ni,G:Xi,F:Hi,O:Vi,P:ji,U:Ui}=Me,{rect:Gi,roundRect:qi,arcTo:Ki,arc:Zi,ellipse:Ji,quadraticCurveTo:Qi}=hi,{ellipticalArc:$i}=mi,ts=ee.get("PathConvert"),es={},is={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=Ne[s],a+=s===n?" ":Ye[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?We:Ie;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ss.dot&&(ns(r,o),o=""),ss.dot++),"0"===o&&"."!==s&&(ns(r,o),o=""),o+=s):Me[s]?(o&&(ns(r,o),o=""),ss.name=Me[s],ss.length=Fe[s],ss.index=0,ns(r,ss.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&ns(r,o),o=s):o&&(ns(r,o),o=""),n=s;return o&&ns(r,o),i?is.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 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 Si:t[c+1]+=a;case ki:a=t[c+1],g.push(xi,a,h),c+=2;break;case Bi:t[c+1]+=h;case Ei:h=t[c+1],g.push(xi,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case xi:a=t[c+1],h=t[c+2],g.push(xi,a,h),c+=3;break;case Pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:r=o===Ti||o===Ci,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(Ti,l,d,i,s,a,h),c+=5;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ti;case Ti:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ti,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Di:t[c+1]+=a,t[c+2]+=h,n=Ai;case Ai:r=o===Oi||o===Ai,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Oi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Oi;case Oi:i=t[c+1],s=t[c+2],e?Qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Oi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Fi:t[c+6]+=a,t[c+7]+=h;case Mi:$i(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 Wi:case Ii:g.push(Ii),c++;break;case zi:a=t[c+1],h=t[c+2],e?Gi(g,a,h,t[c+3],t[c+4]):os(g,t,c,5),c+=5;break;case Yi:a=t[c+1],h=t[c+2],e?qi(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):os(g,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?qi(g,a,h,t[c+3],t[c+4],t[c+5]):os(g,t,c,6),c+=6;break;case Xi:Ji(e?g:os(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,es),a=es.x,h=es.y,c+=9;break;case Hi:e?Ji(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):os(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:Zi(e?g:os(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),a=es.x,h=es.y,c+=7;break;case ji:e?Zi(g,t[c+1],t[c+2],t[c+3],0,360,!1):os(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ui:Ki(e?g:os(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),a=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(xi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ii)}}),e}},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){ss.index===ss.length&&(ss.index=1,t.push(ss.name)),t.push(Number(e)),ss.index++,ss.dot=0}},{current:ss,pushData:ns,copyData:os}=is,{M:rs,L:as,C:hs,Q:ls,Z:ds,N:cs,D:us,X:gs,G:_s,F:ps,O:fs,P:ms,U:ys}=Me,{getMinDistanceFrom:vs,getRadianFrom:ws}=ct,{tan:xs,min:bs,abs:ks}=Math,Ss={},Es={beginPath(t){t.length=0},moveTo(t,e,i){t.push(rs,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(hs,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(ls,e,i,s,n)},closePath(t){t.push(ds)},rect(t,e,i,s,n){t.push(cs,e,i,s,n)},roundRect(t,e,i,s,n,o){if(a(o))t.push(gs,e,i,s,n,o);else{const r=W.fourNumber(o);r?t.push(us,e,i,s,n,...r):t.push(cs,e,i,s,n)}},ellipse(t,e,i,s,o,r,a,h,l){if(s===o)return Ts(t,e,i,s,a,h,l);n(r)?t.push(ps,e,i,s,o):(n(a)&&(a=0),n(h)&&(h=360),t.push(_s,e,i,s,o,r,a,h,l?1:0))},arc(t,e,i,s,o,r,a){n(o)?t.push(ms,e,i,s):(n(o)&&(o=0),n(r)&&(r=360),t.push(fs,e,i,s,o,r,a?1:0))},arcTo(t,e,i,n,o,r,a,h){if(!s(a)){const t=vs(a,h,e,i,n,o);r=bs(r,bs(t/2,t/2*ks(xs(ws(a,h,e,i,n,o)/2))))}t.push(ys,e,i,n,o,r)},drawEllipse(t,e,i,s,o,r,a,h,l){hi.ellipse(null,e,i,s,o,n(r)?0:r,n(a)?0:a,n(h)?360:h,l,null,null,Ss),t.push(rs,Ss.x,Ss.y),Bs(t,e,i,s,o,r,a,h,l)},drawArc(t,e,i,s,o,r,a){hi.arc(null,e,i,s,n(o)?0:o,n(r)?360:r,a,null,null,Ss),t.push(rs,Ss.x,Ss.y),Ts(t,e,i,s,o,r,a)},drawPoints(t,e,i,s){hi.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=Es,{moveTo:Rs,lineTo:Cs,quadraticCurveTo:Ps,bezierCurveTo:Os,closePath:Ls,beginPath:As,rect:Ds,roundRect:Ms,ellipse:Fs,arc:Is,arcTo:Ws,drawEllipse:zs,drawArc:Ys,drawPoints:Ns}=Es;class Xs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return Rs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Cs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Os(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ps(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ls(this.__path),this.paint(),this}rect(t,e,i,s){return Ds(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ms(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Fs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Is(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return Ws(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return zs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Ys(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Hs,L:Vs,C:js,Q:Us,Z:Gs,N:qs,D:Ks,X:Zs,G:Js,F:Qs,O:$s,P:tn,U:en}=Me,sn=ee.get("PathDrawer"),nn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Hs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Us:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case qs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Js: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 Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case $s: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 tn:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case en:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sn.error(`command: ${i} [index:${s}]`,e)}}},{M:on,L:rn,C:an,Q:hn,Z:ln,N:dn,D:cn,X:un,G:gn,F:_n,O:pn,P:fn,U:mn}=Me,{toTwoPointBounds:yn,toTwoPointBoundsByQuadraticCurve:vn,arcTo:wn,arc:xn,ellipse:bn}=hi,{addPointBounds:kn,copy:Sn,addPoint:En,setPoint:Bn,addBounds:Tn,toBounds:Rn}=xt,Cn=ee.get("PathBounds");let Pn,On,Ln;const An={},Dn={},Mn={},Fn={toBounds(t,e){Fn.toTwoPointBounds(t,Dn),Rn(Dn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(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===ln||r===an||r===hn?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),r){case on:case rn:h=t[a+1],l=t[a+2],En(e,h,l),a+=3;break;case an:n=t[a+5],o=t[a+6],yn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,An),kn(e,An),h=n,l=o,a+=7;break;case hn:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],vn(h,l,i,s,n,o,An),kn(e,An),h=n,l=o,a+=5;break;case ln:a+=1;break;case dn:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=5;break;case cn:case un:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=r===cn?9:6;break;case gn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],An,Mn),0===a?Sn(e,An):kn(e,An),h=Mn.x,l=Mn.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],On=t[a+3],Ln=t[a+4],Tn(e,h-On,l-Ln,2*On,2*Ln),h+=On,a+=5;break;case pn:xn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],An,Mn),0===a?Sn(e,An):kn(e,An),h=Mn.x,l=Mn.y,a+=7;break;case fn:h=t[a+1],l=t[a+2],Pn=t[a+3],Tn(e,h-Pn,l-Pn,2*Pn,2*Pn),h+=Pn,a+=4;break;case mn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],An,Mn),0===a?Sn(e,An):kn(e,An),h=Mn.x,l=Mn.y,a+=6;break;default:return void Cn.error(`command: ${r} [index:${a}]`,t)}}},{M:In,L:Wn,Z:zn}=Me,{getCenterX:Yn,getCenterY:Nn}=ct,{arcTo:Xn}=Es,Hn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,c=0,u=0,g=0,_=0,p=0;d(e)&&(e=e[0]||0);const f=t.length,m=[];for(;r<f;){switch(s=t[r],s){case In:l=_=t[r+1],c=p=t[r+2],r+=3,t[r]===Wn?(u=t[r+1],g=t[r+2],m.push(In,Yn(l,u),Nn(c,g))):m.push(In,l,c);break;case Wn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Wn:Xn(m,a,h,t[r+1],t[r+2],e,_,p);break;case zn:Xn(m,a,h,l,c,e,_,p);break;default:m.push(Wn,a,h)}_=a,p=h;break;case zn:n!==zn&&(Xn(m,l,c,u,g,e,_,p),m.push(zn)),r+=1;break;default:o=Ne[s];for(let e=0;e<o;e++)m.push(t[r+e]);r+=o}n=s}return s!==zn&&(m[1]=l,m[2]=c),m}};function Vn(t){return new Xs(t)}const jn=Vn();Ae.creator=Vn(),Ae.parse=is.parse,Ae.convertToCanvasData=is.toCanvasData;const{drawRoundRect:Un}=Xe;function Gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Un(this,t,e,i,s,n)})}(t)}const qn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Kn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Kn=qn;Kn.alphaPixelTypes.forEach(t=>Kn.upperCaseTypeMap[t]=t.toUpperCase());const Zn=ee.get("TaskProcessor");class Jn{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Zn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Qn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&_.assign(this.config,t),this.empty()}add(t,e,i){let n,o,r,h;const l=new Jn(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 $n=ee.get("Resource"),to={tasker:new Qn,map:{},get isComplete(){return eo.tasker.isComplete},set(t,e){eo.map[t]&&$n.repeat(t),eo.map[t]=e},get:t=>eo.map[t],remove(t){const e=eo.map[t];e&&(e.destroy&&e.destroy(),delete eo.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=le.image(s)),eo.set(t,e),e},destroy(){eo.map={}}},eo=to,io={maxRecycled:10,recycledList:[],patternTasker:new Qn({parallel:1}),get(t){let e=to.get(t.url);return e||to.set(t.url,e=le.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(v.image.isLarge(t)?t.url&&to.remove(t.url):(t.clearLevels(),so.recycledList.push(t)))})},recyclePaint(t){so.recycle(t.image)},clearRecycled(t){const e=so.recycledList;(e.length>so.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&to.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qn.alphaPixelTypes.some(e=>so.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+qn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},so=io,{IMAGE:no,create:oo}=x;class ro{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=oo(no),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}io.isFormat("svg",t)&&(this.isSVG=!0),io.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;to.tasker.add(()=>ye(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 ao(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ho(t,e){return Object.getOwnPropertyDescriptor(t,e)}function lo(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function co(t,e){return(i,s)=>go(i,s,t,e&&e(s))}function uo(t){return t}function go(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ao(t,e,Object.assign(n,s||{})),Xo(t,e,i)}function _o(t){return co(t)}function po(t,e){return co(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fo(t,e){return co(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function mo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),bo(this))}}))}function yo(t,e){return co(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function vo(t,e){return co(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function wo(t,e){return co(t,t=>({set(i){this.__setAttr(t,i,e)&&bo(this)}}))}function xo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(bo(this),this.__.__removeNaturalSize())}}))}function bo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function ko(t){return co(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),bo(this)}}))}const So=wo;function Eo(t,e){return co(t,t=>({set(i){this.__setAttr(t,i)&&(Bo(this),e&&(this.__.__useStroke=!0))}}))}function Bo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&bo(t)}const To=Eo;function Ro(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Co(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Po(t){return co(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Oo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ao(this)}}))}function Lo(t){return co(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Do(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Do(this,t,e,i),this.mask&&Ao(this)}}))}function Ao(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Do(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||bo(t))}function Mo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Fo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Io(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Wo(t){return co(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ee.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function zo(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Yo(t){return(e,i)=>{ao(e,"__DataProcessor",{get:()=>t})}}function No(t){return(e,i)=>{ao(e,"__LayoutProcessor",{get:()=>t})}}function Xo(t,e,i){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=lo(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?{}:_.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=ho(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),ao(n,e,a)}const Ho=new ee("rewrite"),Vo=[],jo=["destroy","constructor"];function Uo(t){return(e,i)=>{Vo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Go(){return t=>{qo()}}function qo(t){Vo.length&&(Vo.forEach(e=>{t&&Ho.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Vo.length=0)}function Ko(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(jo.includes(s)||e&&e.includes(s)))if(t.prototype){ho(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Zo(){return t=>{ce.register(t)}}function Jo(){return t=>{_e.register(t)}}setTimeout(()=>qo(!0));const{copy:Qo,toInnerPoint:$o,toOuterPoint:tr,scaleOfOuter:er,rotateOfOuter:ir,skewOfOuter:sr,multiplyParent:nr,divideParent:or,getLayout:rr}=$,ar={},{round:hr}=Math,lr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),ur(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)cr(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++)gr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&gr(t),t.__updateChange()},updateAllChange(t){if(pr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)_r(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?tr(t.localTransform,o,o,!0):t.parent&&$o(t.parent.scrollWorldTransform,o,o,!0),dr.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=hr(e),i=hr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){dr.zoomOfLocal(t,fr(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),Qo(ar,r),er(ar,e,i,s),dr.hasHighPosition(t))dr.setTransform(t,ar,n,o);else{const e=t.x+ar.e-r.e,a=t.y+ar.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){dr.rotateOfLocal(t,fr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Qo(ar,n),ir(ar,e,i),dr.hasHighPosition(t)?dr.setTransform(t,ar,!1,s):t.set({x:t.x+ar.e-n.e,y:t.y+ar.f-n.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){dr.skewOfLocal(t,fr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Qo(ar,t.__localMatrix),sr(ar,e,i,s),dr.setTransform(t,ar,n,o)},transformWorld(t,e,i,s){Qo(ar,t.worldTransform),nr(ar,e),t.parent&&or(ar,t.parent.scrollWorldTransform),dr.setTransform(t,ar,i,s)},transform(t,e,i,s){Qo(ar,t.localTransform),nr(ar,e),dr.setTransform(t,ar,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&dr.getInnerOrigin(t,n.origin),r=rr(e,o,n.around&&dr.getInnerOrigin(t,n.around));if(dr.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){Ut.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=dr.getInnerOrigin(t,n.origin);ct.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 er(i,dr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ct.tempToOuterOf(dr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Qo(ar,t.worldTransform),or(ar,e.scrollWorldTransform),i?ar:Object.assign({},ar)),drop(t,e,i,s){t.setTransform(dr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||dr.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(()=>dr.animateMove(t,e,i))}}},dr=lr,{updateAllMatrix:cr,updateMatrix:ur,updateAllWorldOpacity:gr,updateAllChange:_r,updateChange:pr}=dr;function fr(t,e){return t.updateLayout(),t.parent?ct.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const mr={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)=>vr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>vr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>vr(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 yr;function vr(t,e){return e||(yr=0),t.__.mask&&(yr=1),yr<0?null:(yr&&(yr=-1),!0)}const{updateBounds:wr}=lr,xr={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),br(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++)kr(e[t],e)},updateBounds(t,e){const i=[t];kr(t,i),Sr(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++)wr(s[t]);e&&e===i||wr(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&&Er(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&&Br(t,e,i,s,n,o,r)}},{pushAllChildBranch:br,pushAllBranchStack:kr,updateBoundsByBranchStack:Sr,move:Er,scale:Br}=xr,Tr={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:Rr,updateBounds:Cr}=lr,{toOuterOf:Pr,getPoints:Or,copy:Lr}=Ut,Ar="_localContentBounds",Dr="_worldContentBounds",Mr="_worldBoxBounds",Fr="_worldStrokeBounds";class Ir{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 Pr(this.contentBounds,this.leaf.__localMatrix,this[Ar]||(this[Ar]={})),this[Ar]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Pr(this.contentBounds,this.leaf.__world,this[Dr]||(this[Dr]={})),this[Dr]}get worldBoxBounds(){return Pr(this.boxBounds,this.leaf.__world,this[Mr]||(this[Mr]={})),this[Mr]}get worldStrokeBounds(){return Pr(this.strokeBounds,this.leaf.__world,this[Fr]||(this[Fr]={})),this[Fr]}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 Cr(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 $.defaultMatrix;case"page":t=e.zoomLayer;default:return Rr(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 Zt(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=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Rr(s,e,!0)}if(r||(r=$.getLayout(o)),Lr(r,a),ct.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=Or(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 Wr{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 zr extends Wr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}zr.ADD="child.add",zr.REMOVE="child.remove",zr.CREATED="created",zr.MOUNTED="mounted",zr.UNMOUNTED="unmounted",zr.DESTROY="destroy";const Yr="property.scroll";class Nr extends Wr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Nr.CHANGE="property.change",Nr.LEAFER_CHANGE="property.leafer_change",Nr.SCROLL=Yr;const Xr={scrollX:Yr,scrollY:Yr};class Hr extends Wr{constructor(t,e){super(t),Object.assign(this,e)}}Hr.LOAD="image.load",Hr.LOADED="image.loaded",Hr.ERROR="image.error";class Vr extends Wr{static checkHas(t,e,i){"on"===i?e===qr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(jr)||t.hasEvent(Ur)||t.hasEvent(Gr),t.__hasWorldEvent=t.hasEvent(qr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(jr,t),"inner"===e&&t.emit(Ur,t)),t.emit(Gr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(qr,this)}}Vr.RESIZE="bounds.resize",Vr.INNER="bounds.inner",Vr.LOCAL="bounds.local",Vr.WORLD="bounds.world";const{RESIZE:jr,INNER:Ur,LOCAL:Gr,WORLD:qr}=Vr,Kr={};[jr,Ur,Gr,qr].forEach(t=>Kr[t]=1);class Zr extends Wr{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(Zr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Zr.RESIZE="resize";class Jr extends Wr{constructor(t,e){super(t),this.data=e}}Jr.REQUEST="watch.request",Jr.DATA="watch.data";class Qr extends Wr{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 $r extends Wr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}$r.REQUEST="render.request",$r.CHILD_START="render.child_start",$r.CHILD_END="render.child_end",$r.START="render.start",$r.BEFORE="render.before",$r.RENDER="render",$r.AFTER="render.after",$r.AGAIN="render.again",$r.END="render.end",$r.NEXT="render.next";class ta extends Wr{}ta.START="leafer.start",ta.BEFORE_READY="leafer.before_ready",ta.READY="leafer.ready",ta.AFTER_READY="leafer.after_ready",ta.VIEW_READY="leafer.view_ready",ta.VIEW_COMPLETED="leafer.view_completed",ta.STOP="leafer.stop",ta.RESTART="leafer.restart",ta.END="leafer.end",ta.UPDATE_MODE="leafer.update_mode",ta.TRANSFORM="leafer.transform",ta.MOVE="leafer.move",ta.SCALE="leafer.scale",ta.ROTATE="leafer.rotate",ta.SKEW="leafer.skew";const{MOVE:ea,SCALE:ia,ROTATE:sa,SKEW:na}=ta,oa={x:ea,y:ea,scaleX:ia,scaleY:ia,rotation:sa,skewX:na,skewY:na},ra={};class aa{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=ha(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],Kr[t]&&Vr.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=ha(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],Kr[t]&&Vr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&_e.has(t)&&(e=_e.get(t,{type:t,target:this,current:this}));const s=ha(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 ha(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ra)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ra)}}const{on:la,on_:da,off:ca,off_:ua,once:ga,emit:_a,emitEvent:pa,hasEvent:fa,destroy:ma}=aa.prototype,ya={on:la,on_:da,off:ca,off_:ua,once:ga,emit:_a,emitEvent:pa,hasEvent:fa,destroyEventer:ma},va=ee.get("setAttr"),wa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||r(e)||s(e)||(va.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Nr(Nr.LEAFER_CHANGE,this,t,n,e));const i=oa[t];i&&(this.emitEvent(new ta(i,this)),this.emitEvent(new ta(ta.TRANSFORM,this)))}this.emitPropertyEvent(Nr.CHANGE,t,n,e);const i=Xr[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 Nr(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:xa,multiplyParent:ba,translateInner:ka,defaultWorld:Sa}=$,{toPoint:Ea,tempPoint:Ba}=Bt,Ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ba(this.__local||e,t?t.__scrollWorld||t.__world:Sa,i,!!e.affectScaleOrRotation,n),s&&ka(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)&&(xa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Ea(i.around||i.origin,t.boxBounds,Ba),ka(e,-Ba.x,-Ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ra,updateAllMatrix:Ca}=lr,{updateBounds:Pa}=xr,{toOuterOf:Oa,copyAndSpread:La,copy:Aa}=Ut,{toBounds:Da}=Fn,Ma={__updateWorldBounds(){const{__layout:t,__world:e}=this;Oa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Vr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Vr.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(),Oa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Oa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Oa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Da(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ca(this),Pa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ca(this),Pa(this,this))):Ra(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;La(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Aa(e.renderBounds,e.strokeBounds):La(e.renderBounds,e.boxBounds,i)}},Fa={__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),lr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ee.showBounds&&ee.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ia}=mr,Wa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ia(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ia(i[s],e)||i[s].__clip(t,e)}}},za={},{LEAF:Ya,create:Na}=x,{stintSet:Xa}=_,{toInnerPoint:Ha,toOuterPoint:Va,multiplyParent:ja}=$,{toOuterOf:Ua}=Ut,{copy:Ga,move:qa}=ct,{moveLocal:Ka,zoomOfLocal:Za,rotateOfLocal:Ja,skewOfLocal:Qa,moveWorld:$a,zoomOfWorld:th,rotateOfWorld:eh,skewOfWorld:ih,transform:sh,transformWorld:nh,setTransform:oh,getFlipTransform:rh,getLocalOrigin:ah,getRelativeWorld:hh,drop:lh}=lr;let dh=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 Ir}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=Na(Ya),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(zr.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(zr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(zr.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(zr.MOUNTED)):this.__emitLifeEvent(zr.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 ja(i,t.matrix,e,void 0,i),Ua(this.__layout.renderBounds,e,e),Xa(e,"half",i.half),Xa(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}=io.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),za.scaleX=i,za.scaleY=s,za}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?hh(this,e):this.worldTransform,n=i?t:{};return Ua(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ha(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Va(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 qa(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 qa(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){oh(this,t,e,i)}transform(t,e,i){sh(this,t,e,i)}move(t,e,i){Ka(this,t,e,i)}moveInner(t,e,i){$a(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Za(this,ah(this,t),e,i,s,n)}rotateOf(t,e,i){Ja(this,ah(this,t),e,i)}skewOf(t,e,i,s,n){Qa(this,ah(this,t),e,i,s,n)}transformWorld(t,e,i){nh(this,t,e,i)}moveWorld(t,e,i){$a(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}rotateOfWorld(t,e){eh(this,t,e)}skewOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}flip(t,e){sh(this,rh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return he.need("path")}getMotionPoint(t){return he.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){lh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Xo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=wo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new zr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(zr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};dh=me([Ko(wa),Ko(Ta),Ko(Ma),Ko(ya),Ko(Fa)],dh);const{setListWithFn:ch}=Ut,{sort:uh}=xr,{localBoxBounds:gh,localStrokeBounds:_h,localRenderBounds:ph,maskLocalBoxBounds:fh,maskLocalStrokeBounds:mh,maskLocalRenderBounds:yh}=mr,vh=new ee("Branch");let wh=class extends dh{__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){ch(e||this.__layout.boxBounds,this.children,this.__hasMask?fh:gh)}__updateStrokeBounds(t){ch(t||this.__layout.strokeBounds,this.children,this.__hasMask?mh:_h)}__updateRenderBounds(t){ch(t||this.__layout.renderBounds,this.children,this.__hasMask?yh:ph)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(uh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.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=ce.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(zr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(zr.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(zr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(zr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new zr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};wh=me([Ko(Wa)],wh);class xh{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 xh;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 bh{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 kh="1.12.2";class Sh extends Le{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(o(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=v.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&v.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,n={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(n),this.context&&(this.viewSelect&&(v.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,a(n)?[n]:n)}),Gn(this.context.__proto__))}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&v.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),v.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,v.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};_.copyAttrs(e,this,Oe),this.resize(t),s(this.width)||this.resizeListener(new Zr(t,e))}}const{mineType:Eh,fileType:Bh}=qn;function Th(t,e){v.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(Eh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(Eh(Bh(e)),i);return s=s.substring(s.indexOf("64,")+3),v.origin.download(s,e)},download:(t,i)=>new Promise((s,n)=>{let o;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,o=!0);const r=e.getFileSystemManager();r.writeFile({filePath:i,data:t,encoding:"base64",success(){o?v.miniapp.saveToAlbum(i).then(()=>{r.unlink({filePath:i}),s()}):s()},fail(t){n(t)}})}),loadImage:t=>new Promise((e,i)=>{const s=v.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=v.image.getRealURL(t)}),noRepeat:"repeat-x"},v.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},v.event={stopDefault(t){},stopNow(t){},stop(t){}},v.canvas=le.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(le,{canvas:(t,e)=>new Sh(t,e),image:t=>new ro(t)}),v.name="miniapp",v.requestRender=function(t){const{view:e}=v.renderCanvas||v.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},ao(v,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class Rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new xh;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 xh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit($r.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===zr.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 Jr(Jr.DATA,{updatedList:this.updatedList})),this.__updatedList=new xh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Nr.CHANGE,this.__onAttrChange,this],[[zr.ADD,zr.REMOVE],this.__onChildEvent,this],[Jr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ch,updateBounds:Ph,updateChange:Oh}=lr,{pushAllChildBranch:Lh,pushAllParent:Ah}=xr;const{worldBounds:Dh}=mr;class Mh{constructor(t){this.updatedBounds=new Zt,this.beforeBounds=new Zt,this.afterBounds=new Zt,d(t)&&(t=new xh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Dh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Fh,updateAllChange:Ih}=lr,Wh=ee.get("Layouter");class zh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new bh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Qr.START),this.layoutOnce(),t.emitEvent(new Qr(Qr.END,this.layoutedBlocks,this.times))}catch(t){Wh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Wh.warn("layouting"):this.times>3?Wh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Jr.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=oe.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE: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?(Ch(t,!0),e.add(t),t.isBranch&&Lh(t,e),Ah(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ah(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ph(s[t])}Ph(i)}})}(this.__levelList),function(t){t.list.forEach(Oh)}(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,oe.end(e)}fullLayout(){const t=oe.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Qr,o=this.getBlocks(new xh(e));e.emitEvent(new Qr(i,o,this.times)),zh.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),oe.end(t)}static fullLayout(t){Fh(t,!0),t.isBranch?xr.updateBounds(t):lr.updateBounds(t),Ih(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Mh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Mh(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],[Jr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Yh=ee.get("Renderer");class Nh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Qr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit($r.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit($r.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit($r.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Zt,Yh.log(e.innerName,"---\x3e");try{this.emitRender($r.START),this.renderOnce(t),this.emitRender($r.END,this.totalBounds),io.clearRecycled()}catch(t){this.rendering=!1,Yh.error(t)}Yh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Yh.warn("rendering");if(this.times>3)return Yh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Zt,this.renderOptions={},t)this.emitRender($r.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender($r.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender($r.RENDER,this.renderBounds,this.renderOptions),this.emitRender($r.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=oe.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Zt(s);i.save(),s.spread(Nh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),oe.end(e)}fullRender(){const t=oe.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),oe.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ee.showRepaint&&ee.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 Zt;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 Zt(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 Zt(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||Yh.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 $r(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[$r.REQUEST,this.update,this],[Qr.END,this.__onLayoutEnd,this],[$r.AGAIN,this.renderAgain,this],[Zr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Nh.clipSpread=10;const Xh={},{copyRadiusPoint:Hh}=ct,{hitRadiusPoint:Vh}=Ut;class jh{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 xh(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 xh;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||lr.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&lr.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=>lr.worldHittable(t))}getPath(t){const e=new xh,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 xh;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 xh,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,n;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=Vh(i.__world,n.hitRadius?Hh(Xh,o,n.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else s&&this.hitChild(i,o)}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 Uh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new jh(this.target=t,this),this.finder=le.finder&&le.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):he.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Gh(t){return co(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function qh(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Kh(){return(t,e)=>{const i="_"+e;ao(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Zh(t){return(e,i)=>{ao(e,i,lo(i,t))}}Object.assign(le,{watcher:(t,e)=>new Rh(t,e),layouter:(t,e)=>new zh(t,e),renderer:(t,e,i)=>new Nh(t,e,i),selector:(t,e)=>new Uh(t,e)}),v.layout=zh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new xh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Jh={},Qh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},$h={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},tl={},el={},il={},sl={},nl={},ol={apply(){he.need("filter")}},rl={},al={setStyleName:()=>he.need("state"),set:()=>he.need("state")},hl={list:{},register(t,e){hl.list[t]=e},get:t=>hl.list[t]},{parse:ll,objectToCanvasData:dl}=is,{stintSet:cl}=_,{hasTransparent:ul}=Qh,gl={originPaint:{}},_l=ee.get("UIData");class pl 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,_l.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,_l.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(cl(this,"__isTransparentFill",ul(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(cl(this,"__isTransparentStroke",ul(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?ll(t):dl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){fl(this,"shadow",t)}setInnerShadow(t){fl(this,"innerShadow",t)}setFilter(t){fl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&el.compute("fill",this.__leaf),e&&el.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gl)):(this.__isStrokes=!0,this._stroke||(this._stroke=gl))}__removePaint(t,e){e&&this.__removeInput(t),il.recycleImage(t,this),"fill"===t?(cl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(cl(this,"__isAlphaPixelStroke",void 0),cl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function fl(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 ml extends pl{}class yl extends ml{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 vl extends ml{__getInputData(t,e){const i=super.__getInputData(t,e);return Oe.forEach(t=>delete i[t]),i}}class wl extends yl{}class xl extends pl{get __usePathBox(){return this.points||this.__pathInputed}}class bl extends pl{get __boxStroke(){return!this.__pathInputed}}class kl extends pl{get __boxStroke(){return!this.__pathInputed}}class Sl extends xl{}class El extends pl{}class Bl extends pl{get __pathInputed(){return 2}}class Tl extends ml{}const Rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Cl extends pl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=Rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ce.get("Rect",0);const n=e.__layout,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 Pl extends bl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Ol extends bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Ll,add:Al}=R,Dl={__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=Ll(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=nl.getShadowRenderSpread(this,e)),s&&(t=Ll(t,s)),o&&(t=Al(t,ol.getSpread(o))),r&&(t=Al(t,r)),a&&(t=Al(t,a));let l=t;return i&&(l=Ll(l,nl.getInnerShadowSpread(this,i))),n&&(l=Ll(l,n)),this.__layout.renderShapeSpread=l,h?Ll(h.__updateRenderSpread(),t):t}},{stintSet:Ml}=_,Fl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ml(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ml(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ml(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!nl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Ml(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Il(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=el.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&nl.shadow(this,t,h),a&&(s.__isStrokes?el.strokes(o,this,t,e):el.stroke(o,this,t,e)),n&&(s.__isFills?el.fills(n,this,t,e):el.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&nl.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?el.strokes(o,this,t,e):el.stroke(o,this,t,e)),c&&ol.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?el.strokes(o,this,t,e):el.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?el.fills(n,this,t,e):el.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?el.strokes(o,this,t,e):el.stroke(o,this,t,e))}}else s.__pathForRender?Il(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?el.fills(s,this,t,e):el.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?el.strokes(n,this,t,e):el.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Il(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&el.stroke(n,t,e,i),s&&el.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&el.stroke(n,t,e,i)}const Wl={__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 zl;let Yl=zl=class extends dh{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 jn.set(this.path=t||[]),t||this.__drawPathByBox(jn),jn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return he.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return he.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?is.toCanvasData(i,!0):i}getPathString(t,e,i){return is.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||rl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&tl.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?nn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,o,a(e)?[e]:e)}else t.rect(i,s,n,o);t.closePath()}drawImagePlaceholder(t,e,i){el.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),he.need("animate")}killAnimate(t,e){}export(t,e){return he.need("export")}syncExport(t,e){return he.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),zl.one(e)}static one(t,e,i,s,n){return ce.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Zo()(this)}static registerData(t){Yo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([Yo(pl)],Yl.prototype,"__",void 0),me([Kh()],Yl.prototype,"zoomLayer",void 0),me([_o("")],Yl.prototype,"id",void 0),me([_o("")],Yl.prototype,"name",void 0),me([_o("")],Yl.prototype,"className",void 0),me([Co("pass-through")],Yl.prototype,"blendMode",void 0),me([Oo(1)],Yl.prototype,"opacity",void 0),me([Lo(!0)],Yl.prototype,"visible",void 0),me([Co(!1)],Yl.prototype,"locked",void 0),me([Po(!1)],Yl.prototype,"dim",void 0),me([Po(!1)],Yl.prototype,"dimskip",void 0),me([Mo(0)],Yl.prototype,"zIndex",void 0),me([Fo(!1)],Yl.prototype,"mask",void 0),me([Io(!1)],Yl.prototype,"eraser",void 0),me([po(0,!0)],Yl.prototype,"x",void 0),me([po(0,!0)],Yl.prototype,"y",void 0),me([wo(100,!0)],Yl.prototype,"width",void 0),me([wo(100,!0)],Yl.prototype,"height",void 0),me([yo(1,!0)],Yl.prototype,"scaleX",void 0),me([yo(1,!0)],Yl.prototype,"scaleY",void 0),me([vo(0,!0)],Yl.prototype,"rotation",void 0),me([vo(0,!0)],Yl.prototype,"skewX",void 0),me([vo(0,!0)],Yl.prototype,"skewY",void 0),me([po(0,!0)],Yl.prototype,"offsetX",void 0),me([po(0,!0)],Yl.prototype,"offsetY",void 0),me([fo(0,!0)],Yl.prototype,"scrollX",void 0),me([fo(0,!0)],Yl.prototype,"scrollY",void 0),me([mo()],Yl.prototype,"origin",void 0),me([mo()],Yl.prototype,"around",void 0),me([_o(!1)],Yl.prototype,"lazy",void 0),me([xo(1)],Yl.prototype,"pixelRatio",void 0),me([Ro(0)],Yl.prototype,"renderSpread",void 0),me([ko()],Yl.prototype,"path",void 0),me([So()],Yl.prototype,"windingRule",void 0),me([So(!0)],Yl.prototype,"closed",void 0),me([wo(0)],Yl.prototype,"padding",void 0),me([wo(!1)],Yl.prototype,"lockRatio",void 0),me([wo()],Yl.prototype,"widthRange",void 0),me([wo()],Yl.prototype,"heightRange",void 0),me([_o(!1)],Yl.prototype,"draggable",void 0),me([_o()],Yl.prototype,"dragBounds",void 0),me([_o("auto")],Yl.prototype,"dragBoundsType",void 0),me([_o(!1)],Yl.prototype,"editable",void 0),me([Wo(!0)],Yl.prototype,"hittable",void 0),me([Wo("path")],Yl.prototype,"hitFill",void 0),me([To("path")],Yl.prototype,"hitStroke",void 0),me([Wo(!1)],Yl.prototype,"hitBox",void 0),me([Wo(!0)],Yl.prototype,"hitChildren",void 0),me([Wo(!0)],Yl.prototype,"hitSelf",void 0),me([Wo()],Yl.prototype,"hitRadius",void 0),me([zo("")],Yl.prototype,"cursor",void 0),me([Co()],Yl.prototype,"fill",void 0),me([To(void 0,!0)],Yl.prototype,"stroke",void 0),me([To("inside")],Yl.prototype,"strokeAlign",void 0),me([To(1,!0)],Yl.prototype,"strokeWidth",void 0),me([To(!1)],Yl.prototype,"strokeWidthFixed",void 0),me([To("none")],Yl.prototype,"strokeCap",void 0),me([To("miter")],Yl.prototype,"strokeJoin",void 0),me([To()],Yl.prototype,"dashPattern",void 0),me([To(0)],Yl.prototype,"dashOffset",void 0),me([To(10)],Yl.prototype,"miterLimit",void 0),me([So(0)],Yl.prototype,"cornerRadius",void 0),me([So()],Yl.prototype,"cornerSmoothing",void 0),me([Gh()],Yl.prototype,"shadow",void 0),me([Gh()],Yl.prototype,"innerShadow",void 0),me([Gh()],Yl.prototype,"blur",void 0),me([Gh()],Yl.prototype,"backgroundBlur",void 0),me([Gh()],Yl.prototype,"grayscale",void 0),me([Gh()],Yl.prototype,"filter",void 0),me([Co()],Yl.prototype,"placeholderColor",void 0),me([_o(100)],Yl.prototype,"placeholderDelay",void 0),me([_o({})],Yl.prototype,"data",void 0),me([Uo(dh.prototype.reset)],Yl.prototype,"reset",null),Yl=zl=me([Ko(Dl),Ko(Fl),Go()],Yl);let Nl=class extends Yl{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 Xl;me([Yo(ml)],Nl.prototype,"__",void 0),me([wo(0)],Nl.prototype,"width",void 0),me([wo(0)],Nl.prototype,"height",void 0),Nl=me([Ko(wh),Zo()],Nl);const Hl=ee.get("Leafer");let Vl=Xl=class extends Nl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&to.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Xl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const n=this.canvas=le.canvas(s);this.__controllers.push(this.renderer=le.renderer(this,n,s),this.watcher=le.watcher(this,s),this.layouter=le.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=le.selector(this),this.interaction=le.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=le.hitCanvasManager()),this.canvasManager=new fe,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Tr.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(ta.RESTART):this.emitLeafer(ta.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(ta.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Oe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Zt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Oe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Zr(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Oe),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 Qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Oe.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(ta.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Oe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=_.copyAttrs({},s,Oe);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(ta.BEFORE_READY),this.emitLeafer(ta.READY),this.emitLeafer(ta.AFTER_READY),Tr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ta.VIEW_READY),Tr.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){Tr.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(ta.VIEW_COMPLETED),Tr.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return he.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ta(t,this))}__listenEvents(){const t=oe.start("FirstCreate "+this.innerName);this.once([[ta.START,()=>oe.end(t)],[Qr.START,this.updateLazyBounds,this],[$r.START,this.__onCreated,this],[$r.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Jr.DATA,this.__onWatchData,this],[Qr.END,this.__onLayoutEnd,this],[$r.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Xl.list.remove(this);try{this.stop(),this.emitLeafer(ta.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{io.clearRecycled()},100)}catch(t){Hl.error(t)}}};t?e():setTimeout(e)}};Vl.list=new xh,me([Yo(vl)],Vl.prototype,"__",void 0),me([wo()],Vl.prototype,"pixelRatio",void 0),me([_o("normal")],Vl.prototype,"mode",void 0),Vl=Xl=me([Zo()],Vl);let jl=class extends Yl{get __tag(){return"Rect"}};me([Yo(bl)],jl.prototype,"__",void 0),jl=me([Ko(Wl),Go(),Zo()],jl);const{add:Ul,includes:Gl,scroll:ql}=Ut,Kl=jl.prototype,Zl=Nl.prototype;let Jl=class extends Nl{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"))&&(Ul(a,o),ql(a,i)),this.__updateRectRenderBounds(),t=!Gl(o,a),t&&"show"===r&&Ul(n,a)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([Yo(yl)],Jl.prototype,"__",void 0),me([wo(100)],Jl.prototype,"width",void 0),me([wo(100)],Jl.prototype,"height",void 0),me([_o(!1)],Jl.prototype,"resizeChildren",void 0),me([Ro("show")],Jl.prototype,"overflow",void 0),me([Uo(Kl.__updateStrokeSpread)],Jl.prototype,"__updateStrokeSpread",null),me([Uo(Kl.__updateRenderSpread)],Jl.prototype,"__updateRectRenderSpread",null),me([Uo(Kl.__updateBoxBounds)],Jl.prototype,"__updateRectBoxBounds",null),me([Uo(Kl.__updateStrokeBounds)],Jl.prototype,"__updateStrokeBounds",null),me([Uo(Kl.__updateRenderBounds)],Jl.prototype,"__updateRectRenderBounds",null),me([Uo(Kl.__updateChange)],Jl.prototype,"__updateRectChange",null),me([Uo(Kl.__render)],Jl.prototype,"__renderRect",null),me([Uo(Zl.__render)],Jl.prototype,"__renderGroup",null),Jl=me([Go(),Zo()],Jl);let Ql=class extends Jl{get __tag(){return"Frame"}get isFrame(){return!0}};me([Yo(wl)],Ql.prototype,"__",void 0),me([Co("#FFFFFF")],Ql.prototype,"fill",void 0),me([Ro("hide")],Ql.prototype,"overflow",void 0),Ql=me([Zo()],Ql);const{moveTo:$l,closePath:td,ellipse:ed}=Es;let id=class extends Yl{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&&ed(a,o,r,o*i,r*i,0,s,n,!1),ed(a,o,r,o,r,0,n,s,!0)):(i<1&&(ed(a,o,r,o*i,r*i),$l(a,t,r)),ed(a,o,r,o,r,0,360,0,!0)):s||n?($l(a,o,r),ed(a,o,r,o,r,0,s,n,!1)):ed(a,o,r,o,r),td(a),v.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([Yo(kl)],id.prototype,"__",void 0),me([So(0)],id.prototype,"innerRadius",void 0),me([So(0)],id.prototype,"startAngle",void 0),me([So(0)],id.prototype,"endAngle",void 0),id=me([Zo()],id);const{sin:sd,cos:nd,PI:od}=Math,{moveTo:rd,lineTo:ad,closePath:hd,drawPoints:ld}=Es;let dd=class extends Yl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ld(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;rd(e,o,0);for(let t=1;t<n;t++)ad(e,o+o*sd(2*t*od/n),r-r*nd(2*t*od/n));hd(e)}}};me([Yo(Sl)],dd.prototype,"__",void 0),me([So(3)],dd.prototype,"sides",void 0),me([So()],dd.prototype,"points",void 0),me([So(0)],dd.prototype,"curve",void 0),dd=me([Go(),Zo()],dd);const{sin:cd,cos:ud,PI:gd}=Math,{moveTo:_d,lineTo:pd,closePath:fd}=Es;let md=class extends Yl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];_d(r,n,0);for(let t=1;t<2*i;t++)pd(r,n+(t%2==0?n:n*s)*cd(t*gd/i),o-(t%2==0?o:o*s)*ud(t*gd/i));fd(r)}};me([Yo(El)],md.prototype,"__",void 0),me([So(5)],md.prototype,"corners",void 0),me([So(.382)],md.prototype,"innerRadius",void 0),md=me([Zo()],md);const{moveTo:yd,lineTo:vd,drawPoints:wd}=Es,{rotate:xd,getAngle:bd,getDistance:kd,defaultPoint:Sd}=ct;let Ed=class extends Yl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&xd(i,e),i}set toPoint(t){this.width=kd(Sd,t),this.rotation=bd(Sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?wd(e,t.points,t.curve,t.closed):(yd(e,0,0),vd(e,this.width,0))}};me([Yo(xl)],Ed.prototype,"__",void 0),me([Eo("center")],Ed.prototype,"strokeAlign",void 0),me([wo(0)],Ed.prototype,"height",void 0),me([So()],Ed.prototype,"points",void 0),me([So(0)],Ed.prototype,"curve",void 0),me([So(!1)],Ed.prototype,"closed",void 0),Ed=me([Zo()],Ed);let Bd=class extends jl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([Yo(Pl)],Bd.prototype,"__",void 0),me([wo("")],Bd.prototype,"url",void 0),Bd=me([Zo()],Bd);const Td=Bd;let Rd=class extends jl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=le.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ro({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Hr(Hr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new vt(t.worldTransform).invert(),o=new vt;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()}};me([Yo(Ol)],Rd.prototype,"__",void 0),me([qh(100)],Rd.prototype,"width",void 0),me([qh(100)],Rd.prototype,"height",void 0),me([qh(1)],Rd.prototype,"pixelRatio",void 0),me([qh(!0)],Rd.prototype,"smooth",void 0),me([_o(!1)],Rd.prototype,"safeResize",void 0),me([qh()],Rd.prototype,"contextSettings",void 0),Rd=me([Zo()],Rd);const{copyAndSpread:Cd,includes:Pd,spread:Od,setList:Ld}=Ut,{stintSet:Ad}=_;let Dd=class extends Yl{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=$h.number(e,n),t.__letterSpacing=$h.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"}`,Ad(t,"__padding",l&&W.fourNumber(l)),Ad(t,"__clipText","show"!==h&&!t.__autoSize),Ad(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&&Od(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),_.stintSet(this,"isOverflow",!Pd(h,a)),this.isOverflow?(Ld(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;Cd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([Yo(Cl)],Dd.prototype,"__",void 0),me([wo(0)],Dd.prototype,"width",void 0),me([wo(0)],Dd.prototype,"height",void 0),me([Co()],Dd.prototype,"boxStyle",void 0),me([_o(!1)],Dd.prototype,"resizeFontSize",void 0),me([Co("#000000")],Dd.prototype,"fill",void 0),me([Eo("outside")],Dd.prototype,"strokeAlign",void 0),me([Wo("all")],Dd.prototype,"hitFill",void 0),me([wo("")],Dd.prototype,"text",void 0),me([wo("")],Dd.prototype,"placeholder",void 0),me([wo("caption")],Dd.prototype,"fontFamily",void 0),me([wo(12)],Dd.prototype,"fontSize",void 0),me([wo("normal")],Dd.prototype,"fontWeight",void 0),me([wo(!1)],Dd.prototype,"italic",void 0),me([wo("none")],Dd.prototype,"textCase",void 0),me([wo("none")],Dd.prototype,"textDecoration",void 0),me([wo(0)],Dd.prototype,"letterSpacing",void 0),me([wo({type:"percent",value:1.5})],Dd.prototype,"lineHeight",void 0),me([wo(0)],Dd.prototype,"paraIndent",void 0),me([wo(0)],Dd.prototype,"paraSpacing",void 0),me([wo("x")],Dd.prototype,"writingMode",void 0),me([wo("left")],Dd.prototype,"textAlign",void 0),me([wo("top")],Dd.prototype,"verticalAlign",void 0),me([wo(!0)],Dd.prototype,"autoSizeAlign",void 0),me([wo("normal")],Dd.prototype,"textWrap",void 0),me([wo("show")],Dd.prototype,"textOverflow",void 0),me([Co(!1)],Dd.prototype,"textEditing",void 0),Dd=me([Zo()],Dd);let Md=class extends Yl{get __tag(){return"Path"}};me([Yo(Bl)],Md.prototype,"__",void 0),me([Eo("center")],Md.prototype,"strokeAlign",void 0),Md=me([Zo()],Md);let Fd=class extends Nl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Md(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")}};me([Yo(Tl)],Fd.prototype,"__",void 0),me([(t,e)=>{ao(t,e,{get(){return this.__path}})}],Fd.prototype,"path",void 0),Fd=me([Ko(Xs,["set","path","paint"]),Zo()],Fd);let Id=class extends Vl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&le.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Vl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),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&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Oe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Qr.END,this.__onReady,this],[$r.START,this.__onCreated,this],[$r.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_($r.END,this.__onChildRenderEnd,this))}};Id=me([Zo()],Id);const Wd={},zd={isHoldSpaceKey:()=>zd.isHold("Space"),isHold:t=>Wd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Wd[t]||(Wd[t]=!0)},setUpCode(t){Wd[t]=!1}},Yd={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 Nd extends Wr{get spaceKey(){return zd.isHoldSpaceKey()}get left(){return Yd.left(this)}get right(){return Yd.right(this)}get middle(){return Yd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return zd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){_e.changeName(t,e)}}const{min:Xd,max:Hd,abs:Vd}=Math,{float:jd,sign:Ud}=W,{minX:Gd,maxX:qd,minY:Kd,maxY:Zd}=Ut,Jd=new Zt,Qd=new Zt,$d={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&tc.getValidMove(t.__localBoxBounds,tc.getDragBounds(t),s,e,!0),tc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&tc.getValidScaleOf(t.__localBoxBounds,tc.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)),tc.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),tc.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=jd(s.x),s.y=jd(s.y),s},getValidScaleOf(t,e,i,s,n,o,a){a||(n=Object.assign({},n)),Qd.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 tc.isInnerMode(t,e,i,"width")?(n.x<0&&Jd.scaleOf(s,f=1/n.x,1),_=jd(Jd.minX-Qd.minX),p=jd(Qd.maxX-Jd.maxX),u=h&&_>0?1+_/(h*Jd.width):1,g=l&&p>0?1+p/(l*Jd.width):1,f*=Hd(u,g)):(n.x<0&&((jd(Gd(t)-Gd(e))<=0||jd(qd(e)-qd(t))<=0)&&Jd.scaleOf(s,f=1/n.x,1),Jd.unsign()),_=jd(Qd.minX-Jd.minX),p=jd(Jd.maxX-Qd.maxX),u=h&&_>0?1-_/(h*Jd.width):1,g=l&&p>0?1-p/(l*Jd.width):1,f*=Xd(u,g)),tc.isInnerMode(t,e,i,"height")?(n.y<0&&Jd.scaleOf(s,1,m=1/n.y),_=jd(Jd.minY-Qd.minY),p=jd(Qd.maxY-Jd.maxY),u=d&&_>0?1+_/(d*Jd.height):1,g=c&&p>0?1+p/(c*Jd.height):1,m*=Hd(u,g),o&&(u=Hd(Vd(f),Vd(m)),f=Ud(f)*u,m=Ud(m)*u)):(n.y<0&&((jd(Kd(t)-Kd(e))<=0||jd(Zd(e)-Zd(t))<=0)&&Jd.scaleOf(s,1,m=1/n.y),Jd.unsign()),_=jd(Qd.minY-Jd.minY),p=jd(Jd.maxY-Qd.maxY),u=d&&_>0?1-_/(d*Jd.height):1,g=c&&p>0?1-p/(c*Jd.height):1,m*=Xd(u,g)),n.x*=r(f)?f:1,n.y*=r(m)?m:1,n}},tc=$d;let ec=class extends Nd{};ec.POINTER="pointer",ec.BEFORE_DOWN="pointer.before_down",ec.BEFORE_MOVE="pointer.before_move",ec.BEFORE_UP="pointer.before_up",ec.DOWN="pointer.down",ec.MOVE="pointer.move",ec.UP="pointer.up",ec.OVER="pointer.over",ec.OUT="pointer.out",ec.ENTER="pointer.enter",ec.LEAVE="pointer.leave",ec.TAP="tap",ec.DOUBLE_TAP="double_tap",ec.CLICK="click",ec.DOUBLE_CLICK="double_click",ec.LONG_PRESS="long_press",ec.LONG_TAP="long_tap",ec.MENU="pointer.menu",ec.MENU_TAP="pointer.menu_tap",ec=me([Jo()],ec);const ic=ec,sc={};let nc=class extends ec{static setList(t){this.list=t instanceof xh?t:new xh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ct.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),$d.axisMove(t,n),n}static limitMove(t,e){$d.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(sc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(sc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(sc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Ut.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ut.unsign(i),i}assignMove(t){sc.x=t?this.totalX:this.moveX,sc.y=t?this.totalY:this.moveY}};nc.BEFORE_DRAG="drag.before_drag",nc.START="drag.start",nc.DRAG="drag",nc.END="drag.end",nc.OVER="drag.over",nc.OUT="drag.out",nc.ENTER="drag.enter",nc.LEAVE="drag.leave",nc=me([Jo()],nc);const oc=nc;let rc=class extends ec{static setList(t){nc.setList(t)}static setData(t){nc.setData(t)}};rc.DROP="drop",rc=me([Jo()],rc);let ac=class extends nc{};ac.BEFORE_MOVE="move.before_move",ac.START="move.start",ac.MOVE="move",ac.DRAG_ANIMATE="move.drag_animate",ac.END="move.end",ac=me([Jo()],ac);let hc=class extends Nd{};hc=me([Jo()],hc);const lc=hc;let dc=class extends ec{};dc.BEFORE_ROTATE="rotate.before_rotate",dc.START="rotate.start",dc.ROTATE="rotate",dc.END="rotate.end",dc=me([Jo()],dc);let cc=class extends nc{};cc.SWIPE="swipe",cc.LEFT="swipe.left",cc.RIGHT="swipe.right",cc.UP="swipe.up",cc.DOWN="swipe.down",cc=me([Jo()],cc);let uc=class extends ec{};uc.BEFORE_ZOOM="zoom.before_zoom",uc.START="zoom.start",uc.ZOOM="zoom",uc.END="zoom.end",uc=me([Jo()],uc);let gc=class extends Nd{};gc.BEFORE_DOWN="key.before_down",gc.BEFORE_UP="key.before_up",gc.DOWN="key.down",gc.HOLD="key.hold",gc.UP="key.up",gc=me([Jo()],gc);const _c={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?cc.UP:t>45&&t<135?cc.DOWN:t<=45&&t>=-45?cc.RIGHT:cc.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:pc.getSwipeDirection(ct.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new xh,{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=>lr.draggable(t)||!t.isLeafer&&t.hasEvent(nc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},pc=_c,fc=new xh,{getDragEventData:mc,getDropEventData:yc,getSwipeEventData:vc}=_c;class wc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=mc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=nc.list||this.draggableList||fc;return this.dragging&&(s?t?fc:new xh(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(ac.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Yd.left(t),this.dragging&&(this.interaction.emit(nc.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],lr.draggable(e)){this.draggableList=new xh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=mc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(ac.BEFORE_MOVE,this.dragData),e.emit(ac.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(nc.BEFORE_DRAG,this.dragData),e.emit(nc.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=nc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);r&&!s&&t?lr.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(nc.OUT,t,i),e.emit(nc.OVER,t,s)):e.emit(nc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(nc.LEAVE,t,i,s),e.emit(nc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=mc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(ac.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(nc.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(ct.getDistance(e,t)>n.config.pointer.swipeDistance){const t=vc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=yc(t,e,nc.data);s.path=i,this.interaction.emit(rc.DROP,s),this.interaction.emit(nc.LEAVE,t,i)}dragReset(){nc.list=nc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const xc=ee.get("emit");const bc=["move","zoom","rotate","key"];function kc(t,e,i,s,n){if(bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Ec(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&&Sc(o,e,i,s,n)}}function Sc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Ec(t,n)&&(al.updateEventStyle&&!s&&al.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=_e.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Ec(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:Tc,pathCanDrag:Rc,pathHasOutside:Cc}=_c;class Pc{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&&Yd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Yd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&zd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=_.clone(Bc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new xh(t),this.createTransformer(),this.dragger=new wc(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Yd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(ec.BEFORE_DOWN,t),this.emit(ec.DOWN,t),Yd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Yd.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&&Yd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(ec.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ct.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(ec.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;Yd.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(ec.BEFORE_UP,t),this.emit(ec.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(ec.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(ec.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,zd.setDownCode(e),this.emit(gc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(gc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,zd.setUpCode(e),this.emit(gc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new xh),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(ec.OUT,t,i),this.emit(ec.OVER,t,e)):this.emit(ec.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(ec.LEAVE,t,i,e),this.emit(ec.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ec.LEAVE,t),this.dragger.dragging&&this.emit(rc.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=[ec.DOUBLE_TAP,ec.DOUBLE_CLICK].some(e=>Tc(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&&!Cc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Rc(t.path))&&!Cc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:ec.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&&ct.round(s),s}emitTap(t){this.emit(ec.TAP,t),this.emit(ec.CLICK,t)}emitDoubleTap(t){this.emit(ec.DOUBLE_TAP,t),this.emit(ec.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(ec.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ec.LONG_TAP,t),(Tc(t.path,ec.LONG_TAP)||Tc(t.path,ec.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 Zt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Zr.RESIZE,this.__onResize,this)],t.once(ta.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],Sc(n,t,e,!0,s))return;n.isApp&&kc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&kc(n,t,e,!1,s),Sc(n,t,e,!1,s))return}catch(t){xc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Oc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Oc.custom={};class Lc extends fe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new xh,this.pixelList=new xh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),le.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),le.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())};const{toInnerRadiusPointOf:Ac,copyRadiusPoint:Dc}=ct,{hitRadiusPoint:Mc,hitPoint:Fc}=Ut,Ic={},Wc={},zc=dh.prototype;zc.hit=function(t,e=0){this.updateLayout(),Dc(Wc,t,e);const i=this.__world;return!!(e?Mc(i,Wc):Fc(i,Wc))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Wc),e,{target:this}):this.__hitWorld(Wc))},zc.__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&&(Dc(Ic,t,i.hitRadius),t=Ic),Ac(t,s,Ic),i.hitBox||o){if(Ut.hitRadiusPoint(n.boxBounds,Ic))return!0;if(o)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Ic,e)},zc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},zc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},zc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},zc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Yc=new vt,Nc=Yl.prototype;Nc.__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=Jt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Jt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),io.patternLocked=!0,this.__renderShape(o,{matrix:Yc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),io.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},Nc.__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 Xc=Yl.prototype,Hc=jl.prototype,Vc=Jl.prototype;Hc.__updateHitCanvas=Vc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Xc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Hc.__hitFill=Vc.__hitFill=function(t){return this.__hitCanvas?Xc.__hitFill.call(this,t):Ut.hitRadiusPoint(this.__layout.boxBounds,t)},Dd.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))},Nl.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 jc=Le.prototype;jc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},jc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},jc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Jt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Jt.x,Jt.y,Jt.width||1,Jt.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 Uc={convertTouch(t,e){const i=Uc.getTouch(t),s=_c.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Gc extends Pc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return s(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Uc.getTouch(t);this.pointerDown(Uc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Uc.getTouch(t);this.pointerMove(Uc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Uc.getTouch(t);this.pointerUp(Uc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(_c.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function qc(t,e,i){t.__.__font?el.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Kc(t,e,i,s,n){const o=i.__;c(t)?el.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&el.strokeArrow(t,i,s,n)}function Zc(t,e,i,s,n){const o=i.__;c(t)?el.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),el.drawTextStroke(i,s,n))}function Jc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Zc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",el.fillText(i,o,n),o.blendMode="normal",lr.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}const{getSpread:Qc,copyAndSpread:$c,toOuterOf:tu,getOuterOf:eu,getByMove:iu,move:su,getIntersectData:nu}=Ut,ou={};let ru;const{stintSet:au}=_,{hasTransparent:hu}=Qh;function lu(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=il.image(i,t,e,r,!ru||!ru[e.url]);break;case"linear":n=sl.linearGradient(e,r);break;case"radial":n=sl.radialGradient(e,r);break;case"angular":n=sl.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)&&hu(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const du={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];d(a)||(a=[a]),ru=il.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=lu(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?(au(i,"__isAlphaPixelFill",n),au(i,"__isTransparentFill",o)):(au(i,"__isAlphaPixelStroke",n),au(i,"__isTransparentStroke",o),au(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,qc(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,il.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),qc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),qc(e,i,s),i.restoreBlendMode()):qc(e,i,s)}},fillPathOrText:qc,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)el.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Kc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Kc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Kc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),lr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){el.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Zc(t,1,e,i,s);break;case"inside":Jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Zc(t,2,e,i,s):Jc(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||!il.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?el.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?el.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;tu(r.strokeSpread?($c(ou,r.boxBounds,r.strokeSpread),ou):r.boxBounds,o,a);let{scaleX:_,scaleY:p}=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?Qc(n,R.swapAndScale(r.renderShapeSpread,_,p)):n;s=nu(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),_*=f,p*=m),u=eu(a,c),h=iu(u,-c.e,-c.f),l=eu(o,c),su(l,-c.e,-c.f);const y=i.matrix;y?(d=new vt(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:_,scaleY:p}}};let cu,uu=new Zt;const{isSame:gu}=Ut;function _u(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||il.createData(n,s,i,o),!0}function pu(t,e){yu(t,Hr.LOAD,e)}function fu(t,e){yu(t,Hr.LOADED,e)}function mu(t,e,i){e.error=i,t.forceUpdate("surface"),yu(t,Hr.ERROR,e)}function yu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Hr(e,i))}function vu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:xu}=$,bu=new Zt,ku={},Su={};function Eu(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 Bu={},Tu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Ru,set:Cu,rotateOfOuter:Pu,translate:Ou,scaleOfOuter:Lu,multiplyParent:Au,scale:Du,rotate:Mu,skew:Fu}=$;function Iu(t,e,i,s,n,o,r,a){r&&Mu(t,r),a&&Fu(t,a.x,a.y),n&&Du(t,n,o),Ou(t,e.x+i,e.y+s)}const{get:Wu,scale:zu,copy:Yu}=$,{getFloorScale:Nu}=W,{abs:Xu}=Math;const Hu={image:function(t,e,i,s,n){let o,r;const a=io.get(i);return cu&&i===cu.paint&&gu(s,cu.boxBounds)?o=cu.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),cu=a.use>1?{leafPaint:o,paint:i,boxBounds:uu.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(_u(t,e,i,a,o,s),n&&(pu(t,r),fu(t,r))):a.error?n&&mu(t,r,a.error):(n&&(vu(t,!0),pu(t,r)),o.loadId=a.load(()=>{vu(t,!1),t.destroyed||(_u(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),fu(t,r)),o.loadId=void 0},e=>{vu(t,!1),mu(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}=il.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&&Zr.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()),il.drawImage(t,o,r,i,s,n),!0):(!t.style||l.sync||d?il.createPattern(t,i,s,n):il.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:_,height:p}=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&&(_*=r.scaleX,p*=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,io.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=io.patternTasker.add(()=>ye(this,void 0,void 0,function*(){il.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=il.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=il.getPatternFixScale(t,n,o);let d,c,u,{width:g,height:_}=i;l&&(n*=l,o*=l),g*=n,_*=o,h&&(c=h.x*n/Xu(s.scaleX||1),u=h.y*o/Xu(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=Nu(g+(c||0)),o*=Nu(_+(u||0)),d=Wu(),a&&Yu(d,a),zu(d,1/n,1/o));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,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=il.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=bu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:g,skew:_,clipSize:p,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(Ut.set(Su,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,ku),b=ku.scaleX,k=ku.scaleY),(h||m||f)&&(b&&Ut.scale(Su,b,k,!0),h&&Ct.toPoint(h,Su,e,Su,!0,!0))):v&&!g||(b=k=Ut.getFitScale(e,Su,"fit"!==a),Ut.put(e,i,h,b,!1,Su),Ut.scale(Su,b,k,!0)),l&&ct.move(Su,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,il.stretchMode(w,e,b,k));break;case"normal":case"clip":if(Su.x||Su.y||b||p||g||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),il.clipMode(w,e,Su.x,Su.y,b,k,g,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||_)&&il.repeatMode(w,e,s,n,Su.x,Su.y,b,k,g,_,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:Eu(o,i,n.width,e&&e.x),y:Eu(r,s,n.height,e&&e.y)}}(m,i&&f,Su.width,Su.height,e));break;default:b&&il.fillOrFitMode(w,e,Su.x,Su.y,b,k,g)}return w.transform||(e.x||e.y)&&xu(w.transform=wu(),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=Ru(),{x:o,y:r}=e;o||r?Ou(n,o,r):n.onlyScale=!0,Du(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=Ru();Ou(a,e.x+i,e.y+s),Du(a,n,o),r&&Pu(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=Ru();Iu(d,e,i,s,n,o,r,a),h&&(r||a?(Cu(Tu),Lu(Tu,e,h,l),Au(d,Tu)):Lu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=Ru();if(c)Iu(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Pu(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Ou(u,s,0);break;case 180:Ou(u,i,s);break;case 270:Ou(u,0,i)}Bu.x=e.x+n,Bu.y=e.y+o,Ou(u,Bu.x,Bu.y),r&&Lu(u,Bu,r,a)}t.transform=u}},{toPoint:Vu}=Bt,{hasTransparent:ju}=Qh,Uu={},Gu={};function qu(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&&ju(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ku,getDistance:Zu}=ct,{get:Ju,rotateOfOuter:Qu,scaleOfOuter:$u}=$,{toPoint:tg}=Bt,eg={},ig={};function sg(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Ku(e,i);o=Ju(),n?($u(o,e,r/a*(s||1),1),Qu(o,e,t+90)):($u(o,e,1,r/a*(s||1)),Qu(o,e,t))}return o}const{getDistance:ng}=ct,{toPoint:og}=Bt,rg={},ag={};const hg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Vu(i||"top",e,Uu),Vu(s||"bottom",e,Gu);const r=v.canvas.createLinearGradient(Uu.x,Uu.y,Gu.x,Gu.y),a={type:n,style:r};return qu(a,r,t.stops,o),a},radialGradient: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.canvas.createRadialGradient(eg.x,eg.y,0,eg.x,eg.y,Zu(eg,ig)),h={type:n,style:a};qu(h,a,t.stops,o);const l=sg(e,eg,ig,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;og(i||"center",e,rg),og(s||"bottom",e,ag);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,rg.x,rg.y):v.canvas.createRadialGradient(rg.x,rg.y,0,rg.x,rg.y,ng(rg,ag)),h={type:n,style:a};qu(h,a,t.stops,o);const l=sg(e,rg,ag,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:sg},{copy:lg,move:dg,toOffsetOutBounds:cg}=Ut,{max:ug,abs:gg}=Math,_g={},pg=new vt,fg={};function mg(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=gg(t.spread||0),r=ug(r,n+o-s),a=ug(a,n+o+i),h=ug(h,n+o+s),l=ug(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function yg(t,e,i){const{shapeBounds:s}=i;let n,o;v.fullImageShadow?(lg(_g,t.bounds),dg(_g,e.x-s.x,e.y-s.y),n=t.bounds,o=_g):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:vg}=Ut,wg={};const xg=mg;const bg={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(),_=r.length-1;cg(h,fg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(fg.offsetX+(r.x||0)*c*f,fg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Qh.string(r.color)),n=nl.getShadowTransform(t,g,i,r,fg,f),n&&g.setTransform(n),yg(g,fg,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")),lr.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&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(),_=r.length-1;vg(h,wg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(wg.offsetX+(r.x||0)*c*f,wg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=nl.getShadowTransform(t,g,i,r,wg,f,!0),n&&g.setTransform(n),yg(g,wg,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"),lr.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&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:mg,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 pg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),pg}},isTransformShadow(t){},getInnerShadowSpread:xg},{excludeRenderBounds:kg}=mr;let Sg;function Eg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Sg||(Sg=!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);Tg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Tg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Bg(t){return t.getSameCanvas(!1,!0)}function Tg(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)}Nl.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&&(Eg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||kg(i,e)||i.__render(t,e),o=i.__.opacity,Sg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Bg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Bg(t)),n||(n=Bg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&Eg(this,r,t,n,s,o,void 0,!1),kg(i,e)||i.__render(n||t,e),d&&Eg(this,r,t,n,s,o,d,!1)}Eg(this,r,t,n,s,o,void 0,!0)};const Rg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Cg=Rg+"_#~&*+\\=|≮≯≈≠=…",Pg=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 Og(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Lg=Og("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ag=Og("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Dg=Og(Rg),Mg=Og(Cg),Fg=Og("- —/~|┆·");var Ig;!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"}(Ig||(Ig={}));const{Letter:Wg,Single:zg,Before:Yg,After:Ng,Symbol:Xg,Break:Hg}=Ig;function Vg(t){return Lg[t]?Wg:Fg[t]?Hg:Ag[t]?Yg:Dg[t]?Ng:Mg[t]?Xg:Pg.test(t)?zg:Wg}const jg={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 Ug(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:Gg}=jg,{Letter:qg,Single:Kg,Before:Zg,After:Jg,Symbol:Qg,Break:$g}=Ig;let t_,e_,i_,s_,n_,o_,r_,a_,h_,l_,d_,c_,u_,g_,__,p_,f_,m_=[];function y_(t,e){h_&&!a_&&(a_=h_),t_.data.push({char:t,width:e}),i_+=e}function v_(){s_+=i_,t_.width=i_,e_.words.push(t_),t_={data:[]},i_=0}function w_(){g_&&(__.paraNumber++,e_.paraStart=!0,g_=!1),h_&&(e_.startCharSize=a_,e_.endCharSize=h_,a_=0),e_.width=s_,p_.width?Gg(e_):f_&&x_(),m_.push(e_),e_={words:[]},s_=0}function x_(){s_>(__.maxWidth||0)&&(__.maxWidth=s_)}const{top:b_,right:k_,bottom:S_,left:E_}=kt;function B_(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 T_={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[E_],n-=a[k_]+a[E_],!n&&(n=.01)):e.autoSizeAlign||(i=a[E_]),r?(s=a[b_],r-=a[b_]+a[S_],!r&&(r=.01)):e.autoSizeAlign||(s=a[b_]));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){__=t,m_=t.rows,p_=t.bounds,f_=!p_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=v,{width:a}=p_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;g_=!0,d_=null,a_=r_=h_=i_=s_=0,t_={data:[]},e_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)o_=e[i],"\n"===o_?(i_&&v_(),e_.paraEnd=!0,w_(),g_=!0):(l_=Vg(o_),l_===qg&&"none"!==o&&(o_=Ug(o_,o,!i_)),r_=r.measureText(o_).width,s&&(s<0&&(h_=r_),r_+=s),c_=l_===Kg&&(d_===Kg||d_===qg)||d_===Kg&&l_!==Jg,u_=!(l_!==Zg&&l_!==Kg||d_!==Qg&&d_!==Jg),n_=g_&&n?a-n:a,t&&a&&s_+i_+r_>n_&&(h?(i_&&v_(),s_&&w_()):(u_||(u_=l_===qg&&d_==Jg),c_||u_||l_===$g||l_===Zg||l_===Kg||i_+r_>n_?(i_&&v_(),s_&&w_()):s_&&w_()))," "===o_&&!0!==g_&&s_+i_===0||(l_===$g?(" "===o_&&i_&&v_(),y_(o_,r_),v_()):c_||u_?(i_&&v_(),y_(o_,r_)):y_(o_,r_)),d_=l_);i_&&v_(),s_&&w_(),m_.length>0&&(m_[m_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{__.paraNumber++,s_=r.measureText(t).width,m_.push({x:n||0,text:t,width:s_,paraStart:!0}),f_&&x_()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":B_(e,"x",t[E_]);break;case"right":B_(e,"x",-t[k_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":B_(e,"y",t[b_]);break;case"bottom":B_(e,"y",-t[S_])}}(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:_,width:p,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":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!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&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,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&&(_=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===p?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===p?(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 R_={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+")"}};Object.assign(Jh,T_),Object.assign(Qh,R_),Object.assign(el,du),Object.assign(il,Hu),Object.assign(sl,hg),Object.assign(nl,bg),Object.assign(le,{interaction:(t,e,i,s)=>new Gc(t,e,i,s),hitCanvas:(t,e)=>new Sh(t,e),hitCanvasManager:()=>new Lc}),Vl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Th(0,wx)}catch(t){}function C_(t){return t?d(t)?t:[t]:[]}class P_ extends Wr{get list(){return C_(this.value)}get oldList(){return C_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function O_(t){return(e,i)=>{const s="_"+i;ao(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?P_.BEFORE_SELECT:P_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new P_(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}P_.BEFORE_SELECT="editor.before_select",P_.SELECT="editor.select",P_.AFTER_SELECT="editor.after_select",P_.BEFORE_HOVER="editor.before_hover",P_.HOVER="editor.hover";const{abs:L_}=Math,{copy:A_}=$,{setListWithFn:D_}=Ut,{worldBounds:M_}=mr,F_={a:1,b:0,c:0,d:1,e:0,f:0},I_={x:0,y:0,width:0,height:0};class W_ extends Yl{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?(D_(I_,e,M_),t&&this.set(t),this.set(I_),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=L_(c.scaleX),l=L_(c.scaleY);A_(F_,c),F_.half=a%2,t.setWorld(F_,e.matrix),t.beginPath(),"path"===this.strokePathType||s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Math.max(i,l),r&&(o(r)?el.stroke(r,this,t,e):el.strokes(r,this,t,e)),h&&(o(h)?el.fill(h,this,t,e):el.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}me([O_(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],W_.prototype,"target",void 0),me([Co("render-path")],W_.prototype,"strokePathType",void 0);class z_ extends Nl{constructor(t){super(t),this.strokeArea=new jl({strokeAlign:"center"}),this.fillArea=new jl,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 Y_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return N_([t],i,e),i}};function N_(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&&N_(s.children,e,i)}}const{findOne:X_,findByBounds:H_}=Y_;class V_ extends Nl{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 W_,this.targetStroker=new W_,this.bounds=new Zt,this.selectArea=new z_,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,selectedPathType:i,selectedStyle:s}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2),strokePathType:i},s||{}))}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 xh(H_(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)&&!X_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new xh(this.editor.editBox.rect)};return X_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):X_(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_([[P_.HOVER,this.onHover,this],[P_.SELECT,this.onSelect,this]]),e.on_([[ec.MOVE,this.onPointerMove,this],[ec.BEFORE_DOWN,this.onBeforeDown,this],[ec.TAP,this.onTap,this],[nc.START,this.onDragStart,this,!0],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ac.MOVE,this.onAutoMove,this],[[uc.ZOOM,ac.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:j_,top:U_,topRight:G_,right:q_,bottomRight:K_,bottom:Z_,bottomLeft:J_,left:Q_}=St,{toPoint:$_}=Bt,{within:tp,sign:ep}=W,{abs:ip}=Math,sp={getScaleData(t,e,i,s,n,o,r,h){let l,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=ep(x),S=ep(b),E=h?x:k*_.width/v,B=h?b:S*_.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 U_:g=t,l="bottom";break;case q_:u=e,l="left";break;case Z_:g=r,l="top";break;case Q_:u=a,l="right";break;case j_:g=t,u=a,l="bottom-right";break;case G_:g=t,u=e,l="bottom-left";break;case K_:g=r,u=e,l="top-left";break;case J_:g=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case U_:case Z_:u=g;break;case Q_:case q_:g=u;break;default:d=Math.sqrt(ip(u*g)),u=ep(u)*d,g=ep(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/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if($_(o||l,_,c,!0),m){const e={x:u,y:g};$d.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=tp(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=tp(e*g,f)/e}return T&&ip(u*y.width)<1&&(u=ep(u)/y.width),R&&ip(g*y.height)<1&&(g=ep(g)/y.height),n&&u!==g&&(d=Math.min(ip(u),ip(g)),u=ep(u)*d,g=ep(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 j_:o="bottom-right";break;case G_:o="bottom-left";break;case K_:o="top-left";break;case J_:o="top-right";break;default:o="center"}return $_(n||o,t.boxBounds,r,!0),{origin:r,rotation:ct.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case U_:case j_:o={x:.5,y:0},n="bottom",a=1;break;case Z_:case K_:o={x:.5,y:1},n="top",a=1;break;case Q_:case J_:o={x:0,y:.5},n="right",h=1;break;case q_:case G_: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,$_(s||n,t,r,!0);const c=ct.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 Q_:t=q_;break;case j_:t=G_;break;case J_:t=K_;break;case q_:t=Q_;break;case G_:t=j_;break;case K_:t=J_}if(i)switch(t){case U_:t=Z_;break;case j_:t=J_;break;case G_:t=K_;break;case Z_:t=U_;break;case J_:t=j_;break;case K_:t=G_}return t}},np={};function op(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 rp(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(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*(sp.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;np[S]?i.cursor=np[S]:np[S]=i.cursor={url:ap(x,h),x:b,y:k}}function rp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function ap(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class hp extends Jl{constructor(t){super(t),this.useFastShadow=!0}}const lp=["top","right","bottom","left"],dp=void 0;class cp extends Nl{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 Nl,this.rect=new hp({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new hp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Nl({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 hp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new hp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new hp({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 p;this.visible=!t.locked;for(let t=0;t<8;t++)p=r[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.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:dp},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&&_.stintSet(t.__world,"ignorePixelSnap",d),rp(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:_,hideOnSmall:p,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&&Ut.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=a(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)Bt.toPoint(Bt.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!_),v.visible=y&&_&&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,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));o.visible=y&&_&&!(!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=lp.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=lp.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?sp.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:dp};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)}op(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&&(Zr.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 nc||t instanceof ac)&&this.transformTool.onMove(t),this.resizing&&(Zr.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 ac.START:this.onTransformStart(t);break;case ac.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 uc.START:this.onTransformStart(t);break;case uc.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 uc.START:this.onTransformStart(t);break;case uc.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){op(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 Dd)||t.find(t=>t instanceof Dd);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_([[nc.START,this.onDragStart,this],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ec.ENTER,e=>{this.enterPoint=t,op(this,e)}],[ec.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[ec.DOUBLE_TAP,this.onDoubleTap,this],[ec.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[gc.HOLD,gc.UP],this.onKey,this],[gc.DOWN,this.onArrow,this],[[ac.START,ac.BEFORE_MOVE,ac.END],this.onMove,this,!0],[[uc.START,uc.BEFORE_ZOOM,uc.END],this.onScale,this,!0],[[dc.START,dc.BEFORE_ROTATE,dc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const up={x:0,y:0,width:1e5,height:1e5};class gp extends Yl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,up),Object.assign(this.__world,up)}__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 _p='\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"/>',pp={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${_p}\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${_p}\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${_p}\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},fp=new Zt;function mp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{fp.setListWithFn(i,t=>t.getBounds("box","page")),0===fp.width&&(fp.width=.1),0===fp.height&&(fp.height=.1),e.reset(fp.get())}),s.add(e)}const yp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),vp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),wp={group(t,e,i){t.sort(vp);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Nl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(yp);const r=new vt(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(yp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(vp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},xp=ee.get("EditToolCreator");function bp(){return t=>{Sp.register(t)}}const kp=bp,Sp={list:{},register(t){const{tag:e}=t.prototype;Ep[e]&&xp.repeat(e),Ep[e]=t},get:(t,e)=>new Ep[t](e)},{list:Ep}=Sp;class Bp extends P_{constructor(t,e){super(t,e)}}Bp.BEFORE_OPEN="innerEditor.before_open",Bp.OPEN="innerEditor.open",Bp.BEFORE_CLOSE="innerEditor.before_close",Bp.CLOSE="innerEditor.close";class Tp extends P_{constructor(t,e){super(t,e)}}Tp.BEFORE_GROUP="editor.before_group",Tp.GROUP="editor.group",Tp.BEFORE_UNGROUP="editor.before_ungroup",Tp.UNGROUP="editor.ungroup",Tp.BEFORE_OPEN="editor.before_open_group",Tp.OPEN="editor.open_group",Tp.BEFORE_CLOSE="editor.before_close_group",Tp.CLOSE="editor.close_group";const{updateMatrix:Rp}=lr,Cp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Pp="top-left";class Op extends jl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Nr.CHANGE,e=>{if(this.checkChange&&Cp[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,Rp(this.parent),Rp(this);const a=new vt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Rp(this),this.changedTransform=new vt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(Pp,o);break;case"scaleX":t.scaleOf(Pp,o,1);break;case"scaleY":t.scaleOf(Pp,1,o);break;case"skewX":t.skewOf(Pp,o,0);break;case"skewY":t.skewOf(Pp,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Lp extends P_{constructor(t,e){super(t,e)}}Lp.BEFORE_MOVE="editor.before_move",Lp.MOVE="editor.move";class Ap extends P_{constructor(t,e){super(t,e)}}Ap.BEFORE_SCALE="editor.before_scale",Ap.SCALE="editor.scale";class Dp extends P_{constructor(t,e){super(t,e)}}Dp.BEFORE_ROTATE="editor.before_rotate",Dp.ROTATE="editor.rotate";class Mp extends P_{constructor(t,e){super(t,e)}}Mp.BEFORE_SKEW="editor.before_skew",Mp.SKEW="editor.skew";class Fp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:r}=i;const h=t.type===ac.END||t.type===nc.END,l=o(e.draggable),d=!r||h||l,c={x:t.totalX,y:t.totalY};t instanceof ac&&ct.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=nc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(r&&!l&&h?lr.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 uc?(r||(r=e.getBoxPoint(t)),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=sp.getScaleData(e,n.bounds,d,o,a,sp.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof nc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ct.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 dc)d=t.rotation,l=o?Bt.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=sp.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),ct.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}=sp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),sp.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 Lp(Lp.BEFORE_MOVE,h));const l=new Lp(Lp.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 Ap(Ap.BEFORE_SCALE,t));const o=new Ap(Ap.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 Ap(Ap.BEFORE_SCALE,u));const g=new Ap(Ap.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 vt(lr.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 Ap(Ap.BEFORE_SCALE,r));const a=new Ap(Ap.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 Dp(Dp.BEFORE_ROTATE,d));const c=new Dp(Dp.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 Mp(Mp.BEFORE_SKEW,u));const g=new Mp(Mp.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(lr.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new vt(e.worldTransform);return t(),new vt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Ip=class extends Nl{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 xh,this.openedGroupList=new xh,this.simulateTarget=new Op(this),this.editBox=new cp(this),this.editToolList={},this.selector=new V_(this),this.editMask=new gp(this),this.targetEventIds=[];let i=_.clone(pp);t&&(i=_.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),he.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=>_.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&&mp(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||Sp.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(Sp.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(Tp.BEFORE_GROUP),this.target=wp.group(this.list,this.element,t),this.emitGroupEvent(Tp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Tp.BEFORE_UNGROUP,t)),this.target=wp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Tp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Tp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Tp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Tp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Tp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!lr.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 Tp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||Sp.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}Sp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Bp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Bp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Bp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Bp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Bp(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&&(wp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(wp.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_($r.START,this.onRenderStart,this),i&&i.on_(Nr.SCROLL,this.onChildScroll,this),t.on_($r.CHILD_START,this.onAppRenderStart,this),t.on_(ta.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())}};me([(t,e)=>{ao(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}})}],Ip.prototype,"mergeConfig",void 0),me([O_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof xh?i:new xh(i),t.multiple&&mp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new P_(P_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new P_(P_.AFTER_SELECT,s))})],Ip.prototype,"target",void 0),me([O_(function(t,e){t.emitEvent(new P_(P_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Ip.prototype,"hoverTarget",void 0),Ip=me([Ko(Fp,["editBox","editTool","emitEvent"])],Ip);class Wp{static registerInnerEditor(){Sp.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 Nl,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 zp=class extends Wp{static registerEditTool(){Sp.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()}};zp=me([bp()],zp);const{left:Yp,right:Np}=St,{move:Xp,copy:Hp,toNumberPoints:Vp}=ct;let jp=class extends zp{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===Yp;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=Vp(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?(Xp(t,o,r),s&&Xp(e,-o,-r)):(s&&Xp(t,-o,-r),Xp(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),Hp(s[7],i),Hp(e[7],i),Hp(s[3],a),Hp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Yp||t===Np,s[t].visible=a,e[t].visible=!r&&a}};jp=me([bp()],jp);const{M:Up,L:Gp,C:qp,Q:Kp,Z:Zp,N:Jp,D:Qp,X:$p,G:tf,F:ef,O:sf,P:nf,U:of}=Me,rf={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Up:case Gp:af(t,e,i,n,1),n+=3;break;case qp:af(t,e,i,n,3),n+=7;break;case Kp:af(t,e,i,n,2),n+=5;break;case Zp:n+=1;break;case Jp:af(t,e,i,n,2),n+=5;break;case Qp:af(t,e,i,n,2),n+=9;break;case $p:af(t,e,i,n,2),n+=6;break;case tf:af(t,e,i,n,2),n+=9;break;case ef:af(t,e,i,n,2),n+=5;break;case sf:t[n]=tf,t.splice(n+4,0,t[n+3],0),af(t,e,i,n,2),n+=9,o+=2;break;case nf:t[n]=ef,t.splice(n+4,0,t[n+3]),af(t,e,i,n,2),n+=5,o+=1;break;case of:af(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:af}=rf,hf=$.get(),{topLeft:lf,top:df,topRight:cf,right:uf,bottom:gf,left:_f}=St;function pf(t,e,i){t.pathInputed?mf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function ff(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 df:case gf:o=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case _f:case uf:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case lf:case cf: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 mf(t,e,i){rf.scale(t.__.path,e,i),t.path=t.__.path}function yf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):rf.scalePoints(s,e,i),t.points=s}function vf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)hf.a=e,hf.d=i,s[t].transform(hf,!0)}const wf=dh.prototype;function xf(t,e,i){bf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(ac.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);t.zoomLayer.move(i)}),t.on_(ac.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(ac.END,e=>{lr.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(uc.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&&_.assign(i,e),_.assign(t.config,i,t.userConfig)}wf.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))},wf.__scaleResize=function(t,e){pf(this,t,e)},wf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},wf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Dd.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)ff(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),pf(this,t,e)}},Md.prototype.__scaleResize=function(t,e){mf(this,t,e)},Ed.prototype.__scaleResize=function(t,e){this.pathInputed?mf(this,t,e):this.points?yf(this,t,e):this.width*=t},dd.prototype.__scaleResize=function(t,e){this.pathInputed?mf(this,t,e):this.points?yf(this,t,e):pf(this,t,e)},Nl.prototype.__scaleResize=function(t,e){vf(this,t,e)},Jl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||pf(this,t,e),i&&vf(this,t,e)},he.add("resize"),he.add("editor","resize"),le.editor=function(t,e){const i=new Ip(t);return e&&e.sky.add(e.editor=i),i},Jl.addAttr("textBox",!1,_o),Yl.addAttr("editConfig",void 0,_o),Yl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),_o),Yl.addAttr("editInner","PathEditor",_o),Nl.addAttr("editInner","",_o),Dd.addAttr("editInner","TextEditor",_o),Yl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Yl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Yl.setEditInner=function(t){this.changeAttr("editInner",t)};const kf=ee.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=ct.getCenter(e.from,i.from),n=ct.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=ct.getDistance(e.from,i.from);return{move:o,scale:ct.getDistance(e.to,i.to)/r,rotation:ct.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&&(ct.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:Pf}=Math,{sign:Of,within:Lf}=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=Pf(50,o/3)*Of(s)),r>50&&(n=Pf(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=Lf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Lf(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(ac.START,this.moveData)),t.path=this.moveData.path,t.totalX=Df+=t.moveX,t.totalY=Mf+=t.moveY,e.emit(ac.BEFORE_MOVE,t),e.emit(ac.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(uc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Ff*=t.scale,e.emit(uc.BEFORE_ZOOM,t),e.emit(uc.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(dc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=If+=t.rotation,e.emit(dc.BEFORE_ROTATE,t),e.emit(dc.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(ac.END,Object.assign(Object.assign({},e),{totalX:Df,totalY:Mf})),i&&t.emit(uc.END,Object.assign(Object.assign({},i),{totalScale:Ff})),s&&t.emit(dc.END,Object.assign(Object.assign({},s),{totalRotation:If})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const zf=Vl.prototype,Yf=new Zt,Nf=new mt;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),$d.getValidMove(Yf,this.canvas.bounds,"auto",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=Pc.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&&ct.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=wc.prototype,{abs:Uf,min:Gf,max:qf,hypot:Kf}=Math;function Zf(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){const{interaction:e}=this,i=this.canAnimate&&this.moving&&e.m.dragAnimate;if(i){const s=a(i)?i:.95,n=.15,o=150;let r,h,l,d=0,c=0,u=0,g=0,_=3;const{dragDataList:p}=this,f=p.length;for(let t=f-1;t>=qf(f-3,0)&&(l=p[t],!(l.time&&Date.now()-l.time>100));t--)r=_--,d+=l.moveX*r,c+=l.moveY*r,g+=r,h=Kf(l.moveX,l.moveY),h>u&&(u=h);if(g&&(d/=g,c/=g),u>8){const t=1.15+Gf((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=qf(Uf(d),Uf(c));m>o&&(h=o/m,d*=h,c*=h);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),Uf(d)<n&&Uf(c)<n)return this.dragEndReal(t);ct.move(t,d,c),this.drag(t),this.animate(y),e.emit(ac.DRAG_ANIMATE,t)};this.animate(y)}return i},jf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},jf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},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=Ut.maxX(r),d=Ut.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,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=u,ct.move(i,c,u),ct.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},jf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},he.add("viewport"),he.add("view"),Vl.prototype.zoom=function(t,e,i,s){let r;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 Zt,_={x:l.x+l.width/2,y:l.y+l.height/2};let p;h.killAnimate();const{x:f,y:m,scaleX:y,scaleY:v}=h.__,{boxBounds:w}=h;if(o(t))switch(t){case"in":p=Zf(y,"in");break;case"out":p=Zf(y,"out");break;case"fit":t=w;break;case"fit-width":(t=new Zt(w)).height=0;break;case"fit-height":(t=new Zt(w)).width=0}else a(t)&&(p=t/y);if(p)p=this.getValidScale(p),h.scaleOfWorld(_,p,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,mr.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)):(p=this.getValidScale(Math.min(l.width/o,l.height/r)),a+=(l.width-o*p)/2,c+=(l.height-r*p)/2,ct.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(a=0),ct.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class Jf extends Nl{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&&_.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 Zt(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:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.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_(nc.DRAG,this.onDrag,this),e.on_(nc.DRAG,this.onDrag,this),t.on_(nc.END,this.onDragEnd,this),e.on_(nc.END,this.onDragEnd,this),this.target.on_($r.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Zr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}he.add("scroll");class Qf extends xl{}function $f(t){return co(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&bo(this),t.__useArrow=e,Bo(this)}}}))}let tm=class extends Ed{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){tl.register(t,e)}};me([Yo(Qf)],tm.prototype,"__",void 0),me([$f("angle")],tm.prototype,"endArrow",void 0),tm=me([Zo()],tm);const{M:em,L:im,C:sm,Q:nm,O:om}=Me,{rotate:rm,copyFrom:am,scale:hm}=ct,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:_m}=ct,pm={x:-.5},fm={connect:pm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},mm={connect:pm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},ym={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]},vm={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]},wm={offset:pm,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=_.clone(km),Bm=_.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:pm,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:_,dashPath:p}=a;let f=g?g.x:0,m=u?u.x:0;const y=[..._];return r&&p&&y.push(...p),"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,_m(i,s)),o.x=(f+m)*n,y}const{M:Cm,L:Pm,C:Om,Q:Lm,Z:Am,N:Dm,D:Mm,X:Fm,G:Im,F:Wm,O:zm,P:Ym,U:Nm}=Me,{copy:Xm,copyFrom:Hm,getDistancePoint:Vm}=ct,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 Pm:(c<2||l+6>=d)&&(Hm(Km,o[l+1],o[l+2]),!c&&u&&Xm(Um,Km)),l+=3;break;case Om:(1===c||l+7>=d-3)&&Jm(o,qm,Km,l+3),l+=7;break;case Lm:(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===Pm?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 Pm:t=l-3+1;break;case Om:t=l-7+5;break;case Lm:t=l-5+3;break;case Nm:t=l-6+3}t&&Qm(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 Qm(t,e,i){t[i]=e.x,t[i+1]=e.y}he.add("arrow"),Yl.addAttr("startArrow","none",$f),Yl.addAttr("endArrow","none",$f),Object.assign(tl,Zm),Object.assign(el,{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}};me([Yo(class extends yl{})],$m.prototype,"__",void 0),me([mo("x")],$m.prototype,"flow",void 0),$m=me([Zo()],$m);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;Ct.toPoint(i,e,n,ty),e.x=s.__autoWidth?n.x:ty.x,e.y=s.__autoHeight?n.y:ty.y}const{move:ny}=ct;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=_y(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=_y(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function _y(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:py}=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?py(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:yy}=ct;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++)_=s[m=e?h-1-o:o],_.__.inFlow&&0!==_.__.visible&&(p=cy(_,n),r?(_.__flowBounds=p,y||(y=ly(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?gy(t,y,x,e):d&&dy(y,i,x,c),ry(u,y,i),y=ly(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&my(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(yy(_,v-p.x,w-p.y),v+=p.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}=ct;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}=ct;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++)_=s[m=e?h-1-o:o],_.__.inFlow&&0!==_.__.visible&&(p=cy(_,n),r?(_.__flowBounds=p,y||(y=ly(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&fy(t,y,b,e),d&&dy(y,i,b,c),ry(u,y,i),y=ly(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&_y(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(by(_,v-p.x,w-p.y),w+=p.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 co(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)&&bo(this)}}))}he.add("flow","resize");const Ey=Jl.prototype,{__updateBoxBounds:By}=Nl.prototype;Yl.addAttr("flow",!1,mo),Yl.addAttr("gap",0,wo),Yl.addAttr("flowAlign","top-left",wo),Yl.addAttr("flowWrap",!1,wo),Yl.addAttr("itemBox","box",wo),Yl.addAttr("inFlow",!0,wo),Yl.addAttr("autoWidth",void 0,Sy),Yl.addAttr("autoHeight",void 0,Sy),Yl.addAttr("autoBox",void 0,wo);const{copyAndSpread:Ty}=Ut;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:Py,sqrt:Oy,abs:Ly,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=>Py(e,t)}function Hy(t){return e=>1-Py(1-e,t)}function Vy(t){return e=>e<.5?.5*Py(2*e,t):1-.5*Py(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),!(Ly(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?Py(2,10*t-10):0,"expo-out":t=>1===t?1:1-Py(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Py(2,2*t*10-10):.5*(2-Py(2,10-2*t*10)),"circ-in":t=>1-Oy(1-Py(t,2)),"circ-out":t=>Oy(1-Py(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Oy(1-Py(2*t,2))):.5*(Oy(1-Py(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:-Py(2,10*(t-1))*Cy((t-1.1)*Iy),"elastic-out":t=>0===t||1===t?t:Py(2,-10*t)*Cy((t-.1)*Iy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Py(2,10*((t*=2)-1))*Cy((t-1.1)*Iy)*.5:Py(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 aa{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(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:n,attrs: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.startRequestAnimate():(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,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=$h.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(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,_=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,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),n&&(d.easingFn=qy.get(n))}if(!d.autoDuration&&s(d.duration)&&(o>1?n>0||r?_+=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)}_?((this.duration<=g||!n||!n.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):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))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,v.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(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={}),hl.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)}};me([Ky("ease")],Jy.prototype,"easing",void 0),me([Ky(0)],Jy.prototype,"delay",void 0),me([Ky(.2)],Jy.prototype,"duration",void 0),me([Ky("auto")],Jy.prototype,"ending",void 0),me([Ky(!1)],Jy.prototype,"reverse",void 0),me([Ky(!1)],Jy.prototype,"swing",void 0),me([Ky(!1)],Jy.prototype,"loop",void 0),me([Ky(0)],Jy.prototype,"loopDelay",void 0),me([Ky(1)],Jy.prototype,"speed",void 0),me([Ky(!0)],Jy.prototype,"autoplay",void 0),me([Ky()],Jy.prototype,"join",void 0),me([Ky()],Jy.prototype,"jump",void 0),me([Ky()],Jy.prototype,"attrs",void 0),Jy=me([Ko(ya)],Jy);let Qy=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)}};Qy=me([Ko(ya)],Qy);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"},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 _v(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 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=_v(a,s,t+gv),o=_v(a,s,t),r=_v(a,s,t-gv)}return{r:rv(255*n),g:rv(255*o),b:rv(255*r),a:s}}he.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 pv(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 pv(ov(e[1]),ov(e[2]),ov(e[3]),1)}(t))}if(!i){const e=$y[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 hl.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}=hl;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})}he.add("animate","color"),al.canAnimate=!0,Object.assign(hl.list,yv),Object.assign(hl,vv);const Ev=Yl.prototype;Yl.addAttr("animation",void 0,function(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Yl.addAttr("animationOut",void 0,_o),Yl.addAttr("transition",!0,_o),Yl.addAttr("transitionOut",void 0,_o),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 Qy(this,t,n):new Jy(this,t,e,n);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof Qy?o.list.unshift(r):o=new Qy(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 Qy&&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}=hi,Pv={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),_=Cv(d,e,s,o,a),p+=Tv[h]*(Rv(c*c+u*u)+Rv(g*g+_*_));return p*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,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)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,_=d*o+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Me.C,c,u,p,f,m,y)}},{getDistance:Ov}=Pv,{M:Lv,L:Av,C:Dv,Z:Mv}=Me,{float:Fv}=W,Iv={},Wv={},zv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Lv:case Av:zv.transformPoints(t,e,s,1),s+=3;break;case Dv:zv.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)Iv.x=t[n],Iv.y=t[n+1],$.toOuterPoint(e,Iv),t[n]=Iv.x,t[n+1]=Iv.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 Lv:case Av:i=t[a+1],s=t[a+2],e=n===Av&&a>0?ct.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Dv:i=t[a+5],s=t[a+6],e=Pv.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=$h.number(e,t.total);let o,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Lv:case Av:if(r=n[f+1],a=n[f+2],o=s[m],_+o>=e||!t.total)return f||(y=r,v=a),Wv.x=y,Wv.y=v,p.x=r,p.y=a,ct.getDistancePoint(Wv,p,e-_,!0),p.rotation=ct.getAngle(Wv,p),p;y=r,v=a,f+=3;break;case Dv:if(r=n[f+5],a=n[f+6],o=s[m],_+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Pv.getT(e-_,o,y,v,l,d,c,u,r,a,i),hi.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=Pv.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Mv:f+=1;default:o=0}m++,_+=o}return p},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=$h.number(e,t.total);let r,a,h,l,d,c,u,g,_,p,f=0,m={},y=0,v=0,w=0,x=0;const b=n.length;for(;y<b;){switch(d=n[y],d){case Lv:case Av:if(h=n[y+1],l=n[y+2],r=s[v],f+r>e||!t.total)return y||(w=h,x=l),Wv.x=w,Wv.y=x,m.x=h,m.y=l,a=Fv(e-f),a&&(ct.getDistancePoint(Wv,m,a,!0),o.push(d,m.x,m.y)),o;w=h,x=l,y+=3,o.push(d,w,x);break;case Dv:if(c=n[y+1],u=n[y+2],g=n[y+3],_=n[y+4],h=n[y+5],l=n[y+6],r=s[v],f+r>e)return a=Fv(e-f),a&&(p=Pv.getT(a,r,w,x,c,u,g,_,h,l,i),Pv.cut(o,p,w,x,c,u,g,_,h,l)),o;w=h,x=l,y+=7,o.push(d,c,u,g,_,h,l);break;case Mv:y+=1,o.push(d);default:r=0}v++,f+=r}return o}};function Yv(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}he.add("motion-path"),hl.register("motion",function(t,e,i,s){return c(t)&&(t=$h.number(t,s.getMotionTotal())),c(e)&&(e=$h.number(e,s.getMotionTotal())),hl.number(t||0,e||0,i)}),hl.register("motionRotation",function(t,e,i){return hl.number(t,e,i)});const Nv=Yl.prototype,{updateMatrix:Xv,updateAllMatrix:Hv}=lr,{updateBounds:Vv}=xr;function jv(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Gv(t);i.total&&(t.__.__pathForRender=zv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Hv(t),Vv(t,t)):Xv(t));i&&(t.leafer.created=!0)}}function Uv(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 Gv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=zv.getMotionPathData(t.getPath(!0,!0))}function qv(t,e){return co(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?al.setStyleName(this,e,i):al.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Kv(t){return co(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Zv(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 Jv(t,e){c(e)||(e=void 0),tw(t,e,"in")}function Qv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),tw(t,e,"out"))}Yl.addAttr("motionPath",void 0,Yv),Yl.addAttr("motionPrecision",1,Yv),Yl.addAttr("motion",void 0,Yv),Yl.addAttr("motionRotation",!0,Yv),Nv.getMotionPathData=function(){return Gv(Uv(this))},Nv.getMotionPoint=function(t){const e=Uv(this),i=Gv(e);if(!i.total)return{};const s=zv.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:a(n)&&(s.rotation+=n),s},Nv.getMotionTotal=function(){return this.getMotionPathData().total},Nv.__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(),jv(t))}else jv(this)};const $v={};function tw(t,e,i){const{normalStyle:s}=t;e||(e=$v),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==$v&&al.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=sw(e,t),s=t.animate();s&&sw(i,t,s.fromStyle);return i}(t,e):void 0;al.canAnimate&&ew(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=ew(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=iw(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=iw(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function ew(t){let e;const i={},s=Zv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&al.isState(n,t,s)&&(e=nw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&al.isSelected(t,s)&&(e=nw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&al.isPlacehold(t,s)&&(e=nw(i,a)),al.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=nw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&al.isFocus(t,s)&&(e=nw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&al.isHover(t,s)&&(e=nw(i,o));const r=i.pressStyle||t.pressStyle;r&&al.isPress(t,s)&&(e=nw(i,r))}return e?i:void 0}function iw(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&al.animateExcludes[t]||(n[t]=e[t]);return n}function sw(t,e,i){return iw(t,e,i,!0)}function nw(t,e){return Object.assign(t,e),!0}function ow(t,e){const i=t[e];i&&Jv(t,i),t.button&&aw(t.children,e)}function rw(t,e,i){i||(i=t.states[e]),Jv(t,i),t.button&&aw(t.children,null,e)}function aw(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":al.isHover(n)&&(o=!1);break;case"pressStyle":al.isPress(n)&&(o=!1);break;case"focusStyle":al.isFocus(n)&&(o=!1)}o&&ow(n,e)}else s(i)||rw(n,i);n.isBranch&&aw(n.children,e,i)}}function hw(t,e){const i=t[e];i&&Qv(t,i),t.button&&dw(t.children,e)}function lw(t,e,i){Qv(t,i),t.button&&dw(t.children,null,e)}function dw(t,e,i){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?hw(n,e):s(i)||lw(n,i),n.isBranch&&dw(n.children,e,i)}function cw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Zv(e,i);o&&(s=n[t](o))}return s}function uw(t,e,i){let s=e[t];if(!s&&i){const n=Zv(e,i);n&&(s=n[t])}return s}he.add("state"),al.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},al.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Zv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},al.isSelected=function(t,e){return uw("selected",t,e)},al.isDisabled=function(t,e){return uw("disabled",t,e)},al.isFocus=function(t,e){return cw("isFocus",t,e)},al.isHover=function(t,e){return cw("isHover",t,e)},al.isPress=function(t,e){return cw("isPress",t,e)},al.isPlacehold=function(t,e){return t.__.__isPlacehold},al.isDrag=function(t,e){return cw("isDrag",t,e)},al.setStyleName=function(t,e,i){i?rw(t,e,t[e]):lw(t,e,t[e])},al.set=function(t,e){const i=t.states[e];i?rw(t,e,i):lw(t,e,i)},al.getStyle=ew,al.updateStyle=tw,al.updateEventStyle=function(t,e){switch(e){case ec.ENTER:ow(t,"hoverStyle");break;case ec.LEAVE:hw(t,"hoverStyle");break;case ec.DOWN:ow(t,"pressStyle");break;case ec.UP:hw(t,"pressStyle")}};const gw=Yl.prototype;Yl.addAttr("selected",!1,qv,"selectedStyle"),Yl.addAttr("disabled",!1,qv,"disabledStyle"),Yl.addAttr("states",{},Kv),Yl.addAttr("state","",qv),Yl.addAttr("normalStyle",void 0,_o),Yl.addAttr("hoverStyle",void 0,Kv),Yl.addAttr("pressStyle",void 0,Kv),Yl.addAttr("focusStyle",void 0,Kv),Yl.addAttr("selectedStyle",void 0,Kv),Yl.addAttr("disabledStyle",void 0,Kv),Yl.addAttr("placeholderStyle",void 0,Kv),Yl.addAttr("button",!1,_o),gw.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))},gw.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?ow(this,"focusStyle"):hw(this,"focusStyle")})},gw.updateState=function(){al.updateStyle(this,void 0,"in")};const _w=Dd.prototype,pw="text";ao(_w,pw,Object.assign(Object.assign({},ho(_w,pw)),{set(t){const e=this,i=e.text;e.__setAttr(pw,t)&&(bo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class fw extends pl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let mw=class extends Yl{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=io.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 Hr(Hr.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()}};me([Yo(fw)],mw.prototype,"__",void 0),me([wo()],mw.prototype,"robot",void 0),me([_o()],mw.prototype,"actions",void 0),me([_o("")],mw.prototype,"action",void 0),me([Co(0)],mw.prototype,"now",void 0),me([_o(12)],mw.prototype,"FPS",void 0),me([_o(!0)],mw.prototype,"loop",void 0),mw=me([Zo()],mw),he.add("robot");const{Yes:yw,NoAndSkip:vw,YesAndSkip:ww}=e,xw={},bw={},kw={};class Sw{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"#":xw.id=t.substring(1),t=xw;break;case".":bw.className=t.substring(1),t=bw;break;default:kw.tag=t,t=kw}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?_.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&&lr.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),"boolean"==typeof o&&(o=o?1:0),o===yw||o===ww){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<vw&&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_(zr.REMOVE,this.__onRemoveChild,this),this.target.on_(Nr.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 Ew=Yl.prototype;function Bw(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())}Ew.find=function(t,e){return Bw(this).getBy(t,this,!1,e)},Ew.findOne=function(t,e){return Bw(this).getBy(t,this,!0,e)},he.add("find"),le.finder=function(t){return new Sw(t)};const{setPoint:Tw,addPoint:Rw,toBounds:Cw}=xt;const Pw={syncExport(t,e,i){let n;rl.running=!0;try{const o=qn.fileType(e),r=e.includes(".");i=qn.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:_,trim:p,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=qn.isOpaqueImage(e)||b,S=new vt;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:P}=new Zt(o).scale(E.scaleX,E.scaleY);_&&(T+=_.x,R+=_.y,C=_.width,P=_.height);const O={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=le.canvas({width:Math.floor(C),height:Math.floor(P),pixelRatio:B,smooth:w,contextSettings:x});g&&(L=t,L.__worldOpacity=0,t=c||t,O.bounds=A.bounds),A.save();const D=u&&!s(b),M=t.get("fill");if(D&&(t.fill=""),v.render(t,A,O),D&&(t.fill=M),A.restore(),L&&L.__updateWorldOpacity(),p){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?Rw(r,n,o):Tw(r={},n,o)),a++;const h=new Zt;return r&&(Cw(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=le.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=le.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 rl.running=!1,n},export(t,e,i){return rl.running=!0,function(t){Ow||(Ow=new Qn);return new Promise(e=>{Ow.add(()=>ye(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>ye(this,void 0,void 0,function*(){if(!to.isComplete)return v.requestRender(o);const r=rl.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 Aw=Le.prototype,Dw=ee.get("@leafer-in/export");Aw.export=function(t,e){const{quality:i,blob:s}=qn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Aw.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Dw.error(t),i(null)})})},Aw.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Aw.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Dw.error(t),i(!1)})})},he.add("export"),Object.assign(rl,Pw),Yl.prototype.export=function(t,e){return rl.export(this,t,e)},Yl.prototype.syncExport=function(t,e){return rl.syncExport(this,t,e)},he.add("filter"),Object.assign(ol,{list:{},register(t,e){ol.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=ol.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=ol.list[t.type],e&&(i+=e.getSpread(t))}),i}}),he.add("bright"),Yl.addAttr("bright",!1,Po);export{Ct as AlignHelper,Jy as Animate,qy as AnimateEasing,Zy as AnimateEvent,Qy as AnimateList,e as Answer,Id as App,Bt as AroundHelper,tm as Arrow,Qf as ArrowData,Qt as AutoBounds,hi as BezierHelper,Zt as Bounds,Vr as BoundsEvent,Ut as BoundsHelper,Jl as Box,yl as BoxData,wh as Branch,xr as BranchHelper,Wa as BranchRender,Rd as Canvas,Ol as CanvasData,fe as CanvasManager,zr as ChildEvent,Qh as ColorConvert,le as Creator,Oc as Cursor,_ as DataHelper,ee as Debug,kt as Direction4,St as Direction9,$d as DragBoundsHelper,nc as DragEvent,wc as Dragger,rc as DropEvent,cp as EditBox,sp as EditDataHelper,hp as EditPoint,V_ as EditSelect,Y_ as EditSelectHelper,zp as EditTool,Sp as EditToolCreator,Ip as Editor,P_ as EditorEvent,Tp as EditorGroupEvent,wp as EditorHelper,Lp as EditorMoveEvent,Dp as EditorRotateEvent,Ap as EditorScaleEvent,Mp as EditorSkewEvent,nl as Effect,id as Ellipse,kl as EllipseData,mi as EllipseHelper,Wr as Event,_e as EventCreator,aa as Eventer,rl as Export,qn as FileHelper,ol as Filter,Sw as Finder,$m as Flow,R as FourNumberHelper,Ql as Frame,wl as FrameData,Nl as Group,ml as GroupData,Pv as HighBezierHelper,zv as HighCurveHelper,Lc as HitCanvasManager,Bd as Image,Pl as ImageData,Hr as ImageEvent,io as ImageManager,x as IncrementId,Wp as InnerEditor,Bp as InnerEditorEvent,Gc as Interaction,Pc as InteractionBase,_c as InteractionHelper,gc as KeyEvent,zd as Keyboard,Qr as LayoutEvent,zh as Layouter,dh as Leaf,Ma as LeafBounds,mr as LeafBoundsHelper,f as LeafData,wa as LeafDataProxy,ya as LeafEventer,lr as LeafHelper,Ir as LeafLayout,bh as LeafLevelList,xh as LeafList,Ta as LeafMatrix,Fa as LeafRender,Vl as Leafer,Sh as LeaferCanvas,Le as LeaferCanvasBase,vl as LeaferData,ta as LeaferEvent,ro as LeaferImage,Sf as LeaferTypeCreator,Ed as Line,xl as LineData,jp as LineEditTool,W as MathHelper,vt as Matrix,$ as MatrixHelper,ac as MoveEvent,Tf as MultiTouchHelper,oc as MyDragEvent,Td as MyImage,ic as MyPointerEvent,lc as MyTouchEvent,Ie as NeedConvertToCanvasCommandMap,Y as OneRadian,N as PI2,X as PI_2,el as Paint,sl as PaintGradient,il as PaintImage,Md as Path,tl as PathArrow,Zm as PathArrowModule,Fn as PathBounds,Es as PathCommandDataHelper,Me as PathCommandMap,yi as PathCommandNodeHelper,is as PathConvert,Hn as PathCorner,Xs as PathCreator,Bl as PathData,nn as PathDrawer,Ae as PathHelper,dm as PathMatrixHelper,t as PathNodeHandleType,Ne as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,rf as PathScaler,Fd as Pen,Tl as PenData,jh as Picker,v as Platform,he as Plugin,mt as Point,ct as PointHelper,Yd as PointerButton,ec as PointerEvent,dd as Polygon,Sl as PolygonData,Nr as PropertyEvent,jl as Rect,bl as RectData,Xe as RectHelper,Wl as RectRender,$r as RenderEvent,Nh as Renderer,Zr as ResizeEvent,to as Resource,mw as Robot,fw as RobotData,dc as RotateEvent,oe as Run,Jf as ScrollBar,z_ as SelectArea,Uh as Selector,md as Star,El as StarData,al as State,$t as StringNumberMap,W_ as Stroker,cc as SwipeEvent,Jn as TaskItem,Qn as TaskProcessor,Dd as Text,Jh as TextConvert,Cl as TextData,hc as TouchEvent,Fp as TransformTool,Wf as Transformer,hl as Transition,xt as TwoPointBoundsHelper,Yl as UI,Dl as UIBounds,ce as UICreator,pl as UIData,Nd as UIEvent,Fl as UIRender,$h as UnitConvert,Tr as WaitHelper,Jr as WatchEvent,Rh as Watcher,Af as WheelEventHelper,uc as ZoomEvent,xf as addViewport,bf as addViewportConfig,Ro as affectRenderBoundsType,Eo as affectStrokeBoundsType,$f as arrowType,uo as attr,mo as autoLayoutType,wo as boundsType,Gn as canvasPatch,Oe as canvasSizeAttrs,Zh as createAttr,lo as createDescriptor,zo as cursorType,Yo as dataProcessor,_o as dataType,co as decorateLeafAttr,Xo as defineDataProcessor,ao as defineKey,go as defineLeafAttr,Po as dimType,bo as doBoundsType,Bo as doStrokeType,Gh as effectType,i as emptyData,Io as eraserType,Xr as extraPropertyEventMap,V as getBoundsData,ho as getDescriptor,j as getMatrixData,H as getPointData,Wo 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,No as layoutProcessor,oa as leaferTransformAttrMap,Fo as maskType,Yv as motionPathType,xo as naturalBoundsType,Oo as opacityType,Vn as path,ko as pathInputType,So as pathType,jn as pen,po as positionType,bp as registerEditTool,kp as registerInnerEditor,Zo as registerUI,Jo as registerUIEvent,qh as resizeType,Uo as rewrite,Go as rewriteAble,vo as rotationType,pf as scaleResize,ff as scaleResizeFontSize,vf as scaleResizeGroup,mf as scaleResizePath,yf as scaleResizePoints,yo as scaleType,fo as scrollType,Mo as sortType,Kv as stateStyleType,qv as stateType,To as strokeType,Co as surfaceType,Jt as tempBounds,wt as tempMatrix,yt as tempPoint,l as tryToNumber,Th as useCanvas,Ko as useModule,kh as version,Lo as visibleType,Kh as zoomLayerType};
2
2
  //# sourceMappingURL=miniapp.module.min.js.map