@leafer-editor/worker 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +151 -88
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +156 -93
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +17 -17
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function 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 r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return p(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&p(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{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 r in this)if("_"!==r[0]&&(t=this["_"+r],!s(t))){if("path"===r&&!this.__pathInputed)continue;e=n?n[r]:void 0,i[r]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=y;return e[t]?e[t]++:(e[t]=1,0)}},y=m;let v,x,w;const{max:b}=Math,k=[0,0,0,0],E={zero:[...k],tempFour:k,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)=>S(k,t,e,i,s),toTempAB(t,e,i){w=i?a(t)?e:t:[],a(t)?(v=T(t),x=e):a(e)?(v=t,x=T(e)):(v=t,x=e),4!==v.length&&(v=B(v)),4!==x.length&&(x=B(x))},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):(R(t,e,i),S(w,b(v[0],x[0]),b(v[1],x[1]),b(v[2],x[2]),b(v[3],x[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(R(t,e,i),S(w,v[0]+x[0],v[1]+x[1],v[2]+x[2],v[3]+x[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,h,l]=4===t.length?t:B(t);return S(n,h*i,l*e,r*i,o*e)}},{set:S,get:B,setTemp:T,toTempAB:R}=E,{round:L,pow:O,max:C,floor:P,PI:M}=Math,A={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:E.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),A.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:O(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(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&&A.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)=>C(P(t),e)/t,randInt:D,randColor:t=>`rgba(${D(255)},${D(255)},${D(255)},${t||1})`};function D(t){return Math.round(Math.random()*t)}const I=M/180,W=2*M,F=M/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function N(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:V,sqrt:U}=Math,{float:j}=A,G={};function K(){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 Z={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:K(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:N,getWorld:K,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){q.toInnerPoint(t,e,G),q.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){q.translateInner(t,e.x,e.y),q.scale(t,i,s),q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=H(e*=I),a=X(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){q.toInnerPoint(t,e,G),q.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){q.translateInner(t,e.x,e.y),q.rotate(t,i),q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=I,t.a=s+r*i,t.b=n+o*i),e&&(e*=I,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){q.toInnerPoint(t,e,G),q.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){q.translateInner(t,e.x,e.y),q.skew(t,i,s),q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,n,r){const{e:o,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:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){q.multiply(t,q.tempInvert(e))},divideParent(t,e){q.multiplyParent(t,q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=q;return q.copy(e,t),q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,n,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:n}=e,r=i*I,o=H(r),a=X(r);if(s||n){const e=s*I,i=n*I;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||n)&&q.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=U(n*n+r*r),c=t/d;const e=n/d;u=r>0?V(e):-V(e)}else{c=U(o*o+a*a),d=t/c;const e=o/c;u=F-(a>0?V(-e):-V(e))}const e=j(H(u)),i=X(u);d=j(d),c=j(c),g=e?j((o/c+i)/e/I,9):0,_=e?j((r/d-i)/e/I,9):0,u=j(u/I)}else d=n,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*n+e.y*o,f+=e.x*r+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:r,d:o}=t;n||r?i=(s*o-n*r)/(e=U(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){q.set(t)}},q=Z,{float:J}=A,{toInnerPoint:$,toOuterPoint:Q}=Z,{sin:tt,cos:et,abs:it,sqrt:st,atan2:nt,min:rt,round:ot}=Math,at={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ot(t.x-.5)+.5:ot(t.x),t.y=e?ot(t.y-.5)+.5:ot(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ht.defaultPoint);const s=et(e*=I),n=tt(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=ht;return dt(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ht;return dt(i,t),Q(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ht;return dt(i,t),ht.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(dt(t,e),ct(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){Q(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=it(i-t),r=it(s-e);return st(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>rt(lt(t,e,i,s),lt(i,s,n,r)),getAngle:(t,e)=>ut(t,e)/I,getRotation:(t,e,i,s)=>(s||(s=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,n,r,o,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=ut(t,e);return n&&(t=e),s||(e={}),e.x=t.x+et(r)*i,e.y=t.y+tt(r)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){ht.reset(t)}},ht=at,{getDistanceFrom:lt,copy:dt,setRadius:ct,getAtan2:ut}=ht;class gt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?at.copy(this,t):at.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,i){return at.scaleOf(this,t,e,i),this}rotate(t,e){return at.rotate(this,t,e),this}rotateOf(t,e){return at.rotate(this,e,t),this}getRotation(t,e,i){return at.getRotation(this,t,e,i)}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}getCenter(t){return new gt(at.getCenter(this,t))}getDistance(t){return at.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(at.getDistancePoint(this,t,e,i,s))}getAngle(t){return at.getAngle(this,t)}getAtan2(t){return at.getAtan2(this,t)}isSame(t){return at.isSame(this,t)}reset(){return at.reset(this),this}}const _t=new gt;class pt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Z.copy(this,t):Z.set(this,t,e,i,s,n,r),this}setWith(t){return Z.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new pt(this)}translate(t,e){return Z.translate(this,t,e),this}translateInner(t,e){return Z.translateInner(this,t,e),this}scale(t,e){return Z.scale(this,t,e),this}scaleWith(t,e){return Z.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Z.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Z.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Z.scaleOfInner(this,t,e,i),this}rotate(t){return Z.rotate(this,t),this}rotateOfOuter(t,e){return Z.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Z.rotateOfInner(this,t,e),this}skew(t,e){return Z.skew(this,t,e),this}skewOfOuter(t,e,i){return Z.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Z.skewOfInner(this,t,e,i),this}multiply(t){return Z.multiply(this,t),this}multiplyParent(t){return Z.multiplyParent(this,t),this}divide(t){return Z.divide(this,t),this}divideParent(t){return Z.divideParent(this,t),this}invert(){return Z.invert(this),this}invertWith(){return Z.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Z.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Z.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Z.setLayout(this,t,e,i),this}getLayout(t,e,i){return Z.getLayout(this,t,e,i)}withScale(t,e){return Z.withScale(this,t,e)}reset(){Z.reset(this)}}const ft=new pt,mt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){yt(t,e,i),yt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:yt}=mt;var vt,xt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(vt||(vt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(xt||(xt={}));const wt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];wt.forEach(t=>t.type="percent");const bt={directionData:wt,tempPoint:{},get:kt,toPoint(t,e,i,s,n,r){const o=kt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function kt(t){return r(t)?wt[xt[t]]:t}const{toPoint:Et}=bt,St={toPoint(t,e,i,s,n,r){Et(t,i,s,n,e,r)}},{tempPointBounds:Bt,setPoint:Tt,addPoint:Rt,toBounds:Lt}=mt,{toOuterPoint:Ot}=Z,{float:Ct,fourNumber:Pt}=A,{floor:Mt,ceil:At}=Math;let Dt,It,Wt,Ft;const zt={},Yt={},Nt={},Xt={tempBounds:Nt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(d(i)){const e=Pt(i);s?Ht.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ut(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||at.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){at.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Nt,t),Ht.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else zt.x=t.x,zt.y=t.y,Ot(e,zt,Yt),Tt(Bt,Yt.x,Yt.y),zt.x=t.x+t.width,Ot(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),zt.y=t.y+t.height,Ot(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),zt.x=t.x,Ot(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),Lt(Bt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new pt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),r(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Nt.width=n?e.width*=s:e.width*s,Nt.height=n?e.height*=s:e.height*s,St.toPoint(i,Nt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?At(t.width+e-t.x):At(t.width),t.height=i>t.y?At(t.height+i-t.y):At(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Ct(t.x,e),t.y=Ct(t.y,e),t.width=Ct(t.width,e),t.height=Ct(t.height,e)},add(t,e,i){Dt=t.x+t.width,It=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),Dt=Dt>Wt?Dt:Wt,It=It>Ft?It:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Dt-t.x,t.height=It-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Ut(t,n)):Vt(t,n));r&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Tt(Bt,t.x,t.y):Rt(Bt,t.x,t.y)),Lt(Bt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Vt(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=at.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=at.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Dt=s+r,It=n+o,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Dt=Dt<Wt?Dt:Wt,It=It<Ft?It:Ft,r=Dt-s,o=It-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:Vt,copy:Ut}=Ht;class jt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new jt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new jt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Gt=new jt;class Kt{constructor(t,e,i,s,n,r){c(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new jt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Zt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Jt,max:$t}=Math,Qt={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||te.maxCacheSize),isSuperLarge:(t,e,i)=>te.isLarge(t,e,i,te.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=te;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=$t(Jt(e+(s||0)),1),c=$t(Jt(i+(n||0)),1);let u,g,_;l&&(_=Zt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:g=!0);const p=Qt.origin.createCanvas(g?2*d:d,u?2*c:c),f=p.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,te.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(p,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(p,0,0,d,c,u?_:d,u?c:_,d,c))}return p},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:te}=Qt,{randColor:ee}=A;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=se(t)}static set exclude(t){this.excludeList=se(t)}static drawRepaint(t,e){const i=ee();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ie.showBounds,n=t.__nowWorld,r=ee();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(ne.enable){if(ne.filterList.length&&ne.filterList.every(t=>t!==this.name))return;if(ne.excludeList.length&&ne.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ne.enable&&this.warn(...t)}warn(...t){ne.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function se(t){return t?r(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const ne=ie,re=ie.get("RunTime"),oe={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return ae.currentId=ae.idMap[i]=e?performance.now():Date.now(),ae.currentName=ae.nameMap[i]=t,ae.nameToIdMap[t]=i,i},end(t,e){const i=ae.idMap[t],s=ae.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;ae.idMap[t]=ae.nameMap[t]=ae.nameToIdMap[s]=void 0,re.log(s,n,"ms")},endOfName(t,e){const i=ae.nameToIdMap[t];s(i)||ae.end(i,e)}},ae=oe,he=[],le={list:{},add(t,...e){this.list[t]=!0,he.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>he.forEach(t=>le.has(t,!0)));const de={editor:t=>le.need("editor")},ce=ie.get("UICreator"),ue={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&ce.repeat(e),ge[e]=t},get(t,e,i,n,r,o){ge[t]||ce.error("not register "+t);const a=new ge[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:ge}=ue,_e=ie.get("EventCreator"),pe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(fe[e]&&_e.repeat(e),fe[e]=t)})},changeName(t,e){const i=fe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,fe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new fe[t](...e)},{nameList:fe}=pe;class me{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=de.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function ye(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function ve(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function xe(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 be(){return(t,e)=>{we.push(e)}}const ke=[];let Ee=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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};ye([xe("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),ye([xe("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),ye([xe("globalAlpha")],Ee.prototype,"opacity",void 0),ye([xe()],Ee.prototype,"fillStyle",void 0),ye([xe()],Ee.prototype,"strokeStyle",void 0),ye([xe("lineWidth")],Ee.prototype,"strokeWidth",void 0),ye([xe("lineCap")],Ee.prototype,"strokeCap",void 0),ye([xe("lineJoin")],Ee.prototype,"strokeJoin",void 0),ye([xe("lineDashOffset")],Ee.prototype,"dashOffset",void 0),ye([xe()],Ee.prototype,"miterLimit",void 0),ye([xe()],Ee.prototype,"shadowBlur",void 0),ye([xe()],Ee.prototype,"shadowColor",void 0),ye([xe()],Ee.prototype,"shadowOffsetX",void 0),ye([xe()],Ee.prototype,"shadowOffsetY",void 0),ye([xe()],Ee.prototype,"filter",void 0),ye([xe()],Ee.prototype,"font",void 0),ye([xe()],Ee.prototype,"fontKerning",void 0),ye([xe()],Ee.prototype,"fontStretch",void 0),ye([xe()],Ee.prototype,"fontVariantCaps",void 0),ye([xe()],Ee.prototype,"textAlign",void 0),ye([xe()],Ee.prototype,"textBaseline",void 0),ye([xe()],Ee.prototype,"textRendering",void 0),ye([xe()],Ee.prototype,"wordSpacing",void 0),ye([xe()],Ee.prototype,"letterSpacing",void 0),ye([xe()],Ee.prototype,"direction",void 0),ye([be()],Ee.prototype,"setTransform",null),ye([be()],Ee.prototype,"resetTransform",null),ye([be()],Ee.prototype,"getTransform",null),ye([be()],Ee.prototype,"save",null),ye([be()],Ee.prototype,"restore",null),ye([be()],Ee.prototype,"translate",null),ye([be()],Ee.prototype,"scale",null),ye([be()],Ee.prototype,"rotate",null),ye([be()],Ee.prototype,"fill",null),ye([be()],Ee.prototype,"stroke",null),ye([be()],Ee.prototype,"clip",null),ye([be()],Ee.prototype,"fillRect",null),ye([be()],Ee.prototype,"strokeRect",null),ye([be()],Ee.prototype,"clearRect",null),ye([be()],Ee.prototype,"beginPath",null),ye([be()],Ee.prototype,"moveTo",null),ye([be()],Ee.prototype,"lineTo",null),ye([be()],Ee.prototype,"bezierCurveTo",null),ye([be()],Ee.prototype,"quadraticCurveTo",null),ye([be()],Ee.prototype,"closePath",null),ye([be()],Ee.prototype,"arc",null),ye([be()],Ee.prototype,"arcTo",null),ye([be()],Ee.prototype,"ellipse",null),ye([be()],Ee.prototype,"rect",null),ye([be()],Ee.prototype,"roundRect",null),ye([be()],Ee.prototype,"createConicGradient",null),ye([be()],Ee.prototype,"createLinearGradient",null),ye([be()],Ee.prototype,"createPattern",null),ye([be()],Ee.prototype,"createRadialGradient",null),ye([be()],Ee.prototype,"fillText",null),ye([be()],Ee.prototype,"measureText",null),ye([be()],Ee.prototype,"strokeText",null);const{copy:Se,multiplyParent:Be,pixelScale:Te}=Z,{round:Re}=Math,Le=new jt,Oe=new jt,Ce={width:1,height:1,pixelRatio:1},Pe=["width","height","pixelRatio"];class Me extends Ee{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ce),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||Qt.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;_.copyAttrs(s,t,Pe),Pe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new jt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Be(t,e,n),Te(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Re(n.e-.5)+.5,n.f=Re(n.f-.5)+.5):(n.e=Re(n.e),n.f=Re(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:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(r=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Oe):i=Le,this.drawImage(t.view,Le.x,Le.y,Le.width,Le.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,Xt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Le.x,Le.y,Le.width,Le.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Le.x,Le.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(Le.x,Le.y,Le.width,Le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Le.x,Le.y,Le.width,Le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Le.x,Le.y,Le.width,Le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Le.x,Le.y,Le.width,Le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Oe,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):de.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},Ie=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},De),We={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ze=Object.assign(Object.assign({},Fe),De),Ye=Ie,Ne={};for(let t in Ye)Ne[Ye[t]]=t;const Xe={};for(let t in Ye)Xe[Ye[t]]=We[t];const He={drawRoundRect(t,e,i,s,n,r){const o=A.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ve,cos:Ue,hypot:je,atan2:Ge,ceil:Ke,abs:Ze,PI:qe,sqrt:Je,pow:$e}=Math,{setPoint:Qe,addPoint:ti}=mt,{set:ei,toNumberPoints:ii}=at,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Ie,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,g,_,p,f,m,y,v=n.length;const x=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,p=a-r,f=Je($e(_,2)+$e(p,2)),m=Je($e(h-o,2)+$e(l-a,2)),(f||m)&&(y=f+m,f=x*f/y,m=x*m/y,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(_||p)&&t.push(ri,u,g,d,c,o,a),u=o+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(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Ae.creator.path=[],He.drawRoundRect(Ae.creator,e,i,s,n,r),t.push(...Ae.convertToCanvasData(Ae.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,g=r-s,_=o-n;let p=Ge(u,c),f=Ge(_,g);const m=je(c,u),y=je(g,_);let v=f-p;if(v<0&&(v+=W),m<1e-12||y<1e-12||v<1e-12||Ze(v-qe)<1e-12)return t&&t.push(ni,s,n),h&&(Qe(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const x=c*_-g*u<0,w=x?-1:1,b=a/Ue(v/2),k=s+b*Ue(p+v/2+F*w),E=n+b*Ve(p+v/2+F*w);return p-=F*w,f-=F*w,ui(t,k,E,a,a,0,p/I,f/I,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*I,g=Ve(u),_=Ue(u);let p=o*I,f=a*I;p>qe&&(p-=W),f<0&&(f+=W);let m=f-p;m<0?m+=W:m>W&&(m-=W),h&&(m-=W);const y=Ke(Ze(m/F)),v=m/y,x=Ve(v/4),w=8/3*x*x/Ve(v/2);f=p+v;let b,k,E,S,B,T,R,L,O=Ue(p),C=Ve(p),P=E=_*s*O-g*n*C,M=S=g*s*O+_*n*C,A=e+E,D=i+S;t&&t.push(t.length?ni:si,A,D),l&&Qe(l,A,D),c&&ei(c,A,D);for(let r=0;r<y;r++)b=Ue(f),k=Ve(f),E=_*s*b-g*n*k,S=g*s*b+_*n*k,B=e+P-w*(_*s*C+g*n*O),T=i+M-w*(g*s*C-_*n*O),R=e+E+w*(_*s*k+g*n*b),L=i+S+w*(g*s*k-_*n*b),t&&t.push(ri,B,T,R,L,e+E,i+S),l&&ci(e+P,i+M,B,T,R,L,e+E,i+S,l,!0),P=E,M=S,O=b,C=k,p=f,f+=v;d&&ei(d,e+E,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,x=i,w=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,b=a),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,g=3*x-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?ti(h,t,e):Qe(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*r+_*a,l.y=c*i+u*n+g*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:gi,cos:_i,sqrt:pi,atan2:fi}=Math,{ellipse:mi}=li,yi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=r*I,_=gi(g),p=_i(g),f=-p*c-_*u,m=-p*u+_*c,y=s*s,v=n*n,x=m*m,w=f*f,b=y*v-y*x-v*w;let k=0;if(b<0){const t=pi(1-b/(y*v));s*=t,n*=t}else k=(o===a?-1:1)*pi(b/(y*x+v*w));const E=k*s*m/n,S=-k*n*f/s,B=fi((m-S)/n,(f-E)/s),T=fi((-m-S)/n,(-f-E)/s);let R=T-B;0===a&&R>0?R-=W:1===a&&R<0&&(R+=W);const L=e+c+p*E-_*S,O=i+u+_*E+p*S,C=R<0?1:0;d||Qt.ellipseToCurve?mi(t,L,O,s,n,r,B/I,T/I,C):s!==n||r?t.push(Ie.G,L,O,s,n,r,B/I,T/I,C):t.push(Ie.O,L,O,s,B/I,T/I,C)}},vi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:wi,L:bi,l:ki,H:Ei,h:Si,V:Bi,v:Ti,C:Ri,c:Li,S:Oi,s:Ci,Q:Pi,q:Mi,T:Ai,t:Di,A:Ii,a:Wi,Z:Fi,z:zi,N:Yi,D:Ni,X:Xi,G:Hi,F:Vi,O:Ui,P:ji,U:Gi}=Ie,{rect:Ki,roundRect:Zi,arcTo:qi,arc:Ji,ellipse:$i,quadraticCurveTo:Qi}=li,{ellipticalArc:ts}=yi,es=ie.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Xe[s],a+=s===n?" ":Ne[s];for(let s=1;s<i;s++)a+=A.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ze:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Ie[s]?(r&&(rs(o,r),r=""),ns.name=Ie[s],ns.length=We[s],ns.index=0,rs(o,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case wi: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 Si:t[c+1]+=a;case Ei:a=t[c+1],g.push(bi,a,h),c+=2;break;case Ti:t[c+1]+=h;case Bi:h=t[c+1],g.push(bi,a,h),c+=2;break;case ki:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],g.push(bi,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Oi;case Oi:o=r===Ri||r===Oi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Ri,l,d,i,s,a,h),c+=5;break;case Li: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=Ri;case Ri:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ri,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Di:t[c+1]+=a,t[c+2]+=h,n=Ai;case Ai:o=r===Pi||r===Ai,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Mi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:i=t[c+1],s=t[c+2],e?Qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Wi:t[c+6]+=a,t[c+7]+=h;case Ii:ts(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 zi:case Fi:g.push(Fi),c++;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4]):os(g,t,c,5),c+=5;break;case Ni:a=t[c+1],h=t[c+2],e?Zi(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 Xi:a=t[c+1],h=t[c+2],e?Zi(g,a,h,t[c+3],t[c+4],t[c+5]):os(g,t,c,6),c+=6;break;case Hi:$i(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,is),a=is.x,h=is.y,c+=9;break;case Vi:e?$i(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 Ui:Ji(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,is),a=is.x,h=is.y,c+=7;break;case ji:e?Ji(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 Gi:qi(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,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${n} [index:${c}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:gs,X:_s,G:ps,F:fs,O:ms,P:ys,U:vs}=Ie,{getMinDistanceFrom:xs,getRadianFrom:ws}=at,{tan:bs,min:ks,abs:Es}=Math,Ss={},Bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(_s,e,i,s,n,r);else{const o=A.fourNumber(r);o?t.push(gs,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){if(s===r)return Rs(t,e,i,s,a,h,l);n(o)?t.push(fs,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(ps,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(ys,e,i,s):(n(r)&&(r=0),n(o)&&(o=360),t.push(ms,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h,l){if(!s(a)){const t=xs(a,h,e,i,n,r)/(l?1:2);o=ks(o,ks(t,t*Es(bs(ws(a,h,e,i,n,r)/2))))}t.push(vs,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){li.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Ss),t.push(as,Ss.x,Ss.y),Ts(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){li.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,Ss),t.push(as,Ss.x,Ss.y),Rs(t,e,i,s,r,o,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Ts,arc:Rs}=Bs,{moveTo:Ls,lineTo:Os,quadraticCurveTo:Cs,bezierCurveTo:Ps,closePath:Ms,beginPath:As,rect:Ds,roundRect:Is,ellipse:Ws,arc:Fs,arcTo:zs,drawEllipse:Ys,drawArc:Ns,drawPoints:Xs}=Bs;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return Ls(this.__path,t,e),this.paint(),this}lineTo(t,e){return Os(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ps(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ms(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 Is(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ws(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return zs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Ys(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Ns(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Vs,L:Us,C:js,Q:Gs,Z:Ks,N:Zs,D:qs,X:Js,G:$s,F:Qs,O:tn,P:en,U:sn}=Ie,nn=ie.get("PathDrawer"),rn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Vs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us: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 Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.closePath(),s+=1;break;case Zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case en:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case sn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void nn.error(`command: ${i} [index:${s}]`,e)}}},{M:on,L:an,C:hn,Q:ln,Z:dn,N:cn,D:un,X:gn,G:_n,F:pn,O:fn,P:mn,U:yn}=Ie,{toTwoPointBounds:vn,toTwoPointBoundsByQuadraticCurve:xn,arcTo:wn,arc:bn,ellipse:kn}=li,{addPointBounds:En,copy:Sn,addPoint:Bn,setPoint:Tn,addBounds:Rn,toBounds:Ln}=mt,On=ie.get("PathBounds");let Cn,Pn,Mn;const An={},Dn={},In={},Wn={toBounds(t,e){Wn.toTwoPointBounds(t,Dn),Ln(Dn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Tn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===dn||o===hn||o===ln?Tn(e,h,l):Tn(e,t[a+1],t[a+2])),o){case on:case an:h=t[a+1],l=t[a+2],Bn(e,h,l),a+=3;break;case hn:n=t[a+5],r=t[a+6],vn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,An),En(e,An),h=n,l=r,a+=7;break;case ln:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],xn(h,l,i,s,n,r,An),En(e,An),h=n,l=r,a+=5;break;case dn:a+=1;break;case cn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=5;break;case un:case gn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=o===un?9:6;break;case _n:kn(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,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=9;break;case pn:h=t[a+1],l=t[a+2],Pn=t[a+3],Mn=t[a+4],Rn(e,h-Pn,l-Mn,2*Pn,2*Mn),h+=Pn,a+=5;break;case fn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],An,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=7;break;case mn:h=t[a+1],l=t[a+2],Cn=t[a+3],Rn(e,h-Cn,l-Cn,2*Cn,2*Cn),h+=Cn,a+=4;break;case yn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],An,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=6;break;default:return void On.error(`command: ${o} [index:${a}]`,t)}}},{M:Fn,L:zn,Z:Yn}=Ie,{getCenterX:Nn,getCenterY:Xn}=at,{arcTo:Hn}=Bs,Vn={smooth(t,e,i){let s,n,r,o=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=9===f,y=[];for(;o<f;){switch(s=t[o],s){case Fn:l=_=t[o+1],c=p=t[o+2],o+=3,t[o]===zn?(u=t[o+1],g=t[o+2],m?y.push(Fn,l,c):y.push(Fn,Nn(l,u),Xn(c,g))):y.push(Fn,l,c);break;case zn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case zn:Hn(y,a,h,t[o+1],t[o+2],e,_,p,m);break;case Yn:Hn(y,a,h,l,c,e,_,p,m);break;default:y.push(zn,a,h)}_=a,p=h;break;case Yn:n!==Yn&&(Hn(y,l,c,u,g,e,_,p,m),y.push(Yn)),o+=1;break;default:r=Xe[s];for(let e=0;e<r;e++)y.push(t[o+e]);o+=r}n=s}return s!==Yn&&(y[1]=l,y[2]=c),y}};function Un(t){return new Hs(t)}const jn=Un();Ae.creator=Un(),Ae.parse=ss.parse,Ae.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Gn}=He;function Kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Gn(this,t,e,i,s,n)})}(t)}const Zn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=qn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},qn=Zn;qn.alphaPixelTypes.forEach(t=>qn.upperCaseTypeMap[t]=t.toUpperCase());const Jn=ie.get("TaskProcessor");class $n{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return ve(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Jn.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,r,o,h;const l=new $n(t);return l.parent=this,a(e)?h=e:e&&(r=e.parallel,n=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(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.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const tr=ie.get("Resource"),er={tasker:new Qn,map:{},get isComplete(){return ir.tasker.isComplete},set(t,e){ir.map[t]&&tr.repeat(t),ir.map[t]=e},get:t=>ir.map[t],remove(t){const e=ir.map[t];e&&(e.destroy&&e.destroy(),delete ir.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 r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=de.image(s)),ir.set(t,e),e},destroy(){ir.map={}}},ir=er,sr={maxRecycled:10,recycledList:[],patternTasker:new Qn({parallel:1}),get(t){let e=er.get(t.url);return e||er.set(t.url,e=de.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(Qt.image.isLarge(t)?t.url&&er.remove(t.url):(t.clearLevels(),nr.recycledList.push(t)))})},recyclePaint(t){nr.recycle(t.image)},clearRecycled(t){const e=nr.recycledList;(e.length>nr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&er.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Zn.alphaPixelTypes.some(e=>nr.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:"+Zn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Zn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},nr=sr,{IMAGE:rr,create:or}=m;class ar{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?Qt.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=or(rr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sr.isFormat("svg",t)&&(this.isSVG=!0),sr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,er.tasker.add(()=>ve(this,void 0,void 0,function*(){return yield Qt.origin.loadImage(this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=Qt.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=Qt.canvas.createPattern(t,e);return Qt.image.setPatternTransform(n,i,s),n}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function hr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function lr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function cr(t,e){return(i,s)=>gr(i,s,t,e&&e(s))}function ur(t){return t}function gr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};hr(t,e,Object.assign(n,s||{})),Xr(t,e,i)}function _r(t){return cr(t)}function pr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function mr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),br(this))}}))}function yr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function vr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function xr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i,e)&&br(this)}}))}function wr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(br(this),this.__.__removeNaturalSize())}}))}function br(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function kr(t){return cr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),br(this)}}))}const Er=xr;function Sr(t,e){return cr(t,t=>({set(i){this.__setAttr(t,i)&&(Br(this),e&&(this.__.__useStroke=!0))}}))}function Br(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&br(t)}const Tr=Sr;function Rr(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Lr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Or(t){return cr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Cr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Mr(this)}}))}function Pr(t){return cr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ar(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ar(this,t,e,i),this.mask&&Mr(this)}}))}function Mr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ar(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||br(t))}function Dr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ir(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Wr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fr(t){return cr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ie.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function zr(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Yr(t){return(e,i)=>{hr(e,"__DataProcessor",{get:()=>t})}}function Nr(t){return(e,i)=>{hr(e,"__LayoutProcessor",{get:()=>t})}}function Xr(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=dr(e,i);if(s(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(c(i)){const t=g(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=lr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),hr(n,e,a)}const Hr=new ie("rewrite"),Vr=[],Ur=["destroy","constructor"];function jr(t){return(e,i)=>{Vr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Gr(){return t=>{Kr()}}function Kr(t){Vr.length&&(Vr.forEach(e=>{t&&Hr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Vr.length=0)}function Zr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ur.includes(s)||e&&e.includes(s)))if(t.prototype){lr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function qr(){return t=>{ue.register(t)}}function Jr(){return t=>{pe.register(t)}}setTimeout(()=>Kr(!0));const{copy:$r,toInnerPoint:Qr,toOuterPoint:to,scaleOfOuter:eo,rotateOfOuter:io,skewOfOuter:so,multiplyParent:no,divideParent:ro,getLayout:oo}=Z,ao={},{round:ho}=Math,lo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),go(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)uo(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)_o(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&_o(t),t.__updateChange()},updateAllChange(t){if(fo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)po(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||Qt.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?to(t.localTransform,r,r,!0):t.parent&&Qr(t.parent.scrollWorldTransform,r,r,!0),co.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ho(e),i=ho(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){co.zoomOfLocal(t,mo(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(a(s)||(s&&(r=s),s=i),$r(ao,o),eo(ao,e,i,s),co.hasHighPosition(t))co.setTransform(t,ao,n,r);else{const e=t.x+ao.e-o.e,a=t.y+ao.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){co.rotateOfLocal(t,mo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;$r(ao,n),io(ao,e,i),co.hasHighPosition(t)?co.setTransform(t,ao,!1,s):t.set({x:t.x+ao.e-n.e,y:t.y+ao.f-n.f,rotation:A.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){co.skewOfLocal(t,mo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){$r(ao,t.__localMatrix),so(ao,e,i,s),co.setTransform(t,ao,n,r)},transformWorld(t,e,i,s){$r(ao,t.worldTransform),no(ao,e),t.parent&&ro(ao,t.parent.scrollWorldTransform),co.setTransform(t,ao,i,s)},transform(t,e,i,s){$r(ao,t.localTransform),no(ao,e),co.setTransform(t,ao,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&co.getInnerOrigin(t,n.origin),o=oo(e,r,n.around&&co.getInnerOrigin(t,n.around));if(co.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=co.getInnerOrigin(t,n.origin);at.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return eo(i,co.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>at.tempToOuterOf(co.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>($r(ao,t.worldTransform),ro(ao,e.scrollWorldTransform),i?ao:Object.assign({},ao)),drop(t,e,i,s){t.setTransform(co.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||co.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),Qt.requestRender(()=>co.animateMove(t,e,i))}}},co=lo,{updateAllMatrix:uo,updateMatrix:go,updateAllWorldOpacity:_o,updateAllChange:po,updateChange:fo}=co;function mo(t,e){return t.updateLayout(),t.parent?at.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const yo={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)=>xo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>xo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>xo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let vo;function xo(t,e){return e||(vo=0),t.__.mask&&(vo=1),vo<0?null:(vo&&(vo=-1),!0)}const{updateBounds:wo}=lo,bo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ko(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++)Eo(e[t],e)},updateBounds(t,e){const i=[t];Eo(t,i),So(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++)wo(s[t]);e&&e===i||wo(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Bo(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&To(t,e,i,s,n,r,o)}},{pushAllChildBranch:ko,pushAllBranchStack:Eo,updateBoundsByBranchStack:So,move:Bo,scale:To}=bo,Ro={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Lo,updateBounds:Oo}=lo,{toOuterOf:Co,getPoints:Po,copy:Mo}=Xt,Ao="_localContentBounds",Do="_worldContentBounds",Io="_worldBoxBounds",Wo="_worldStrokeBounds";class Fo{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 Co(this.contentBounds,this.leaf.__localMatrix,this[Ao]||(this[Ao]={})),this[Ao]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Co(this.contentBounds,this.leaf.__world,this[Do]||(this[Do]={})),this[Do]}get worldBoxBounds(){return Co(this.boxBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}get worldStrokeBounds(){return Co(this.strokeBounds,this.leaf.__world,this[Wo]||(this[Wo]={})),this[Wo]}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 Oo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,Qt.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Z.defaultMatrix;case"page":t=e.zoomLayer;default:return Lo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new jt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Z.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Lo(s,e,!0)}if(o||(o=Z.getLayout(r)),Mo(o,a),at.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,n=Po(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return s(r)||n.forEach(t=>i.innerToWorld(t,null,!1,r)),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 zo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&Qt.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&Qt.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&Qt.event.stop(this.origin)}}class Yo extends zo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Yo.ADD="child.add",Yo.REMOVE="child.remove",Yo.CREATED="created",Yo.MOUNTED="mounted",Yo.UNMOUNTED="unmounted",Yo.DESTROY="destroy";const No="property.scroll";class Xo extends zo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Xo.CHANGE="property.change",Xo.LEAFER_CHANGE="property.leafer_change",Xo.SCROLL=No;const Ho={scrollX:No,scrollY:No};class Vo extends zo{constructor(t,e){super(t),Object.assign(this,e)}}Vo.LOAD="image.load",Vo.LOADED="image.loaded",Vo.ERROR="image.error";class Uo extends zo{static checkHas(t,e,i){"on"===i?e===Zo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(jo)||t.hasEvent(Go)||t.hasEvent(Ko),t.__hasWorldEvent=t.hasEvent(Zo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(jo,t),"inner"===e&&t.emit(Go,t)),t.emit(Ko,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Zo,this)}}Uo.RESIZE="bounds.resize",Uo.INNER="bounds.inner",Uo.LOCAL="bounds.local",Uo.WORLD="bounds.world";const{RESIZE:jo,INNER:Go,LOCAL:Ko,WORLD:Zo}=Uo,qo={};[jo,Go,Ko,Zo].forEach(t=>qo[t]=1);class Jo extends zo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Jo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Jo.RESIZE="resize";class $o extends zo{constructor(t,e){super(t),this.data=e}}$o.REQUEST="watch.request",$o.DATA="watch.data";class Qo extends zo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Qo.REQUEST="layout.request",Qo.START="layout.start",Qo.BEFORE="layout.before",Qo.LAYOUT="layout",Qo.AFTER="layout.after",Qo.AGAIN="layout.again",Qo.END="layout.end";class ta extends zo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ta.REQUEST="render.request",ta.CHILD_START="render.child_start",ta.CHILD_END="render.child_end",ta.START="render.start",ta.BEFORE="render.before",ta.RENDER="render",ta.AFTER="render.after",ta.AGAIN="render.again",ta.END="render.end",ta.NEXT="render.next";class ea extends zo{}ea.START="leafer.start",ea.BEFORE_READY="leafer.before_ready",ea.READY="leafer.ready",ea.AFTER_READY="leafer.after_ready",ea.VIEW_READY="leafer.view_ready",ea.VIEW_COMPLETED="leafer.view_completed",ea.STOP="leafer.stop",ea.RESTART="leafer.restart",ea.END="leafer.end",ea.UPDATE_MODE="leafer.update_mode",ea.TRANSFORM="leafer.transform",ea.MOVE="leafer.move",ea.SCALE="leafer.scale",ea.ROTATE="leafer.rotate",ea.SKEW="leafer.skew";const{MOVE:ia,SCALE:sa,ROTATE:na,SKEW:ra}=ea,oa={x:ia,y:ia,scaleX:sa,scaleY:sa,rotation:na,skewX:ra,skewY:ra},aa={};class ha{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=la(this,s,!0),h=r(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):a[t]=[l],qo[t]&&Uo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=r(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=la(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],qo[t]&&Uo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&pe.has(t)&&(e=pe.get(t,{type:t,target:this,current:this}));const s=la(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:n}=this,r=i&&i[t],o=n&&n[t];return!!(s(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function la(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:aa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:aa)}}const{on:da,on_:ca,off:ua,off_:ga,once:_a,emit:pa,emitEvent:fa,hasEvent:ma,destroy:ya}=ha.prototype,va={on:da,on_:ca,off:ua,off_:ga,once:_a,emit:pa,emitEvent:fa,hasEvent:ma,destroyEventer:ya},xa=ie.get("setAttr"),wa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(xa.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Xo(Xo.LEAFER_CHANGE,this,t,n,e));const i=oa[t];i&&(this.emitEvent(new ea(i,this)),this.emitEvent(new ea(ea.TRANSFORM,this)))}this.emitPropertyEvent(Xo.CHANGE,t,n,e);const i=Ho[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 Xo(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:ba,multiplyParent:ka,translateInner:Ea,defaultWorld:Sa}=Z,{toPoint:Ba,tempPoint:Ta}=bt,Ra={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ka(this.__local||e,t?t.__scrollWorld||t.__world:Sa,i,!!e.affectScaleOrRotation,n),s&&Ea(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)&&(ba(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Ba(i.around||i.origin,t.boxBounds,Ta),Ea(e,-Ta.x,-Ta.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:La,updateAllMatrix:Oa}=lo,{updateBounds:Ca}=bo,{toOuterOf:Pa,copyAndSpread:Ma,copy:Aa}=Xt,{toBounds:Da}=Wn,Ia={__updateWorldBounds(){const{__layout:t,__world:e}=this;Pa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Uo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Uo.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(),Pa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Pa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Pa(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(),Oa(this),Ca(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Oa(this),Ca(this,this))):La(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Aa(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,i)}},Wa={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),lo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Fa}=yo,{hasSize:za}=Xt,Ya={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&za(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Fa(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++)Fa(i[s],e)||i[s].__clip(t,e)}}},Na={},{LEAF:Xa,create:Ha}=m,{stintSet:Va}=_,{toInnerPoint:Ua,toOuterPoint:ja,multiplyParent:Ga}=Z,{toOuterOf:Ka}=Xt,{copy:Za,move:qa}=at,{moveLocal:Ja,zoomOfLocal:$a,rotateOfLocal:Qa,skewOfLocal:th,moveWorld:eh,zoomOfWorld:ih,rotateOfWorld:sh,skewOfWorld:nh,transform:rh,transformWorld:oh,setTransform:ah,getFlipTransform:hh,getLocalOrigin:lh,getRelativeWorld:dh,drop:ch}=lo;let uh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Fo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ha(Xa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Yo.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(Yo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Yo.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(Yo.MOUNTED)):this.__emitLifeEvent(Yo.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 Ga(i,t.matrix,e,void 0,i),Ka(this.__layout.renderBounds,e,e),Va(e,"half",i.half),Va(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}=sr.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),Na.scaleX=i,Na.scaleY=s,Na}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?dh(this,e):this.worldTransform,n=i?t:{};return Ka(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Za(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Za(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ua(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){ja(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return qa(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){ah(this,t,e,i)}transform(t,e,i){rh(this,t,e,i)}move(t,e,i){Ja(this,t,e,i)}moveInner(t,e,i){eh(this,t,e,!0,i)}scaleOf(t,e,i,s,n){$a(this,lh(this,t),e,i,s,n)}rotateOf(t,e,i){Qa(this,lh(this,t),e,i)}skewOf(t,e,i,s,n){th(this,lh(this,t),e,i,s,n)}transformWorld(t,e,i){oh(this,t,e,i)}moveWorld(t,e,i){eh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}rotateOfWorld(t,e){sh(this,t,e)}skewOfWorld(t,e,i,s,n){nh(this,t,e,i,s,n)}flip(t,e){rh(this,hh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return le.need("path")}getMotionPoint(t){return le.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){ch(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Xr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=xr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Yo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Yo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};uh=ye([Zr(wa),Zr(Ra),Zr(Ia),Zr(va),Zr(Wa)],uh);const{setListWithFn:gh}=Xt,{sort:_h}=bo,{localBoxBounds:ph,localStrokeBounds:fh,localRenderBounds:mh,maskLocalBoxBounds:yh,maskLocalStrokeBounds:vh,maskLocalRenderBounds:xh}=yo,wh=new ie("Branch");let bh=class extends uh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){gh(e||this.__layout.boxBounds,this.children,this.__hasMask?yh:ph)}__updateStrokeBounds(t){gh(t||this.__layout.strokeBounds,this.children,this.__hasMask?vh:fh)}__updateRenderBounds(t){gh(t||this.__layout.renderBounds,this.children,this.__hasMask?xh:mh)}__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(_h),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return wh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ue.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Yo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Yo.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(Yo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Yo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Yo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};bh=ye([Zr(Ya)],bh);class kh{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,r=e.length;n<r;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 kh;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 Eh{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 Sh="2.0.1";class Bh extends Me{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=Qt.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Kn(OffscreenCanvasRenderingContext2D.prototype),Kn(Path2D.prototype);const{mineType:Th}=Zn;function Rh(t,e){Qt.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Th(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Th(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",Qt.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},Qt.canvas=de.canvas(),Qt.conicGradientSupport=!!Qt.canvas.context.createConicGradient}Object.assign(de,{canvas:(t,e)=>new Bh(t,e),image:t=>new ar(t)}),Qt.name="web",Qt.isWorker=!0,Qt.backgrounder=!0,Qt.requestRender=function(t){requestAnimationFrame(t)},hr(Qt,"devicePixelRatio",{get:()=>1});const{userAgent:Lh}=navigator;Lh.indexOf("Firefox")>-1?(Qt.conicGradientRotate90=!0,Qt.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(Qt.fullImageShadow=!0),Lh.indexOf("Windows")>-1?(Qt.os="Windows",Qt.intWheelDeltaY=!0):Lh.indexOf("Mac")>-1?Qt.os="Mac":Lh.indexOf("Linux")>-1&&(Qt.os="Linux");class Oh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new kh;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 kh,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(ta.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Yo.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 $o($o.DATA,{updatedList:this.updatedList})),this.__updatedList=new kh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Xo.CHANGE,this.__onAttrChange,this],[[Yo.ADD,Yo.REMOVE],this.__onChildEvent,this],[$o.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:Mh}=lo,{pushAllChildBranch:Ah,pushAllParent:Dh}=bo;const{worldBounds:Ih}=yo;class Wh{constructor(t){this.updatedBounds=new jt,this.beforeBounds=new jt,this.afterBounds=new jt,d(t)&&(t=new kh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ih),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Fh,updateAllChange:zh}=lo,Yh=ie.get("Layouter");class Nh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Eh,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(Qo.START),this.layoutOnce(),t.emitEvent(new Qo(Qo.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit($o.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:r,AFTER:o}=Qo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Qo(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&&Ah(t,e),Dh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Dh(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(Mh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Qo(r,a,this.times)),i.emitEvent(new Qo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,oe.end(e)}fullLayout(){const t=oe.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Qo,r=this.getBlocks(new kh(e));e.emitEvent(new Qo(i,r,this.times)),Nh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Qo(s,r,this.times)),e.emitEvent(new Qo(n,r,this.times)),this.addBlocks(r),oe.end(t)}static fullLayout(t){Fh(t,!0),t.isBranch?bo.updateBounds(t):lo.updateBounds(t),zh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Wh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Wh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Qo.REQUEST,this.layout,this],[Qo.AGAIN,this.layoutAgain,this],[$o.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Xh=ie.get("Renderer");class Hh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.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(Qo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ta.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ta.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ta.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new jt,Xh.log(e.innerName,"---\x3e");try{this.emitRender(ta.START),this.renderOnce(t),this.emitRender(ta.END,this.totalBounds),sr.clearRecycled()}catch(t){this.rendering=!1,Xh.error(t)}Xh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Xh.warn("rendering");if(this.times>3)return Xh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new jt,this.renderOptions={},t)this.emitRender(ta.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ta.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ta.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ta.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=oe.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new jt(s);i.save(),s.spread(Hh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),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),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),Qt.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new jt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return Qt.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};Qt.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new jt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new jt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Xh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new ta(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ta.REQUEST,this.update,this],[Qo.END,this.__onLayoutEnd,this],[ta.AGAIN,this.renderAgain,this],[Jo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Hh.clipSpread=10;const Vh={},{copyRadiusPoint:Uh}=at,{hitRadiusPoint:jh}=Xt;class Gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new kh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new kh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||lo.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&lo.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=>lo.worldHittable(t))}getPath(t){const e=new kh,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 kh;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 kh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=jh(i.__world,n.hitRadius?Uh(Vh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Kh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Gh(this.target=t,this),this.finder=de.finder&&de.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return Qt.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):le.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Zh(t){return cr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function qh(t){return cr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Jh(){return(t,e)=>{const i="_"+e;hr(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function $h(t){return(e,i)=>{hr(e,i,dr(i,t))}}Object.assign(de,{watcher:(t,e)=>new Oh(t,e),layouter:(t,e)=>new Nh(t,e),renderer:(t,e,i)=>new Hh(t,e,i),selector:(t,e)=>new Kh(t,e)}),Qt.layout=Nh.fullLayout,Qt.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new kh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Qh={},tl={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},el=Zt,il={},sl={},nl={},rl={},ol={},al={apply(){le.need("filter")}},hl={},ll={setStyleName:()=>le.need("state"),set:()=>le.need("state")},dl={list:{},register(t,e){dl.list[t]=e},get:t=>dl.list[t]},{parse:cl,objectToCanvasData:ul}=ss,{stintSet:gl}=_,{hasTransparent:_l}=tl,pl={originPaint:{}},fl=ie.get("UIData");class ml extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,fl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,fl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(gl(this,"__isTransparentFill",_l(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(gl(this,"__isTransparentStroke",_l(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?cl(t):ul(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){yl(this,"shadow",t)}setInnerShadow(t){yl(this,"innerShadow",t)}setFilter(t){yl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&sl.compute("fill",this.__leaf),e&&sl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=pl)):(this.__isStrokes=!0,this._stroke||(this._stroke=pl))}__removePaint(t,e){e&&this.__removeInput(t),nl.recycleImage(t,this),"fill"===t?(gl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(gl(this,"__isAlphaPixelStroke",void 0),gl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function yl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class vl extends ml{}class xl extends vl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class wl extends vl{__getInputData(t,e){const i=super.__getInputData(t,e);return Pe.forEach(t=>delete i[t]),i}}class bl extends xl{}class kl extends ml{get __usePathBox(){return this.points||this.__pathInputed}}class El extends ml{get __boxStroke(){return!this.__pathInputed}}class Sl extends ml{get __boxStroke(){return!this.__pathInputed}}class Bl extends kl{}class Tl extends ml{}class Rl extends ml{get __pathInputed(){return 2}}class Ll extends vl{}const Ol={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Cl extends ml{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=Ol[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ue.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Pl extends El{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 Ml extends El{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:Al,add:Dl}=E,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Al(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=ol.getShadowRenderSpread(this,e)),s&&(t=Al(t,s)),r&&(t=Dl(t,al.getSpread(r))),o&&(t=Dl(t,o)),a&&(t=Dl(t,a));let l=t;return i&&(l=Al(l,ol.getInnerShadowSpread(this,i))),n&&(l=Al(l,n)),this.__layout.renderShapeSpread=l,h?Al(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=_,Fl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!ol.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){zl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=sl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&ol.shadow(this,t,h),a&&(s.__isStrokes?sl.strokes(r,this,t,e):sl.stroke(r,this,t,e)),n&&(s.__isFills?sl.fills(n,this,t,e):sl.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&ol.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?sl.strokes(r,this,t,e):sl.stroke(r,this,t,e)),c&&al.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?sl.strokes(r,this,t,e):sl.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,tl.string(e.color))}n&&(s.__isFills?sl.fills(n,this,t,e):sl.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?sl.strokes(r,this,t,e):sl.stroke(r,this,t,e))}}else s.__pathForRender?zl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?sl.fills(s,this,t,e):sl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?sl.strokes(n,this,t,e):sl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function zl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&sl.stroke(n,t,e,i),s&&sl.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&sl.stroke(n,t,e,i)}const Yl={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Nl;let Xl=Nl=class extends uh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){A.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 r(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return le.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return le.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||hl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Vn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&il.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,a(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){sl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),le.need("animate")}killAnimate(t,e){}export(t,e){return le.need("export")}syncExport(t,e){return le.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Nl.one(e)}static one(t,e,i,s,n){return ue.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){qr()(this)}static registerData(t){Yr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};ye([Yr(ml)],Xl.prototype,"__",void 0),ye([Jh()],Xl.prototype,"zoomLayer",void 0),ye([_r("")],Xl.prototype,"id",void 0),ye([_r("")],Xl.prototype,"name",void 0),ye([_r("")],Xl.prototype,"className",void 0),ye([Lr("pass-through")],Xl.prototype,"blendMode",void 0),ye([Cr(1)],Xl.prototype,"opacity",void 0),ye([Pr(!0)],Xl.prototype,"visible",void 0),ye([Lr(!1)],Xl.prototype,"locked",void 0),ye([Or(!1)],Xl.prototype,"dim",void 0),ye([Or(!1)],Xl.prototype,"dimskip",void 0),ye([Dr(0)],Xl.prototype,"zIndex",void 0),ye([Ir(!1)],Xl.prototype,"mask",void 0),ye([Wr(!1)],Xl.prototype,"eraser",void 0),ye([pr(0,!0)],Xl.prototype,"x",void 0),ye([pr(0,!0)],Xl.prototype,"y",void 0),ye([xr(100,!0)],Xl.prototype,"width",void 0),ye([xr(100,!0)],Xl.prototype,"height",void 0),ye([yr(1,!0)],Xl.prototype,"scaleX",void 0),ye([yr(1,!0)],Xl.prototype,"scaleY",void 0),ye([vr(0,!0)],Xl.prototype,"rotation",void 0),ye([vr(0,!0)],Xl.prototype,"skewX",void 0),ye([vr(0,!0)],Xl.prototype,"skewY",void 0),ye([pr(0,!0)],Xl.prototype,"offsetX",void 0),ye([pr(0,!0)],Xl.prototype,"offsetY",void 0),ye([fr(0,!0)],Xl.prototype,"scrollX",void 0),ye([fr(0,!0)],Xl.prototype,"scrollY",void 0),ye([mr()],Xl.prototype,"origin",void 0),ye([mr()],Xl.prototype,"around",void 0),ye([_r(!1)],Xl.prototype,"lazy",void 0),ye([wr(1)],Xl.prototype,"pixelRatio",void 0),ye([Rr(0)],Xl.prototype,"renderSpread",void 0),ye([kr()],Xl.prototype,"path",void 0),ye([Er()],Xl.prototype,"windingRule",void 0),ye([Er(!0)],Xl.prototype,"closed",void 0),ye([xr(0)],Xl.prototype,"padding",void 0),ye([xr(!1)],Xl.prototype,"lockRatio",void 0),ye([xr()],Xl.prototype,"widthRange",void 0),ye([xr()],Xl.prototype,"heightRange",void 0),ye([_r(!1)],Xl.prototype,"draggable",void 0),ye([_r()],Xl.prototype,"dragBounds",void 0),ye([_r("auto")],Xl.prototype,"dragBoundsType",void 0),ye([_r(!1)],Xl.prototype,"editable",void 0),ye([Fr(!0)],Xl.prototype,"hittable",void 0),ye([Fr("path")],Xl.prototype,"hitFill",void 0),ye([Tr("path")],Xl.prototype,"hitStroke",void 0),ye([Fr(!1)],Xl.prototype,"hitBox",void 0),ye([Fr(!0)],Xl.prototype,"hitChildren",void 0),ye([Fr(!0)],Xl.prototype,"hitSelf",void 0),ye([Fr()],Xl.prototype,"hitRadius",void 0),ye([zr("")],Xl.prototype,"cursor",void 0),ye([Lr()],Xl.prototype,"fill",void 0),ye([Tr(void 0,!0)],Xl.prototype,"stroke",void 0),ye([Tr("inside")],Xl.prototype,"strokeAlign",void 0),ye([Tr(1,!0)],Xl.prototype,"strokeWidth",void 0),ye([Tr(!1)],Xl.prototype,"strokeWidthFixed",void 0),ye([Tr("none")],Xl.prototype,"strokeCap",void 0),ye([Tr("miter")],Xl.prototype,"strokeJoin",void 0),ye([Tr()],Xl.prototype,"dashPattern",void 0),ye([Tr(0)],Xl.prototype,"dashOffset",void 0),ye([Tr(10)],Xl.prototype,"miterLimit",void 0),ye([Er(0)],Xl.prototype,"cornerRadius",void 0),ye([Er()],Xl.prototype,"cornerSmoothing",void 0),ye([Zh()],Xl.prototype,"shadow",void 0),ye([Zh()],Xl.prototype,"innerShadow",void 0),ye([Zh()],Xl.prototype,"blur",void 0),ye([Zh()],Xl.prototype,"backgroundBlur",void 0),ye([Zh()],Xl.prototype,"grayscale",void 0),ye([Zh()],Xl.prototype,"filter",void 0),ye([Lr()],Xl.prototype,"placeholderColor",void 0),ye([_r(100)],Xl.prototype,"placeholderDelay",void 0),ye([_r({})],Xl.prototype,"data",void 0),ye([jr(uh.prototype.reset)],Xl.prototype,"reset",null),Xl=Nl=ye([Zr(Il),Zr(Fl),Gr()],Xl);let Hl=class extends Xl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Vl;ye([Yr(vl)],Hl.prototype,"__",void 0),ye([xr(0)],Hl.prototype,"width",void 0),ye([xr(0)],Hl.prototype,"height",void 0),Hl=ye([Zr(bh),qr()],Hl);const Ul=ie.get("Leafer");let jl=Vl=class extends Hl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&er.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),Vl.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=de.canvas(s);this.__controllers.push(this.renderer=de.renderer(this,n,s),this.watcher=de.watcher(this,s),this.layouter=de.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=de.selector(this),this.interaction=de.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=de.hitCanvasManager()),this.canvasManager=new me,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))),Ro.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ea.RESTART):this.emitLeafer(ea.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(ea.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Pe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new jt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Pe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Jo(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Pe),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 Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Pe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ea.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Pe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=_.copyAttrs({},s,Pe);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(ea.BEFORE_READY),this.emitLeafer(ea.READY),this.emitLeafer(ea.AFTER_READY),Ro.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ea.VIEW_READY),Ro.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ro.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(ea.VIEW_COMPLETED),Ro.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return le.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ea(t,this))}__listenEvents(){const t=oe.start("FirstCreate "+this.innerName);this.once([[ea.START,()=>oe.end(t)],[Qo.START,this.updateLazyBounds,this],[ta.START,this.__onCreated,this],[ta.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[$o.DATA,this.__onWatchData,this],[Qo.END,this.__onLayoutEnd,this],[ta.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Vl.list.remove(this);try{this.stop(),this.emitLeafer(ea.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sr.clearRecycled()},100)}catch(t){Ul.error(t)}}};t?e():setTimeout(e)}};jl.list=new kh,ye([Yr(wl)],jl.prototype,"__",void 0),ye([xr()],jl.prototype,"pixelRatio",void 0),ye([_r("normal")],jl.prototype,"mode",void 0),jl=Vl=ye([qr()],jl);let Gl=class extends Xl{get __tag(){return"Rect"}};ye([Yr(El)],Gl.prototype,"__",void 0),Gl=ye([Zr(Yl),Gr(),qr()],Gl);const{add:Kl,includes:Zl,scroll:ql}=Xt,Jl=Gl.prototype,$l=Hl.prototype;let Ql=class extends Hl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Kl(a,r),ql(a,i)),this.__updateRectRenderBounds(),t=!Zl(r,a),t&&"show"===o&&Kl(n,a)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};ye([Yr(xl)],Ql.prototype,"__",void 0),ye([xr(100)],Ql.prototype,"width",void 0),ye([xr(100)],Ql.prototype,"height",void 0),ye([_r(!1)],Ql.prototype,"resizeChildren",void 0),ye([Rr("show")],Ql.prototype,"overflow",void 0),ye([jr(Jl.__updateStrokeSpread)],Ql.prototype,"__updateStrokeSpread",null),ye([jr(Jl.__updateRenderSpread)],Ql.prototype,"__updateRectRenderSpread",null),ye([jr(Jl.__updateBoxBounds)],Ql.prototype,"__updateRectBoxBounds",null),ye([jr(Jl.__updateStrokeBounds)],Ql.prototype,"__updateStrokeBounds",null),ye([jr(Jl.__updateRenderBounds)],Ql.prototype,"__updateRectRenderBounds",null),ye([jr(Jl.__updateChange)],Ql.prototype,"__updateRectChange",null),ye([jr(Jl.__render)],Ql.prototype,"__renderRect",null),ye([jr($l.__render)],Ql.prototype,"__renderGroup",null),Ql=ye([Gr(),qr()],Ql);let td=class extends Ql{get __tag(){return"Frame"}get isFrame(){return!0}};ye([Yr(bl)],td.prototype,"__",void 0),ye([Lr("#FFFFFF")],td.prototype,"fill",void 0),ye([Rr("hide")],td.prototype,"overflow",void 0),td=ye([qr()],td);const{moveTo:ed,closePath:id,ellipse:sd}=Bs;let nd=class extends Xl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h;i?s||n?(i<1?sd(a,r,o,r*i,o*i,0,s,n,!1):h=!0,sd(a,r,o,r,o,0,n,s,!0)):(i<1&&(sd(a,r,o,r*i,o*i),ed(a,t,o)),sd(a,r,o,r,o,0,360,0,!0)):s||n?(ed(a,r,o),sd(a,r,o,r,o,0,s,n,!1)):sd(a,r,o,r,o),h||id(a),Qt.ellipseToCurve&&(this.__.path=this.getPath(!0))}};ye([Yr(Sl)],nd.prototype,"__",void 0),ye([Er(0)],nd.prototype,"innerRadius",void 0),ye([Er(0)],nd.prototype,"startAngle",void 0),ye([Er(0)],nd.prototype,"endAngle",void 0),nd=ye([qr()],nd);const{sin:rd,cos:od,PI:ad}=Math,{moveTo:hd,lineTo:ld,closePath:dd,drawPoints:cd}=Bs;let ud=class extends Xl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)cd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;hd(e,r,0);for(let t=1;t<n;t++)ld(e,r+r*rd(2*t*ad/n),o-o*od(2*t*ad/n));dd(e)}}};ye([Yr(Bl)],ud.prototype,"__",void 0),ye([Er(3)],ud.prototype,"sides",void 0),ye([Er()],ud.prototype,"points",void 0),ye([Er(0)],ud.prototype,"curve",void 0),ud=ye([Gr(),qr()],ud);const{sin:gd,cos:_d,PI:pd}=Math,{moveTo:fd,lineTo:md,closePath:yd}=Bs;let vd=class extends Xl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];fd(o,n,0);for(let t=1;t<2*i;t++)md(o,n+(t%2==0?n:n*s)*gd(t*pd/i),r-(t%2==0?r:r*s)*_d(t*pd/i));yd(o)}};ye([Yr(Tl)],vd.prototype,"__",void 0),ye([Er(5)],vd.prototype,"corners",void 0),ye([Er(.382)],vd.prototype,"innerRadius",void 0),vd=ye([qr()],vd);const{moveTo:xd,lineTo:wd,drawPoints:bd}=Bs,{rotate:kd,getAngle:Ed,getDistance:Sd,defaultPoint:Bd}=at;let Td=class extends Xl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&kd(i,e),i}set toPoint(t){this.width=Sd(Bd,t),this.rotation=Ed(Bd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?bd(e,t.points,t.curve,t.closed):(xd(e,0,0),wd(e,this.width,0))}};ye([Yr(kl)],Td.prototype,"__",void 0),ye([Sr("center")],Td.prototype,"strokeAlign",void 0),ye([xr(0)],Td.prototype,"height",void 0),ye([Er()],Td.prototype,"points",void 0),ye([Er(0)],Td.prototype,"curve",void 0),ye([Er(!1)],Td.prototype,"closed",void 0),Td=ye([qr()],Td);let Rd=class extends Gl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};ye([Yr(Pl)],Rd.prototype,"__",void 0),ye([xr("")],Rd.prototype,"url",void 0),Rd=ye([qr()],Rd);const Ld=Rd;let Od=class extends Gl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=de.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ar({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Vo(Vo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new pt(t.worldTransform).invert(),r=new pt;e&&r.translate(e.x,e.y),i&&(a(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};ye([Yr(Ml)],Od.prototype,"__",void 0),ye([qh(100)],Od.prototype,"width",void 0),ye([qh(100)],Od.prototype,"height",void 0),ye([qh(1)],Od.prototype,"pixelRatio",void 0),ye([qh(!0)],Od.prototype,"smooth",void 0),ye([_r(!1)],Od.prototype,"safeResize",void 0),ye([qh()],Od.prototype,"contextSettings",void 0),Od=ye([qr()],Od);const{copyAndSpread:Cd,includes:Pd,spread:Md,setList:Ad}=Xt,{stintSet:Dd}=_;let Id=class extends Xl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=el.number(e,n),t.__letterSpacing=el.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,Dd(t,"__padding",l&&A.fourNumber(l)),Dd(t,"__clipText","show"!==h&&!t.__autoSize),Dd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Qh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Md(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!Pd(h,a)),this.isOverflow?(Ad(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()}};ye([Yr(Cl)],Id.prototype,"__",void 0),ye([xr(0)],Id.prototype,"width",void 0),ye([xr(0)],Id.prototype,"height",void 0),ye([Lr()],Id.prototype,"boxStyle",void 0),ye([_r(!1)],Id.prototype,"resizeFontSize",void 0),ye([Lr("#000000")],Id.prototype,"fill",void 0),ye([Sr("outside")],Id.prototype,"strokeAlign",void 0),ye([Fr("all")],Id.prototype,"hitFill",void 0),ye([xr("")],Id.prototype,"text",void 0),ye([xr("")],Id.prototype,"placeholder",void 0),ye([xr("caption")],Id.prototype,"fontFamily",void 0),ye([xr(12)],Id.prototype,"fontSize",void 0),ye([xr("normal")],Id.prototype,"fontWeight",void 0),ye([xr(!1)],Id.prototype,"italic",void 0),ye([xr("none")],Id.prototype,"textCase",void 0),ye([xr("none")],Id.prototype,"textDecoration",void 0),ye([xr(0)],Id.prototype,"letterSpacing",void 0),ye([xr({type:"percent",value:1.5})],Id.prototype,"lineHeight",void 0),ye([xr(0)],Id.prototype,"paraIndent",void 0),ye([xr(0)],Id.prototype,"paraSpacing",void 0),ye([xr("x")],Id.prototype,"writingMode",void 0),ye([xr("left")],Id.prototype,"textAlign",void 0),ye([xr("top")],Id.prototype,"verticalAlign",void 0),ye([xr(!0)],Id.prototype,"autoSizeAlign",void 0),ye([xr("normal")],Id.prototype,"textWrap",void 0),ye([xr("show")],Id.prototype,"textOverflow",void 0),ye([Lr(!1)],Id.prototype,"textEditing",void 0),Id=ye([qr()],Id);let Wd=class extends Xl{get __tag(){return"Path"}};ye([Yr(Rl)],Wd.prototype,"__",void 0),ye([Sr("center")],Wd.prototype,"strokeAlign",void 0),Wd=ye([qr()],Wd);let Fd=class extends Hl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Wd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};ye([Yr(Ll)],Fd.prototype,"__",void 0),ye([(t,e)=>{hr(t,e,{get(){return this.__path}})}],Fd.prototype,"path",void 0),Fd=ye([Zr(Hs,["set","path","paint"]),qr()],Fd);let zd=class extends jl{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&&de.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 jl(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,Pe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Qo.END,this.__onReady,this],[ta.START,this.__onCreated,this],[ta.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ta.END,this.__onChildRenderEnd,this))}};zd=ye([qr()],zd);const Yd={},Nd={isHoldSpaceKey:()=>Nd.isHold("Space"),isHold:t=>Yd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Yd[t]||(Yd[t]=!0)},setUpCode(t){Yd[t]=!1}},Xd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Hd extends zo{get spaceKey(){return Nd.isHoldSpaceKey()}get left(){return Xd.left(this)}get right(){return Xd.right(this)}get middle(){return Xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Nd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){pe.changeName(t,e)}}const{min:Vd,max:Ud,abs:jd}=Math,{float:Gd,sign:Kd}=A,{minX:Zd,maxX:qd,minY:Jd,maxY:$d}=Xt,Qd=new jt,tc=new jt,ec={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ic.getValidMove(t.__localBoxBounds,ic.getDragBounds(t),s,e,!0),ic.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&ic.getValidScaleOf(t.__localBoxBounds,ic.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),ic.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),ic.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Gd(s.x),s.y=Gd(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),tc.set(e),Qd.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 ic.isInnerMode(t,e,i,"width")?(n.x<0&&Qd.scaleOf(s,f=1/n.x,1),_=Gd(Qd.minX-tc.minX),p=Gd(tc.maxX-Qd.maxX),u=h&&_>0?1+_/(h*Qd.width):1,g=l&&p>0?1+p/(l*Qd.width):1,f*=Ud(u,g)):(n.x<0&&((Gd(Zd(t)-Zd(e))<=0||Gd(qd(e)-qd(t))<=0)&&Qd.scaleOf(s,f=1/n.x,1),Qd.unsign()),_=Gd(tc.minX-Qd.minX),p=Gd(Qd.maxX-tc.maxX),u=h&&_>0?1-_/(h*Qd.width):1,g=l&&p>0?1-p/(l*Qd.width):1,f*=Vd(u,g)),ic.isInnerMode(t,e,i,"height")?(n.y<0&&Qd.scaleOf(s,1,m=1/n.y),_=Gd(Qd.minY-tc.minY),p=Gd(tc.maxY-Qd.maxY),u=d&&_>0?1+_/(d*Qd.height):1,g=c&&p>0?1+p/(c*Qd.height):1,m*=Ud(u,g),r&&(u=Ud(jd(f),jd(m)),f=Kd(f)*u,m=Kd(m)*u)):(n.y<0&&((Gd(Jd(t)-Jd(e))<=0||Gd($d(e)-$d(t))<=0)&&Qd.scaleOf(s,1,m=1/n.y),Qd.unsign()),_=Gd(tc.minY-Qd.minY),p=Gd(Qd.maxY-tc.maxY),u=d&&_>0?1-_/(d*Qd.height):1,g=c&&p>0?1-p/(c*Qd.height):1,m*=Vd(u,g)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},ic=ec;let sc=class extends Hd{};sc.POINTER="pointer",sc.BEFORE_DOWN="pointer.before_down",sc.BEFORE_MOVE="pointer.before_move",sc.BEFORE_UP="pointer.before_up",sc.DOWN="pointer.down",sc.MOVE="pointer.move",sc.UP="pointer.up",sc.OVER="pointer.over",sc.OUT="pointer.out",sc.ENTER="pointer.enter",sc.LEAVE="pointer.leave",sc.TAP="tap",sc.DOUBLE_TAP="double_tap",sc.CLICK="click",sc.DOUBLE_CLICK="double_click",sc.LONG_PRESS="long_press",sc.LONG_TAP="long_tap",sc.MENU="pointer.menu",sc.MENU_TAP="pointer.menu_tap",sc=ye([Jr()],sc);const nc=sc,rc={};let oc=class extends sc{static setList(t){this.list=t instanceof kh?t:new kh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return at.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),ec.axisMove(t,n),n}static limitMove(t,e){ec.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(rc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(rc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(rc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){rc.x=t?this.totalX:this.moveX,rc.y=t?this.totalY:this.moveY}};oc.BEFORE_DRAG="drag.before_drag",oc.START="drag.start",oc.DRAG="drag",oc.END="drag.end",oc.OVER="drag.over",oc.OUT="drag.out",oc.ENTER="drag.enter",oc.LEAVE="drag.leave",oc=ye([Jr()],oc);const ac=oc;let hc=class extends sc{static setList(t){oc.setList(t)}static setData(t){oc.setData(t)}};hc.DROP="drop",hc=ye([Jr()],hc);let lc=class extends oc{};lc.BEFORE_MOVE="move.before_move",lc.START="move.start",lc.MOVE="move",lc.DRAG_ANIMATE="move.drag_animate",lc.END="move.end",lc.PULL_DOWN="move.pull_down",lc.REACH_BOTTOM="move.reach_bottom",lc=ye([Jr()],lc);let dc=class extends Hd{};dc=ye([Jr()],dc);const cc=dc;let uc=class extends sc{};uc.BEFORE_ROTATE="rotate.before_rotate",uc.START="rotate.start",uc.ROTATE="rotate",uc.END="rotate.end",uc=ye([Jr()],uc);let gc=class extends oc{};gc.SWIPE="swipe",gc.LEFT="swipe.left",gc.RIGHT="swipe.right",gc.UP="swipe.up",gc.DOWN="swipe.down",gc=ye([Jr()],gc);let _c=class extends sc{};_c.BEFORE_ZOOM="zoom.before_zoom",_c.START="zoom.start",_c.ZOOM="zoom",_c.END="zoom.end",_c=ye([Jr()],_c);let pc=class extends Hd{};pc.BEFORE_DOWN="key.before_down",pc.BEFORE_UP="key.before_up",pc.DOWN="key.down",pc.HOLD="key.hold",pc.UP="key.up",pc=ye([Jr()],pc);const fc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?gc.UP:t>45&&t<135?gc.DOWN:t<=45&&t>=-45?gc.RIGHT:gc.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:mc.getSwipeDirection(at.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new kh,{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=>lo.draggable(t)||!t.isLeafer&&t.hasEvent(oc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},mc=fc,yc=new kh,{getDragEventData:vc,getDropEventData:xc,getSwipeEventData:wc}=fc;class bc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=vc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=oc.list||this.draggableList||yc;return this.dragging&&(s?t?yc:new kh(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(lc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Xd.left(t),this.dragging&&(this.interaction.emit(oc.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],lo.draggable(e)){this.draggableList=new kh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=vc(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(lc.BEFORE_MOVE,this.dragData),e.emit(lc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(oc.BEFORE_DRAG,this.dragData),e.emit(oc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=r(e.draggable),l=oc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);o&&!s&&t?lo.animateMove(e,l,a(o)?o:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(oc.OUT,t,i),e.emit(oc.OVER,t,s)):e.emit(oc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(oc.LEAVE,t,i,s),e.emit(oc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=vc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(lc.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(oc.END,o),this.swipe(t,i,s,o),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(at.getDistance(e,t)>n.config.pointer.swipeDistance){const t=wc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=xc(t,e,oc.data);s.path=i,this.interaction.emit(hc.DROP,s),this.interaction.emit(oc.LEAVE,t,i)}dragReset(){oc.list=oc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const kc=ie.get("emit");const Ec=["move","zoom","rotate","key"];function Sc(t,e,i,s,n){if(Ec.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Tc(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Bc(r,e,i,s,n)}}function Bc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Tc(t,n)&&(ll.updateEventStyle&&!s&&ll.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=pe.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Tc(t,e){return e&&e.has(t)}const Rc={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:Lc,pathCanDrag:Oc,pathHasOutside:Cc}=fc;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&&Xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Nd.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(Rc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new kh(t),this.createTransformer(),this.dragger=new bc(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&&(Xd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(sc.BEFORE_DOWN,t),this.emit(sc.DOWN,t),Xd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Xd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(sc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=at.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(sc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Xd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(sc.BEFORE_UP,t),this.emit(sc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(sc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(sc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(pc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Nd.setDownCode(e),this.emit(pc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(pc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(pc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Nd.setUpCode(e),this.emit(pc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new kh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(sc.OUT,t,i),this.emit(sc.OVER,t,e)):this.emit(sc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(sc.LEAVE,t,i,e),this.emit(sc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(sc.LEAVE,t),this.dragger.dragging&&this.emit(hc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[sc.DOUBLE_TAP,sc.DOUBLE_CLICK].some(e=>Lc(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:r}=this;Qt.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Cc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Oc(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:sc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,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&&at.round(s),s}emitTap(t){this.emit(sc.TAP,t),this.emit(sc.CLICK,t)}emitDoubleTap(t){this.emit(sc.DOUBLE_TAP,t),this.emit(sc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(sc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(sc.LONG_TAP,t),(Lc(t.path,sc.LONG_TAP)||Lc(t.path,sc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new jt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Jo.RESIZE,this.__onResize,this)],t.once(ea.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Bc(n,t,e,!0,s))return;n.isApp&&Sc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Sc(n,t,e,!1,s),Bc(n,t,e,!1,s))return}catch(t){kc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Mc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Mc.custom={};class Ac extends me{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new kh,this.pixelList=new kh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),de.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),de.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}Qt.getSelector=function(t){return t.leafer?t.leafer.selector:Qt.selector||(Qt.selector=de.selector())};const{toInnerRadiusPointOf:Dc,copyRadiusPoint:Ic}=at,{hitRadiusPoint:Wc,hitPoint:Fc}=Xt,zc={},Yc={},Nc=uh.prototype;Nc.hit=function(t,e=0){this.updateLayout(),Ic(Yc,t,e);const i=this.__world;return!!(e?Wc(i,Yc):Fc(i,Yc))&&(this.isBranch?Qt.getSelector(this).hitPoint(Object.assign({},Yc),e,{target:this}):this.__hitWorld(Yc))},Nc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(Ic(zc,t,i.hitRadius),t=zc),Dc(t,s,zc),i.hitBox||r){if(Xt.hitRadiusPoint(n.boxBounds,zc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(zc,e)},Nc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Nc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Nc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Nc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Xc=new pt,Hc=Xl.prototype;Hc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=Qt.image.hitCanvasSize,o=r.hitScale=Gt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Gt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),sr.patternLocked=!0,this.__renderShape(r,{matrix:Xc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Hc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Vc=Xl.prototype,Uc=Gl.prototype,jc=Ql.prototype;Uc.__updateHitCanvas=jc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Vc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Uc.__hitFill=jc.__hitFill=function(t){return this.__hitCanvas?Vc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},Id.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},Hl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),Qt.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Gc=Me.prototype;function Kc(t,e,i){t.__.__font?sl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Zc(t,e,i,s,n){const r=i.__;c(t)?sl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&sl.strokeArrow(t,i,s,n)}function qc(t,e,i,s,n){const r=i.__;c(t)?sl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),sl.drawTextStroke(i,s,n))}function Jc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,qc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",sl.fillText(i,r,n),r.blendMode="normal",lo.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}Gc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Gc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Gc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Gt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:$c,copyAndSpread:Qc,toOuterOf:tu,getOuterOf:eu,getByMove:iu,move:su,getIntersectData:nu}=Xt,ru={};let ou;const{stintSet:au}=_,{hasTransparent:hu}=tl;function lu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:o}=i.__layout;switch(e.type){case"image":if(!e.url)return;n=nl.image(i,t,e,o,!ou||!ou[e.url]);break;case"linear":n=rl.linearGradient(e,o);break;case"radial":n=rl.radialGradient(e,o);break;case"angular":n=rl.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;n={type:r,style:tl.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:tl.string(e)})}if(n&&(n.originPaint=e,r(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,r,o,a=i.__input[t];d(a)||(a=[a]),ou=nl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=lu(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(au(i,"__isAlphaPixelFill",n),au(i,"__isTransparentFill",r)):(au(i,"__isAlphaPixelStroke",n),au(i,"__isTransparentStroke",r),au(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Kc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,nl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),Kc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),Kc(e,i,s),i.restoreBlendMode()):Kc(e,i,s)}},fillPathOrText:Kc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)sl.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Zc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Zc(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)Zc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Zc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),lo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){sl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":qc(t,1,e,i,s);break;case"inside":Jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?qc(t,2,e,i,s):Jc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!nl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?sl.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?sl.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;tu(o.strokeSpread?(Qc(ru,o.boxBounds,o.strokeSpread),ru):o.boxBounds,r,a);let{scaleX:_,scaleY:p}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=r;else{let s;if(Qt.fullImageShadow)s=a;else{const t=o.renderShapeSpread?$c(n,E.swapAndScale(o.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(r,c),su(l,-c.e,-c.f);const y=i.matrix;y?(d=new pt(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 jt;const{isSame:gu}=Xt;function _u(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||nl.createData(n,s,i,r),!0}function pu(t,e){yu(t,Vo.LOAD,e)}function fu(t,e){yu(t,Vo.LOADED,e)}function mu(t,e,i){e.error=i,t.forceUpdate("surface"),yu(t,Vo.ERROR,e)}function yu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Vo(e,i))}function vu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:xu,translate:wu}=Z,bu=new jt,ku={},Eu={};function Su(t,e,i,s){const n=r(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:Lu,rotateOfOuter:Ou,translate:Cu,scaleOfOuter:Pu,multiplyParent:Mu,scale:Au,rotate:Du,skew:Iu}=Z;function Wu(t,e,i,s,n,r,o,a){o&&Du(t,o),a&&Iu(t,a.x,a.y),n&&Au(t,n,r),Cu(t,e.x+i,e.y+s)}const{get:Fu,scale:zu,copy:Yu}=Z,{getFloorScale:Nu}=A,{abs:Xu}=Math;const Hu={image:function(t,e,i,s,n){let r,o;const a=sr.get(i);return cu&&i===cu.paint&&gu(s,cu.boxBounds)?r=cu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),cu=a.use>1?{leafPaint:r,paint:i,boxBounds:uu.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(_u(t,e,i,a,r,s),n&&(pu(t,o),fu(t,o))):a.error?n&&mu(t,o,a.error):(n&&(vu(t,!0),pu(t,o)),r.loadId=a.load(()=>{vu(t,!1),t.destroyed||(_u(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),fu(t,o)),r.loadId=void 0},e=>{vu(t,!1),mu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=nl.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d,snapshot:c}=n;return!(!h||t.patternId===r+"-"+o&&!d||c)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===Qt.name&&Jo.isResizing(i)||d||(e=Qt.image.isLarge(a,r,o)||a.width*r>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),nl.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?nl.createPattern(t,i,s,n):nl.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let 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()):(o.scaleX&&(_*=o.scaleX,p*=o.scaleY),n.drawImage(c,0,0,_,p))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,sr.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=sr.patternTasker.add(()=>ve(this,void 0,void 0,function*(){nl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=nl.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!Qt.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=nl.getPatternFixScale(t,n,r);let d,c,u,{width:g,height:_}=i;l&&(n*=l,r*=l),g*=n,_*=r,h&&(c=h.x*n/Xu(s.scaleX||1),u=h.y*r/Xu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=Nu(g+(c||0)),r*=Nu(_+(u||0)),d=Fu(),a&&Yu(d,a),zu(d,1/n,1/r));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth,s.interlace),f=i.getPattern(p,s.repeat||Qt.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=Qt.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=nl.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:o,mode:h,align:l,offset:d,scale:u,size:g,rotation:_,skew:p,clipSize:f,repeat:m,gap:y,filters:v,interlace:x}=t,w=e.width===s&&e.height===n,b={mode:h},k="center"!==l&&(_||0)%180==90;let E,S;switch(Xt.set(Eu,0,0,k?n:s,k?s:n),h&&"cover"!==h&&"fit"!==h?((u||g)&&(A.getScaleData(u,g,i,ku),E=ku.scaleX,S=ku.scaleY),(l||y||m)&&(E&&Xt.scale(Eu,E,S,!0),l&&St.toPoint(l,Eu,e,Eu,!0,!0))):w&&!_||(E=S=Xt.getFitScale(e,Eu,"fit"!==h),Xt.put(e,i,l,E,!1,Eu),Xt.scale(Eu,E,S,!0)),d&&at.move(Eu,d),h){case"stretch":w?E&&(E=S=void 0):(E=e.width/s,S=e.height/n,nl.stretchMode(b,e,E,S));break;case"normal":case"clip":if(Eu.x||Eu.y||E||f||_||p){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),nl.clipMode(b,e,Eu.x,Eu.y,E,S,_,p,t,i),t&&(E=E?E*t:t,S=S?S*i:i)}break;case"repeat":(!w||E||_||p)&&nl.repeatMode(b,e,s,n,Eu.x,Eu.y,E,S,_,p,l,t.freeTransform),m||(b.repeat="repeat");const i=c(m);(y||i)&&(b.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:Su(r,i,n.width,e&&e.x),y:Su(o,s,n.height,e&&e.y)}}(y,i&&m,Eu.width,Eu.height,e));break;default:E&&nl.fillOrFitMode(b,e,Eu.x,Eu.y,E,S,_)}return b.transform||(e.x||e.y)&&wu(b.transform=xu(),e.x,e.y),E&&(b.scaleX=E,b.scaleY=S),o&&o<1&&(b.opacity=o),v&&(b.filters=v),m&&(b.repeat=r(m)?"x"===m?"repeat-x":"repeat-y":"repeat"),x&&(b.interlace=a(x)||"percent"===x.type?{type:"x",offset:x}:x),b},stretchMode:function(t,e,i,s){const n=Ru(),{x:r,y:o}=e;r||o?Cu(n,r,o):n.onlyScale=!0,Au(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Ru();Cu(a,e.x+i,e.y+s),Au(a,n,r),o&&Ou(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=Ru();Wu(d,e,i,s,n,r,o,a),h&&(o||a?(Lu(Tu),Pu(Tu,e,h,l),Mu(d,Tu)):Pu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Ru();if(c)Wu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Ou(u,{x:i/2,y:s/2},h);else switch(Du(u,h),h){case 90:Cu(u,s,0);break;case 180:Cu(u,i,s);break;case 270:Cu(u,0,i)}Bu.x=e.x+n,Bu.y=e.y+r,Cu(u,Bu.x,Bu.y),o&&Pu(u,Bu,o,a)}t.transform=u}},{toPoint:Vu}=bt,{hasTransparent:Uu}=tl,ju={},Gu={};function Ku(t,e,i,s){if(i){let n,o,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],r(n)?(a=t/(l-1),o=tl.string(n,s)):(a=n.offset,o=tl.string(n.color,s)),e.addColorStop(a,o),!h&&Uu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Zu,getDistance:qu}=at,{get:Ju,rotateOfOuter:$u,scaleOfOuter:Qu}=Z,{toPoint:tg}=bt,eg={},ig={};function sg(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Zu(e,i);r=Ju(),n?(Qu(r,e,o/a*(s||1),1),$u(r,e,t+90)):(Qu(r,e,1,o/a*(s||1)),$u(r,e,t))}return r}const{getDistance:ng}=at,{toPoint:rg}=bt,og={},ag={};const hg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;Vu(i||"top",e,ju),Vu(s||"bottom",e,Gu);const o=Qt.canvas.createLinearGradient(ju.x,ju.y,Gu.x,Gu.y),a={type:n,style:o};return Ku(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;tg(i||"center",e,eg),tg(s||"bottom",e,ig);const a=Qt.canvas.createRadialGradient(eg.x,eg.y,0,eg.x,eg.y,qu(eg,ig)),h={type:n,style:a};Ku(h,a,t.stops,r);const l=sg(e,eg,ig,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;rg(i||"center",e,og),rg(s||"bottom",e,ag);const a=Qt.conicGradientSupport?Qt.canvas.createConicGradient(0,og.x,og.y):Qt.canvas.createRadialGradient(og.x,og.y,0,og.x,og.y,ng(og,ag)),h={type:n,style:a};Ku(h,a,t.stops,r);const l=sg(e,og,ag,o||1,Qt.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:sg},{copy:lg,move:dg,toOffsetOutBounds:cg}=Xt,{max:ug,abs:gg}=Math,_g={},pg=new pt,fg={};function mg(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=gg(t.spread||0),o=ug(o,n+r-s),a=ug(a,n+r+i),h=ug(h,n+r+s),l=ug(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function yg(t,e,i){const{shapeBounds:s}=i;let n,r;Qt.fullImageShadow?(lg(_g,t.bounds),dg(_g,e.x-s.x,e.y-s.y),n=t.bounds,r=_g):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:vg}=Xt,xg={};const wg=mg;const bg={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=o.length-1;cg(h,fg,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}g.setWorldShadow(fg.offsetX+(o.x||0)*c*f,fg.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,tl.string(o.color)),n=ol.getShadowTransform(t,g,i,o,fg,f),n&&g.setTransform(n),yg(g,fg,i),n&&g.resetTransform(),s=l,o.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,r,"copy"),s=r),a?g.copyWorld(a,r,r,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),lo.copyCanvasByWorld(t,e,g,s,o.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=o.length-1;vg(h,xg,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(xg.offsetX+(o.x||0)*c*f,xg.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=ol.getShadowTransform(t,g,i,o,xg,f,!0),n&&g.setTransform(n),yg(g,xg,i),g.restore(),a?(g.copyWorld(g,l,r,"copy"),g.copyWorld(a,r,r,"source-out"),s=r):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,tl.string(o.color),"source-in"),lo.copyCanvasByWorld(t,e,g,s,o.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,r,o){if(s.spread){const i=2*s.spread*r*(o?-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:wg},{excludeRenderBounds:kg}=yo;let Eg;function Sg(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Eg||(Eg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);Tg(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Tg(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Bg(t){return t.getSameCanvas(!1,!0)}function Tg(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}Hl.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Sg(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||kg(i,e)||i.__render(t,e),r=i.__.opacity,Eg=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Bg(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Bg(t)),n||(n=Bg(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Sg(this,o,t,n,s,r,void 0,!1),kg(i,e)||i.__render(n||t,e),d&&Sg(this,o,t,n,s,r,d,!1)}Sg(this,o,t,n,s,r,void 0,!0)};const Rg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Lg=Rg+"_#~&*+\\=|≮≯≈≠=…",Og=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 Cg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Pg=Cg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Mg=Cg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ag=Cg(Rg),Dg=Cg(Lg),Ig=Cg("- —/~|┆·");var Wg;!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"}(Wg||(Wg={}));const{Letter:Fg,Single:zg,Before:Yg,After:Ng,Symbol:Xg,Break:Hg}=Wg;function Vg(t){return Pg[t]?Fg:Ig[t]?Hg:Mg[t]?Yg:Ag[t]?Ng:Dg[t]?Xg:Og.test(t)?zg:Fg}const Ug={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function jg(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}=Ug,{Letter:Kg,Single:Zg,Before:qg,After:Jg,Symbol:$g,Break:Qg}=Wg;let t_,e_,i_,s_,n_,r_,o_,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 x_(){g_&&(__.paraNumber++,e_.paraStart=!0,g_=!1),h_&&(e_.startCharSize=a_,e_.endCharSize=h_,a_=0),e_.width=s_,p_.width?Gg(e_):f_&&w_(),m_.push(e_),e_={words:[]},s_=0}function w_(){s_>(__.maxWidth||0)&&(__.maxWidth=s_)}const{top:b_,right:k_,bottom:E_,left:S_}=vt;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){r(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[S_],n-=a[k_]+a[S_],!n&&(n=.01)):e.autoSizeAlign||(i=a[S_]),o?(s=a[b_],o-=a[b_]+a[E_],!o&&(o=.01)):e.autoSizeAlign||(s=a[b_]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:Qt.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:r}=i,{canvas:o}=Qt,{width:a}=p_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;g_=!0,d_=null,a_=o_=h_=i_=s_=0,t_={data:[]},e_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)r_=e[i],"\n"===r_?(i_&&v_(),e_.paraEnd=!0,x_(),g_=!0):(l_=Vg(r_),l_===Kg&&"none"!==r&&(r_=jg(r_,r,!i_)),o_=o.measureText(r_).width,s&&(s<0&&(h_=o_),o_+=s),c_=l_===Zg&&(d_===Zg||d_===Kg)||d_===Zg&&l_!==Jg,u_=!(l_!==qg&&l_!==Zg||d_!==$g&&d_!==Jg),n_=g_&&n?a-n:a,t&&a&&s_+i_+o_>n_&&(h?(i_&&v_(),s_&&x_()):(u_||(u_=l_===Kg&&d_==Jg),c_||u_||l_===Qg||l_===qg||l_===Zg||i_+o_>n_?(i_&&v_(),s_&&x_()):s_&&x_()))," "===r_&&!0!==g_&&s_+i_===0||(l_===Qg?(" "===r_&&i_&&v_(),y_(r_,o_),v_()):c_||u_?(i_&&v_(),y_(r_,o_)):y_(r_,o_)),d_=l_);i_&&v_(),s_&&x_(),m_.length>0&&(m_[m_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{__.paraNumber++,s_=o.measureText(t).width,m_.push({x:n||0,text:t,width:s_,paraStart:!0}),f_&&w_()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":B_(e,"x",t[S_]);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[E_])}}(a,h,e,n,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=r*n+(c?c*(t.paraNumber-1):0),y=o;if(h&&m>f)m=Math.max(e.__autoHeight?m:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,x,w,b=p||u?p:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],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&&o>0&&(y+=c),v.y=y,y+=r,t.overflow>o&&y>m&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&p&&p<w&&(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:r,__letterSpacing:o}=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&&(_=r&&t.paraStart?r: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=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(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){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?Qt.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=tl.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const R_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!tl.object)return t;t=tl.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};function L_(t){return t?d(t)?t:[t]:[]}Object.assign(Qh,T_),Object.assign(tl,R_),Object.assign(sl,du),Object.assign(nl,Hu),Object.assign(rl,hg),Object.assign(ol,bg),Object.assign(de,{interaction:(t,e,i,s)=>new Pc(t,e,i,s),hitCanvas:(t,e)=>new Bh(t,e),hitCanvasManager:()=>new Ac}),Rh();class O_ extends zo{get list(){return L_(this.value)}get oldList(){return L_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function C_(t){return(e,i)=>{const s="_"+i;hr(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const r=this;if(r.config){const t="target"===i;if(t){const{beforeSelect:t}=r.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}r.setDimOthers(!1),r.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),r.single&&(delete r.element.syncEventer,delete r.element.__world.ignorePixelSnap)}const s=t?O_.BEFORE_SELECT:O_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new O_(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}O_.BEFORE_SELECT="editor.before_select",O_.SELECT="editor.select",O_.AFTER_SELECT="editor.after_select",O_.BEFORE_HOVER="editor.before_hover",O_.HOVER="editor.hover";const{abs:P_}=Math,{copy:M_}=Z,{setListWithFn:A_}=Xt,{worldBounds:D_}=yo,I_={a:1,b:0,c:0,d:1,e:0,f:0},W_={x:0,y:0,width:0,height:0};class F_ extends Xl{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?(A_(W_,e,D_),t&&this.set(t),this.set(W_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,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=P_(c.scaleX),l=P_(c.scaleY);if(M_(I_,c),I_.half=a%2,t.setWorld(I_,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),n.shadow){const e=n.shadow[0],{scaleX:i,scaleY:s}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*s,e.blur*i,tl.string(e.color))}o&&(r(o)?sl.stroke(o,this,t,e):sl.strokes(o,this,t,e)),h&&(r(h)?sl.fill(h,this,t,e):sl.fills(h,this,t,e)),n.shadow&&t.restore()}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}ye([C_(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],F_.prototype,"target",void 0),ye([Lr("render-path")],F_.prototype,"strokePathType",void 0);class z_ extends Hl{constructor(t){super(t),this.strokeArea=new Gl({strokeAlign:"center"}),this.fillArea=new Gl,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 r=0,o=t.length;r<o;r++)if(s=t[r],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 Hl{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 F_,this.targetStroker=new F_,this.bounds=new jt,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:r,hover:o,hoverStyle:a}=s;this.hoverStroker.setTarget(o?e:null,Object.assign({stroke:n,strokeWidth:r},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:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},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 kh(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 kh(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_([[O_.HOVER,this.onHover,this],[O_.SELECT,this.onSelect,this]]),e.on_([[sc.MOVE,this.onPointerMove,this],[sc.BEFORE_DOWN,this.onBeforeDown,this],[sc.TAP,this.onTap,this],[oc.START,this.onDragStart,this,!0],[oc.DRAG,this.onDrag,this],[oc.END,this.onDragEnd,this],[lc.MOVE,this.onAutoMove,this],[[_c.ZOOM,lc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:U_,top:j_,topRight:G_,right:K_,bottomRight:Z_,bottom:q_,bottomLeft:J_,left:$_}=xt,{toPoint:Q_}=bt,{within:tp,sign:ep}=A,{abs:ip}=Math,sp={getScaleData(t,e,i,s,n,r,o,h){let l,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:x}=e,w=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=ep(w),E=ep(b),S=h?w:k*_.width/v,B=h?b:E*_.height/x;if(a(s))u=g=Math.sqrt(s);else{r&&(s.x*=2,s.y*=2),s.x*=h?w:k,s.y*=h?b:E;const t=(-s.y+x)/x,e=(s.x+v)/v,o=(s.y+x)/x,a=(-s.x+v)/v;switch(i){case j_:g=t,l="bottom";break;case K_:u=e,l="left";break;case q_:g=o,l="top";break;case $_:u=a,l="right";break;case U_:g=t,u=a,l="bottom-right";break;case G_:g=t,u=e,l="bottom-left";break;case Z_:g=o,u=e,l="top-left";break;case J_:g=o,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case j_:case q_:u=g;break;case $_:case K_: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/=S),R&&(g/=B),!o){const{worldTransform:e}=t;u<0&&(u=1/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(Q_(r||l,_,c,!0),m){const e={x:u,y:g};ec.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:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case U_:r="bottom-right";break;case G_:r="bottom-left";break;case Z_:r="top-left";break;case J_:r="top-right";break;default:r="center"}return Q_(n||r,t.boxBounds,o,!0),{origin:o,rotation:at.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case j_:case U_:r={x:.5,y:0},n="bottom",a=1;break;case q_:case Z_:r={x:.5,y:1},n="top",a=1;break;case $_:case J_:r={x:0,y:.5},n="right",h=1;break;case K_:case G_:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,Q_(s||n,t,o,!0);const c=at.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,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 $_:t=K_;break;case U_:t=G_;break;case J_:t=Z_;break;case K_:t=$_;break;case G_:t=U_;break;case Z_:t=J_}if(i)switch(t){case j_:t=q_;break;case U_:t=J_;break;case G_:t=Z_;break;case q_:t=j_;break;case J_:t=U_;break;case Z_:t=G_}return t}},np={};function rp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return op(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),x=s?n?g:r?c:u:v?g:y?c:u;h+=45*(sp.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(A.formatRotation(h,!0)/2);const{url:w,x:b,y:k}=x,E=w+h;np[E]?i.cursor=np[E]:np[E]=i.cursor={url:ap(w,h),x:b,y:k}}function op(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 Ql{constructor(t){super(t),this.useFastShadow=!0}}const lp=["top","right","bottom","left"],dp=void 0;class cp extends Hl{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 r(t)||r(e)||r(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Hl,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 Hl({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:r,resizeLines:o,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"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new hp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.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(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:r,resizePoints:o,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=o[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]||{}));r.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),op(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,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:r,skewX:o,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:r,buttons:o,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:x,hideRotatePoints:w,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),x&&Xt.spread(t,x),this.view.worldOpacity){const{width:e,height:c}=t,m=a(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,x,k,E={};for(let i=0;i<8;i++)bt.toPoint(bt.directionData[i],t,E),x=h[i],v=l[i],x.set(E),v.set(E),x.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!w,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=x.visible&&!b,x.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*x.width>e&&(x.visible=!1)):(k.width=c+k.height,p&&2*x.width>c&&(x.visible=!1)));r.visible=y&&_&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),o.visible=y&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=lp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=lp.indexOf(e);(a%2&&r||(a+1)%2&&o)&&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=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(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:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:dp};return t?Object.assign(o,t):o}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:r,skewable:o}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(r&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(o&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&o&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t)}rp(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&&(Jo.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 oc||t instanceof lc)&&this.transformTool.onMove(t),this.resizing&&(Jo.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(),r(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case lc.START:this.onTransformStart(t);break;case lc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case _c.START:this.onTransformStart(t);break;case _c.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case _c.START:this.onTransformStart(t);break;case _c.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){rp(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 Id)||t.find(t=>t instanceof Id);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_([[oc.START,this.onDragStart,this],[oc.DRAG,this.onDrag,this],[oc.END,this.onDragEnd,this],[sc.ENTER,e=>{this.enterPoint=t,rp(this,e)}],[sc.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[sc.DOUBLE_TAP,this.onDoubleTap,this],[sc.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[pc.HOLD,pc.UP],this.onKey,this],[pc.DOWN,this.onArrow,this],[[lc.START,lc.BEFORE_MOVE,lc.END],this.onMove,this,!0],[[_c.START,_c.BEFORE_ZOOM,_c.END],this.onScale,this,!0],[[uc.START,uc.BEFORE_ROTATE,uc.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 Xl{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 jt;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),xp={group(t,e,i){t.sort(vp);const{app:s,parent:n}=t[0];let r;r=i&&i.add?i:new Hl(i),n.addAt(r,n.children.indexOf(t[0])),t.sort(yp);const o=new pt(e.worldTransform);return o.divideParent(n.scrollWorldTransform),r.setTransform(o),r.editable=!0,r.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(r)),s.unlockLayout(),r},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)})}},wp=ie.get("EditToolCreator");function bp(){return t=>{Ep.register(t)}}const kp=bp,Ep={list:{},register(t){const{tag:e}=t.prototype;Sp[e]&&wp.repeat(e),Sp[e]=t},get:(t,e)=>new Sp[t](e)},{list:Sp}=Ep;class Bp extends O_{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 O_{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}=lo,Lp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Op="top-left";class Cp extends Gl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Xo.CHANGE,e=>{if(this.checkChange&&Lp[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,Rp(this.parent),Rp(this);const a=new pt(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Rp(this),this.changedTransform=new pt(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Op,r);break;case"scaleX":t.scaleOf(Op,r,1);break;case"scaleY":t.scaleOf(Op,1,r);break;case"skewX":t.skewOf(Op,r,0);break;case"skewY":t.skewOf(Op,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Pp extends O_{constructor(t,e){super(t,e)}}Pp.BEFORE_MOVE="editor.before_move",Pp.MOVE="editor.move";class Mp extends O_{constructor(t,e){super(t,e)}}Mp.BEFORE_SCALE="editor.before_scale",Mp.SCALE="editor.scale";class Ap extends O_{constructor(t,e){super(t,e)}}Ap.BEFORE_ROTATE="editor.before_rotate",Ap.ROTATE="editor.rotate";class Dp extends O_{constructor(t,e){super(t,e)}}Dp.BEFORE_SKEW="editor.before_skew",Dp.SKEW="editor.skew";class Ip{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const h=t.type===lc.END||t.type===oc.END,l=r(e.draggable),d=!o||h||l,c={x:t.totalX,y:t.totalY};t instanceof lc&&at.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=oc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(o&&!l&&h?lo.animateMove(this,n,a(o)?o:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let r,{around:o,lockRatio:a,flipable:h,editSize:l}=i;t instanceof _c?(o||(o=e.getBoxPoint(t)),r=t.totalScale):r=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=sp.getScaleData(e,n.bounds,d,r,a,sp.getAround(o,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof oc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),at.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:r,rotateGap:o,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof uc)d=t.rotation,l=r?bt.getPoint(r,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,o=sp.getRotateData(e,h,t,s,i?null:r||e.around||e.origin||n||"center");d=s.rotation+o.rotation-e.rotation,l=o.origin}if(d=A.float(A.getGapRotation(d,o,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),at.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=sp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),sp.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}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:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({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:r,moveX:a.x,moveY:a.y};this.emitEvent(new Pp(Pp.BEFORE_MOVE,h));const l=new Pp(Pp.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:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Mp(Mp.BEFORE_SCALE,t));const r=new Mp(Mp.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;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=!o&&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 Mp(Mp.BEFORE_SCALE,u));const g=new Mp(Mp.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"),r=i?new pt(lo.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new Mp(Mp.BEFORE_SCALE,o));const a=new Mp(Mp.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({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:r,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Ap(Ap.BEFORE_ROTATE,d));const c=new Ap(Ap.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;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=!o&&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 Dp(Dp.BEFORE_SKEW,u));const g=new Dp(Dp.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(lo.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new pt(e.worldTransform);return t(),new pt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Wp=class extends Hl{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 kh,this.openedGroupList=new kh,this.simulateTarget=new Cp(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),le.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]||Ep.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(r(s))e=s;else if(!1===s)return}if(Ep.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=xp.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=xp.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=>!lo.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]||Ep.get(t,this)}openInnerEditor(t,e,i){let s;if(r(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(r(i))s=i;else if(!1===i)return}Ep.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&&(xp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(xp.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_(ta.START,this.onRenderStart,this),i&&i.on_(Xo.SCROLL,this.onChildScroll,this),t.on_(ta.CHILD_START,this.onAppRenderStart,this),t.on_(ea.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())}};ye([(t,e)=>{hr(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:r,app:o}=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 r.config&&Object.assign(a,r.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=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Wp.prototype,"mergeConfig",void 0),ye([C_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof kh?i:new kh(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 O_(O_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new O_(O_.AFTER_SELECT,s))})],Wp.prototype,"target",void 0),ye([C_(function(t,e){t.emitEvent(new O_(O_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Wp.prototype,"hoverTarget",void 0),Wp=ye([Zr(Ip,["editBox","editTool","emitEvent"])],Wp);class Fp{static registerInnerEditor(){Ep.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this._editBox||this.editor.editBox}set editBox(t){this._editBox=t}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Hl,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 Fp{static registerEditTool(){Ep.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};zp=ye([bp()],zp);const{left:Yp,right:Np}=xt,{move:Xp,copy:Hp,toNumberPoints:Vp}=at;let Up=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,r=t.target,o=i===Yp;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.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:r,y:o}=n;i?(Xp(t,r,o),s&&Xp(e,-r,-o)):(s&&Xp(t,-r,-o),Xp(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=t.target;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.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=!o&&a}};Up=ye([bp()],Up);const{M:jp,L:Gp,C:Kp,Q:Zp,Z:qp,N:Jp,D:$p,X:Qp,G:tf,F:ef,O:sf,P:nf,U:rf}=Ie,of={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case jp:case Gp:af(t,e,i,n,1),n+=3;break;case Kp:af(t,e,i,n,3),n+=7;break;case Zp:af(t,e,i,n,2),n+=5;break;case qp:n+=1;break;case Jp:af(t,e,i,n,2),n+=5;break;case $p:af(t,e,i,n,2),n+=9;break;case Qp: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,r+=2;break;case nf:t[n]=ef,t.splice(n+4,0,t[n+3]),af(t,e,i,n,2),n+=5,r+=1;break;case rf:af(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:af}=of,hf=Z.get(),{topLeft:lf,top:df,topRight:cf,right:uf,bottom:gf,left:_f}=xt;function pf(t,e,i){t.pathInputed?ff(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function ff(t,e,i){of.scale(t.__.path,e,i),t.path=t.__.path}function mf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):of.scalePoints(s,e,i),t.points=s}function yf(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 vf=uh.prototype;function xf(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function wf(t,e,i){bf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(lc.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(xf(t).includes("limit")){const s=t.getValidMove(0,0);if(s.x||s.y){const t=100,n=200,r="drag"===e.moveType?.3:.05;Math.abs(s.x)>t?i.x=0:i.x*=r,Math.abs(s.y)>n?i.y=0:i.y*=r}}t.zoomLayer.move(i)}),t.on_(lc.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(lc.END,e=>{lo.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(_c.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)}vf.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))},vf.__scaleResize=function(t,e){pf(this,t,e)},vf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},vf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Id.prototype.__scaleResize=function(t,e){const{app:i,editConfig:n}=this,r=i&&i.editor,o=r&&r.dragPoint;if(this.__.resizeFontSize||n&&"font-size"===n.editSize||o&&"font-size"===r.mergedConfig.editSize)!function(t,e,i,n){let r=e;if(!s(n)){const s=t.__layout;let{width:o,height:a}=s.boxBounds;switch(o*=i-e,a*=e-i,n){case df:case gf:r=i,s.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/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*=r;const o=t.__,{padding:a}=o;a&&(t.padding=d(a)?a.map(t=>t*r):a*r),o.__autoWidth||(t.width*=r),o.__autoHeight||(t.height*=r)}(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),pf(this,t,e)}},Wd.prototype.__scaleResize=function(t,e){ff(this,t,e)},Td.prototype.__scaleResize=function(t,e){this.pathInputed?ff(this,t,e):this.points?mf(this,t,e):this.width*=t},ud.prototype.__scaleResize=function(t,e){this.pathInputed?ff(this,t,e):this.points?mf(this,t,e):pf(this,t,e)},Hl.prototype.__scaleResize=function(t,e){yf(this,t,e)},Ql.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||pf(this,t,e),i&&yf(this,t,e)},le.add("resize"),le.add("editor","resize"),de.editor=function(t,e){const i=new Wp(t);return e&&e.sky.add(e.editor=i),i},Ql.addAttr("textBox",!1,_r),Xl.addAttr("editConfig",void 0,_r),Xl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),_r),Xl.addAttr("editInner","PathEditor",_r),Hl.addAttr("editInner","",_r),Id.addAttr("editInner","TextEditor",_r),Xl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Xl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Xl.setEditInner=function(t){this.changeAttr("editInner",t)};const kf=ie.get("LeaferTypeCreator"),Ef={list:{},register(t,e){Sf[t]&&kf.repeat(t),Sf[t]=e},run(t,e){const i=Sf[t];i&&i(e)}},{list:Sf,register:Bf}=Ef;Bf("viewport",wf),Bf("custom",function(t){wf(t,null,!0)}),Bf("design",function(t){wf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Bf("document",function(t){wf(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=at.getCenter(e.from,i.from),n=at.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=at.getDistance(e.from,i.from);return{move:r,scale:at.getDistance(e.to,i.to)/o,rotation:at.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&&(at.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:Lf,max:Of}=Math,{sign:Cf,within:Pf}=A,Mf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=Lf(s),o=Lf(n);return r>50&&(s=Of(50,r/3)*Cf(s)),o>50&&(n=Of(50,o/3)*Cf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:r}=e;const o=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(Qt.intWheelDeltaY?Math.abs(o)>17:Math.ceil(o)!==o),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){r=Pf(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Pf(1-Lf(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let Af,Df,If,Wf;class Ff{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Af=0,Df=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Af,totalY:Df}),e.emit(lc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Af+=t.moveX,t.totalY=Df+=t.moveY,e.emit(lc.BEFORE_MOVE,t),e.emit(lc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),If=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:If}),e.emit(_c.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=If*=t.scale,e.emit(_c.BEFORE_ZOOM,t),e.emit(_c.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Wf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Wf}),e.emit(uc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Wf+=t.rotation,e.emit(uc.BEFORE_ROTATE,t),e.emit(uc.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(lc.END,Object.assign(Object.assign({},e),{totalX:Af,totalY:Df})),i&&t.emit(_c.END,Object.assign(Object.assign({},i),{totalScale:If})),s&&t.emit(uc.END,Object.assign(Object.assign({},s),{totalRotation:Wf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const zf=jl.prototype,Yf=new jt,Nf=new gt;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){Ef.run(t,this)},zf.getValidMove=function(t,e,i=!0){const{disabled:s,scrollSpread:n}=this.app.config.move;Nf.set(t,e);const r=xf(this);return r&&(r.includes("x")?Nf.y=0:r.includes("y")?Nf.x=0:Math.abs(Nf.x)>Math.abs(Nf.y)?Nf.y=0:Nf.x=0,i&&r.includes("limit")&&(Yf.set(this.__world).addPoint(this.zoomLayer),n&&Yf.spread(n),ec.getValidMove(Yf,this.canvas.bounds,"auto",Nf,!0),r.includes("x")?Nf.y=0:r.includes("y")&&(Nf.x=0))),{x:s?0:Nf.x,y:s?0:Nf.y}},zf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const Vf=Pc.prototype;Vf.createTransformer=function(){this.transformer=new Ff(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 r=e.getScale?e.getScale(t,e):Mf.getScale(t,e);if(1!==r)this.zoom(Hf(r,t));else{const s=e.getMove?e.getMove(t,e):Mf.getMove(t,e);i.snap&&at.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:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Tf.detect(n,c(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}Tf.reset()}r||(n.center=Tf.state.center)}else r=o=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}))),o&&this.zoom(Hf(n.scale,t)),r&&this.move(Xf(n.move,t))};const Uf=bc.prototype,{abs:jf,min:Gf,max:Kf,hypot:Zf}=Math;function qf(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}Uf.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,r=150;let o,h,l,d=0,c=0,u=0,g=0,_=3;const{dragDataList:p}=this,f=p.length;for(let t=f-1;t>=Kf(f-3,0)&&(l=p[t],!(l.time&&Date.now()-l.time>100));t--)o=_--,d+=l.moveX*o,c+=l.moveY*o,g+=o,h=Zf(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=Kf(jf(d),jf(c));m>r&&(h=r/m,d*=h,c*=h);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),jf(d)<n&&jf(c)<n)return this.dragEndReal(t);at.move(t,d,c),this.drag(t),this.animate(y),e.emit(lc.DRAG_ANIMATE,t)};this.animate(y)}return i},Uf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Uf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},Uf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Uf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Xt.maxX(o),d=Xt.maxY(o),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,at.move(i,c,u),at.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)},Uf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},le.add("viewport"),le.add("view"),jl.prototype.zoom=function(t,e,i,s){let o;u(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:h}=this,l=this.canvas.bounds.clone().shrink(n(o)?30:o),g=new jt,_={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:x}=h;if(r(t))switch(t){case"in":p=qf(y,"in");break;case"out":p=qf(y,"out");break;case"fit":t=x;break;case"fit-width":(t=new jt(x)).height=0;break;case"fit-height":(t=new jt(x)).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,yo.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,l);g.set(h.getWorldBounds(e))}const{width:r,height:o}=g;let a=l.x-g.x,c=l.y-g.y;return i?(a+=Math.max((l.width-r)/2,0),c+=Math.max((l.height-o)/2,0)):(p=this.getValidScale(Math.min(l.width/r,l.height/o)),a+=(l.width-r*p)/2,c+=(l.height-o*p)/2,at.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(a=0),at.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class Jf extends Hl{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;r(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 Ql,this.scrollYBar=new Ql),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:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new jt(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=o.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_(oc.DRAG,this.onDrag,this),e.on_(oc.DRAG,this.onDrag,this),t.on_(oc.END,this.onDragEnd,this),e.on_(oc.END,this.onDragEnd,this),this.target.on_(ta.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Jo.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}le.add("scroll");class $f extends kl{}function Qf(t){return cr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&br(this),t.__useArrow=e,Br(this)}}}))}let tm=class extends Td{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){il.register(t,e)}};ye([Yr($f)],tm.prototype,"__",void 0),ye([Qf("angle")],tm.prototype,"endArrow",void 0),tm=ye([qr()],tm);const{M:em,L:im,C:sm,Q:nm,O:rm}=Ie,{rotate:om,copyFrom:am,scale:hm}=at,lm={},dm={layout(t,e,i,s,n,r,o){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,r,o),l+=3;break;case sm:for(h=1;h<6;h+=2)cm(t,l+h,e,i,s,n,r,o);l+=7;break;case nm:for(h=1;h<4;h+=2)cm(t,l+h,e,i,s,n,r,o);l+=5;break;case rm:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){dm.layout(t,0,0,1,1,e,i)}};function cm(t,e,i,s,n,r,o,a){am(lm,t[e],t[e+1]),o&&om(lm,o,a),n&&hm(lm,n,r),t[e]=i+lm.x,t[e+1]=s+lm.y}const{layout:um,rotate:gm}=dm,{getAngle:_m}=at,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]},xm={offset:pm,path:[...ym.path],dashPath:[1,-2.5,0,2,-1,0]};gm(xm.path,180,{x:-1.5,y:0});const wm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},bm={connect:{x:.5},path:[...wm.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]},Em={path:[...km.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Sm=_.clone(km),Bm=_.clone(Em);gm(Sm.path,45),gm(Bm.path,45);const Tm={angle:fm,"angle-side":mm,arrow:vm,triangle:ym,"triangle-flip":xm,circle:bm,"circle-line":wm,square:Em,"square-line":km,diamond:Bm,"diamond-line":Sm,mark:{offset:pm,path:[1,0,-2,2,0,2]}};function Rm(t,e,i,s,n,r,o){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 o&&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)),r.x=(f+m)*n,y}const{M:Lm,L:Om,C:Cm,Q:Pm,Z:Mm,N:Am,D:Dm,X:Im,G:Wm,F:Fm,O:zm,P:Ym,U:Nm}=Ie,{copy:Xm,copyFrom:Hm,getDistancePoint:Vm}=at,Um={},jm={},Gm={},Km={},Zm={},qm={list:Tm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:r,cornerRadius:o}=t.__,a=!o;let h,l=0,d=r.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=r[l],h){case Lm:case Om:(c<2||l+6>=d)&&(Hm(Zm,r[l+1],r[l+2]),!c&&u&&Xm(jm,Zm)),l+=3;break;case Cm:(1===c||l+7>=d-3)&&Jm(r,Km,Zm,l+3),l+=7;break;case Pm:(1===c||l+5>=d-3)&&Jm(r,Km,Zm,l+1),l+=5;break;case Mm:return;case Am:l+=5;break;case Dm:l+=9;break;case Im:l+=6;break;case Wm:l+=9;break;case Fm:l+=5;break;case zm:l+=7;break;case Ym:l+=4;break;case Nm:(1===c||l+6>=d-3)&&(Jm(r,Km,Zm,l+1),l+6!==d&&(Zm.x-=(Zm.x-Km.x)/10,Zm.y-=(Zm.y-Km.y)/10)),l+=6}if(c++,1===c&&h!==Lm)return;if(2===c&&u&&Xm(Gm,h===Om?Zm:Km),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Rm(t,e,Gm,jm,s,Um,!!n);n?d.push(...i):o.push(...i),Um.x&&(Vm(jm,Gm,-Um.x,!0),o[1]=Gm.x,o[2]=Gm.y)}if(i&&"none"!==i){const e=Rm(t,i,Km,Zm,s,Um,!!n);if(n?d.push(...e):o.push(...e),Um.x){let t;switch(Vm(Zm,Km,-Um.x,!0),h){case Om:t=l-3+1;break;case Cm:t=l-7+5;break;case Pm:t=l-5+3;break;case Nm:t=l-6+3}t&&$m(o,Km,t)}}}else Xm(Km,Zm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Jm(t,e,i,s){Hm(e,t[s],t[s+1]),Hm(i,t[s+2],t[s+3])}function $m(t,e,i){t[i]=e.x,t[i+1]=e.y}le.add("arrow"),Xl.addAttr("startArrow","none",Qf),Xl.addAttr("endArrow","none",Qf),Object.assign(il,qm),Object.assign(sl,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:Qm,NoAndSkip:ty,YesAndSkip:ey}=e,iy={},sy={},ny={};class ry{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 r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":iy.id=t.substring(1),t=iy;break;case".":sy.className=t.substring(1),t=sy;break;default:ny.tag=t,t=ny}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&&lo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===Qm||r===ey){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<ty&&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_(Yo.REMOVE,this.__onRemoveChild,this),this.target.on_(Xo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const oy=Xl.prototype;function ay(t){return t.leafer?t.leafer.selector:Qt.selector||(Qt.selector=de.selector())}oy.find=function(t,e){return ay(this).getBy(t,this,!1,e)},oy.findOne=function(t,e){return ay(this).getBy(t,this,!0,e)},le.add("find"),de.finder=function(t){return new ry(t)};const{setPoint:hy,addPoint:ly,toBounds:dy}=mt;const cy={syncExport(t,e,i){let n;hl.running=!0;try{const r=Zn.fileType(e),o=e.includes(".");i=Zn.getExportOptions(i);const{toURL:a}=Qt,{download:h}=Qt.origin;if("json"===r)o&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),n={data:!!o||t.toJSON(i.json)};else if("svg"===r)o&&h(a(t.toSVG(),"svg"),e),n={data:!!o||t.toSVG()};else{let r,o,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,v=s(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&s(i.fill)?t.fill:i.fill,b=Zn.isOpaqueImage(e)||w,k=new pt;if(f)r=!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":k.set(l);break;case"local":k.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:k.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}r=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};A.getScaleData(i.scale,i.size,r,E);let S=i.pixelRatio||1,{x:B,y:T,width:R,height:L}=new jt(r).scale(E.scaleX,E.scaleY);_&&(B+=_.x,T+=_.y,R=_.width,L=_.height,_.rotation&&k.rotateOfInner({x:B,y:T},-_.rotation));const O={exporting:!0,matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-B,-T).withScale(1/a*E.scaleX,1/h*E.scaleY)};let C,P=de.canvas({width:Math.floor(R),height:Math.floor(L),pixelRatio:S,smooth:v,contextSettings:x});g&&(C=t,C.__worldOpacity=0,t=c||t,O.bounds=P.bounds),P.save();const M=u&&!s(w),D=t.get("fill");if(M&&(t.fill=""),Qt.render(t,P,O),M&&(t.fill=D),P.restore(),C&&C.__updateWorldOpacity(),p){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?ly(o,n,r):hy(o={},n,r)),a++;const h=new jt;return o&&(dy(o,h),h.scale(1/t.pixelRatio).ceil()),h}(P);const t=P,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:S};P=de.canvas(s),P.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=A.fourNumber(m),n=P,{width:r,height:o}=n;P=de.canvas({width:r+s+e,height:o+t+i,pixelRatio:S}),P.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&P.fillWorld(P.bounds,w||"#FFFFFF","destination-over"),y&&y(P);n={data:"canvas"===e?P:P.export(e,i),width:P.pixelWidth,height:P.pixelHeight,renderBounds:r,trimBounds:o};const I=c&&c.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return hl.running=!1,n},export(t,e,i){return hl.running=!0,function(t){uy||(uy=new Qn);return new Promise(e=>{uy.add(()=>ve(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const r=()=>ve(this,void 0,void 0,function*(){if(!er.isComplete)return Qt.requestRender(r);const o=hl.syncExport(t,e,i);o.data instanceof Promise&&(o.data=yield o.data),s(o),n()});t.updateLayout(),gy(t);const{leafer:o}=t;o?o.waitViewCompleted(r):r()}))}};let uy;function gy(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>gy(t))}const _y=Me.prototype,py=ie.get("@leafer-in/export");_y.export=function(t,e){const{quality:i,blob:s}=Zn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},_y.toBlob=function(t,e){return new Promise(i=>{Qt.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{py.error(t),i(null)})})},_y.toDataURL=function(t,e){return Qt.origin.canvasToDataURL(this.view,t,e)},_y.saveAs=function(t,e){return new Promise(i=>{Qt.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{py.error(t),i(!1)})})},le.add("export"),Object.assign(hl,cy),Xl.prototype.export=function(t,e){return hl.export(this,t,e)},Xl.prototype.syncExport=function(t,e){return hl.syncExport(this,t,e)};const fy={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},my={top:"flex-start",middle:"center",bottom:"flex-end"},yy={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function vy(t,e,i){const{style:n}=t,{fill:o,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let g;n.fontFamily=e.fontFamily,n.fontSize=e.fontSize*i+"px",function(t,e){let i="black";d(e)&&(e=e[0]);if(c(e))switch(e.type){case"solid":i=tl.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=tl.string(r(t)?t:t.color);break;default:s(e.r)||(i=tl.string(e))}else i=e;t.color=i}(n,o),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,c(u)?(g=u.type,u.color&&(n.textDecorationColor=tl.string(u.color))):g=u,n.textDecoration=yy[g],n.textTransform=fy[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=my[e.verticalAlign],n.lineHeight=(e.__.__lineHeight||0)*i+"px",n.letterSpacing=(e.__.__letterSpacing||0)*i+"px",n.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",n.wordBreak="break"===h?"break-all":"normal",n.textIndent=(e.paraIndent||0)*i+"px",n.padding=d(a)?a.map(t=>t*i+"px").join(" "):(a||0)*i+"px",n.textOverflow="show"===l?"":"hide"===l?"clip":l}let xy=class extends Fp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Id),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:r}=t.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(s):r.appendChild(s),this.eventIds=[t.app.on_(sc.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const o=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}o.removeAllRanges(),o.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth)switch(i+=20,o.textAlign){case"center":n=o.autoSizeAlign?-i/2:-10;break;case"right":n=o.autoSizeAlign?-i:-20}if(o.__autoHeight)switch(s+=20,o.verticalAlign){case"middle":r=o.autoSizeAlign?-s/2:-10;break;case"bottom":r=o.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:_}=new pt(t.worldTransform).scale(1/e).translateInner(n,r),{style:p}=this.editDom;p.transform=`matrix(${l},${d},${c},${u},${g},${_})`,p.left=a+"px",p.top=h+"px",p.width=i+"px",p.height=s+"px",this.isHTMLText||vy(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};xy=ye([kp()],xy),le.add("text-editor","editor");class wy extends Pl{setText(t){this._text=t,this.__htmlChanged=!0}}const by={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let ky=class extends Rd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const r=t.indexOf(";",n+1);if(r>n+1&&(e=t.slice(n+1,r),i=by[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){r(t)?by[t]=e:Object.assign(by,t)}};ye([Yr(wy)],ky.prototype,"__",void 0),ye([xr("")],ky.prototype,"text",void 0),ye([_r("TextEditor")],ky.prototype,"editInner",void 0),ye([Lr(!1)],ky.prototype,"textEditing",void 0),ky=ye([qr()],ky),le.add("html");export{St as AlignHelper,e as Answer,zd as App,bt as AroundHelper,tm as Arrow,$f as ArrowData,Kt as AutoBounds,li as BezierHelper,jt as Bounds,Uo as BoundsEvent,Xt as BoundsHelper,Ql as Box,xl as BoxData,bh as Branch,bo as BranchHelper,Ya as BranchRender,Od as Canvas,Ml as CanvasData,me as CanvasManager,Yo as ChildEvent,tl as ColorConvert,de as Creator,Mc as Cursor,_ as DataHelper,ie as Debug,vt as Direction4,xt as Direction9,ec as DragBoundsHelper,oc as DragEvent,bc as Dragger,hc as DropEvent,cp as EditBox,sp as EditDataHelper,hp as EditPoint,V_ as EditSelect,Y_ as EditSelectHelper,zp as EditTool,Ep as EditToolCreator,Wp as Editor,O_ as EditorEvent,Tp as EditorGroupEvent,xp as EditorHelper,Pp as EditorMoveEvent,Ap as EditorRotateEvent,Mp as EditorScaleEvent,Dp as EditorSkewEvent,ol as Effect,nd as Ellipse,Sl as EllipseData,yi as EllipseHelper,zo as Event,pe as EventCreator,ha as Eventer,hl as Export,Zn as FileHelper,al as Filter,ry as Finder,E as FourNumberHelper,td as Frame,bl as FrameData,Hl as Group,vl as GroupData,ky as HTMLText,wy as HTMLTextData,Ac as HitCanvasManager,Rd as Image,Pl as ImageData,Vo as ImageEvent,sr as ImageManager,m as IncrementId,Fp as InnerEditor,Bp as InnerEditorEvent,Pc as InteractionBase,fc as InteractionHelper,pc as KeyEvent,Nd as Keyboard,Qo as LayoutEvent,Nh as Layouter,uh as Leaf,Ia as LeafBounds,yo as LeafBoundsHelper,f as LeafData,wa as LeafDataProxy,va as LeafEventer,lo as LeafHelper,Fo as LeafLayout,Eh as LeafLevelList,kh as LeafList,Ra as LeafMatrix,Wa as LeafRender,jl as Leafer,Bh as LeaferCanvas,Me as LeaferCanvasBase,wl as LeaferData,ea as LeaferEvent,ar as LeaferImage,Ef as LeaferTypeCreator,Td as Line,kl as LineData,Up as LineEditTool,A as MathHelper,pt as Matrix,Z as MatrixHelper,lc as MoveEvent,Tf as MultiTouchHelper,ac as MyDragEvent,Ld as MyImage,nc as MyPointerEvent,cc as MyTouchEvent,Fe as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,F as PI_2,sl as Paint,rl as PaintGradient,nl as PaintImage,Wd as Path,il as PathArrow,qm as PathArrowModule,Wn as PathBounds,Bs as PathCommandDataHelper,Ie as PathCommandMap,vi as PathCommandNodeHelper,ss as PathConvert,Vn as PathCorner,Hs as PathCreator,Rl as PathData,rn as PathDrawer,Ae as PathHelper,dm as PathMatrixHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ne as PathNumberCommandMap,Fd as Pen,Ll as PenData,Gh as Picker,Qt as Platform,le as Plugin,gt as Point,at as PointHelper,Xd as PointerButton,sc as PointerEvent,ud as Polygon,Bl as PolygonData,Xo as PropertyEvent,Gl as Rect,El as RectData,He as RectHelper,Yl as RectRender,ta as RenderEvent,Hh as Renderer,Jo as ResizeEvent,er as Resource,uc as RotateEvent,oe as Run,Jf as ScrollBar,z_ as SelectArea,Kh as Selector,vd as Star,Tl as StarData,ll as State,qt as StringNumberMap,F_ as Stroker,gc as SwipeEvent,$n as TaskItem,Qn as TaskProcessor,Id as Text,Qh as TextConvert,Cl as TextData,xy as TextEditor,dc as TouchEvent,Ip as TransformTool,Ff as Transformer,dl as Transition,mt as TwoPointBoundsHelper,Xl as UI,Il as UIBounds,ue as UICreator,ml as UIData,Hd as UIEvent,Fl as UIRender,el as UnitConvert,Zt as UnitConvertHelper,Ro as WaitHelper,$o as WatchEvent,Oh as Watcher,Mf as WheelEventHelper,_c as ZoomEvent,wf as addViewport,bf as addViewportConfig,Rr as affectRenderBoundsType,Sr as affectStrokeBoundsType,Qf as arrowType,ur as attr,mr as autoLayoutType,xr as boundsType,Kn as canvasPatch,Pe as canvasSizeAttrs,$h as createAttr,dr as createDescriptor,zr as cursorType,Yr as dataProcessor,_r as dataType,cr as decorateLeafAttr,Xr as defineDataProcessor,hr as defineKey,gr as defineLeafAttr,Or as dimType,br as doBoundsType,Br as doStrokeType,Zh as effectType,i as emptyData,Wr as eraserType,Ho as extraPropertyEventMap,Y as getBoundsData,lr as getDescriptor,N as getMatrixData,z as getPointData,Fr as hitType,d as isArray,u as isData,g as isEmptyData,o as isFinite,n as isNull,a as isNumber,c as isObject,r as isString,s as isUndefined,Nr as layoutProcessor,oa as leaferTransformAttrMap,Ir as maskType,wr as naturalBoundsType,Cr as opacityType,Un as path,kr as pathInputType,Er as pathType,jn as pen,pr as positionType,bp as registerEditTool,kp as registerInnerEditor,qr as registerUI,Jr as registerUIEvent,qh as resizeType,jr as rewrite,Gr as rewriteAble,vr as rotationType,yr as scaleType,fr as scrollType,Dr as sortType,Tr as strokeType,Lr as surfaceType,Gt as tempBounds,ft as tempMatrix,_t as tempPoint,l as tryToNumber,Rh as useCanvas,Zr as useModule,Sh as version,Pr as visibleType,Jh as zoomLayerType};
|
|
1
|
+
var t,e;function i(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function s(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const n={};function r(t){return void 0===t}function o(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!u(t)}function p(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return m(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&m(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(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:m}=f;class y{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(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=v;let w,b,k;const{max:E}=Math,S=[0,0,0,0],B={zero:[...S],tempFour:S,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)=>T(S,t,e,i,s),toTempAB(t,e,i){k=i?l(t)?e:t:[],l(t)?(w=O(t),b=e):l(e)?(w=t,b=O(e)):(w=t,b=e),4!==w.length&&(w=R(w)),4!==b.length&&(b=R(b))},get(t,e){let i;if(!l(t))switch(t.length){case 4:i=r(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]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>l(t)&&l(e)?E(t,e):(L(t,e,i),T(k,E(w[0],b[0]),E(w[1],b[1]),E(w[2],b[2]),E(w[3],b[3]))),add:(t,e,i)=>l(t)&&l(e)?t+e:(L(t,e,i),T(k,w[0]+b[0],w[1]+b[1],w[2]+b[2],w[3]+b[3])),swapAndScale(t,e,i,s){if(l(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:R(t);return T(n,a*i,h*e,r*i,o*e)}},{set:T,get:R,setTemp:O,toTempAB:L}=B,{round:C,pow:P,max:M,floor:A,PI:D}=Math,I={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:B.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.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=r(e)?1e12:P(10,e);return-0===(t=C(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&I.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(A(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=D/180,z=2*D,N=D/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:V,cos:U,acos:j,sqrt:G}=Math,{float:K}=I,Z={};function q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:q(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:H,getWorld: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){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=U(e*=F),a=V(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=F,t.a=s+r*i,t.b=n+o*i),e&&(e*=F,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:o,f:a}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*F,o=U(r),a=V(r);if(s||n){const e=s*F,i=n*F;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=G(n*n+r*r),c=t/d;const e=n/d;u=r>0?j(e):-j(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?j(-e):-j(e))}const e=K(U(u)),i=V(u);d=K(d),c=K(c),g=e?K((o/c+i)/e/F,9):0,_=e?K((r/d-i)/e/F,9):0,u=K(u/F)}else d=n,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*n+e.y*o,f+=e.x*r+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:r,d:o}=t;n||r?i=(s*o-n*r)/(e=G(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{float:Q}=I,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:nt,sqrt:rt,atan2:ot,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){g(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=F),n=it(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),gt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),r=nt(s-e);return rt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>at(ct(t,e,i,s),ct(i,s,n,r)),getAngle:(t,e)=>_t(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(r)*i,e.y=t.y+it(r)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>Q(t.x)===Q(e.x)&&Q(t.y)===Q(e.y),reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:gt,getAtan2:_t}=dt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new pt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const ft=new pt;class mt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return g(t)?J.copy(this,t):J.set(this,t,e,i,s,n,r),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new mt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const yt=new mt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){xt(t,e,i),xt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=vt;var wt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(bt||(bt={}));const 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 Et={directionData:kt,tempPoint:{},get:St,toPoint(t,e,i,s,n,r){const o=St(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Et.toPoint(t,e,i,!0),i)};function St(t){return a(t)?kt[bt[t]]:t}const{toPoint:Bt}=Et,Tt={toPoint(t,e,i,s,n,r){Bt(t,i,s,n,e,r)}},{tempPointBounds:Rt,setPoint:Ot,addPoint:Lt,toBounds:Ct}=vt,{toOuterPoint:Pt}=J,{float:Mt,fourNumber:At}=I,{floor:Dt,ceil:It}=Math;let Wt,Ft,zt,Nt;const Yt={},Xt={},Ht={},Vt={tempBounds:Ht,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=At(i);s?Ut.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ut.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ut.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=Ut.maxX(i),e.offsetY=Ut.maxY(i),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ut.copy(Ht,t),Ut.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Yt.x=t.x,Yt.y=t.y,Pt(e,Yt,Xt),Ot(Rt,Xt.x,Xt.y),Yt.x=t.x+t.width,Pt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.y=t.y+t.height,Pt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.x=t.x,Pt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Ct(Rt,i)},toInnerOf(t,e,i){i||(i=t),Ut.move(i,-e.e,-e.f),Ut.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ut.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),a(s)&&(s=Ut.getFitScale(t,e,"cover"===s)),Ht.width=n?e.width*=s:e.width*s,Ht.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,r,!0,!0)},getSpread(t,e,i){const s={};return Ut.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ut.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ut.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(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){Wt=t.x+t.width,Ft=t.y+t.height,zt=e.x,Nt=e.y,i||(zt+=e.width,Nt+=e.height),Wt=Wt>zt?Wt:zt,Ft=Ft>Nt?Ft:Nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Ft-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ut.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ut.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Gt(t,n)):jt(t,n));r&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ot(Rt,t.x,t.y):Lt(Rt,t.x,t.y)),Ct(Rt,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){jt(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=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ut.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=Ut.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=Ut.tempToOuterOf(e,i)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Wt=s+r,Ft=n+o,zt=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Wt=Wt<zt?Wt:zt,Ft=Ft<Nt?Ft:Nt,r=Wt-s,o=Ft-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Ut.copy(t,Ut.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ut.set(t)}},Ut=Vt,{add:jt,copy:Gt}=Ut;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 g(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 Zt=new Kt;class qt{constructor(t,e,i,s,n,r){g(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Kt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Jt={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},$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},{floor:Qt,max:te}=Math,ee={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=te(Qt(e+(s||0)),1),c=te(Qt(i+(n||0)),1);let u,g,_;l&&(_=Jt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:g=!0);const p=ee.origin.createCanvas(g?2*d:d,u?2*c:c),f=p.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(p,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(p,0,0,d,c,u?_:d,u?c:_,d,c))}return p},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&f.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=I;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,r=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?a(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const oe=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];r(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},ge=ne.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ge.repeat(e),pe[e]=t},get(t,e,i,s,n,o){if(!pe[t])return void ge.warn("not register "+t);const a=new pe[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:pe}=_e,fe=ne.get("EventCreator"),me={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ye[e]&&fe.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=me;class ve{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=ue.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const we=[];function be(){return(t,e)=>{we.push(e)}}const ke=[];let Ee=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||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};i([xe("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),i([xe("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),i([xe("globalAlpha")],Ee.prototype,"opacity",void 0),i([xe()],Ee.prototype,"fillStyle",void 0),i([xe()],Ee.prototype,"strokeStyle",void 0),i([xe("lineWidth")],Ee.prototype,"strokeWidth",void 0),i([xe("lineCap")],Ee.prototype,"strokeCap",void 0),i([xe("lineJoin")],Ee.prototype,"strokeJoin",void 0),i([xe("lineDashOffset")],Ee.prototype,"dashOffset",void 0),i([xe()],Ee.prototype,"miterLimit",void 0),i([xe()],Ee.prototype,"shadowBlur",void 0),i([xe()],Ee.prototype,"shadowColor",void 0),i([xe()],Ee.prototype,"shadowOffsetX",void 0),i([xe()],Ee.prototype,"shadowOffsetY",void 0),i([xe()],Ee.prototype,"filter",void 0),i([xe()],Ee.prototype,"font",void 0),i([xe()],Ee.prototype,"fontKerning",void 0),i([xe()],Ee.prototype,"fontStretch",void 0),i([xe()],Ee.prototype,"fontVariantCaps",void 0),i([xe()],Ee.prototype,"textAlign",void 0),i([xe()],Ee.prototype,"textBaseline",void 0),i([xe()],Ee.prototype,"textRendering",void 0),i([xe()],Ee.prototype,"wordSpacing",void 0),i([xe()],Ee.prototype,"letterSpacing",void 0),i([xe()],Ee.prototype,"direction",void 0),i([be()],Ee.prototype,"setTransform",null),i([be()],Ee.prototype,"resetTransform",null),i([be()],Ee.prototype,"getTransform",null),i([be()],Ee.prototype,"save",null),i([be()],Ee.prototype,"restore",null),i([be()],Ee.prototype,"translate",null),i([be()],Ee.prototype,"scale",null),i([be()],Ee.prototype,"rotate",null),i([be()],Ee.prototype,"fill",null),i([be()],Ee.prototype,"stroke",null),i([be()],Ee.prototype,"clip",null),i([be()],Ee.prototype,"fillRect",null),i([be()],Ee.prototype,"strokeRect",null),i([be()],Ee.prototype,"clearRect",null),i([be()],Ee.prototype,"beginPath",null),i([be()],Ee.prototype,"moveTo",null),i([be()],Ee.prototype,"lineTo",null),i([be()],Ee.prototype,"bezierCurveTo",null),i([be()],Ee.prototype,"quadraticCurveTo",null),i([be()],Ee.prototype,"closePath",null),i([be()],Ee.prototype,"arc",null),i([be()],Ee.prototype,"arcTo",null),i([be()],Ee.prototype,"ellipse",null),i([be()],Ee.prototype,"rect",null),i([be()],Ee.prototype,"roundRect",null),i([be()],Ee.prototype,"createConicGradient",null),i([be()],Ee.prototype,"createLinearGradient",null),i([be()],Ee.prototype,"createPattern",null),i([be()],Ee.prototype,"createRadialGradient",null),i([be()],Ee.prototype,"fillText",null),i([be()],Ee.prototype,"measureText",null),i([be()],Ee.prototype,"strokeText",null);const{copy:Se,multiplyParent:Be,pixelScale:Te}=J,{round:Re}=Math,Oe=new Kt,Le=new Kt,Ce={width:1,height:1,pixelRatio:1},Pe=["width","height","pixelRatio"];class Me extends Ee{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Ce),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,Pe),Pe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Be(t,e,n),Te(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Re(n.e-.5)+.5,n.f=Re(n.f-.5)+.5):(n.e=Re(n.e),n.f=Re(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio: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=Le):i=Oe,this.drawImage(t.view,Oe.x,Oe.y,Oe.width,Oe.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,Vt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Oe.x,Oe.y,Oe.width,Oe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Oe.x,Oe.y,Oe.width,Oe.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Oe.x,Oe.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(Oe.x,Oe.y,Oe.width,Oe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Oe.x,Oe.y,Oe.width,Oe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Oe.x,Oe.y,Oe.width,Oe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Oe.x,Oe.y,Oe.width,Oe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Oe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Le,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):ue.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},Ie=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},De),We={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ze=Object.assign(Object.assign({},Fe),De),Ne=Ie,Ye={};for(let t in Ne)Ye[Ne[t]]=t;const Xe={};for(let t in Ne)Xe[Ne[t]]=We[t];const He={drawRoundRect(t,e,i,s,n,r){const o=I.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Ve,cos:Ue,hypot:je,atan2:Ge,ceil:Ke,abs:Ze,PI:qe,sqrt:Je,pow:$e}=Math,{setPoint:Qe,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Ie,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,g,_,p,f,m,y,v=n.length;const x=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,p=a-r,f=Je($e(_,2)+$e(p,2)),m=Je($e(h-o,2)+$e(l-a,2)),(f||m)&&(y=f+m,f=x*f/y,m=x*m/y,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(_||p)&&t.push(ri,u,g,d,c,o,a),u=o+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(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Ae.creator.path=[],He.drawRoundRect(Ae.creator,e,i,s,n,r),t.push(...Ae.convertToCanvasData(Ae.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,g=r-s,_=o-n;let p=Ge(u,c),f=Ge(_,g);const m=je(c,u),y=je(g,_);let v=f-p;if(v<0&&(v+=z),m<1e-12||y<1e-12||v<1e-12||Ze(v-qe)<1e-12)return t&&t.push(ni,s,n),h&&(Qe(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const x=c*_-g*u<0,w=x?-1:1,b=a/Ue(v/2),k=s+b*Ue(p+v/2+N*w),E=n+b*Ve(p+v/2+N*w);return p-=N*w,f-=N*w,ui(t,k,E,a,a,0,p/F,f/F,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*F,g=Ve(u),_=Ue(u);let p=o*F,f=a*F;p>qe&&(p-=z),f<0&&(f+=z);let m=f-p;m<0?m+=z:m>z&&(m-=z),h&&(m-=z);const y=Ke(Ze(m/N)),v=m/y,x=Ve(v/4),w=8/3*x*x/Ve(v/2);f=p+v;let b,k,E,S,B,T,R,O,L=Ue(p),C=Ve(p),P=E=_*s*L-g*n*C,M=S=g*s*L+_*n*C,A=e+E,D=i+S;t&&t.push(t.length?ni:si,A,D),l&&Qe(l,A,D),c&&ei(c,A,D);for(let r=0;r<y;r++)b=Ue(f),k=Ve(f),E=_*s*b-g*n*k,S=g*s*b+_*n*k,B=e+P-w*(_*s*C+g*n*L),T=i+M-w*(g*s*C-_*n*L),R=e+E+w*(_*s*k+g*n*b),O=i+S+w*(g*s*k-_*n*b),t&&t.push(ri,B,T,R,O,e+E,i+S),l&&ci(e+P,i+M,B,T,R,O,e+E,i+S,l,!0),P=E,M=S,L=b,C=k,p=f,f+=v;d&&ei(d,e+E,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,x=i,w=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,b=a),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,g=3*x-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?ti(h,t,e):Qe(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*r+_*a,l.y=c*i+u*n+g*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:gi,cos:_i,sqrt:pi,atan2:fi}=Math,{ellipse:mi}=li,yi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=r*F,_=gi(g),p=_i(g),f=-p*c-_*u,m=-p*u+_*c,y=s*s,v=n*n,x=m*m,w=f*f,b=y*v-y*x-v*w;let k=0;if(b<0){const t=pi(1-b/(y*v));s*=t,n*=t}else k=(o===a?-1:1)*pi(b/(y*x+v*w));const E=k*s*m/n,S=-k*n*f/s,B=fi((m-S)/n,(f-E)/s),T=fi((-m-S)/n,(-f-E)/s);let R=T-B;0===a&&R>0?R-=z:1===a&&R<0&&(R+=z);const O=e+c+p*E-_*S,L=i+u+_*E+p*S,C=R<0?1:0;d||ee.ellipseToCurve?mi(t,O,L,s,n,r,B/F,T/F,C):s!==n||r?t.push(Ie.G,O,L,s,n,r,B/F,T/F,C):t.push(Ie.O,O,L,s,B/F,T/F,C)}},vi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:wi,L:bi,l:ki,H:Ei,h:Si,V:Bi,v:Ti,C:Ri,c:Oi,S:Li,s:Ci,Q:Pi,q:Mi,T:Ai,t:Di,A:Ii,a:Wi,Z:Fi,z:zi,N:Ni,D:Yi,X:Xi,G:Hi,F:Vi,O:Ui,P:ji,U:Gi}=Ie,{rect:Ki,roundRect:Zi,arcTo:qi,arc:Ji,ellipse:$i,quadraticCurveTo:Qi}=li,{ellipticalArc:ts}=yi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Xe[s],a+=s===n?" ":Ye[s];for(let s=1;s<i;s++)a+=I.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ze:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Ie[s]?(r&&(rs(o,r),r=""),ns.name=Ie[s],ns.length=We[s],ns.index=0,rs(o,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case wi: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 Si:t[c+1]+=a;case Ei:a=t[c+1],g.push(bi,a,h),c+=2;break;case Ti:t[c+1]+=h;case Bi:h=t[c+1],g.push(bi,a,h),c+=2;break;case ki:t[c+1]+=a,t[c+2]+=h;case bi:a=t[c+1],h=t[c+2],g.push(bi,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:o=r===Ri||r===Li,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Ri,l,d,i,s,a,h),c+=5;break;case Oi: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=Ri;case Ri:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ri,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Di:t[c+1]+=a,t[c+2]+=h,n=Ai;case Ai:o=r===Pi||r===Ai,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Mi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:i=t[c+1],s=t[c+2],e?Qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Wi:t[c+6]+=a,t[c+7]+=h;case Ii:ts(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 zi:case Fi:g.push(Fi),c++;break;case Ni:a=t[c+1],h=t[c+2],e?Ki(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?Zi(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 Xi:a=t[c+1],h=t[c+2],e?Zi(g,a,h,t[c+3],t[c+4],t[c+5]):os(g,t,c,6),c+=6;break;case Hi:$i(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,is),a=is.x,h=is.y,c+=9;break;case Vi:e?$i(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 Ui:Ji(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,is),a=is.x,h=is.y,c+=7;break;case ji:e?Ji(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 Gi:qi(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,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${n} [index:${c}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:gs,X:_s,G:ps,F:fs,O:ms,P:ys,U:vs}=Ie,{getMinDistanceFrom:xs,getRadianFrom:ws}=lt,{tan:bs,min:ks,abs:Es}=Math,Ss={},Bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(l(r))t.push(_s,e,i,s,n,r);else{const o=I.fourNumber(r);o?t.push(gs,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,r,a,h,l){if(s===n)return Rs(t,e,i,s,a,h,l);o(r)?t.push(fs,e,i,s,n):(o(a)&&(a=0),o(h)&&(h=360),t.push(ps,e,i,s,n,r,a,h,l?1:0))},arc(t,e,i,s,n,r,a){o(n)?t.push(ys,e,i,s):(o(n)&&(n=0),o(r)&&(r=360),t.push(ms,e,i,s,n,r,a?1:0))},arcTo(t,e,i,s,n,o,a,h,l){if(!r(a)){const t=xs(a,h,e,i,s,n)/(l?1:2);o=ks(o,ks(t,t*Es(bs(ws(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,o)},drawEllipse(t,e,i,s,n,r,a,h,l){li.ellipse(null,e,i,s,n,o(r)?0:r,o(a)?0:a,o(h)?360:h,l,null,null,Ss),t.push(as,Ss.x,Ss.y),Ts(t,e,i,s,n,r,a,h,l)},drawArc(t,e,i,s,n,r,a){li.arc(null,e,i,s,o(n)?0:n,o(r)?360:r,a,null,null,Ss),t.push(as,Ss.x,Ss.y),Rs(t,e,i,s,n,r,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Ts,arc:Rs}=Bs,{moveTo:Os,lineTo:Ls,quadraticCurveTo:Cs,bezierCurveTo:Ps,closePath:Ms,beginPath:As,rect:Ds,roundRect:Is,ellipse:Ws,arc:Fs,arcTo:zs,drawEllipse:Ns,drawArc:Ys,drawPoints:Xs}=Bs;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return Os(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ls(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ps(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ms(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 Is(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ws(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return zs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Ns(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Ys(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Vs,L:Us,C:js,Q:Gs,Z:Ks,N:Zs,D:qs,X:Js,G:$s,F:Qs,O:tn,P:en,U:sn}=Ie,nn=ne.get("PathDrawer"),rn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Vs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us: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 Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.closePath(),s+=1;break;case Zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,z,!1),s+=5;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case en:t.arc(e[s+1],e[s+2],e[s+3],0,z,!1),s+=4;break;case sn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void nn.error(`command: ${i} [index:${s}]`,e)}}},{M:on,L:an,C:hn,Q:ln,Z:dn,N:cn,D:un,X:gn,G:_n,F:pn,O:fn,P:mn,U:yn}=Ie,{toTwoPointBounds:vn,toTwoPointBoundsByQuadraticCurve:xn,arcTo:wn,arc:bn,ellipse:kn}=li,{addPointBounds:En,copy:Sn,addPoint:Bn,setPoint:Tn,addBounds:Rn,toBounds:On}=vt,Ln=ne.get("PathBounds");let Cn,Pn,Mn;const An={},Dn={},In={},Wn={toBounds(t,e){Wn.toTwoPointBounds(t,Dn),On(Dn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Tn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===dn||o===hn||o===ln?Tn(e,h,l):Tn(e,t[a+1],t[a+2])),o){case on:case an:h=t[a+1],l=t[a+2],Bn(e,h,l),a+=3;break;case hn:n=t[a+5],r=t[a+6],vn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,An),En(e,An),h=n,l=r,a+=7;break;case ln:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],xn(h,l,i,s,n,r,An),En(e,An),h=n,l=r,a+=5;break;case dn:a+=1;break;case cn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=5;break;case un:case gn:h=t[a+1],l=t[a+2],Rn(e,h,l,t[a+3],t[a+4]),a+=o===un?9:6;break;case _n:kn(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,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=9;break;case pn:h=t[a+1],l=t[a+2],Pn=t[a+3],Mn=t[a+4],Rn(e,h-Pn,l-Mn,2*Pn,2*Mn),h+=Pn,a+=5;break;case fn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],An,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=7;break;case mn:h=t[a+1],l=t[a+2],Cn=t[a+3],Rn(e,h-Cn,l-Cn,2*Cn,2*Cn),h+=Cn,a+=4;break;case yn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],An,In),0===a?Sn(e,An):En(e,An),h=In.x,l=In.y,a+=6;break;default:return void Ln.error(`command: ${o} [index:${a}]`,t)}}},{M:Fn,L:zn,Z:Nn}=Ie,{getCenterX:Yn,getCenterY:Xn}=lt,{arcTo:Hn}=Bs,Vn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,g=0,_=0,p=0;u(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;o<f;){switch(s=t[o],s){case Fn:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===zn?(c=t[o+1],g=t[o+2],m?y.push(Fn,l,d):y.push(Fn,Yn(l,c),Xn(d,g))):y.push(Fn,l,d);break;case zn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case zn:Hn(y,a,h,t[o+1],t[o+2],e,_,p,m);break;case Nn:Hn(y,a,h,l,d,e,_,p,m);break;default:y.push(zn,a,h)}_=a,p=h;break;case Nn:n!==Nn&&(Hn(y,l,d,c,g,e,_,p,m),y.push(Nn)),o+=1;break;default:r=Xe[s];for(let e=0;e<r;e++)y.push(t[o+e]);o+=r}n=s}return s!==Nn&&(y[1]=l,y[2]=d),y}};function Un(t){return new Hs(t)}const jn=Un();Ae.creator=Un(),Ae.parse=ss.parse,Ae.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Gn}=He;function Kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Gn(this,t,e,i,s,n)})}(t)}const Zn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=qn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},qn=Zn;qn.mineType=qn.mimeType,qn.alphaPixelTypes.forEach(t=>qn.upperCaseTypeMap[t]=t.toUpperCase());const Jn=ne.get("TaskProcessor");class $n{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return s(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Jn.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&&f.assign(this.config,t),this.empty()}add(t,e,i){let s,n,o,a;const h=new $n(t);return h.parent=this,l(e)?a=e:e&&(n=e.parallel,s=e.start,o=e.time,a=e.delay,i||(i=e.canUse)),o&&(h.time=o),!1===n&&(h.parallel=!1),i&&(h.canUse=i),r(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let 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 tr=ne.get("Resource"),er={tasker:new Qn,queue:new Qn({parallel:1}),map:{},get isComplete(){return ir.tasker.isComplete},set(t,e){ir.map[t]&&tr.repeat(t),ir.map[t]=e},get:t=>ir.map[t],remove(t){const e=ir.map[t];e&&(e.destroy&&e.destroy(),delete ir.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 a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),ir.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){ir.map={}}},ir=er,sr={maxRecycled:10,recycledList:[],patternTasker:er.queue,get(t,e){let i=er.get(t.url);return i||er.set(t.url,i="film"===e?ue.film(t):ue.image(t)),i.use++,i},recycle(t){t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&er.remove(t.url):(t.clearLevels(),nr.recycledList.push(t)))})},recyclePaint(t){nr.recycle(t.image)},clearRecycled(t){const e=nr.recycledList;(e.length>nr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&er.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Zn.alphaPixelTypes.some(e=>nr.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:"+Zn.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Zn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},nr=sr,{IMAGE:rr,create:or}=v;class ar{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return r(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=or(rr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sr.isFormat("svg",t)&&(this.isSVG=!0),sr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,er.tasker.add(()=>s(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=ee.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}class hr extends ar{get tag(){return"Film"}}class lr extends ar{get tag(){return"Video"}}function dr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function cr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ur(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function gr(t,e){return(i,s)=>pr(i,s,t,e&&e(s))}function _r(t){return t}function pr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};dr(t,e,Object.assign(n,s||{})),Vr(t,e,i)}function fr(t){return gr(t)}function mr(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function yr(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function vr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Er(this))}}))}function xr(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function wr(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function br(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i,e)&&Er(this)}}))}function kr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(Er(this),this.__.__removeNaturalSize())}}))}function Er(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Sr(t){return gr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Er(this)}}))}const Br=br;function Tr(t,e){return gr(t,t=>({set(i){this.__setAttr(t,i)&&(Rr(this),e&&(this.__.__useStroke=!0))}}))}function Rr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Er(t)}const Or=Tr;function Lr(t){return gr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Cr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Pr(t){return gr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Mr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Dr(this)}}))}function Ar(t){return gr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ir(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ir(this,t,e,i),this.mask&&Dr(this)}}))}function Dr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ir(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Er(t))}function Wr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Fr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function zr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Nr(t){return gr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ne.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Yr(t){return gr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Xr(t){return(e,i)=>{dr(e,"__DataProcessor",{get:()=>t})}}function Hr(t){return(e,i)=>{dr(e,"__LayoutProcessor",{get:()=>t})}}function Vr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ur(e,i);if(r(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(g(i)){const t=p(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.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=s;for(;!l&&d;)l=cr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),dr(s,e,a)}const Ur=new ne("rewrite"),jr=[],Gr=["destroy","constructor"];function Kr(t){return(e,i)=>{jr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Zr(){return t=>{qr()}}function qr(t){jr.length&&(jr.forEach(e=>{t&&Ur.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),jr.length=0)}function Jr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Gr.includes(s)||e&&e.includes(s)))if(t.prototype){cr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function $r(){return t=>{_e.register(t)}}function Qr(){return t=>{me.register(t)}}setTimeout(()=>qr(!0));const{copy:to,toInnerPoint:eo,toOuterPoint:io,scaleOfOuter:so,rotateOfOuter:no,skewOfOuter:ro,multiplyParent:oo,divideParent:ao,getLayout:ho}=J,lo={},{round:co}=Math,uo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),po(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)_o(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)fo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&fo(t),t.__updateChange()},updateAllChange(t){if(yo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)mo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=g(e)?Object.assign({},e):{x:e,y:i};s?io(t.localTransform,r,r,!0):t.parent&&eo(t.parent.scrollWorldTransform,r,r,!0),go.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){g(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=co(e),i=co(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){go.zoomOfLocal(t,vo(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(l(s)||(s&&(r=s),s=i),to(lo,o),so(lo,e,i,s),go.hasHighPosition(t))go.setTransform(t,lo,n,r);else{const e=t.x+lo.e-o.e,a=t.y+lo.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){go.rotateOfLocal(t,vo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;to(lo,n),no(lo,e,i),go.hasHighPosition(t)?go.setTransform(t,lo,!1,s):t.set({x:t.x+lo.e-n.e,y:t.y+lo.f-n.f,rotation:I.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){go.skewOfLocal(t,vo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){to(lo,t.__localMatrix),ro(lo,e,i,s),go.setTransform(t,lo,n,r)},transformWorld(t,e,i,s){to(lo,t.worldTransform),oo(lo,e),t.parent&&ao(lo,t.parent.scrollWorldTransform),go.setTransform(t,lo,i,s)},transform(t,e,i,s){to(lo,t.localTransform),oo(lo,e),go.setTransform(t,lo,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&go.getInnerOrigin(t,n.origin),o=ho(e,r,n.around&&go.getInnerOrigin(t,n.around));if(go.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=go.getInnerOrigin(t,n.origin);lt.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return so(i,go.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(go.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Et.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(to(lo,t.worldTransform),ao(lo,e.scrollWorldTransform),i?lo:Object.assign({},lo)),drop(t,e,i,s){t.setTransform(go.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||go.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),ee.requestRender(()=>go.animateMove(t,e,i))}}},go=uo,{updateAllMatrix:_o,updateMatrix:po,updateAllWorldOpacity:fo,updateAllChange:mo,updateChange:yo}=go;function vo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const xo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>bo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>bo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>bo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let wo;function bo(t,e){return e||(wo=0),t.__.mask&&(wo=1),wo<0?null:(wo&&(wo=-1),!0)}const{updateBounds:ko}=uo,Eo={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),So(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Bo(e[t],e)},updateBounds(t,e){const i=[t];Bo(t,i),To(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++)ko(s[t]);e&&e===i||ko(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Ro(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Oo(t,e,i,s,n,r,o)}},{pushAllChildBranch:So,pushAllBranchStack:Bo,updateBoundsByBranchStack:To,move:Ro,scale:Oo}=Eo,Lo={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Co,updateBounds:Po}=uo,{toOuterOf:Mo,getPoints:Ao,copy:Do}=Vt,Io="_localContentBounds",Wo="_worldContentBounds",Fo="_worldBoxBounds",zo="_worldStrokeBounds";class No{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 Mo(this.contentBounds,this.leaf.__localMatrix,this[Io]||(this[Io]={})),this[Io]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Mo(this.contentBounds,this.leaf.__world,this[Wo]||(this[Wo]={})),this[Wo]}get worldBoxBounds(){return Mo(this.boxBounds,this.leaf.__world,this[Fo]||(this[Fo]={})),this[Fo]}get worldStrokeBounds(){return Mo(this.strokeBounds,this.leaf.__world,this[zo]||(this[zo]={})),this[zo]}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 Po(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,ee.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return J.defaultMatrix;case"page":t=e.zoomLayer;default:return Co(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Co(s,e,!0)}if(o||(o=J.getLayout(r)),Do(o,a),lt.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Ao(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Yo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Xo extends Yo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Xo.ADD="child.add",Xo.REMOVE="child.remove",Xo.CREATED="created",Xo.MOUNTED="mounted",Xo.UNMOUNTED="unmounted",Xo.DESTROY="destroy";const Ho="property.scroll";class Vo extends Yo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Vo.CHANGE="property.change",Vo.LEAFER_CHANGE="property.leafer_change",Vo.SCROLL=Ho;const Uo={scrollX:Ho,scrollY:Ho};class jo extends Yo{constructor(t,e){super(t),Object.assign(this,e)}}jo.LOAD="image.load",jo.LOADED="image.loaded",jo.ERROR="image.error";class Go extends Yo{static checkHas(t,e,i){"on"===i?e===Jo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ko)||t.hasEvent(Zo)||t.hasEvent(qo),t.__hasWorldEvent=t.hasEvent(Jo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ko,t),"inner"===e&&t.emit(Zo,t)),t.emit(qo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Jo,this)}}Go.RESIZE="bounds.resize",Go.INNER="bounds.inner",Go.LOCAL="bounds.local",Go.WORLD="bounds.world";const{RESIZE:Ko,INNER:Zo,LOCAL:qo,WORLD:Jo}=Go,$o={};[Ko,Zo,qo,Jo].forEach(t=>$o[t]=1);class Qo extends Yo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){g(t)?(super(Qo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Qo.RESIZE="resize";class ta extends Yo{constructor(t,e){super(t),this.data=e}}ta.REQUEST="watch.request",ta.DATA="watch.data";class ea extends Yo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ea.REQUEST="layout.request",ea.START="layout.start",ea.BEFORE="layout.before",ea.LAYOUT="layout",ea.AFTER="layout.after",ea.AGAIN="layout.again",ea.END="layout.end";class ia extends Yo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ia.REQUEST="render.request",ia.CHILD_START="render.child_start",ia.CHILD_END="render.child_end",ia.START="render.start",ia.BEFORE="render.before",ia.RENDER="render",ia.AFTER="render.after",ia.AGAIN="render.again",ia.END="render.end",ia.NEXT="render.next";class sa extends Yo{}sa.START="leafer.start",sa.BEFORE_READY="leafer.before_ready",sa.READY="leafer.ready",sa.AFTER_READY="leafer.after_ready",sa.VIEW_READY="leafer.view_ready",sa.VIEW_COMPLETED="leafer.view_completed",sa.STOP="leafer.stop",sa.RESTART="leafer.restart",sa.END="leafer.end",sa.UPDATE_MODE="leafer.update_mode",sa.TRANSFORM="leafer.transform",sa.MOVE="leafer.move",sa.SCALE="leafer.scale",sa.ROTATE="leafer.rotate",sa.SKEW="leafer.skew";const{MOVE:na,SCALE:ra,ROTATE:oa,SKEW:aa}=sa,ha={x:na,y:na,scaleX:ra,scaleY:ra,rotation:oa,skewX:aa,skewY:aa},la={};class da{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=ca(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],$o[t]&&Go.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ca(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],$o[t]&&Go.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&me.has(t)&&(e=me.get(t,{type:t,target:this,current:this}));const s=ca(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],o=s&&s[t];return!!(r(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ca(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:la)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:la)}}const{on:ua,on_:ga,off:_a,off_:pa,once:fa,emit:ma,emitEvent:ya,hasEvent:va,destroy:xa}=da.prototype,wa={on:ua,on_:ga,off:_a,off_:pa,once:fa,emit:ma,emitEvent:ya,hasEvent:va,destroyEventer:xa},ba=ne.get("setAttr"),ka={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||r(e)||(ba.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Vo(Vo.LEAFER_CHANGE,this,t,s,e));const i=ha[t];i&&(this.emitEvent(new sa(i,this)),this.emitEvent(new sa(sa.TRANSFORM,this)))}this.emitPropertyEvent(Vo.CHANGE,t,s,e);const i=Uo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Vo(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||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ea,multiplyParent:Sa,translateInner:Ba,defaultWorld:Ta}=J,{toPoint:Ra,tempPoint:Oa}=Et,La={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Sa(this.__local||e,t?t.__scrollWorld||t.__world:Ta,i,!!e.affectScaleOrRotation,n),s&&Ba(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Ea(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)&&(Ra(i.around||i.origin,t.boxBounds,Oa),Ba(e,-Oa.x,-Oa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ca,updateAllMatrix:Pa}=uo,{updateBounds:Ma}=Eo,{toOuterOf:Aa,copyAndSpread:Da,copy:Ia}=Vt,{toBounds:Wa}=Wn,Fa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Aa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Go.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Go.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Aa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Aa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Aa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Wa(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(),Pa(this),Ma(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Pa(this),Ma(this,this))):Ca(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Da(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;l(i)&&i<=0?Ia(e.renderBounds,e.strokeBounds):Da(e.renderBounds,e.boxBounds,i)}},za={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),uo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ne.showBounds&&ne.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:Na}=xo,{hasSize:Ya}=Vt,Xa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ya(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],Na(i,e)||(i.__.complex?i.__renderComplex(t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Na(i[s],e)||i[s].__clip(t,e)}}},Ha={},{LEAF:Va,create:Ua}=v,{stintSet:ja}=f,{toInnerPoint:Ga,toOuterPoint:Ka,multiplyParent:Za}=J,{toOuterOf:qa}=Vt,{copy:Ja,move:$a}=lt,{moveLocal:Qa,zoomOfLocal:th,rotateOfLocal:eh,skewOfLocal:ih,moveWorld:sh,zoomOfWorld:nh,rotateOfWorld:rh,skewOfWorld:oh,transform:ah,transformWorld:hh,setTransform:lh,getFlipTransform:dh,getLocalOrigin:ch,getRelativeWorld:uh,drop:gh}=uo;let _h=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 y}get __LayoutProcessor(){return No}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ua(Va),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Xo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Xo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Xo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Xo.MOUNTED)):this.__emitLifeEvent(Xo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(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 Za(i,t.matrix,e,void 0,i),qa(this.__layout.renderBounds,e,e),ja(e,"half",i.half),ja(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}=sr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ha.scaleX=i,Ha.scaleY=s,Ha}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?uh(this,e):this.worldTransform,n=i?t:{};return qa(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ja(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ja(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ga(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ka(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){lh(this,t,e,i)}transform(t,e,i){ah(this,t,e,i)}move(t,e,i){Qa(this,t,e,i)}moveInner(t,e,i){sh(this,t,e,!0,i)}scaleOf(t,e,i,s,n){th(this,ch(this,t),e,i,s,n)}rotateOf(t,e,i){eh(this,ch(this,t),e,i)}skewOf(t,e,i,s,n){ih(this,ch(this,t),e,i,s,n)}transformWorld(t,e,i){hh(this,t,e,i)}moveWorld(t,e,i){sh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){nh(this,t,e,i,s,n)}rotateOfWorld(t,e){rh(this,t,e)}skewOfWorld(t,e,i,s,n){oh(this,t,e,i,s,n)}flip(t,e){ah(this,dh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__renderComplex(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ce.need("path")}getMotionPoint(t){return ce.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){gh(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):Vr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=br),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Xo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Xo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};_h=i([Jr(ka),Jr(La),Jr(Fa),Jr(wa),Jr(za)],_h);const{setListWithFn:ph}=Vt,{sort:fh}=Eo,{localBoxBounds:mh,localStrokeBounds:yh,localRenderBounds:vh,maskLocalBoxBounds:xh,maskLocalStrokeBounds:wh,maskLocalRenderBounds:bh}=xo,kh=new ne("Branch");let Eh=class extends _h{__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){ph(e||this.__layout.boxBounds,this.children,this.__hasMask?xh:mh)}__updateStrokeBounds(t){ph(t||this.__layout.strokeBounds,this.children,this.__hasMask?wh:yh)}__updateRenderBounds(t){ph(t||this.__layout.renderBounds,this.children,this.__hasMask?bh:vh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(fh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return kh.warn("add self or destroyed");const i=r(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Xo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Xo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Xo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Xo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Xo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Eh=i([Jr(Xa)],Eh);class Sh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Sh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(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 Th="2.0.2";class Rh extends Me{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=ee.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}function Oh(t,e){ee.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Zn.mimeType(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Zn.mimeType(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:(t,e,i)=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",ee.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()}),loadContent(t){return s(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}Kn(OffscreenCanvasRenderingContext2D.prototype),Kn(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Rh(t,e),image:t=>new ar(t)}),ee.name="web",ee.isWorker=!0,ee.backgrounder=!0,ee.requestRender=function(t){requestAnimationFrame(t)},dr(ee,"devicePixelRatio",{get:()=>1});const{userAgent:Lh}=navigator;Lh.indexOf("Firefox")>-1?(ee.conicGradientRotate90=!0,ee.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Lh.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Lh.indexOf("Mac")>-1?ee.os="Mac":Lh.indexOf("Linux")>-1&&(ee.os="Linux");class Ch{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Sh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Sh,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ia.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Xo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ta(ta.DATA,{updatedList:this.updatedList})),this.__updatedList=new Sh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Vo.CHANGE,this.__onAttrChange,this],[[Xo.ADD,Xo.REMOVE],this.__onChildEvent,this],[ta.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ph,updateBounds:Mh,updateChange:Ah}=uo,{pushAllChildBranch:Dh,pushAllParent:Ih}=Eo;const{worldBounds:Wh}=xo;class Fh{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,u(t)&&(t=new Sh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Wh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Wh),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:zh,updateAllChange:Nh}=uo,Yh=ne.get("Layouter");class Xh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Bh,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(ea.START),this.layoutOnce(),t.emitEvent(new ea(ea.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ta.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=ea,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ea(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?(Ph(t,!0),e.add(t),t.isBranch&&Dh(t,e),Ih(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ih(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||Mh(s[t])}Mh(i)}})}(this.__levelList),function(t){t.list.forEach(Ah)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ea(r,a,this.times)),i.emitEvent(new ea(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ea,r=this.getBlocks(new Sh(e));e.emitEvent(new ea(i,r,this.times)),Xh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new ea(s,r,this.times)),e.emitEvent(new ea(n,r,this.times)),this.addBlocks(r),he.end(t)}static fullLayout(t){zh(t,!0),t.isBranch?Eo.updateBounds(t):uo.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Fh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Fh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[ea.REQUEST,this.layout,this],[ea.AGAIN,this.layoutAgain,this],[ta.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Hh=ne.get("Renderer");class Vh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ea.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ia.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ia.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ia.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Hh.log(e.innerName,"---\x3e");try{this.emitRender(ia.START),this.renderOnce(t),this.emitRender(ia.END,this.totalBounds),sr.clearRecycled()}catch(t){this.rendering=!1,Hh.error(t)}Hh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Hh.warn("rendering");if(this.times>3)return Hh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(ia.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ia.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ia.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ia.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Kt(s);i.save(),s.spread(Vh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ne.showRepaint&&ne.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),ee.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){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 ee.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new 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;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Hh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new ia(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ia.REQUEST,this.update,this],[ea.END,this.__onLayoutEnd,this],[ia.AGAIN,this.renderAgain,this],[Qo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Vh.clipSpread=10;const Uh={},{copyRadiusPoint:jh}=lt,{hitRadiusPoint:Gh}=Vt;class Kh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Sh(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new Sh;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||uo.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&uo.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=>uo.worldHittable(t))}getPath(t){const e=new Sh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Sh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new Sh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=Gh(i.__world,n.hitRadius?jh(Uh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Zh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new Kh(this.target=t,this),this.finder=ue.finder&&ue.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return ee.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):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function qh(t){return gr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Jh(t){return gr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function $h(){return(t,e)=>{const i="_"+e;dr(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 Qh(t){return(e,i)=>{dr(e,i,ur(i,t))}}Object.assign(ue,{watcher:(t,e)=>new Ch(t,e),layouter:(t,e)=>new Xh(t,e),renderer:(t,e,i)=>new Vh(t,e,i),selector:(t,e)=>new Zh(t,e)}),ee.layout=Xh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Sh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const tl={},el={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},il=Jt,sl={},nl={},rl={},ol={},al={},hl={apply(){ce.need("filter")}},ll={},dl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},cl={list:{},register(t,e){cl.list[t]=e},get:t=>cl.list[t]},{parse:ul,objectToCanvasData:gl}=ss,{stintSet:_l}=f,{hasTransparent:pl}=el,fl={originPaint:{}},ml=ne.get("UIData");class yl extends y{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ml.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ml.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(_l(this,"__isTransparentFill",pl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(_l(this,"__isTransparentStroke",pl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?ul(t):gl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){vl(this,"shadow",t)}setInnerShadow(t){vl(this,"innerShadow",t)}setFilter(t){vl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&nl.compute("fill",this.__leaf),e&&nl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=fl)):(this.__isStrokes=!0,this._stroke||(this._stroke=fl))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function vl(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class xl extends yl{}class wl extends xl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class bl extends xl{__getInputData(t,e){const i=super.__getInputData(t,e);return Pe.forEach(t=>delete i[t]),i}}class kl extends wl{}class El extends yl{get __usePathBox(){return this.points||this.__pathInputed}}class Sl extends yl{get __boxStroke(){return!this.__pathInputed}}class Bl extends yl{get __boxStroke(){return!this.__pathInputed}}class Tl extends El{}class Rl extends yl{}class Ol extends yl{get __pathInputed(){return 2}}class Ll extends xl{}const Cl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Pl extends yl{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Cl[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=_e.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ml extends Sl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Al extends Sl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Dl,add:Il}=B,Wl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Dl(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Dl(t,s)),r&&(t=Il(t,hl.getSpread(r))),o&&(t=Il(t,o)),a&&(t=Il(t,a));let l=t;return i&&(l=Dl(l,al.getInnerShadowSpread(this,i))),n&&(l=Dl(l,n)),this.__layout.renderShapeSpread=l,h?Dl(h.__updateRenderSpread(),t):t}},{stintSet:Fl}=f,zl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Fl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Fl(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;Fl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Fl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=nl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),c&&hl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,el.string(e.color))}n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e))}}else s.__pathForRender?Nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?nl.fills(s,this,t,e):nl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?nl.strokes(n,this,t,e):nl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Nl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&nl.stroke(n,t,e,i),s&&nl.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&nl.stroke(n,t,e,i)}const Yl={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Xl;let Hl=Xl=class extends _h{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.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 a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(jn.set(i=[]),this.__drawPathByBox(jn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ll.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Vn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&sl.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,l(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){nl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),Xl.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){$r()(this)}static registerData(t){Xr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};i([Xr(yl)],Hl.prototype,"__",void 0),i([$h()],Hl.prototype,"zoomLayer",void 0),i([fr("")],Hl.prototype,"id",void 0),i([fr("")],Hl.prototype,"name",void 0),i([fr("")],Hl.prototype,"className",void 0),i([Cr("pass-through")],Hl.prototype,"blendMode",void 0),i([Mr(1)],Hl.prototype,"opacity",void 0),i([Ar(!0)],Hl.prototype,"visible",void 0),i([Cr(!1)],Hl.prototype,"locked",void 0),i([Pr(!1)],Hl.prototype,"dim",void 0),i([Pr(!1)],Hl.prototype,"dimskip",void 0),i([Wr(0)],Hl.prototype,"zIndex",void 0),i([Fr(!1)],Hl.prototype,"mask",void 0),i([zr(!1)],Hl.prototype,"eraser",void 0),i([mr(0,!0)],Hl.prototype,"x",void 0),i([mr(0,!0)],Hl.prototype,"y",void 0),i([br(100,!0)],Hl.prototype,"width",void 0),i([br(100,!0)],Hl.prototype,"height",void 0),i([xr(1,!0)],Hl.prototype,"scaleX",void 0),i([xr(1,!0)],Hl.prototype,"scaleY",void 0),i([wr(0,!0)],Hl.prototype,"rotation",void 0),i([wr(0,!0)],Hl.prototype,"skewX",void 0),i([wr(0,!0)],Hl.prototype,"skewY",void 0),i([mr(0,!0)],Hl.prototype,"offsetX",void 0),i([mr(0,!0)],Hl.prototype,"offsetY",void 0),i([yr(0,!0)],Hl.prototype,"scrollX",void 0),i([yr(0,!0)],Hl.prototype,"scrollY",void 0),i([vr()],Hl.prototype,"origin",void 0),i([vr()],Hl.prototype,"around",void 0),i([fr(!1)],Hl.prototype,"lazy",void 0),i([kr(1)],Hl.prototype,"pixelRatio",void 0),i([Lr(0)],Hl.prototype,"renderSpread",void 0),i([Sr()],Hl.prototype,"path",void 0),i([Br()],Hl.prototype,"windingRule",void 0),i([Br(!0)],Hl.prototype,"closed",void 0),i([br(0)],Hl.prototype,"padding",void 0),i([br(!1)],Hl.prototype,"lockRatio",void 0),i([br()],Hl.prototype,"widthRange",void 0),i([br()],Hl.prototype,"heightRange",void 0),i([fr(!1)],Hl.prototype,"draggable",void 0),i([fr()],Hl.prototype,"dragBounds",void 0),i([fr("auto")],Hl.prototype,"dragBoundsType",void 0),i([fr(!1)],Hl.prototype,"editable",void 0),i([Nr(!0)],Hl.prototype,"hittable",void 0),i([Nr("path")],Hl.prototype,"hitFill",void 0),i([Or("path")],Hl.prototype,"hitStroke",void 0),i([Nr(!1)],Hl.prototype,"hitBox",void 0),i([Nr(!0)],Hl.prototype,"hitChildren",void 0),i([Nr(!0)],Hl.prototype,"hitSelf",void 0),i([Nr()],Hl.prototype,"hitRadius",void 0),i([Yr("")],Hl.prototype,"cursor",void 0),i([Cr()],Hl.prototype,"fill",void 0),i([Or(void 0,!0)],Hl.prototype,"stroke",void 0),i([Or("inside")],Hl.prototype,"strokeAlign",void 0),i([Or(1,!0)],Hl.prototype,"strokeWidth",void 0),i([Or(!1)],Hl.prototype,"strokeWidthFixed",void 0),i([Or("none")],Hl.prototype,"strokeCap",void 0),i([Or("miter")],Hl.prototype,"strokeJoin",void 0),i([Or()],Hl.prototype,"dashPattern",void 0),i([Or(0)],Hl.prototype,"dashOffset",void 0),i([Or(10)],Hl.prototype,"miterLimit",void 0),i([Br(0)],Hl.prototype,"cornerRadius",void 0),i([Br()],Hl.prototype,"cornerSmoothing",void 0),i([qh()],Hl.prototype,"shadow",void 0),i([qh()],Hl.prototype,"innerShadow",void 0),i([qh()],Hl.prototype,"blur",void 0),i([qh()],Hl.prototype,"backgroundBlur",void 0),i([qh()],Hl.prototype,"grayscale",void 0),i([qh()],Hl.prototype,"filter",void 0),i([Cr()],Hl.prototype,"placeholderColor",void 0),i([fr(100)],Hl.prototype,"placeholderDelay",void 0),i([fr({})],Hl.prototype,"data",void 0),i([Kr(_h.prototype.reset)],Hl.prototype,"reset",null),Hl=Xl=i([Jr(Wl),Jr(zl),Zr()],Hl);let Vl=class extends Hl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ul;i([Xr(xl)],Vl.prototype,"__",void 0),i([br(0)],Vl.prototype,"width",void 0),i([br(0)],Vl.prototype,"height",void 0),Vl=i([Jr(Eh),$r()],Vl);const jl=ne.get("Leafer");let Gl=Ul=class extends Vl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&er.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,n,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new ve,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))),Lo.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(sa.RESTART):this.emitLeafer(sa.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(sa.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,Pe);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=f.copyAttrs({},this.canvas,Pe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Qo(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,Pe),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&&(Pe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(sa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Pe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=f.copyAttrs({},s,Pe);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(sa.BEFORE_READY),this.emitLeafer(sa.READY),this.emitLeafer(sa.AFTER_READY),Lo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(sa.VIEW_READY),Lo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Lo.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(sa.VIEW_COMPLETED),Lo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return ce.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new sa(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[sa.START,()=>he.end(t)],[ea.START,this.updateLazyBounds,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ta.DATA,this.__onWatchData,this],[ea.END,this.__onLayoutEnd,this],[ia.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(sa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sr.clearRecycled()},100)}catch(t){jl.error(t)}}};t?e():setTimeout(e)}};Gl.list=new Sh,i([Xr(bl)],Gl.prototype,"__",void 0),i([br()],Gl.prototype,"pixelRatio",void 0),i([fr("normal")],Gl.prototype,"mode",void 0),Gl=Ul=i([$r()],Gl);let Kl=class extends Hl{get __tag(){return"Rect"}};i([Xr(Sl)],Kl.prototype,"__",void 0),Kl=i([Jr(Yl),Zr(),$r()],Kl);const{add:Zl,includes:ql,scroll:Jl}=Vt,$l=Kl.prototype,Ql=Vl.prototype;let td=class extends Vl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Zl(a,r),Jl(a,i)),this.__updateRectRenderBounds(),t=!ql(r,a),t&&"show"===o&&Zl(n,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};i([Xr(wl)],td.prototype,"__",void 0),i([br(100)],td.prototype,"width",void 0),i([br(100)],td.prototype,"height",void 0),i([fr(!1)],td.prototype,"resizeChildren",void 0),i([Lr("show")],td.prototype,"overflow",void 0),i([Kr($l.__updateStrokeSpread)],td.prototype,"__updateStrokeSpread",null),i([Kr($l.__updateRenderSpread)],td.prototype,"__updateRectRenderSpread",null),i([Kr($l.__updateBoxBounds)],td.prototype,"__updateRectBoxBounds",null),i([Kr($l.__updateStrokeBounds)],td.prototype,"__updateStrokeBounds",null),i([Kr($l.__updateRenderBounds)],td.prototype,"__updateRectRenderBounds",null),i([Kr($l.__updateChange)],td.prototype,"__updateRectChange",null),i([Kr($l.__render)],td.prototype,"__renderRect",null),i([Kr(Ql.__render)],td.prototype,"__renderGroup",null),td=i([Zr(),$r()],td);let ed=class extends td{get __tag(){return"Frame"}get isFrame(){return!0}};i([Xr(kl)],ed.prototype,"__",void 0),i([Cr("#FFFFFF")],ed.prototype,"fill",void 0),i([Lr("hide")],ed.prototype,"overflow",void 0),ed=i([$r()],ed);const{moveTo:id,closePath:sd,ellipse:nd}=Bs;let rd=class extends Hl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h;i?s||n?(i<1?nd(a,r,o,r*i,o*i,0,s,n,!1):h=!0,nd(a,r,o,r,o,0,n,s,!0)):(i<1&&(nd(a,r,o,r*i,o*i),id(a,t,o)),nd(a,r,o,r,o,0,360,0,!0)):s||n?(id(a,r,o),nd(a,r,o,r,o,0,s,n,!1)):nd(a,r,o,r,o),h||sd(a),ee.ellipseToCurve&&(this.__.path=this.getPath(!0))}};i([Xr(Bl)],rd.prototype,"__",void 0),i([Br(0)],rd.prototype,"innerRadius",void 0),i([Br(0)],rd.prototype,"startAngle",void 0),i([Br(0)],rd.prototype,"endAngle",void 0),rd=i([$r()],rd);const{sin:od,cos:ad,PI:hd}=Math,{moveTo:ld,lineTo:dd,closePath:cd,drawPoints:ud}=Bs;let gd=class extends Hl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ud(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;ld(e,r,0);for(let t=1;t<n;t++)dd(e,r+r*od(2*t*hd/n),o-o*ad(2*t*hd/n));cd(e)}}};i([Xr(Tl)],gd.prototype,"__",void 0),i([Br(3)],gd.prototype,"sides",void 0),i([Br()],gd.prototype,"points",void 0),i([Br(0)],gd.prototype,"curve",void 0),gd=i([Zr(),$r()],gd);const{sin:_d,cos:pd,PI:fd}=Math,{moveTo:md,lineTo:yd,closePath:vd}=Bs;let xd=class extends Hl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];md(o,n,0);for(let t=1;t<2*i;t++)yd(o,n+(t%2==0?n:n*s)*_d(t*fd/i),r-(t%2==0?r:r*s)*pd(t*fd/i));vd(o)}};i([Xr(Rl)],xd.prototype,"__",void 0),i([Br(5)],xd.prototype,"corners",void 0),i([Br(.382)],xd.prototype,"innerRadius",void 0),xd=i([$r()],xd);const{moveTo:wd,lineTo:bd,drawPoints:kd}=Bs,{rotate:Ed,getAngle:Sd,getDistance:Bd,defaultPoint:Td}=lt;let Rd=class extends Hl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Ed(i,e),i}set toPoint(t){this.width=Bd(Td,t),this.rotation=Sd(Td,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?kd(e,t.points,t.curve,t.closed):(wd(e,0,0),bd(e,this.width,0))}};i([Xr(El)],Rd.prototype,"__",void 0),i([Tr("center")],Rd.prototype,"strokeAlign",void 0),i([br(0)],Rd.prototype,"height",void 0),i([Br()],Rd.prototype,"points",void 0),i([Br(0)],Rd.prototype,"curve",void 0),i([Br(!1)],Rd.prototype,"closed",void 0),Rd=i([$r()],Rd);let Od=class extends Kl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};i([Xr(Ml)],Od.prototype,"__",void 0),i([br("")],Od.prototype,"url",void 0),Od=i([$r()],Od);const Ld=Od;let Cd=class extends Kl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ar({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new jo(jo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),r=new mt;e&&r.translate(e.x,e.y),i&&(l(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};i([Xr(Al)],Cd.prototype,"__",void 0),i([Jh(100)],Cd.prototype,"width",void 0),i([Jh(100)],Cd.prototype,"height",void 0),i([Jh(1)],Cd.prototype,"pixelRatio",void 0),i([Jh(!0)],Cd.prototype,"smooth",void 0),i([fr(!1)],Cd.prototype,"safeResize",void 0),i([Jh()],Cd.prototype,"contextSettings",void 0),Cd=i([$r()],Cd);const{copyAndSpread:Pd,includes:Md,spread:Ad,setList:Dd}=Vt,{stintSet:Id}=f;let Wd=class extends Hl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=il.number(e,n),t.__letterSpacing=il.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,Id(t,"__padding",l&&I.fourNumber(l)),Id(t,"__clipText","show"!==h&&!t.__autoSize),Id(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=tl.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Ad(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Md(h,a)),this.isOverflow?(Dd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Pd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};i([Xr(Pl)],Wd.prototype,"__",void 0),i([br(0)],Wd.prototype,"width",void 0),i([br(0)],Wd.prototype,"height",void 0),i([Cr()],Wd.prototype,"boxStyle",void 0),i([fr(!1)],Wd.prototype,"resizeFontSize",void 0),i([Cr("#000000")],Wd.prototype,"fill",void 0),i([Tr("outside")],Wd.prototype,"strokeAlign",void 0),i([Nr("all")],Wd.prototype,"hitFill",void 0),i([br("")],Wd.prototype,"text",void 0),i([br("")],Wd.prototype,"placeholder",void 0),i([br("caption")],Wd.prototype,"fontFamily",void 0),i([br(12)],Wd.prototype,"fontSize",void 0),i([br("normal")],Wd.prototype,"fontWeight",void 0),i([br(!1)],Wd.prototype,"italic",void 0),i([br("none")],Wd.prototype,"textCase",void 0),i([br("none")],Wd.prototype,"textDecoration",void 0),i([br(0)],Wd.prototype,"letterSpacing",void 0),i([br({type:"percent",value:1.5})],Wd.prototype,"lineHeight",void 0),i([br(0)],Wd.prototype,"paraIndent",void 0),i([br(0)],Wd.prototype,"paraSpacing",void 0),i([br("x")],Wd.prototype,"writingMode",void 0),i([br("left")],Wd.prototype,"textAlign",void 0),i([br("top")],Wd.prototype,"verticalAlign",void 0),i([br(!0)],Wd.prototype,"autoSizeAlign",void 0),i([br("normal")],Wd.prototype,"textWrap",void 0),i([br("show")],Wd.prototype,"textOverflow",void 0),i([Cr(!1)],Wd.prototype,"textEditing",void 0),Wd=i([$r()],Wd);let Fd=class extends Hl{get __tag(){return"Path"}};i([Xr(Ol)],Fd.prototype,"__",void 0),i([Tr("center")],Fd.prototype,"strokeAlign",void 0),Fd=i([$r()],Fd);let zd=class extends Vl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Fd(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,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};i([Xr(Ll)],zd.prototype,"__",void 0),i([(t,e)=>{dr(t,e,{get(){return this.__path}})}],zd.prototype,"path",void 0),zd=i([Jr(Hs,["set","path","paint"]),$r()],zd);let Nd=class extends Gl{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&&ue.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 Gl(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),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,Pe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ea.END,this.__onReady,this],[ia.START,this.__onCreated,this],[ia.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ia.END,this.__onChildRenderEnd,this))}};Nd=i([$r()],Nd);const Yd={},Xd={isHoldSpaceKey:()=>Xd.isHold("Space"),isHold:t=>Yd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Yd[t]||(Yd[t]=!0)},setUpCode(t){Yd[t]=!1}},Hd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Vd extends Yo{get spaceKey(){return Xd.isHoldSpaceKey()}get left(){return Hd.left(this)}get right(){return Hd.right(this)}get middle(){return Hd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Xd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){me.changeName(t,e)}}const{min:Ud,max:jd,abs:Gd}=Math,{float:Kd,sign:Zd}=I,{minX:qd,maxX:Jd,minY:$d,maxY:Qd}=Vt,tc=new Kt,ec=new Kt,ic={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&sc.getValidMove(t.__localBoxBounds,sc.getDragBounds(t),s,e,!0),sc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&sc.getValidScaleOf(t.__localBoxBounds,sc.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),sc.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),sc.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Kd(s.x),s.y=Kd(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),ec.set(e),tc.set(t).scaleOf(s,n.x,n.y);const a=(s.x-t.x)/t.width,l=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,g,_,p,f=1,m=1;return sc.isInnerMode(t,e,i,"width")?(n.x<0&&tc.scaleOf(s,f=1/n.x,1),_=Kd(tc.minX-ec.minX),p=Kd(ec.maxX-tc.maxX),u=a&&_>0?1+_/(a*tc.width):1,g=l&&p>0?1+p/(l*tc.width):1,f*=jd(u,g)):(n.x<0&&((Kd(qd(t)-qd(e))<=0||Kd(Jd(e)-Jd(t))<=0)&&tc.scaleOf(s,f=1/n.x,1),tc.unsign()),_=Kd(ec.minX-tc.minX),p=Kd(tc.maxX-ec.maxX),u=a&&_>0?1-_/(a*tc.width):1,g=l&&p>0?1-p/(l*tc.width):1,f*=Ud(u,g)),sc.isInnerMode(t,e,i,"height")?(n.y<0&&tc.scaleOf(s,1,m=1/n.y),_=Kd(tc.minY-ec.minY),p=Kd(ec.maxY-tc.maxY),u=d&&_>0?1+_/(d*tc.height):1,g=c&&p>0?1+p/(c*tc.height):1,m*=jd(u,g),r&&(u=jd(Gd(f),Gd(m)),f=Zd(f)*u,m=Zd(m)*u)):(n.y<0&&((Kd($d(t)-$d(e))<=0||Kd(Qd(e)-Qd(t))<=0)&&tc.scaleOf(s,1,m=1/n.y),tc.unsign()),_=Kd(ec.minY-tc.minY),p=Kd(tc.maxY-ec.maxY),u=d&&_>0?1-_/(d*tc.height):1,g=c&&p>0?1-p/(c*tc.height):1,m*=Ud(u,g)),n.x*=h(f)?f:1,n.y*=h(m)?m:1,n}},sc=ic;let nc=class extends Vd{};nc.POINTER="pointer",nc.BEFORE_DOWN="pointer.before_down",nc.BEFORE_MOVE="pointer.before_move",nc.BEFORE_UP="pointer.before_up",nc.DOWN="pointer.down",nc.MOVE="pointer.move",nc.UP="pointer.up",nc.OVER="pointer.over",nc.OUT="pointer.out",nc.ENTER="pointer.enter",nc.LEAVE="pointer.leave",nc.TAP="tap",nc.DOUBLE_TAP="double_tap",nc.CLICK="click",nc.DOUBLE_CLICK="double_click",nc.LONG_PRESS="long_press",nc.LONG_TAP="long_tap",nc.MENU="pointer.menu",nc.MENU_TAP="pointer.menu_tap",nc=i([Qr()],nc);const rc=nc,oc={};let ac=class extends nc{static setList(t){this.list=t instanceof Sh?t:new Sh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),ic.axisMove(t,n),n}static limitMove(t,e){ic.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(oc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(oc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(oc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Vt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Vt.unsign(i),i}assignMove(t){oc.x=t?this.totalX:this.moveX,oc.y=t?this.totalY:this.moveY}};ac.BEFORE_DRAG="drag.before_drag",ac.START="drag.start",ac.DRAG="drag",ac.END="drag.end",ac.OVER="drag.over",ac.OUT="drag.out",ac.ENTER="drag.enter",ac.LEAVE="drag.leave",ac=i([Qr()],ac);const hc=ac;let lc=class extends nc{static setList(t){ac.setList(t)}static setData(t){ac.setData(t)}};lc.DROP="drop",lc=i([Qr()],lc);let dc=class extends ac{};dc.BEFORE_MOVE="move.before_move",dc.START="move.start",dc.MOVE="move",dc.DRAG_ANIMATE="move.drag_animate",dc.END="move.end",dc.PULL_DOWN="move.pull_down",dc.REACH_BOTTOM="move.reach_bottom",dc=i([Qr()],dc);let cc=class extends Vd{};cc=i([Qr()],cc);const uc=cc;let gc=class extends nc{};gc.BEFORE_ROTATE="rotate.before_rotate",gc.START="rotate.start",gc.ROTATE="rotate",gc.END="rotate.end",gc=i([Qr()],gc);let _c=class extends ac{};_c.SWIPE="swipe",_c.LEFT="swipe.left",_c.RIGHT="swipe.right",_c.UP="swipe.up",_c.DOWN="swipe.down",_c=i([Qr()],_c);let pc=class extends nc{};pc.BEFORE_ZOOM="zoom.before_zoom",pc.START="zoom.start",pc.ZOOM="zoom",pc.END="zoom.end",pc=i([Qr()],pc);let fc=class extends Vd{};fc.BEFORE_DOWN="key.before_down",fc.BEFORE_UP="key.before_up",fc.DOWN="key.down",fc.HOLD="key.hold",fc.UP="key.up",fc=i([Qr()],fc);const mc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?_c.UP:t>45&&t<135?_c.DOWN:t<=45&&t>=-45?_c.RIGHT:_c.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:yc.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Sh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>uo.draggable(t)||!t.isLeafer&&t.hasEvent(ac.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},yc=mc,vc=new Sh,{getDragEventData:xc,getDropEventData:wc,getSwipeEventData:bc}=mc;class kc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=xc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=ac.list||this.draggableList||vc;return this.dragging&&(s?t?vc:new Sh(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(dc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Hd.left(t),this.dragging&&(this.interaction.emit(ac.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],uo.draggable(e)){this.draggableList=new Sh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=xc(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(dc.BEFORE_MOVE,this.dragData),e.emit(dc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(ac.BEFORE_DRAG,this.dragData),e.emit(ac.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:r}=e.p,o=!r||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=ac.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},o||s);r&&!s&&t?uo.animateMove(e,h,l(r)?r:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(ac.OUT,t,i),e.emit(ac.OVER,t,s)):e.emit(ac.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(ac.LEAVE,t,i,s),e.emit(ac.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=xc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(dc.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(ac.END,o),this.swipe(t,i,s,o),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=bc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=wc(t,e,ac.data);s.path=i,this.interaction.emit(lc.DROP,s),this.interaction.emit(ac.LEAVE,t,i)}dragReset(){ac.list=ac.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Ec=ne.get("emit");const Sc=["move","zoom","rotate","key"];function Bc(t,e,i,s,n){if(Sc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Rc(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Tc(r,e,i,s,n)}}function Tc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Rc(t,n)&&(dl.updateEventStyle&&!s&&dl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=me.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Rc(t,e){return e&&e.has(t)}const Oc={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:Lc,pathCanDrag:Cc,pathHasOutside:Pc}=mc;class Mc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Hd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Hd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Xd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Oc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Sh(t),this.createTransformer(),this.dragger=new kc(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Hd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(nc.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(nc.DOWN,t),Hd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Hd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Hd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(nc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(nc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Hd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(nc.BEFORE_UP,t),this.emit(nc.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(nc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(nc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(fc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Xd.setDownCode(e),this.emit(fc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(fc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(fc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Xd.setUpCode(e),this.emit(fc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Sh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(nc.OUT,t,i),this.emit(nc.OVER,t,e)):this.emit(nc.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(nc.LEAVE,t,i,e),this.emit(nc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(nc.LEAVE,t),this.dragger.dragging&&this.emit(lc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[nc.DOUBLE_TAP,nc.DOUBLE_CLICK].some(e=>Lc(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:r}=this;ee.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Pc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Cc(t.path))&&!Pc(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:nc.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&<.round(s),s}emitTap(t){this.emit(nc.TAP,t),this.emit(nc.CLICK,t)}emitDoubleTap(t){this.emit(nc.DOUBLE_TAP,t),this.emit(nc.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(nc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(nc.LONG_TAP,t),(Lc(t.path,nc.LONG_TAP)||Lc(t.path,nc.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(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Qo.RESIZE,this.__onResize,this)],t.once(sa.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Tc(n,t,e,!0,s))return;n.isApp&&Bc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Bc(n,t,e,!1,s),Tc(n,t,e,!1,s))return}catch(t){Ec.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 Ac{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ac.custom={};class Dc extends ve{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Sh,this.pixelList=new Sh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:Ic,copyRadiusPoint:Wc}=lt,{hitRadiusPoint:Fc,hitPoint:zc}=Vt,Nc={},Yc={},Xc=_h.prototype;Xc.hit=function(t,e=0){this.updateLayout(),Wc(Yc,t,e);const i=this.__world;return!!(e?Fc(i,Yc):zc(i,Yc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},Yc),e,{target:this}):this.__hitWorld(Yc))},Xc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(Wc(Nc,t,i.hitRadius),t=Nc),Ic(t,s,Nc),i.hitBox||r){if(Vt.hitRadiusPoint(n.boxBounds,Nc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Nc,e)},Xc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Xc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Xc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Xc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Hc=new mt,Vc=Hl.prototype;Vc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ee.image.hitCanvasSize,o=r.hitScale=Zt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Zt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),sr.patternLocked=!0,this.__renderShape(r,{matrix:Hc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Vc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:o}=i,a=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*o,!n&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=o;break;case"outside":if(l+=2*o,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Hl.prototype,jc=Kl.prototype,Gc=td.prototype;jc.__updateHitCanvas=Gc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},jc.__hitFill=Gc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):Vt.hitRadiusPoint(this.__layout.boxBounds,t)},Wd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},Vl.prototype.pick=function(t,e){return e||(e=n),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Kc=Me.prototype;function Zc(t,e,i){t.__.__font?nl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function qc(t,e,i,s,n){const r=i.__;g(t)?nl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&nl.strokeArrow(t,i,s,n)}function Jc(t,e,i,s,n){const r=i.__;g(t)?nl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),nl.drawTextStroke(i,s,n))}function $c(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Jc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",nl.fillText(i,r,n),r.blendMode="normal",uo.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}Kc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Kc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Kc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Zt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Qc,copyAndSpread:tu,toOuterOf:eu,getOuterOf:iu,getByMove:su,move:nu,getIntersectData:ru}=Vt,ou={};let au;const{stintSet:hu}=f,{hasTransparent:lu}=el;function du(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:o}=e;switch(o){case"image":case"film":case"video":if(!e.url)return;s=rl.image(i,t,e,n,!au||!au[e.url]),"image"!==o&&rl[o](s);break;case"linear":s=ol.linearGradient(e,n);break;case"radial":s=ol.radialGradient(e,n);break;case"angular":s=ol.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:o,style:el.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:el.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&lu(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const cu={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),au=rl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=du(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(hu(i,"__isAlphaPixelFill",n),hu(i,"__isTransparentFill",r)):(hu(i,"__isAlphaPixelStroke",n),hu(i,"__isTransparentStroke",r),hu(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Zc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,rl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),Zc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),Zc(e,i,s),i.restoreBlendMode()):Zc(e,i,s)}},fillPathOrText:Zc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)nl.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":qc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),qc(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)qc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),qc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),uo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){nl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Jc(t,1,e,i,s);break;case"inside":$c(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Jc(t,2,e,i,s):$c(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!rl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?nl.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?nl.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;eu(o.strokeSpread?(tu(ou,o.boxBounds,o.strokeSpread),ou):o.boxBounds,r,a);let{scaleX:_,scaleY:p}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=r;else{let s;if(ee.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Qc(n,B.swapAndScale(o.renderShapeSpread,_,p)):n;s=ru(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=iu(a,c),h=su(u,-c.e,-c.f),l=iu(r,c),nu(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 uu,gu=new Kt;const{isSame:_u}=Vt;function pu(t,e,i,s,n,r){const o=t.__;if("fill"===e&&!o.__naturalWidth&&(o.__naturalWidth=s.width/o.pixelRatio,o.__naturalHeight=s.height/o.pixelRatio,o.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",o.width),t.setProxyAttr("height",o.height)),!1;if(!n.data){rl.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||o.path||o.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return!0}function fu(t,e){vu(t,jo.LOAD,e)}function mu(t,e){vu(t,jo.LOADED,e)}function yu(t,e,i){e.error=i,t.forceUpdate("surface"),vu(t,jo.ERROR,e)}function vu(t,e,i){t.hasEvent(e)&&t.emitEvent(new jo(e,i))}function xu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:bu}=J,ku=new Kt,Eu={},Su={};function Bu(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Tu={},Ru={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Ou,set:Lu,rotateOfOuter:Cu,translate:Pu,scaleOfOuter:Mu,multiplyParent:Au,scale:Du,rotate:Iu,skew:Wu}=J;function Fu(t,e,i,s,n,r,o,a){o&&Iu(t,o),a&&Wu(t,a.x,a.y),n&&Du(t,n,r),Pu(t,e.x+i,e.y+s)}const{get:zu,scale:Nu,copy:Yu}=J,{getFloorScale:Xu}=I,{abs:Hu}=Math;const Vu={image:function(t,e,i,s,n){let r,o;const a=sr.get(i,i.type);return uu&&i===uu.paint&&_u(s,uu.boxBounds)?r=uu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),uu=a.use>1?{leafPaint:r,paint:i,boxBounds:gu.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(pu(t,e,i,a,r,s),n&&(fu(t,o),mu(t,o))):a.error?n&&yu(t,o,a.error):(n&&(xu(t,!0),fu(t,o)),r.loadId=a.load(()=>{xu(t,!1),t.destroyed||(pu(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),mu(t,o)),r.loadId=void 0},e=>{xu(t,!1),yu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=rl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=n;return!(!l||t.patternId===a&&!c||u)&&(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===ee.name&&Qo.isResizing(i)||c||(e=ee.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),rl.drawImage(t,r,o,i,s,n),!0):(!t.style||d.sync||c?rl.createPattern(t,i,s,n):rl.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:r,opacity:c}=t.originPaint,{transform:u}=o;n.save(),2===h&&n.clipUI(s),r&&(n.blendMode=r),c&&(n.opacity*=c),u&&n.transform(u),a.render(n,0,0,l,d,s,t,e,i),n.restore()}else o.scaleX&&(l*=o.scaleX,d*=o.scaleY),a.render(n,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,sr.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,n){t.patternTask||(t.patternTask=sr.patternTasker.add(()=>s(this,void 0,void 0,function*(){rl.createPattern(t,e,i,n),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=rl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!ee.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a,filters:h}=t.originPaint,{transform:l,gap:d}=s,c=rl.getPatternFixScale(t,n,r);let u,g,_,{width:p,height:f}=i;c&&(n*=c,r*=c),p*=n,f*=r,d&&(g=d.x*n/Hu(s.scaleX||1),_=d.y*r/Hu(s.scaleY||1)),(l||1!==n||1!==r)&&(n*=Xu(p+(g||0)),r*=Xu(f+(_||0)),u=zu(),l&&Yu(u,l),Nu(u,1/n,1/r));const m=i.getCanvas(p,f,a,h,g,_,e.leafer&&e.leafer.config.smooth,s.interlace),y=i.getPattern(m,s.repeat||ee.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=ee.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ku.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:r,align:o,offset:h,scale:d,size:c,rotation:u,skew:_,clipSize:p,repeat:f,gap:m,interlace:y}=t,v=e.width===s&&e.height===n,x={mode:r},w="center"!==o&&(u||0)%180==90;let b,k;switch(Vt.set(Su,0,0,w?n:s,w?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(I.getScaleData(d,c,i,Eu),b=Eu.scaleX,k=Eu.scaleY),(o||m||f)&&(b&&Vt.scale(Su,b,k,!0),o&&Tt.toPoint(o,Su,e,Su,!0,!0))):v&&!u||(b=k=Vt.getFitScale(e,Su,"fit"!==r),Vt.put(e,i,o,b,!1,Su),Vt.scale(Su,b,k,!0)),h&<.move(Su,h),r){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,rl.stretchMode(x,e,b,k));break;case"normal":case"clip":if(Su.x||Su.y||b||p||u||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),rl.clipMode(x,e,Su.x,Su.y,b,k,u,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||u||_)&&rl.repeatMode(x,e,s,n,Su.x,Su.y,b,k,u,_,o,t.freeTransform),f||(x.repeat="repeat");const i=g(f);(m||i)&&(x.gap=function(t,e,i,s,n){let r,o;g(t)?(r=t.x,o=t.y):r=o=t;return{x:Bu(r,i,n.width,e&&e.x),y:Bu(o,s,n.height,e&&e.y)}}(m,i&&f,Su.width,Su.height,e));break;default:b&&rl.fillOrFitMode(x,e,Su.x,Su.y,b,k,u)}return x.transform||(e.x||e.y)&&bu(x.transform=wu(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=k),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),y&&(x.interlace=l(y)||"percent"===y.type?{type:"x",offset:y}:y),x},stretchMode:function(t,e,i,s){const n=Ou(),{x:r,y:o}=e;r||o?Pu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),Du(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Ou();Pu(a,e.x+i,e.y+s),Du(a,n,r),o&&Cu(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=Ou();Fu(d,e,i,s,n,r,o,a),h&&(o||a?(Lu(Ru),Mu(Ru,e,h,l),Au(d,Ru)):Mu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Ou();if(c)Fu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Cu(u,{x:i/2,y:s/2},h);else switch(Iu(u,h),h){case 90:Pu(u,s,0);break;case 180:Pu(u,i,s);break;case 270:Pu(u,0,i)}Tu.x=e.x+n,Tu.y=e.y+r,Pu(u,Tu.x,Tu.y),o&&Mu(u,Tu,o,a)}t.transform=u}},{toPoint:Uu}=Et,{hasTransparent:ju}=el,Gu={},Ku={};function Zu(t,e,i,s){if(i){let n,r,o,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(o=t/(l-1),r=el.string(n,s)):(o=n.offset,r=el.string(n.color,s)),e.addColorStop(o,r),!h&&ju(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:qu,getDistance:Ju}=lt,{get:$u,rotateOfOuter:Qu,scaleOfOuter:tg}=J,{toPoint:eg}=Et,ig={},sg={};function ng(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=qu(e,i);r=$u(),n?(tg(r,e,o/a*(s||1),1),Qu(r,e,t+90)):(tg(r,e,1,o/a*(s||1)),Qu(r,e,t))}return r}const{getDistance:rg}=lt,{toPoint:og}=Et,ag={},hg={};const lg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;Uu(i||"top",e,Gu),Uu(s||"bottom",e,Ku);const o=ee.canvas.createLinearGradient(Gu.x,Gu.y,Ku.x,Ku.y),a={type:n,style:o};return Zu(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;eg(i||"center",e,ig),eg(s||"bottom",e,sg);const a=ee.canvas.createRadialGradient(ig.x,ig.y,0,ig.x,ig.y,Ju(ig,sg)),h={type:n,style:a};Zu(h,a,t.stops,r);const l=ng(e,ig,sg,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;og(i||"center",e,ag),og(s||"bottom",e,hg);const a=ee.conicGradientSupport?ee.canvas.createConicGradient(0,ag.x,ag.y):ee.canvas.createRadialGradient(ag.x,ag.y,0,ag.x,ag.y,rg(ag,hg)),h={type:n,style:a};Zu(h,a,t.stops,r);const l=ng(e,ag,hg,o||1,ee.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:ng},{copy:dg,move:cg,toOffsetOutBounds:ug}=Vt,{max:gg,abs:_g}=Math,pg={},fg=new mt,mg={};function yg(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=_g(t.spread||0),o=gg(o,n+r-s),a=gg(a,n+r+i),h=gg(h,n+r+s),l=gg(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function vg(t,e,i){const{shapeBounds:s}=i;let n,r;ee.fullImageShadow?(dg(pg,t.bounds),cg(pg,e.x-s.x,e.y-s.y),n=t.bounds,r=pg):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:xg}=Vt,wg={};const bg=yg;const kg={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=o.length-1;ug(h,mg,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}g.setWorldShadow(mg.offsetX+(o.x||0)*c*f,mg.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,el.string(o.color)),n=al.getShadowTransform(t,g,i,o,mg,f),n&&g.setTransform(n),vg(g,mg,i),n&&g.resetTransform(),s=l,o.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,r,"copy"),s=r),a?g.copyWorld(a,r,r,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),uo.copyCanvasByWorld(t,e,g,s,o.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=o.length-1;xg(h,wg,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(wg.offsetX+(o.x||0)*c*f,wg.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=al.getShadowTransform(t,g,i,o,wg,f,!0),n&&g.setTransform(n),vg(g,wg,i),g.restore(),a?(g.copyWorld(g,l,r,"copy"),g.copyWorld(a,r,r,"source-out"),s=r):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,el.string(o.color),"source-in"),uo.copyCanvasByWorld(t,e,g,s,o.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:yg,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return fg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),fg}},isTransformShadow(t){},getInnerShadowSpread:bg},{excludeRenderBounds:Eg}=xo;let Sg;function Bg(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Sg||(Sg=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);Rg(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Rg(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Tg(t){return t.getSameCanvas(!1,!0)}function Rg(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}Vl.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Bg(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Eg(i,e)||i.__render(t,e),r=i.__.opacity,Sg=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Tg(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Tg(t)),n||(n=Tg(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Bg(this,o,t,n,s,r,void 0,!1),Eg(i,e)||i.__render(n||t,e),d&&Bg(this,o,t,n,s,r,d,!1)}Bg(this,o,t,n,s,r,void 0,!0)};const Og=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Lg=Og+"_#~&*+\\=|≮≯≈≠=…",Cg=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 Pg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Mg=Pg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ag=Pg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Dg=Pg(Og),Ig=Pg(Lg),Wg=Pg("- —/~|┆·");var Fg;!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"}(Fg||(Fg={}));const{Letter:zg,Single:Ng,Before:Yg,After:Xg,Symbol:Hg,Break:Vg}=Fg;function Ug(t){return Mg[t]?zg:Wg[t]?Vg:Ag[t]?Yg:Dg[t]?Xg:Ig[t]?Hg:Cg.test(t)?Ng:zg}const jg={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Gg(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:Kg}=jg,{Letter:Zg,Single:qg,Before:Jg,After:$g,Symbol:Qg,Break:t_}=Fg;let e_,i_,s_,n_,r_,o_,a_,h_,l_,d_,c_,u_,g_,__,p_,f_,m_,y_=[];function v_(t,e){l_&&!h_&&(h_=l_),e_.data.push({char:t,width:e}),s_+=e}function x_(){n_+=s_,e_.width=s_,i_.words.push(e_),e_={data:[]},s_=0}function w_(){__&&(p_.paraNumber++,i_.paraStart=!0,__=!1),l_&&(i_.startCharSize=h_,i_.endCharSize=l_,h_=0),i_.width=n_,f_.width?Kg(i_):m_&&b_(),y_.push(i_),i_={words:[]},n_=0}function b_(){n_>(p_.maxWidth||0)&&(p_.maxWidth=n_)}const{top:k_,right:E_,bottom:S_,left:B_}=wt;function T_(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 R_={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:o}=e;o&&(n?(i=o[B_],n-=o[E_]+o[B_],!n&&(n=.01)):e.autoSizeAlign||(i=o[B_]),r?(s=o[k_],r-=o[k_]+o[S_],!r&&(r=.01)):e.autoSizeAlign||(s=o[k_]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){p_=t,y_=t.rows,f_=t.bounds,m_=!f_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=ee,{width:a}=f_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;__=!0,c_=null,h_=a_=l_=s_=n_=0,e_={data:[]},i_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)o_=e[i],"\n"===o_?(s_&&x_(),i_.paraEnd=!0,w_(),__=!0):(d_=Ug(o_),d_===Zg&&"none"!==r&&(o_=Gg(o_,r,!s_)),a_=o.measureText(o_).width,s&&(s<0&&(l_=a_),a_+=s),u_=d_===qg&&(c_===qg||c_===Zg)||c_===qg&&d_!==$g,g_=!(d_!==Jg&&d_!==qg||c_!==Qg&&c_!==$g),r_=__&&n?a-n:a,t&&a&&n_+s_+a_>r_&&(h?(s_&&x_(),n_&&w_()):(g_||(g_=d_===Zg&&c_==$g),u_||g_||d_===t_||d_===Jg||d_===qg||s_+a_>r_?(s_&&x_(),n_&&w_()):n_&&w_()))," "===o_&&!0!==__&&n_+s_===0||(d_===t_?(" "===o_&&s_&&x_(),v_(o_,a_),x_()):u_||g_?(s_&&x_(),v_(o_,a_)):v_(o_,a_)),c_=d_);s_&&x_(),n_&&w_(),y_.length>0&&(y_[y_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{p_.paraNumber++,n_=o.measureText(t).width,y_.push({x:n||0,text:t,width:n_,paraStart:!0}),m_&&b_()})}(h,t,e),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":T_(e,"x",t[B_]);break;case"right":T_(e,"x",-t[E_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":T_(e,"y",t[k_]);break;case"bottom":T_(e,"y",-t[S_])}}(o,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=r*n+(c?c*(t.paraNumber-1):0),y=o;if(h&&m>f)m=Math.max(e.__autoHeight?m:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,x,w,b=p||u?p:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],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&&o>0&&(y+=c),v.y=y,y+=r,t.overflow>o&&y>m&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&p&&p<w&&(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:r,__letterSpacing:o}=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&&(_=r&&t.paraStart?r: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=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(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){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?ee.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,g(r)?(i=r.type,r.color&&(t.decorationColor=el.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const O_={string:function(t,e){if(!t)return"#000";const i=l(e)&&e<1;if(a(t)){if(!i||!el.object)return t;t=el.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function L_(t){return t?u(t)?t:[t]:[]}Object.assign(tl,R_),Object.assign(el,O_),Object.assign(nl,cu),Object.assign(rl,Vu),Object.assign(ol,lg),Object.assign(al,kg),Object.assign(ue,{interaction:(t,e,i,s)=>new Mc(t,e,i,s),hitCanvas:(t,e)=>new Rh(t,e),hitCanvasManager:()=>new Dc}),Oh();class C_ extends Yo{get list(){return L_(this.value)}get oldList(){return L_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function P_(t){return(e,i)=>{const s="_"+i;dr(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const r=this;if(r.config){const t="target"===i;if(t){const{beforeSelect:t}=r.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}r.setDimOthers(!1),r.setBright(!1),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),r.single&&(delete r.element.syncEventer,delete r.element.__world.ignorePixelSnap)}const s=t?C_.BEFORE_SELECT:C_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new C_(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}C_.BEFORE_SELECT="editor.before_select",C_.SELECT="editor.select",C_.AFTER_SELECT="editor.after_select",C_.BEFORE_HOVER="editor.before_hover",C_.HOVER="editor.hover";const{abs:M_}=Math,{copy:A_}=J,{setListWithFn:D_}=Vt,{worldBounds:I_}=xo,W_={a:1,b:0,c:0,d:1,e:0,f:0},F_={x:0,y:0,width:0,height:0};class z_ extends Hl{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_(F_,e,I_),t&&this.set(t),this.set(F_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:o,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=M_(c.scaleX),l=M_(c.scaleY);if(A_(W_,c),W_.half=o%2,t.setWorld(W_,e.matrix),t.beginPath(),"path"===this.strokePathType||s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=o/Math.max(i,l),n.shadow){const e=n.shadow[0],{scaleX:i,scaleY:s}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*s,e.blur*i,el.string(e.color))}r&&(a(r)?nl.stroke(r,this,t,e):nl.strokes(r,this,t,e)),h&&(a(h)?nl.fill(h,this,t,e):nl.fills(h,this,t,e)),n.shadow&&t.restore()}}n.strokeWidth=o}}destroy(){this.target=null,super.destroy()}}i([P_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],z_.prototype,"target",void 0),i([Cr("render-path")],z_.prototype,"strokePathType",void 0);class N_ extends Vl{constructor(t){super(t),this.strokeArea=new Kl({strokeAlign:"center"}),this.fillArea=new Kl,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 X_([t],i,e),i}};function X_(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],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&&X_(s.children,e,i)}}const{findOne:H_,findByBounds:V_}=Y_;class U_ extends Vl{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 z_,this.targetStroker=new z_,this.bounds=new Kt,this.selectArea=new N_,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:r,hover:o,hoverStyle:a}=s;this.hoverStroker.setTarget(o?e:null,Object.assign({stroke:n,strokeWidth:r},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,t.path.needUpdate=!0):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:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},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 Sh(V_(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)&&!H_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Sh(this.editor.editBox.rect)};return H_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):H_(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_([[C_.HOVER,this.onHover,this],[C_.SELECT,this.onSelect,this]]),e.on_([[nc.MOVE,this.onPointerMove,this],[nc.BEFORE_DOWN,this.onBeforeDown,this],[nc.TAP,this.onTap,this],[ac.START,this.onDragStart,this,!0],[ac.DRAG,this.onDrag,this],[ac.END,this.onDragEnd,this],[dc.MOVE,this.onAutoMove,this],[[pc.ZOOM,dc.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:G_,topRight:K_,right:Z_,bottomRight:q_,bottom:J_,bottomLeft:$_,left:Q_}=bt,{toPoint:tp}=Et,{within:ep,sign:ip}=I,{abs:sp}=Math,np={getScaleData(t,e,i,s,n,r,o,a){let h,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:x}=e,w=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=ip(w),E=ip(b),S=a?w:k*_.width/v,B=a?b:E*_.height/x;if(l(s))u=g=Math.sqrt(s);else{r&&(s.x*=2,s.y*=2),s.x*=a?w:k,s.y*=a?b:E;const t=(-s.y+x)/x,e=(s.x+v)/v,o=(s.y+x)/x,l=(-s.x+v)/v;switch(i){case G_:g=t,h="bottom";break;case Z_:u=e,h="left";break;case J_:g=o,h="top";break;case Q_:u=l,h="right";break;case j_:g=t,u=l,h="bottom-right";break;case K_:g=t,u=e,h="bottom-left";break;case q_:g=o,u=e,h="top-left";break;case $_:g=o,u=l,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case G_:case J_:u=g;break;case Q_:case Z_:g=u;break;default:d=Math.sqrt(sp(u*g)),u=ip(u)*d,g=ip(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=S),R&&(g/=B),!o){const{worldTransform:e}=t;u<0&&(u=1/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(tp(r||h,_,c,!0),m){const e={x:u,y:g};ic.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=ep(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=ep(e*g,f)/e}return T&&sp(u*y.width)<1&&(u=ip(u)/y.width),R&&sp(g*y.height)<1&&(g=ip(g)/y.height),n&&u!==g&&(d=Math.min(sp(u),sp(g)),u=ip(u)*d,g=ip(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case j_:r="bottom-right";break;case K_:r="bottom-left";break;case q_:r="top-left";break;case $_:r="top-right";break;default:r="center"}return tp(n||r,t.boxBounds,o,!0),{origin:o,rotation:lt.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case G_:case j_:r={x:.5,y:0},n="bottom",a=1;break;case J_:case q_:r={x:.5,y:1},n="top",a=1;break;case Q_:case $_:r={x:0,y:.5},n="right",h=1;break;case Z_:case K_:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,tp(s||n,t,o,!0);const c=lt.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,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=Z_;break;case j_:t=K_;break;case $_:t=q_;break;case Z_:t=Q_;break;case K_:t=j_;break;case q_:t=$_}if(i)switch(t){case G_:t=J_;break;case j_:t=$_;break;case K_:t=q_;break;case J_:t=G_;break;case $_:t=j_;break;case q_:t=K_}return t}},rp={};function op(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return ap(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),x=s?n?g:r?c:u:v?g:y?c:u;h+=45*(np.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(I.formatRotation(h,!0)/2);const{url:w,x:b,y:k}=x,E=w+h;rp[E]?i.cursor=rp[E]:rp[E]=i.cursor={url:hp(w,h),x:b,y:k}}function ap(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function hp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class lp extends td{constructor(t){super(t),this.useFastShadow=!0}}const dp=["top","right","bottom","left"],cp=void 0;class up extends Vl{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 a(t)||a(e)||a(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Vl,this.rect=new lp({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new lp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Vl({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:r,resizeLines:o,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 lp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new lp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new lp({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(...r,a,h,l,...o,...n),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 _;this.visible=!t.locked;for(let t=0;t<8;t++)_=r[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:cp},e.rect||{}));const p=o(e.rectThrough)?i:e.rectThrough;s.hittable=!p,p&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&f.stintSet(t.__world,"ignorePixelSnap",d),ap(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,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:r,skewX:o,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:r,buttons:o,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,editBox:f,mask:m,dimOthers:y,bright:v,spread:x,hideRotatePoints:w,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),x&&Vt.spread(t,x),this.view.worldOpacity){const{width:e,height:c}=t,m=l(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,x,k,E={};for(let i=0;i<8;i++)Et.toPoint(Et.directionData[i],t,E),x=a[i],v=h[i],x.set(E),v.set(E),x.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!w,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=x.visible&&!b,x.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*x.width>e&&(x.visible=!1)):(k.width=c+k.height,p&&2*x.width>c&&(x.visible=!1)));r.visible=y&&_&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),o.visible=y&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=dp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=dp.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?np.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(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:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:cp};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return u(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:r,skewable:o}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(r&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(o&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&o&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&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&&(Qo.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 ac||t instanceof dc)&&this.transformTool.onMove(t),this.resizing&&(Qo.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(),a(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case dc.START:this.onTransformStart(t);break;case dc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case pc.START:this.onTransformStart(t);break;case pc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),a(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case pc.START:this.onTransformStart(t);break;case pc.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 Wd)||t.find(t=>t instanceof Wd);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_([[ac.START,this.onDragStart,this],[ac.DRAG,this.onDrag,this],[ac.END,this.onDragEnd,this],[nc.ENTER,e=>{this.enterPoint=t,op(this,e)}],[nc.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[nc.DOUBLE_TAP,this.onDoubleTap,this],[nc.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[fc.HOLD,fc.UP],this.onKey,this],[fc.DOWN,this.onArrow,this],[[dc.START,dc.BEFORE_MOVE,dc.END],this.onMove,this,!0],[[pc.START,pc.BEFORE_ZOOM,pc.END],this.onScale,this,!0],[[gc.START,gc.BEFORE_ROTATE,gc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const gp={x:0,y:0,width:1e5,height:1e5};class _p extends Hl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,gp),Object.assign(this.__world,gp)}__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 pp='\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"/>',fp={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${pp}\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${pp}\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${pp}\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},mp=new Kt;function yp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{mp.setListWithFn(i,t=>t.getBounds("box","page")),0===mp.width&&(mp.width=.1),0===mp.height&&(mp.height=.1),e.reset(mp.get())}),s.add(e)}const vp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),xp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),wp={group(t,e,i){t.sort(xp);const{app:s,parent:n}=t[0];let r;r=i&&i.add?i:new Vl(i),n.addAt(r,n.children.indexOf(t[0])),t.sort(vp);const o=new mt(e.worldTransform);return o.divideParent(n.scrollWorldTransform),r.setTransform(o),r.editable=!0,r.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(r)),s.unlockLayout(),r},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(vp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(xp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},bp=ne.get("EditToolCreator");function kp(){return t=>{Sp.register(t)}}const Ep=kp,Sp={list:{},register(t){const{tag:e}=t.prototype;Bp[e]&&bp.repeat(e),Bp[e]=t},get:(t,e)=>new Bp[t](e)},{list:Bp}=Sp;class Tp extends C_{constructor(t,e){super(t,e)}}Tp.BEFORE_OPEN="innerEditor.before_open",Tp.OPEN="innerEditor.open",Tp.BEFORE_CLOSE="innerEditor.before_close",Tp.CLOSE="innerEditor.close";class Rp extends C_{constructor(t,e){super(t,e)}}Rp.BEFORE_GROUP="editor.before_group",Rp.GROUP="editor.group",Rp.BEFORE_UNGROUP="editor.before_ungroup",Rp.UNGROUP="editor.ungroup",Rp.BEFORE_OPEN="editor.before_open_group",Rp.OPEN="editor.open_group",Rp.BEFORE_CLOSE="editor.before_close_group",Rp.CLOSE="editor.close_group";const{updateMatrix:Op}=uo,Lp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Cp="top-left";class Pp extends Kl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.skipJSON=!0,this.on(Vo.CHANGE,e=>{if(this.checkChange&&Lp[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,Op(this.parent),Op(this);const a=new mt(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Op(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Cp,r);break;case"scaleX":t.scaleOf(Cp,r,1);break;case"scaleY":t.scaleOf(Cp,1,r);break;case"skewX":t.skewOf(Cp,r,0);break;case"skewY":t.skewOf(Cp,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Mp extends C_{constructor(t,e){super(t,e)}}Mp.BEFORE_MOVE="editor.before_move",Mp.MOVE="editor.move";class Ap extends C_{constructor(t,e){super(t,e)}}Ap.BEFORE_SCALE="editor.before_scale",Ap.SCALE="editor.scale";class Dp extends C_{constructor(t,e){super(t,e)}}Dp.BEFORE_ROTATE="editor.before_rotate",Dp.ROTATE="editor.rotate";class Ip extends C_{constructor(t,e){super(t,e)}}Ip.BEFORE_SKEW="editor.before_skew",Ip.SKEW="editor.skew";class Wp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:r}=i;const o=t.type===dc.END||t.type===ac.END,h=a(e.draggable),d=!r||o||h,c={x:t.totalX,y:t.totalY};t instanceof dc&<.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=ac.getValidMove(e,s.point,c,d),(n.x||n.y)&&(r&&!h&&o?uo.animateMove(this,n,l(r)?r:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let r,{around:o,lockRatio:a,flipable:h,editSize:l}=i;t instanceof pc?(o||(o=e.getBoxPoint(t)),r=t.totalScale):r=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=np.getScaleData(e,n.bounds,d,r,a,np.getAround(o,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof ac&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),lt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:r,rotateGap:o,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof gc)d=t.rotation,l=r?Et.getPoint(r,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,o=np.getRotateData(e,h,t,s,i?null:r||e.around||e.origin||n||"center");d=s.rotation+o.rotation-e.rotation,l=o.origin}if(d=I.float(I.getGapRotation(d,o,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),lt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=np.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),np.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(g(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:r,moveX:a.x,moveY:a.y};this.emitEvent(new Mp(Mp.BEFORE_MOVE,h));const l=new Mp(Mp.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:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))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 r=new Ap(Ap.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(g(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Ap(Ap.BEFORE_SCALE,c));const u=new Ap(Ap.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new mt(uo.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new Ap(Ap.BEFORE_SCALE,o));const a=new Ap(Ap.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:r,worldOrigin:a,rotation:e,transform:h};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:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(g(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Ip(Ip.BEFORE_SKEW,c));const u=new Ip(Ip.SKEW,c);this.doSkew(u),this.emitEvent(u)}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(uo.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 Fp=class extends Vl{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 Sh,this.openedGroupList=new Sh,this.simulateTarget=new Pp(this),this.editBox=new up(this),this.editToolList={},this.selector=new U_(this),this.editMask=new _p(this),this.targetEventIds=[];let i=f.clone(fp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),ce.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?u(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>f.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&&yp(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(a(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(Rp.BEFORE_GROUP),this.target=wp.group(this.list,this.element,t),this.emitGroupEvent(Rp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Rp.BEFORE_UNGROUP,t)),this.target=wp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Rp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Rp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Rp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Rp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Rp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!uo.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 Rp(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(a(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(a(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(Tp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Tp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Tp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Tp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Tp(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_(ia.START,this.onRenderStart,this),i&&i.on_(Vo.SCROLL,this.onChildScroll,this),t.on_(ia.CHILD_START,this.onAppRenderStart,this),t.on_(sa.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())}};i([(t,e)=>{dr(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=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 s.config&&Object.assign(a,s.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))),r(a.dragLimitAnimate)&&(a.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Fp.prototype,"mergeConfig",void 0),i([P_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Sh?i:new Sh(i),t.multiple&&yp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new C_(C_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new C_(C_.AFTER_SELECT,s))})],Fp.prototype,"target",void 0),i([P_(function(t,e){t.emitEvent(new C_(C_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Fp.prototype,"hoverTarget",void 0),Fp=i([Jr(Wp,["editBox","editTool","emitEvent"])],Fp);class zp{static registerInnerEditor(){Sp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this._editBox||this.editor.editBox}set editBox(t){this._editBox=t}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Vl,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 Np=class extends zp{static registerEditTool(){Sp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Np=i([kp()],Np);const{left:Yp,right:Xp}=bt,{move:Hp,copy:Vp,toNumberPoints:Up}=lt;let jp=class extends Np{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===Yp;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.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=Up(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(Hp(t,r,o),s&&Hp(e,-r,-o)):(s&&Hp(t,-r,-o),Hp(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=t.target;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),Vp(s[7],i),Vp(e[7],i),Vp(s[3],a),Vp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Yp||t===Xp,s[t].visible=a,e[t].visible=!o&&a}};jp=i([kp()],jp);const{M:Gp,L:Kp,C:Zp,Q:qp,Z:Jp,N:$p,D:Qp,X:tf,G:ef,F:sf,O:nf,P:rf,U:of}=Ie,af={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case Gp:case Kp:hf(t,e,i,n,1),n+=3;break;case Zp:hf(t,e,i,n,3),n+=7;break;case qp:hf(t,e,i,n,2),n+=5;break;case Jp:n+=1;break;case $p:hf(t,e,i,n,2),n+=5;break;case Qp:hf(t,e,i,n,2),n+=9;break;case tf:hf(t,e,i,n,2),n+=6;break;case ef:hf(t,e,i,n,2),n+=9;break;case sf:hf(t,e,i,n,2),n+=5;break;case nf:t[n]=ef,t.splice(n+4,0,t[n+3],0),hf(t,e,i,n,2),n+=9,r+=2;break;case rf:t[n]=sf,t.splice(n+4,0,t[n+3]),hf(t,e,i,n,2),n+=5,r+=1;break;case of:hf(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:hf}=af,lf=J.get(),{topLeft:df,top:cf,topRight:uf,right:gf,bottom:_f,left:pf}=bt;function ff(t,e,i){t.pathInputed?mf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function mf(t,e,i){af.scale(t.__.path,e,i),t.path=t.__.path}function yf(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):af.scalePoints(s,e,i),t.points=s}function vf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)lf.a=e,lf.d=i,s[t].transform(lf,!0)}const xf=_h.prototype;function wf(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function bf(t,e,i){kf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(dc.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(wf(t).includes("limit")){const s=t.getValidMove(0,0);if(s.x||s.y){const t=100,n=200,r="drag"===e.moveType?.3:.05;Math.abs(s.x)>t?i.x=0:i.x*=r,Math.abs(s.y)>n?i.y=0:i.y*=r}}t.zoomLayer.move(i)}),t.on_(dc.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(dc.END,e=>{uo.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(pc.BEFORE_ZOOM,e=>{const{zoomLayer:i,layouter:s}=t,n=t.getValidScale(e.scale);1!==n&&(s.stop(),uo.updateMatrix(t),i.scaleOfWorld(e,n),s.start())}))}function kf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}xf.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))},xf.__scaleResize=function(t,e){ff(this,t,e)},xf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},xf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Wd.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)!function(t,e,i,s){let n=e;if(!r(s)){const r=t.__layout;let{width:o,height:a}=r.boxBounds;switch(o*=i-e,a*=e-i,s){case cf:case _f:n=i,r.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case pf:case gf:r.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case df:case uf:r.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),ff(this,t,e)}},Fd.prototype.__scaleResize=function(t,e){mf(this,t,e)},Rd.prototype.__scaleResize=function(t,e){this.pathInputed?mf(this,t,e):this.points?yf(this,t,e):this.width*=t},gd.prototype.__scaleResize=function(t,e){this.pathInputed?mf(this,t,e):this.points?yf(this,t,e):ff(this,t,e)},Vl.prototype.__scaleResize=function(t,e){vf(this,t,e)},td.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||ff(this,t,e),i&&vf(this,t,e)},ce.add("resize"),ce.add("editor","resize"),ue.editor=function(t,e){const i=new Fp(t);return e&&e.sky.add(e.editor=i),i},td.addAttr("textBox",!1,fr),Hl.addAttr("editConfig",void 0,fr),Hl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),fr),Hl.addAttr("editInner","PathEditor",fr),Vl.addAttr("editInner","",fr),Wd.addAttr("editInner","TextEditor",fr),Hl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Hl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Hl.setEditInner=function(t){this.changeAttr("editInner",t)};const Ef=ne.get("LeaferTypeCreator"),Sf={list:{},register(t,e){Bf[t]&&Ef.repeat(t),Bf[t]=e},run(t,e){const i=Bf[t];i&&i(e)}},{list:Bf,register:Tf}=Sf;Tf("viewport",bf),Tf("custom",function(t){bf(t,null,!0)}),Tf("design",function(t){bf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Tf("document",function(t){bf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Rf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),n=lt.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=lt.getDistance(e.from,i.from);return{move:r,scale:lt.getDistance(e.to,i.to)/o,rotation:lt.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}=Of,s=Of.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Of.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)?Of.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Of;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Of=Rf,{abs:Lf,max:Cf}=Math,{sign:Pf,within:Mf}=I,Af={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=Lf(s),o=Lf(n);return r>50&&(s=Cf(50,r/3)*Pf(s)),o>50&&(n=Cf(50,o/3)*Pf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:r}=e;const o=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(ee.intWheelDeltaY?Math.abs(o)>17:Math.ceil(o)!==o),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){r=Mf(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Mf(1-Lf(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let Df,If,Wf,Ff;class zf{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,If=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Df,totalY:If}),e.emit(dc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Df+=t.moveX,t.totalY=If+=t.moveY,e.emit(dc.BEFORE_MOVE,t),e.emit(dc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Wf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Wf}),e.emit(pc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Wf*=t.scale,e.emit(pc.BEFORE_ZOOM,t),e.emit(pc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Ff=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Ff}),e.emit(gc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Ff+=t.rotation,e.emit(gc.BEFORE_ROTATE,t),e.emit(gc.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(dc.END,Object.assign(Object.assign({},e),{totalX:Df,totalY:If})),i&&t.emit(pc.END,Object.assign(Object.assign({},i),{totalScale:Wf})),s&&t.emit(gc.END,Object.assign(Object.assign({},s),{totalRotation:Ff})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Nf=Gl.prototype,Yf=new Kt,Xf=new pt;function Hf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Vf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Nf.initType=function(t){Sf.run(t,this)},Nf.getValidMove=function(t,e,i=!0){const{disabled:s,scrollSpread:n}=this.app.config.move;Xf.set(t,e);const r=wf(this);return r&&(r.includes("x")?Xf.y=0:r.includes("y")?Xf.x=0:Math.abs(Xf.x)>Math.abs(Xf.y)?Xf.y=0:Xf.x=0,i&&r.includes("limit")&&(Yf.set(this.__world).addPoint(this.zoomLayer),n&&Yf.spread(n),ic.getValidMove(Yf,this.canvas.bounds,"auto",Xf,!0),r.includes("x")?Xf.y=0:r.includes("y")&&(Xf.x=0))),{x:s?0:Xf.x,y:s?0:Xf.y}},Nf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const Uf=Mc.prototype;Uf.createTransformer=function(){this.transformer=new zf(this)},Uf.move=function(t){this.transformer.move(t)},Uf.zoom=function(t){this.transformer.zoom(t)},Uf.rotate=function(t){this.transformer.rotate(t)},Uf.transformEnd=function(){this.transformer.transformEnd()},Uf.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 r=e.getScale?e.getScale(t,e):Af.getScale(t,e);if(1!==r)this.zoom(Vf(r,t));else{const s=e.getMove?e.getMove(t,e):Af.getMove(t,e);i.snap&<.round(s),this.move(Hf(s,t))}},Uf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Rf.getData(e),{moving:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Rf.detect(n,g(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}Rf.reset()}r||(n.center=Rf.state.center)}else r=o=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}))),o&&this.zoom(Vf(n.scale,t)),r&&this.move(Hf(n.move,t))};const jf=kc.prototype,{abs:Gf,min:Kf,max:Zf,hypot:qf}=Math;function Jf(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=l(i)?i:.95,n=.15,r=150;let o,a,h,d=0,c=0,u=0,g=0,_=3;const{dragDataList:p}=this,f=p.length;for(let t=f-1;t>=Zf(f-3,0)&&(h=p[t],!(h.time&&Date.now()-h.time>100));t--)o=_--,d+=h.moveX*o,c+=h.moveY*o,g+=o,a=qf(h.moveX,h.moveY),a>u&&(u=a);if(g&&(d/=g,c/=g),u>8){const t=1.15+Kf((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=Zf(Gf(d),Gf(c));m>r&&(a=r/m,d*=a,c*=a);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),Gf(d)<n&&Gf(c)<n)return this.dragEndReal(t);lt.move(t,d,c),this.drag(t),this.animate(y),e.emit(dc.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:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Vt.maxX(o),d=Vt.maxY(o),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,lt.move(i,c,u),lt.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)},ce.add("viewport"),ce.add("view"),Gl.prototype.zoom=function(t,e,i,s){let n;_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:r}=this,h=this.canvas.bounds.clone().shrink(o(n)?30:n),d=new Kt,c={x:h.x+h.width/2,y:h.y+h.height/2};let p;r.killAnimate();const{x:f,y:m,scaleX:y,scaleY:v}=r.__,{boxBounds:x}=r;if(a(t))switch(t){case"in":p=Jf(y,"in");break;case"out":p=Jf(y,"out");break;case"fit":t=x;break;case"fit-width":(t=new Kt(x)).height=0;break;case"fit-height":(t=new Kt(x)).width=0}else l(t)&&(p=t/y);if(p)p=this.getValidScale(p),r.scaleOfWorld(c,p,p,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,xo.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,h);d.set(r.getWorldBounds(e))}const{width:o,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-o)/2,0),c+=Math.max((h.height-a)/2,0)):(p=this.getValidScale(Math.min(h.width/o,h.height/a)),l+=(h.width-o*p)/2,c+=(h.height-a*p)/2,lt.scaleOf(e,d,p),d.scaleOf(d,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(l=0),lt.move(e,l,c),d.move(l,c),r.set(e,s),d}return r.worldBoxBounds};class $f extends Vl{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&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(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 td,this.scrollYBar=new td),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:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Kt(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=o.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_(ac.DRAG,this.onDrag,this),e.on_(ac.DRAG,this.onDrag,this),t.on_(ac.END,this.onDragEnd,this),e.on_(ac.END,this.onDragEnd,this),this.target.on_(ia.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Qo.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}ce.add("scroll");class Qf extends El{}function tm(t){return gr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&Er(this),t.__useArrow=e,Rr(this)}}}))}let em=class extends Rd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){sl.register(t,e)}};i([Xr(Qf)],em.prototype,"__",void 0),i([tm("angle")],em.prototype,"endArrow",void 0),em=i([$r()],em);const{M:im,L:sm,C:nm,Q:rm,O:om}=Ie,{rotate:am,copyFrom:hm,scale:lm}=lt,dm={},cm={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case im:case sm:um(t,l+1,e,i,s,n,r,o),l+=3;break;case nm:for(h=1;h<6;h+=2)um(t,l+h,e,i,s,n,r,o);l+=7;break;case rm:for(h=1;h<4;h+=2)um(t,l+h,e,i,s,n,r,o);l+=5;break;case om:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){cm.layout(t,0,0,1,1,e,i)}};function um(t,e,i,s,n,r,o,a){hm(dm,t[e],t[e+1]),o&&am(dm,o,a),n&&lm(dm,n,r),t[e]=i+dm.x,t[e+1]=s+dm.y}const{layout:gm,rotate:_m}=cm,{getAngle:pm}=lt,fm={x:-.5},mm={connect:fm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},ym={connect:fm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},vm={connect:fm,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]},xm={connect:fm,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:fm,path:[...vm.path],dashPath:[1,-2.5,0,2,-1,0]};_m(wm.path,180,{x:-1.5,y:0});const bm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},km={connect:{x:.5},path:[...bm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Em={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:[...Em.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Bm=f.clone(Em),Tm=f.clone(Sm);_m(Bm.path,45),_m(Tm.path,45);const Rm={angle:mm,"angle-side":ym,arrow:xm,triangle:vm,"triangle-flip":wm,circle:km,"circle-line":bm,square:Sm,"square-line":Em,diamond:Tm,"diamond-line":Bm,mark:{offset:fm,path:[1,0,-2,2,0,2]}};function Om(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=Rm[e.type]):a=e:a=Rm[e];const{offset:c,connect:u,path:_,dashPath:p}=a;let f=u?u.x:0,m=c?c.x:0;const y=[..._];return o&&p&&y.push(...p),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&gm(y,0,0,h,h),m&&gm(y,m,0),gm(y,s.x,s.y,n,n,pm(i,s)),r.x=(f+m)*n,y}const{M:Lm,L:Cm,C:Pm,Q:Mm,Z:Am,N:Dm,D:Im,X:Wm,G:Fm,F:zm,O:Nm,P:Ym,U:Xm}=Ie,{copy:Hm,copyFrom:Vm,getDistancePoint:Um}=lt,jm={},Gm={},Km={},Zm={},qm={},Jm={list:Rm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:r,cornerRadius:o}=t.__,a=!o;let h,l=0,d=r.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=r[l],h){case Lm:case Cm:(c<2||l+6>=d)&&(Vm(qm,r[l+1],r[l+2]),!c&&u&&Hm(Gm,qm)),l+=3;break;case Pm:(1===c||l+7>=d-3)&&$m(r,Zm,qm,l+3),l+=7;break;case Mm:(1===c||l+5>=d-3)&&$m(r,Zm,qm,l+1),l+=5;break;case Am:return;case Dm:l+=5;break;case Im:l+=9;break;case Wm:l+=6;break;case Fm:l+=9;break;case zm:l+=5;break;case Nm:l+=7;break;case Ym:l+=4;break;case Xm:(1===c||l+6>=d-3)&&($m(r,Zm,qm,l+1),l+6!==d&&(qm.x-=(qm.x-Zm.x)/10,qm.y-=(qm.y-Zm.y)/10)),l+=6}if(c++,1===c&&h!==Lm)return;if(2===c&&u&&Hm(Km,h===Cm?qm:Zm),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Om(t,e,Km,Gm,s,jm,!!n);n?d.push(...i):o.push(...i),jm.x&&(Um(Gm,Km,-jm.x,!0),o[1]=Km.x,o[2]=Km.y)}if(i&&"none"!==i){const e=Om(t,i,Zm,qm,s,jm,!!n);if(n?d.push(...e):o.push(...e),jm.x){let t;switch(Um(qm,Zm,-jm.x,!0),h){case Cm:t=l-3+1;break;case Pm:t=l-7+5;break;case Mm:t=l-5+3;break;case Xm:t=l-6+3}t&&Qm(o,Zm,t)}}}else Hm(Zm,qm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function $m(t,e,i,s){Vm(e,t[s],t[s+1]),Vm(i,t[s+2],t[s+3])}function Qm(t,e,i){t[i]=e.x,t[i+1]=e.y}ce.add("arrow"),Hl.addAttr("startArrow","none",tm),Hl.addAttr("endArrow","none",tm),Object.assign(sl,Jm),Object.assign(nl,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:ty,NoAndSkip:ey,YesAndSkip:iy}=e,sy={},ny={},ry={};class oy{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":sy.id=t.substring(1),t=sy;break;case".":ny.className=t.substring(1),t=ny;break;default:ry.tag=t,t=ry}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&uo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===ty||r===iy){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<ey&&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_(Xo.REMOVE,this.__onRemoveChild,this),this.target.on_(Vo.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 ay=Hl.prototype;function hy(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}ay.find=function(t,e){return hy(this).getBy(t,this,!1,e)},ay.findOne=function(t,e){return hy(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t){return new oy(t)};const{setPoint:ly,addPoint:dy,toBounds:cy}=vt;const uy={syncExport(t,e,i){let s;ll.running=!0;try{const n=Zn.fileType(e),o=e.includes(".");i=Zn.getExportOptions(i);const{toURL:a}=ee,{download:h}=ee.origin;if("json"===n)o&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!o||t.toJSON(i.json)};else if("svg"===n)o&&h(a(t.toSVG(),"svg"),e),s={data:!!o||t.toSVG()};else{let n,o,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,v=r(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&r(i.fill)?t.fill:i.fill,b=Zn.isOpaqueImage(e)||w,k=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":k.set(l);break;case"local":k.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:k.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};I.getScaleData(i.scale,i.size,n,E);let S=i.pixelRatio||1,{x:B,y:T,width:R,height:O}=new Kt(n).scale(E.scaleX,E.scaleY);_&&(B+=_.x,T+=_.y,R=_.width,O=_.height,_.rotation&&k.rotateOfInner({x:B,y:T},-_.rotation));const L={exporting:!0,matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-B,-T).withScale(1/a*E.scaleX,1/h*E.scaleY)};let C,P=ue.canvas({width:Math.floor(R),height:Math.floor(O),pixelRatio:S,smooth:v,contextSettings:x});g&&(C=t,C.__worldOpacity=0,t=c||t,L.bounds=P.bounds),P.save();const M=u&&!r(w),A=t.get("fill");if(M&&(t.fill=""),ee.render(t,P,L),M&&(t.fill=A),P.restore(),C&&C.__updateWorldOpacity(),p){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?dy(o,n,r):ly(o={},n,r)),a++;const h=new Kt;return o&&(cy(o,h),h.scale(1/t.pixelRatio).ceil()),h}(P);const t=P,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:S};P=ue.canvas(s),P.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=I.fourNumber(m),n=P,{width:r,height:o}=n;P=ue.canvas({width:r+s+e,height:o+t+i,pixelRatio:S}),P.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&P.fillWorld(P.bounds,w||"#FFFFFF","destination-over"),y&&y(P);s={data:"canvas"===e?P:P.export(e,i),width:P.pixelWidth,height:P.pixelHeight,renderBounds:n,trimBounds:o};const D=c&&c.app;D&&D.canvasManager&&D.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return ll.running=!1,s},export(t,e,i){return ll.running=!0,function(t){gy||(gy=new Qn);return new Promise(e=>{gy.add(()=>s(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(r=>{const o=()=>s(this,void 0,void 0,function*(){if(!er.isComplete)return ee.requestRender(o);const s=ll.syncExport(t,e,i);s.data instanceof Promise&&(s.data=yield s.data),n(s),r()});t.updateLayout(),_y(t);const{leafer:a}=t;a?a.waitViewCompleted(o):o()}))}};let gy;function _y(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>_y(t))}const py=Me.prototype,fy=ne.get("@leafer-in/export");py.export=function(t,e){const{quality:i,blob:s}=Zn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},py.toBlob=function(t,e){return new Promise(i=>{ee.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{fy.error(t),i(null)})})},py.toDataURL=function(t,e){return ee.origin.canvasToDataURL(this.view,t,e)},py.saveAs=function(t,e){return new Promise(i=>{ee.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{fy.error(t),i(!1)})})},ce.add("export"),Object.assign(ll,uy),Hl.prototype.export=function(t,e){return ll.export(this,t,e)},Hl.prototype.syncExport=function(t,e){return ll.syncExport(this,t,e)};const my={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},yy={top:"flex-start",middle:"center",bottom:"flex-end"},vy={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function xy(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(g(e))switch(e.type){case"solid":i=el.string(e.color);break;case"image":case"film":case"video":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=el.string(a(t)?t:t.color);break;default:r(e.r)||(i=el.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=el.string(d.color))):c=d,s.textDecoration=vy[c],s.textTransform=my[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=yy[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let wy=class extends zp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Wd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:r}=t.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(s):r.appendChild(s),this.eventIds=[t.app.on_(nc.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const o=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}o.removeAllRanges(),o.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth)switch(i+=20,o.textAlign){case"center":n=o.autoSizeAlign?-i/2:-10;break;case"right":n=o.autoSizeAlign?-i:-20}if(o.__autoHeight)switch(s+=20,o.verticalAlign){case"middle":r=o.autoSizeAlign?-s/2:-10;break;case"bottom":r=o.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:_}=new mt(t.worldTransform).scale(1/e).translateInner(n,r),{style:p}=this.editDom;p.transform=`matrix(${l},${d},${c},${u},${g},${_})`,p.left=a+"px",p.top=h+"px",p.width=i+"px",p.height=s+"px",this.isHTMLText||xy(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};wy=i([Ep()],wy),ce.add("text-editor","editor");class by extends Ml{setText(t){this._text=t,this.__htmlChanged=!0}}const ky={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let Ey=class extends Od{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const r=t.indexOf(";",n+1);if(r>n+1&&(e=t.slice(n+1,r),i=ky[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){a(t)?ky[t]=e:Object.assign(ky,t)}};i([Xr(by)],Ey.prototype,"__",void 0),i([br("")],Ey.prototype,"text",void 0),i([fr("TextEditor")],Ey.prototype,"editInner",void 0),i([Cr(!1)],Ey.prototype,"textEditing",void 0),Ey=i([$r()],Ey),ce.add("html");export{Tt as AlignHelper,e as Answer,Nd as App,Et as AroundHelper,em as Arrow,Qf as ArrowData,qt as AutoBounds,li as BezierHelper,Kt as Bounds,Go as BoundsEvent,Vt as BoundsHelper,td as Box,wl as BoxData,Eh as Branch,Eo as BranchHelper,Xa as BranchRender,Cd as Canvas,Al as CanvasData,ve as CanvasManager,Xo as ChildEvent,el as ColorConvert,ue as Creator,Ac as Cursor,f as DataHelper,ne as Debug,wt as Direction4,bt as Direction9,ic as DragBoundsHelper,ac as DragEvent,kc as Dragger,lc as DropEvent,up as EditBox,np as EditDataHelper,lp as EditPoint,U_ as EditSelect,Y_ as EditSelectHelper,Np as EditTool,Sp as EditToolCreator,Fp as Editor,C_ as EditorEvent,Rp as EditorGroupEvent,wp as EditorHelper,Mp as EditorMoveEvent,Dp as EditorRotateEvent,Ap as EditorScaleEvent,Ip as EditorSkewEvent,al as Effect,rd as Ellipse,Bl as EllipseData,yi as EllipseHelper,Yo as Event,me as EventCreator,da as Eventer,ll as Export,Zn as FileHelper,hl as Filter,oy as Finder,B as FourNumberHelper,ed as Frame,kl as FrameData,Vl as Group,xl as GroupData,Ey as HTMLText,by as HTMLTextData,Dc as HitCanvasManager,Od as Image,Ml as ImageData,jo as ImageEvent,sr as ImageManager,v as IncrementId,zp as InnerEditor,Tp as InnerEditorEvent,Mc as InteractionBase,mc as InteractionHelper,fc as KeyEvent,Xd as Keyboard,ea as LayoutEvent,Xh as Layouter,_h as Leaf,Fa as LeafBounds,xo as LeafBoundsHelper,y as LeafData,ka as LeafDataProxy,wa as LeafEventer,uo as LeafHelper,No as LeafLayout,Bh as LeafLevelList,Sh as LeafList,La as LeafMatrix,za as LeafRender,Gl as Leafer,Rh as LeaferCanvas,Me as LeaferCanvasBase,bl as LeaferData,sa as LeaferEvent,hr as LeaferFilm,ar as LeaferImage,Sf as LeaferTypeCreator,lr as LeaferVideo,Rd as Line,El as LineData,jp as LineEditTool,I as MathHelper,mt as Matrix,J as MatrixHelper,dc as MoveEvent,Rf as MultiTouchHelper,hc as MyDragEvent,Ld as MyImage,rc as MyPointerEvent,uc as MyTouchEvent,Fe as NeedConvertToCanvasCommandMap,F as OneRadian,z as PI2,N as PI_2,nl as Paint,ol as PaintGradient,rl as PaintImage,Fd as Path,sl as PathArrow,Jm as PathArrowModule,Wn as PathBounds,Bs as PathCommandDataHelper,Ie as PathCommandMap,vi as PathCommandNodeHelper,ss as PathConvert,Vn as PathCorner,Hs as PathCreator,Ol as PathData,rn as PathDrawer,Ae as PathHelper,cm as PathMatrixHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,zd as Pen,Ll as PenData,Kh as Picker,ee as Platform,ce as Plugin,pt as Point,lt as PointHelper,Hd as PointerButton,nc as PointerEvent,gd as Polygon,Tl as PolygonData,Vo as PropertyEvent,Kl as Rect,Sl as RectData,He as RectHelper,Yl as RectRender,ia as RenderEvent,Vh as Renderer,Qo as ResizeEvent,er as Resource,gc as RotateEvent,he as Run,$f as ScrollBar,N_ as SelectArea,Zh as Selector,xd as Star,Rl as StarData,dl as State,$t as StringNumberMap,z_ as Stroker,_c as SwipeEvent,$n as TaskItem,Qn as TaskProcessor,Wd as Text,tl as TextConvert,Pl as TextData,wy as TextEditor,cc as TouchEvent,Wp as TransformTool,zf as Transformer,cl as Transition,vt as TwoPointBoundsHelper,Hl as UI,Wl as UIBounds,_e as UICreator,yl as UIData,Vd as UIEvent,zl as UIRender,il as UnitConvert,Jt as UnitConvertHelper,Lo as WaitHelper,ta as WatchEvent,Ch as Watcher,Af as WheelEventHelper,pc as ZoomEvent,bf as addViewport,kf as addViewportConfig,Lr as affectRenderBoundsType,Tr as affectStrokeBoundsType,tm as arrowType,_r as attr,vr as autoLayoutType,br as boundsType,Kn as canvasPatch,Pe as canvasSizeAttrs,Qh as createAttr,ur as createDescriptor,Yr as cursorType,Xr as dataProcessor,fr as dataType,gr as decorateLeafAttr,Vr as defineDataProcessor,dr as defineKey,pr as defineLeafAttr,Pr as dimType,Er as doBoundsType,Rr as doStrokeType,qh as effectType,n as emptyData,zr as eraserType,Uo as extraPropertyEventMap,X as getBoundsData,cr as getDescriptor,H as getMatrixData,Y as getPointData,Nr as hitType,u as isArray,_ as isData,p as isEmptyData,h as isFinite,o as isNull,l as isNumber,g as isObject,a as isString,r as isUndefined,Hr as layoutProcessor,ha as leaferTransformAttrMap,Fr as maskType,kr as naturalBoundsType,Mr as opacityType,Un as path,Sr as pathInputType,Br as pathType,jn as pen,mr as positionType,kp as registerEditTool,Ep as registerInnerEditor,$r as registerUI,Qr as registerUIEvent,Jh as resizeType,Kr as rewrite,Zr as rewriteAble,wr as rotationType,xr as scaleType,yr as scrollType,Wr as sortType,Or as strokeType,Cr as surfaceType,Zt as tempBounds,yt as tempMatrix,ft as tempPoint,c as tryToNumber,Oh as useCanvas,Jr as useModule,Th as version,Ar as visibleType,$h as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|