@leafer-editor/worker 1.12.2 → 1.12.3
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 +51 -16
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +54 -16
- 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 _(t){return"{}"===JSON.stringify(t)}const g={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}=g;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{floor:m,max:y}=Math,v={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||x.maxCacheSize),isSuperLarge:(t,e,i)=>x.isLarge(t,e,i,x.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,r){const s=e/r.width,n=i/r.height;d.setTransform(s,0,0,n,-r.x*s,-r.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:x}=v,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=w;let k,E,S;const{max:B}=Math,T=[0,0,0,0],R={zero:[...T],tempFour:T,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>L(T,t,e,i,s),toTempAB(t,e,i){S=i?a(t)?e:t:[],a(t)?(k=C(t),E=e):a(e)?(k=t,E=C(e)):(k=t,E=e),4!==k.length&&(k=O(k)),4!==E.length&&(E=O(E))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(P(t,e,i),L(S,B(k[0],E[0]),B(k[1],E[1]),B(k[2],E[2]),B(k[3],E[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(P(t,e,i),L(S,k[0]+E[0],k[1]+E[1],k[2]+E[2],k[3]+E[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:O(t);return L(n,h*i,l*e,r*i,o*e)}},{set:L,get:O,setTemp:C,toTempAB:P}=R,{round:M,pow:A,max:D,floor:I,PI:W}=Math,F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:A(10,e);return-0===(t=M(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&&F.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)=>D(I(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const Y=W/180,N=2*W,X=W/2;function H(){return{x:0,y:0}}function V(){return{x:0,y:0,width:0,height:0}}function U(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:G,acos:K,sqrt:Z}=Math,{float:q}=F,J={};function $(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:$(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:U,getWorld:$,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=G(e*=Y),a=j(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=Y,t.a=s+r*i,t.b=n+o*i),e&&(e*=Y,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d: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){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e: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*Y,o=G(r),a=j(r);if(s||n){const e=s*Y,i=n*Y;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)&&tt.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=Z(n*n+r*r),c=t/d;const e=n/d;u=r>0?K(e):-K(e)}else{c=Z(o*o+a*a),d=t/c;const e=o/c;u=X-(a>0?K(-e):-K(e))}const e=q(G(u)),i=j(u);d=q(d),c=q(c),_=e?q((o/c+i)/e/Y,9):0,g=e?q((r/d-i)/e/Y,9):0,u=q(u/Y)}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:_,skewY:g}},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=Z(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{float:et}=F,{toInnerPoint:it,toOuterPoint:st}=Q,{sin:nt,cos:rt,abs:ot,sqrt:at,atan2:ht,min:lt,round:dt}=Math,ct={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?dt(t.x-.5)+.5:dt(t.x),t.y=e?dt(t.y-.5)+.5:dt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ut.defaultPoint);const s=rt(e*=Y),n=nt(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}=ut;return gt(i,t),it(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ut;return gt(i,t),st(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ut;return gt(i,t),ut.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(gt(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),it(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){it(e,t,i)},toOuterOf(t,e,i){st(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>_t(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=ot(i-t),r=ot(s-e);return at(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>lt(_t(t,e,i,s),_t(i,s,n,r)),getAngle:(t,e)=>ft(t,e)/Y,getRotation:(t,e,i,s)=>(s||(s=e),ut.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/Y),getRadianFrom(t,e,i,n,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)=>ht(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=ft(t,e);return n&&(t=e),s||(e={}),e.x=t.x+rt(r)*i,e.y=t.y+nt(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)=>et(t.x)===et(e.x)&&et(t.y)===et(e.y),reset(t){ut.reset(t)}},ut=ct,{getDistanceFrom:_t,copy:gt,setRadius:pt,getAtan2:ft}=ut;class mt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ct.copy(this,t):ct.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new mt(this)}move(t,e){return ct.move(this,t,e),this}scale(t,e){return ct.scale(this,t,e),this}scaleOf(t,e,i){return ct.scaleOf(this,t,e,i),this}rotate(t,e){return ct.rotate(this,t,e),this}rotateOf(t,e){return ct.rotate(this,e,t),this}getRotation(t,e,i){return ct.getRotation(this,t,e,i)}toInnerOf(t,e){return ct.toInnerOf(this,t,e),this}toOuterOf(t,e){return ct.toOuterOf(this,t,e),this}getCenter(t){return new mt(ct.getCenter(this,t))}getDistance(t){return ct.getDistance(this,t)}getDistancePoint(t,e,i,s){return new mt(ct.getDistancePoint(this,t,e,i,s))}getAngle(t){return ct.getAngle(this,t)}getAtan2(t){return ct.getAtan2(this,t)}isSame(t){return ct.isSame(this,t)}reset(){return ct.reset(this),this}}const yt=new mt;class vt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new vt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const xt=new vt,wt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){bt(t,e,i),bt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:bt}=wt;var kt,Et;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(kt||(kt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(Et||(Et={}));const St=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];St.forEach(t=>t.type="percent");const Bt={directionData:St,tempPoint:{},get:Tt,toPoint(t,e,i,s,n,r){const o=Tt(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 Tt(t){return r(t)?St[Et[t]]:t}const{toPoint:Rt}=Bt,Lt={toPoint(t,e,i,s,n,r){Rt(t,i,s,n,e,r)}},{tempPointBounds:Ot,setPoint:Ct,addPoint:Pt,toBounds:Mt}=wt,{toOuterPoint:At}=Q,{float:Dt,fourNumber:It}=F,{floor:Wt,ceil:Ft}=Math;let zt,Yt,Nt,Xt;const Ht={},Vt={},Ut={},jt={tempBounds:Ut,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(d(i)){const e=It(i);s?Gt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Gt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Gt.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),Gt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Zt(e,t):e=t,i||(i=t),e.offsetX=Gt.maxX(i),e.offsetY=Gt.maxY(i),Gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ct.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ct.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Gt.copy(Ut,t),Gt.toOuterOf(Ut,e),Ut),getOuterOf:(t,e)=>(t=Object.assign({},t),Gt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e: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 Ht.x=t.x,Ht.y=t.y,At(e,Ht,Vt),Ct(Ot,Vt.x,Vt.y),Ht.x=t.x+t.width,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Ht.y=t.y+t.height,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Ht.x=t.x,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Mt(Ot,i)},toInnerOf(t,e,i){i||(i=t),Gt.move(i,-e.e,-e.f),Gt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Gt.getFitScale(t,e));return new vt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),r(s)&&(s=Gt.getFitScale(t,e,"cover"===s)),Ut.width=n?e.width*=s:e.width*s,Ut.height=n?e.height*=s:e.height*s,Lt.toPoint(i,Ut,t,o,!0,!0)},getSpread(t,e,i){const s={};return Gt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Gt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Gt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Wt(t.x),t.y=Wt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Dt(t.x,e),t.y=Dt(t.y,e),t.width=Dt(t.width,e),t.height=Dt(t.height,e)},add(t,e,i){zt=t.x+t.width,Yt=t.y+t.height,Nt=e.x,Xt=e.y,i||(Nt+=e.width,Xt+=e.height),zt=zt>Nt?zt:Nt,Yt=Yt>Xt?Yt:Xt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=zt-t.x,t.height=Yt-t.y},addList(t,e){Gt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Gt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Gt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,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||Zt(t,n)):Kt(t,n));r&&Gt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Ot,t.x,t.y):Pt(Ot,t.x,t.y)),Mt(Ot,t)},setPoint(t,e){Gt.set(t,e.x,e.y)},addPoint(t,e){Kt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ct.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ct.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Gt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Gt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Gt.tempToOuterOf(e,i)),!Gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return zt=s+r,Yt=n+o,Nt=t.x+t.width,Xt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,zt=zt<Nt?zt:Nt,Yt=Yt<Xt?Yt:Xt,r=zt-s,o=Yt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Gt.copy(t,Gt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Gt.set(t)}},Gt=jt,{add:Kt,copy:Zt}=Gt;class qt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?jt.copy(this,t):jt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new qt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Jt=new qt;class $t{constructor(t,e,i,s,n,r){c(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:te}=F;class ee{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ee(t)}static set filter(t){this.filterList=ie(t)}static set exclude(t){this.excludeList=ie(t)}static drawRepaint(t,e){const i=te();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ee.showBounds,n=t.__nowWorld,r=te();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(se.enable){if(se.filterList.length&&se.filterList.every(t=>t!==this.name))return;if(se.excludeList.length&&se.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){se.enable&&this.warn(...t)}warn(...t){se.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ie(t){return t?r(t)&&(t=[t]):t=[],t}ee.filterList=[],ee.excludeList=[],ee.showWarn=!0;const se=ee,ne=ee.get("RunTime"),re={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ne.log(s,n,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=re,ae=[],he={list:{},add(t,...e){this.list[t]=!0,ae.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ae.forEach(t=>he.has(t,!0)));const le={editor:t=>he.need("editor")},de=ee.get("UICreator"),ce={list:{},register(t){const{__tag:e}=t.prototype;ue[e]&&de.repeat(e),ue[e]=t},get(t,e,i,n,r,o){ue[t]||de.error("not register "+t);const a=new ue[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:ue}=ce,_e=ee.get("EventCreator"),ge={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(pe[e]&&_e.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=ge;class fe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=le.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function me(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function ye(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const xe=[];function we(){return(t,e)=>{xe.push(e)}}const be=[];let ke=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.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}};me([ve("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),me([ve("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),me([ve("globalAlpha")],ke.prototype,"opacity",void 0),me([ve()],ke.prototype,"fillStyle",void 0),me([ve()],ke.prototype,"strokeStyle",void 0),me([ve("lineWidth")],ke.prototype,"strokeWidth",void 0),me([ve("lineCap")],ke.prototype,"strokeCap",void 0),me([ve("lineJoin")],ke.prototype,"strokeJoin",void 0),me([ve("lineDashOffset")],ke.prototype,"dashOffset",void 0),me([ve()],ke.prototype,"miterLimit",void 0),me([ve()],ke.prototype,"shadowBlur",void 0),me([ve()],ke.prototype,"shadowColor",void 0),me([ve()],ke.prototype,"shadowOffsetX",void 0),me([ve()],ke.prototype,"shadowOffsetY",void 0),me([ve()],ke.prototype,"filter",void 0),me([ve()],ke.prototype,"font",void 0),me([ve()],ke.prototype,"fontKerning",void 0),me([ve()],ke.prototype,"fontStretch",void 0),me([ve()],ke.prototype,"fontVariantCaps",void 0),me([ve()],ke.prototype,"textAlign",void 0),me([ve()],ke.prototype,"textBaseline",void 0),me([ve()],ke.prototype,"textRendering",void 0),me([ve()],ke.prototype,"wordSpacing",void 0),me([ve()],ke.prototype,"letterSpacing",void 0),me([ve()],ke.prototype,"direction",void 0),me([we()],ke.prototype,"setTransform",null),me([we()],ke.prototype,"resetTransform",null),me([we()],ke.prototype,"getTransform",null),me([we()],ke.prototype,"save",null),me([we()],ke.prototype,"restore",null),me([we()],ke.prototype,"translate",null),me([we()],ke.prototype,"scale",null),me([we()],ke.prototype,"rotate",null),me([we()],ke.prototype,"fill",null),me([we()],ke.prototype,"stroke",null),me([we()],ke.prototype,"clip",null),me([we()],ke.prototype,"fillRect",null),me([we()],ke.prototype,"strokeRect",null),me([we()],ke.prototype,"clearRect",null),me([we()],ke.prototype,"beginPath",null),me([we()],ke.prototype,"moveTo",null),me([we()],ke.prototype,"lineTo",null),me([we()],ke.prototype,"bezierCurveTo",null),me([we()],ke.prototype,"quadraticCurveTo",null),me([we()],ke.prototype,"closePath",null),me([we()],ke.prototype,"arc",null),me([we()],ke.prototype,"arcTo",null),me([we()],ke.prototype,"ellipse",null),me([we()],ke.prototype,"rect",null),me([we()],ke.prototype,"roundRect",null),me([we()],ke.prototype,"createConicGradient",null),me([we()],ke.prototype,"createLinearGradient",null),me([we()],ke.prototype,"createPattern",null),me([we()],ke.prototype,"createRadialGradient",null),me([we()],ke.prototype,"fillText",null),me([we()],ke.prototype,"measureText",null),me([we()],ke.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Se,pixelScale:Be}=Q,{round:Te}=Math,Re=new qt,Le=new qt,Oe={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Pe extends ke{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Oe),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;g.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Se(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin: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=Le):i=Re,this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,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(Re.x,Re.y,Re.width,Re.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,Re.x,Re.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Re.x,Re.y,Re.width,Re.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Re.x,Re.y,Re.width,Re.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Re,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(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):le.canvas(Object.assign({},i));return n.save(),t&&(Ee(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Me={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ae={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},De=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},Ae),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Fe=Object.assign(Object.assign({},We),Ae),ze=De,Ye={};for(let t in ze)Ye[ze[t]]=t;const Ne={};for(let t in ze)Ne[ze[t]]=Ie[t];const Xe={drawRoundRect(t,e,i,s,n,r){const o=F.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:He,cos:Ve,hypot:Ue,atan2:je,ceil:Ge,abs:Ke,PI:Ze,sqrt:qe,pow:Je}=Math,{setPoint:$e,addPoint:Qe}=wt,{set:ti,toNumberPoints:ei}=ct,{M:ii,L:si,C:ni,Q:ri,Z:oi}=De,ai={},hi={points(t,e,i,s){let n=ei(e);if(t.push(ii,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,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],g=o-e,p=a-r,f=qe(Je(g,2)+Je(p,2)),m=qe(Je(h-o,2)+Je(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(ri,d,c,o,a):(g||p)&&t.push(ni,u,_,d,c,o,a),u=o+m*h,_=a+m*l);s||t.push(ri,u,_,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(si,n[e],n[e+1]);s&&t.push(oi)},rect(t,e,i,s,n){Me.creator.path=t,Me.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){Me.creator.path=[],Xe.drawRoundRect(Me.creator,e,i,s,n,r),t.push(...Me.convertToCanvasData(Me.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,g=o-n;let p=je(u,c),f=je(g,_);const m=Ue(c,u),y=Ue(_,g);let v=f-p;if(v<0&&(v+=N),m<1e-12||y<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(si,s,n),h&&($e(h,e,i),Qe(h,s,n)),d&&ti(d,e,i),void(l&&ti(l,s,n));const x=c*g-_*u<0,w=x?-1:1,b=a/Ve(v/2),k=s+b*Ve(p+v/2+X*w),E=n+b*He(p+v/2+X*w);return p-=X*w,f-=X*w,ci(t,k,E,a,a,0,p/Y,f/Y,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ci(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*Y,_=He(u),g=Ve(u);let p=o*Y,f=a*Y;p>Ze&&(p-=N),f<0&&(f+=N);let m=f-p;m<0?m+=N:m>N&&(m-=N),h&&(m-=N);const y=Ge(Ke(m/X)),v=m/y,x=He(v/4),w=8/3*x*x/He(v/2);f=p+v;let b,k,E,S,B,T,R,L,O=Ve(p),C=He(p),P=E=g*s*O-_*n*C,M=S=_*s*O+g*n*C,A=e+E,D=i+S;t&&t.push(t.length?si:ii,A,D),l&&$e(l,A,D),c&&ti(c,A,D);for(let r=0;r<y;r++)b=Ve(f),k=He(f),E=g*s*b-_*n*k,S=_*s*b+g*n*k,B=e+P-w*(g*s*C+_*n*O),T=i+M-w*(_*s*C-g*n*O),R=e+E+w*(g*s*k+_*n*b),L=i+S+w*(_*s*k-g*n*b),t&&t.push(ni,B,T,R,L,e+E,i+S),l&&di(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&&ti(d,e+E,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ni,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){di(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,_,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,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-_/u,0<g&&g<1&&d.push(g)}else m=u*u-4*_*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?Qe(h,t,e):$e(h,t,e),Qe(h,o,a);for(let l=0,c=d.length;l<c;l++)li(d[l],t,e,i,s,n,r,o,a,ai),Qe(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,g=t*t*t;l.x=c*e+u*s+_*r+g*a,l.y=c*i+u*n+_*o+g*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return li(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:li,toTwoPointBounds:di,ellipse:ci}=hi,{sin:ui,cos:_i,sqrt:gi,atan2:pi}=Math,{ellipse:fi}=hi,mi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=r*Y,g=ui(_),p=_i(_),f=-p*c-g*u,m=-p*u+g*c,y=s*s,x=n*n,w=m*m,b=f*f,k=y*x-y*w-x*b;let E=0;if(k<0){const t=gi(1-k/(y*x));s*=t,n*=t}else E=(o===a?-1:1)*gi(k/(y*w+x*b));const S=E*s*m/n,B=-E*n*f/s,T=pi((m-B)/n,(f-S)/s),R=pi((-m-B)/n,(-f-S)/s);let L=R-T;0===a&&L>0?L-=N:1===a&&L<0&&(L+=N);const O=e+c+p*S-g*B,C=i+u+g*S+p*B,P=L<0?1:0;d||v.ellipseToCurve?fi(t,O,C,s,n,r,T/Y,R/Y,P):s!==n||r?t.push(De.G,O,C,s,n,r,T/Y,R/Y,P):t.push(De.O,O,C,s,T/Y,R/Y,P)}},yi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:xi,L:wi,l:bi,H:ki,h:Ei,V:Si,v:Bi,C:Ti,c:Ri,S:Li,s:Oi,Q:Ci,q:Pi,T:Mi,t:Ai,A:Di,a:Ii,Z:Wi,z:Fi,N:zi,D:Yi,X:Ni,G:Xi,F:Hi,O:Vi,P:Ui,U:ji}=De,{rect:Gi,roundRect:Ki,arcTo:Zi,arc:qi,ellipse:Ji,quadraticCurveTo:$i}=hi,{ellipticalArc:Qi}=mi,ts=ee.get("PathConvert"),es={},is={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ne[s],a+=s===n?" ":Ye[s];for(let s=1;s<i;s++)a+=F.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Fe:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(ss.dot&&(ns(o,r),r=""),ss.dot++),"0"===r&&"."!==s&&(ns(o,r),r=""),r+=s):De[s]?(r&&(ns(o,r),r=""),ss.name=De[s],ss.length=Ie[s],ss.index=0,ns(o,ss.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&ns(o,r),r=s):r&&(ns(o,r),r=""),n=s;return r&&ns(o,r),i?is.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case xi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],_.push(vi,a,h),c+=3;break;case Ei:t[c+1]+=a;case ki:a=t[c+1],_.push(wi,a,h),c+=2;break;case Bi:t[c+1]+=h;case Si:h=t[c+1],_.push(wi,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case wi:a=t[c+1],h=t[c+2],_.push(wi,a,h),c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:o=r===Ti||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],_.push(Ti,l,d,i,s,a,h),c+=5;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ti;case Ti:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ti,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ai:t[c+1]+=a,t[c+2]+=h,n=Mi;case Mi:o=r===Ci||r===Mi,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?$i(_,a,h,i,s,t[c+1],t[c+2]):_.push(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:i=t[c+1],s=t[c+2],e?$i(_,a,h,i,s,t[c+3],t[c+4]):_.push(Ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=a,t[c+7]+=h;case Di:Qi(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Fi:case Wi:_.push(Wi),c++;break;case zi:a=t[c+1],h=t[c+2],e?Gi(_,a,h,t[c+3],t[c+4]):rs(_,t,c,5),c+=5;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(_,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?Ki(_,a,h,t[c+3],t[c+4],t[c+5]):rs(_,t,c,6),c+=6;break;case Xi:Ji(e?_:rs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,es),a=es.x,h=es.y,c+=9;break;case Hi:e?Ji(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:qi(e?_:rs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),a=es.x,h=es.y,c+=7;break;case Ui:e?qi(_,t[c+1],t[c+2],t[c+3],0,360,!1):rs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ji:Zi(e?_:rs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),a=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${n} [index:${c}]`,t),_}r=n}return _},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(wi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ss.index===ss.length&&(ss.index=1,t.push(ss.name)),t.push(Number(e)),ss.index++,ss.dot=0}},{current:ss,pushData:ns,copyData:rs}=is,{M:os,L:as,C:hs,Q:ls,Z:ds,N:cs,D:us,X:_s,G:gs,F:ps,O:fs,P:ms,U:ys}=De,{getMinDistanceFrom:vs,getRadianFrom:xs}=ct,{tan:ws,min:bs,abs:ks}=Math,Es={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(hs,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ls,e,i,s,n)},closePath(t){t.push(ds)},rect(t,e,i,s,n){t.push(cs,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(_s,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(us,e,i,s,n,...o):t.push(cs,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){if(s===r)return Ts(t,e,i,s,a,h,l);n(o)?t.push(ps,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(gs,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(ms,e,i,s):(n(r)&&(r=0),n(o)&&(o=360),t.push(fs,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h){if(!s(a)){const t=vs(a,h,e,i,n,r);o=bs(o,bs(t/2,t/2*ks(ws(xs(a,h,e,i,n,r)/2))))}t.push(ys,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){hi.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Es),t.push(os,Es.x,Es.y),Bs(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){hi.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,Es),t.push(os,Es.x,Es.y),Ts(t,e,i,s,r,o,a)},drawPoints(t,e,i,s){hi.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=Ss,{moveTo:Rs,lineTo:Ls,quadraticCurveTo:Os,bezierCurveTo:Cs,closePath:Ps,beginPath:Ms,rect:As,roundRect:Ds,ellipse:Is,arc:Ws,arcTo:Fs,drawEllipse:zs,drawArc:Ys,drawPoints:Ns}=Ss;class Xs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Me.parse(t):t:[],this}beginPath(){return Ms(this.__path),this.paint(),this}moveTo(t,e){return Rs(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 Cs(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ps(this.__path),this.paint(),this}rect(t,e,i,s){return As(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ds(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Is(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Ws(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Fs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return zs(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 Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Hs,L:Vs,C:Us,Q:js,Z:Gs,N:Ks,D:Zs,X:qs,G:Js,F:$s,O:Qs,P:tn,U:en}=De,sn=ee.get("PathDrawer"),nn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Hs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Us:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Js:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*Y,e[s+6]*Y,e[s+7]*Y,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*Y,e[s+5]*Y,e[s+6]),s+=7;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case en:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sn.error(`command: ${i} [index:${s}]`,e)}}},{M:rn,L:on,C:an,Q:hn,Z:ln,N:dn,D:cn,X:un,G:_n,F:gn,O:pn,P:fn,U:mn}=De,{toTwoPointBounds:yn,toTwoPointBoundsByQuadraticCurve:vn,arcTo:xn,arc:wn,ellipse:bn}=hi,{addPointBounds:kn,copy:En,addPoint:Sn,setPoint:Bn,addBounds:Tn,toBounds:Rn}=wt,Ln=ee.get("PathBounds");let On,Cn,Pn;const Mn={},An={},Dn={},In={toBounds(t,e){In.toTwoPointBounds(t,An),Rn(An,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===ln||o===an||o===hn?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),o){case rn:case on:h=t[a+1],l=t[a+2],Sn(e,h,l),a+=3;break;case an:n=t[a+5],r=t[a+6],yn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Mn),kn(e,Mn),h=n,l=r,a+=7;break;case hn:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],vn(h,l,i,s,n,r,Mn),kn(e,Mn),h=n,l=r,a+=5;break;case ln:a+=1;break;case dn:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=5;break;case cn:case un:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=o===cn?9:6;break;case _n:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=9;break;case gn:h=t[a+1],l=t[a+2],Cn=t[a+3],Pn=t[a+4],Tn(e,h-Cn,l-Pn,2*Cn,2*Pn),h+=Cn,a+=5;break;case pn:wn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=7;break;case fn:h=t[a+1],l=t[a+2],On=t[a+3],Tn(e,h-On,l-On,2*On,2*On),h+=On,a+=4;break;case mn:xn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=6;break;default:return void Ln.error(`command: ${o} [index:${a}]`,t)}}},{M:Wn,L:Fn,Z:zn}=De,{getCenterX:Yn,getCenterY:Nn}=ct,{arcTo:Xn}=Ss,Hn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,c=0,u=0,_=0,g=0,p=0;d(e)&&(e=e[0]||0);const f=t.length,m=[];for(;o<f;){switch(s=t[o],s){case Wn:l=g=t[o+1],c=p=t[o+2],o+=3,t[o]===Fn?(u=t[o+1],_=t[o+2],m.push(Wn,Yn(l,u),Nn(c,_))):m.push(Wn,l,c);break;case Fn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Fn:Xn(m,a,h,t[o+1],t[o+2],e,g,p);break;case zn:Xn(m,a,h,l,c,e,g,p);break;default:m.push(Fn,a,h)}g=a,p=h;break;case zn:n!==zn&&(Xn(m,l,c,u,_,e,g,p),m.push(zn)),o+=1;break;default:r=Ne[s];for(let e=0;e<r;e++)m.push(t[o+e]);o+=r}n=s}return s!==zn&&(m[1]=l,m[2]=c),m}};function Vn(t){return new Xs(t)}const Un=Vn();Me.creator=Vn(),Me.parse=is.parse,Me.convertToCanvasData=is.toCanvasData;const{drawRoundRect:jn}=Xe;function Gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){jn(this,t,e,i,s,n)})}(t)}const Kn={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=Zn.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{}}}},Zn=Kn;Zn.alphaPixelTypes.forEach(t=>Zn.upperCaseTypeMap[t]=t.toUpperCase());const qn=ee.get("TaskProcessor");class Jn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){qn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class $n{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e,i){let n,r,o,h;const l=new Jn(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.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Qn=ee.get("Resource"),tr={tasker:new $n,map:{},get isComplete(){return er.tasker.isComplete},set(t,e){er.map[t]&&Qn.repeat(t),er.map[t]=e},get:t=>er.map[t],remove(t){const e=er.map[t];e&&(e.destroy&&e.destroy(),delete er.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=le.image(s)),er.set(t,e),e},destroy(){er.map={}}},er=tr,ir={maxRecycled:10,recycledList:[],patternTasker:new $n({parallel:1}),get(t){let e=tr.get(t.url);return e||tr.set(t.url,e=le.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(v.image.isLarge(t)?t.url&&tr.remove(t.url):(t.clearLevels(),sr.recycledList.push(t)))})},recyclePaint(t){sr.recycle(t.image)},clearRecycled(t){const e=sr.recycledList;(e.length>sr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Kn.alphaPixelTypes.some(e=>sr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Kn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Kn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},sr=ir,{IMAGE:nr,create:rr}=w;class or{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rr(nr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ir.isFormat("svg",t)&&(this.isSVG=!0),ir.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;tr.tasker.add(()=>ye(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,s(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=v.image.resize(this.view,t,e,n,r,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function ar(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function hr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function lr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function dr(t,e){return(i,s)=>ur(i,s,t,e&&e(s))}function cr(t){return t}function ur(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ar(t,e,Object.assign(n,s||{})),Nr(t,e,i)}function _r(t){return dr(t)}function gr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wr(this))}}))}function mr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function yr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function vr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&wr(this)}}))}function xr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(wr(this),this.__.__removeNaturalSize())}}))}function wr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function br(t){return dr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wr(this)}}))}const kr=vr;function Er(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i)&&(Sr(this),e&&(this.__.__useStroke=!0))}}))}function Sr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wr(t)}const Br=Er;function Tr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Rr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Lr(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Or(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Pr(this)}}))}function Cr(t){return dr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Mr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Mr(this,t,e,i),this.mask&&Pr(this)}}))}function Pr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Mr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wr(t))}function Ar(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Dr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ir(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ee.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function zr(t){return(e,i)=>{ar(e,"__DataProcessor",{get:()=>t})}}function Yr(t){return(e,i)=>{ar(e,"__LayoutProcessor",{get:()=>t})}}function Nr(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=lr(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=_(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:g.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=hr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),ar(n,e,a)}const Xr=new ee("rewrite"),Hr=[],Vr=["destroy","constructor"];function Ur(t){return(e,i)=>{Hr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jr(){return t=>{Gr()}}function Gr(t){Hr.length&&(Hr.forEach(e=>{t&&Xr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Hr.length=0)}function Kr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Vr.includes(s)||e&&e.includes(s)))if(t.prototype){hr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Zr(){return t=>{ce.register(t)}}function qr(){return t=>{ge.register(t)}}setTimeout(()=>Gr(!0));const{copy:Jr,toInnerPoint:$r,toOuterPoint:Qr,scaleOfOuter:to,rotateOfOuter:eo,skewOfOuter:io,multiplyParent:so,divideParent:no,getLayout:ro}=Q,oo={},{round:ao}=Math,ho={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),uo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)co(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(po(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)go(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?Qr(t.localTransform,r,r,!0):t.parent&&$r(t.parent.scrollWorldTransform,r,r,!0),lo.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=ao(e),i=ao(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){lo.zoomOfLocal(t,fo(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),Jr(oo,o),to(oo,e,i,s),lo.hasHighPosition(t))lo.setTransform(t,oo,n,r);else{const e=t.x+oo.e-o.e,a=t.y+oo.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){lo.rotateOfLocal(t,fo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Jr(oo,n),eo(oo,e,i),lo.hasHighPosition(t)?lo.setTransform(t,oo,!1,s):t.set({x:t.x+oo.e-n.e,y:t.y+oo.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){lo.skewOfLocal(t,fo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Jr(oo,t.__localMatrix),io(oo,e,i,s),lo.setTransform(t,oo,n,r)},transformWorld(t,e,i,s){Jr(oo,t.worldTransform),so(oo,e),t.parent&&no(oo,t.parent.scrollWorldTransform),lo.setTransform(t,oo,i,s)},transform(t,e,i,s){Jr(oo,t.localTransform),so(oo,e),lo.setTransform(t,oo,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&lo.getInnerOrigin(t,n.origin),o=ro(e,r,n.around&&lo.getInnerOrigin(t,n.around));if(lo.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=lo.getInnerOrigin(t,n.origin);ct.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 to(i,lo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ct.tempToOuterOf(lo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Jr(oo,t.worldTransform),no(oo,e.scrollWorldTransform),i?oo:Object.assign({},oo)),drop(t,e,i,s){t.setTransform(lo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||lo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),v.requestRender(()=>lo.animateMove(t,e,i))}}},lo=ho,{updateAllMatrix:co,updateMatrix:uo,updateAllWorldOpacity:_o,updateAllChange:go,updateChange:po}=lo;function fo(t,e){return t.updateLayout(),t.parent?ct.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const mo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>vo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>vo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>vo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let yo;function vo(t,e){return e||(yo=0),t.__.mask&&(yo=1),yo<0?null:(yo&&(yo=-1),!0)}const{updateBounds:xo}=ho,wo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),bo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ko(e[t],e)},updateBounds(t,e){const i=[t];ko(t,i),Eo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)xo(s[t]);e&&e===i||xo(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&&So(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&&Bo(t,e,i,s,n,r,o)}},{pushAllChildBranch:bo,pushAllBranchStack:ko,updateBoundsByBranchStack:Eo,move:So,scale:Bo}=wo,To={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Ro,updateBounds:Lo}=ho,{toOuterOf:Oo,getPoints:Co,copy:Po}=jt,Mo="_localContentBounds",Ao="_worldContentBounds",Do="_worldBoxBounds",Io="_worldStrokeBounds";class Wo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Oo(this.contentBounds,this.leaf.__localMatrix,this[Mo]||(this[Mo]={})),this[Mo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Oo(this.contentBounds,this.leaf.__world,this[Ao]||(this[Ao]={})),this[Ao]}get worldBoxBounds(){return Oo(this.boxBounds,this.leaf.__world,this[Do]||(this[Do]={})),this[Do]}get worldStrokeBounds(){return Oo(this.strokeBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Lo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,v.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Ro(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Ro(s,e,!0)}if(o||(o=Q.getLayout(r)),Po(o,a),ct.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=Co(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return 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 Fo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class zo extends Fo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}zo.ADD="child.add",zo.REMOVE="child.remove",zo.CREATED="created",zo.MOUNTED="mounted",zo.UNMOUNTED="unmounted",zo.DESTROY="destroy";const Yo="property.scroll";class No extends Fo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}No.CHANGE="property.change",No.LEAFER_CHANGE="property.leafer_change",No.SCROLL=Yo;const Xo={scrollX:Yo,scrollY:Yo};class Ho extends Fo{constructor(t,e){super(t),Object.assign(this,e)}}Ho.LOAD="image.load",Ho.LOADED="image.loaded",Ho.ERROR="image.error";class Vo extends Fo{static checkHas(t,e,i){"on"===i?e===Ko?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Uo)||t.hasEvent(jo)||t.hasEvent(Go),t.__hasWorldEvent=t.hasEvent(Ko))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Uo,t),"inner"===e&&t.emit(jo,t)),t.emit(Go,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Ko,this)}}Vo.RESIZE="bounds.resize",Vo.INNER="bounds.inner",Vo.LOCAL="bounds.local",Vo.WORLD="bounds.world";const{RESIZE:Uo,INNER:jo,LOCAL:Go,WORLD:Ko}=Vo,Zo={};[Uo,jo,Go,Ko].forEach(t=>Zo[t]=1);class qo extends Fo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(qo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}qo.RESIZE="resize";class Jo extends Fo{constructor(t,e){super(t),this.data=e}}Jo.REQUEST="watch.request",Jo.DATA="watch.data";class $o extends Fo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}$o.REQUEST="layout.request",$o.START="layout.start",$o.BEFORE="layout.before",$o.LAYOUT="layout",$o.AFTER="layout.after",$o.AGAIN="layout.again",$o.END="layout.end";class Qo extends Fo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Qo.REQUEST="render.request",Qo.CHILD_START="render.child_start",Qo.CHILD_END="render.child_end",Qo.START="render.start",Qo.BEFORE="render.before",Qo.RENDER="render",Qo.AFTER="render.after",Qo.AGAIN="render.again",Qo.END="render.end",Qo.NEXT="render.next";class ta extends Fo{}ta.START="leafer.start",ta.BEFORE_READY="leafer.before_ready",ta.READY="leafer.ready",ta.AFTER_READY="leafer.after_ready",ta.VIEW_READY="leafer.view_ready",ta.VIEW_COMPLETED="leafer.view_completed",ta.STOP="leafer.stop",ta.RESTART="leafer.restart",ta.END="leafer.end",ta.UPDATE_MODE="leafer.update_mode",ta.TRANSFORM="leafer.transform",ta.MOVE="leafer.move",ta.SCALE="leafer.scale",ta.ROTATE="leafer.rotate",ta.SKEW="leafer.skew";const{MOVE:ea,SCALE:ia,ROTATE:sa,SKEW:na}=ta,ra={x:ea,y:ea,scaleX:ia,scaleY:ia,rotation:sa,skewX:na,skewY:na},oa={};class aa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=ha(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],Zo[t]&&Vo.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=ha(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],Zo[t]&&Vo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ge.has(t)&&(e=ge.get(t,{type:t,target:this,current:this}));const s=ha(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 ha(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:oa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:oa)}}const{on:la,on_:da,off:ca,off_:ua,once:_a,emit:ga,emitEvent:pa,hasEvent:fa,destroy:ma}=aa.prototype,ya={on:la,on_:da,off:ca,off_:ua,once:_a,emit:ga,emitEvent:pa,hasEvent:fa,destroyEventer:ma},va=ee.get("setAttr"),xa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(va.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new No(No.LEAFER_CHANGE,this,t,n,e));const i=ra[t];i&&(this.emitEvent(new ta(i,this)),this.emitEvent(new ta(ta.TRANSFORM,this)))}this.emitPropertyEvent(No.CHANGE,t,n,e);const i=Xo[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 No(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:wa,multiplyParent:ba,translateInner:ka,defaultWorld:Ea}=Q,{toPoint:Sa,tempPoint:Ba}=Bt,Ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ba(this.__local||e,t?t.__scrollWorld||t.__world:Ea,i,!!e.affectScaleOrRotation,n),s&&ka(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(wa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Sa(i.around||i.origin,t.boxBounds,Ba),ka(e,-Ba.x,-Ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ra,updateAllMatrix:La}=ho,{updateBounds:Oa}=wo,{toOuterOf:Ca,copyAndSpread:Pa,copy:Ma}=jt,{toBounds:Aa}=In,Da={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Vo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Vo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ca(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ca(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ca(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Aa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),La(this),Oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(La(this),Oa(this,this))):Ra(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Pa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ma(e.renderBounds,e.strokeBounds):Pa(e.renderBounds,e.boxBounds,i)}},Ia={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ho.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ee.showBounds&&ee.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Wa}=mo,Fa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Wa(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++)Wa(i[s],e)||i[s].__clip(t,e)}}},za={},{LEAF:Ya,create:Na}=w,{stintSet:Xa}=g,{toInnerPoint:Ha,toOuterPoint:Va,multiplyParent:Ua}=Q,{toOuterOf:ja}=jt,{copy:Ga,move:Ka}=ct,{moveLocal:Za,zoomOfLocal:qa,rotateOfLocal:Ja,skewOfLocal:$a,moveWorld:Qa,zoomOfWorld:th,rotateOfWorld:eh,skewOfWorld:ih,transform:sh,transformWorld:nh,setTransform:rh,getFlipTransform:oh,getLocalOrigin:ah,getRelativeWorld:hh,drop:lh}=ho;let dh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Wo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Na(Ya),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(zo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(zo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(zo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(zo.MOUNTED)):this.__emitLifeEvent(zo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ua(i,t.matrix,e,void 0,i),ja(this.__layout.renderBounds,e,e),Xa(e,"half",i.half),Xa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=ir.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),za.scaleX=i,za.scaleY=s,za}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?hh(this,e):this.worldTransform,n=i?t:{};return ja(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ha(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Va(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Ka(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 Ka(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){rh(this,t,e,i)}transform(t,e,i){sh(this,t,e,i)}move(t,e,i){Za(this,t,e,i)}moveInner(t,e,i){Qa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qa(this,ah(this,t),e,i,s,n)}rotateOf(t,e,i){Ja(this,ah(this,t),e,i)}skewOf(t,e,i,s,n){$a(this,ah(this,t),e,i,s,n)}transformWorld(t,e,i){nh(this,t,e,i)}moveWorld(t,e,i){Qa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}rotateOfWorld(t,e){eh(this,t,e)}skewOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}flip(t,e){sh(this,oh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return he.need("path")}getMotionPoint(t){return he.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){lh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Nr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=vr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new zo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(zo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};dh=me([Kr(xa),Kr(Ta),Kr(Da),Kr(ya),Kr(Ia)],dh);const{setListWithFn:ch}=jt,{sort:uh}=wo,{localBoxBounds:_h,localStrokeBounds:gh,localRenderBounds:ph,maskLocalBoxBounds:fh,maskLocalStrokeBounds:mh,maskLocalRenderBounds:yh}=mo,vh=new ee("Branch");let xh=class extends dh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ch(e||this.__layout.boxBounds,this.children,this.__hasMask?fh:_h)}__updateStrokeBounds(t){ch(t||this.__layout.strokeBounds,this.children,this.__hasMask?mh:gh)}__updateRenderBounds(t){ch(t||this.__layout.renderBounds,this.children,this.__hasMask?yh:ph)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(uh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ce.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(zo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(zo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(zo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(zo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new zo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};xh=me([Kr(Fa)],xh);class wh{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 wh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const kh="1.12.2";class Eh extends Pe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Gn(OffscreenCanvasRenderingContext2D.prototype),Gn(Path2D.prototype);const{mineType:Sh}=Kn;function Bh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Sh(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:Sh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=le.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(le,{canvas:(t,e)=>new Eh(t,e),image:t=>new or(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},ar(v,"devicePixelRatio",{get:()=>1});const{userAgent:Th}=navigator;Th.indexOf("Firefox")>-1?(v.conicGradientRotate90=!0,v.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(v.fullImageShadow=!0),Th.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):Th.indexOf("Mac")>-1?v.os="Mac":Th.indexOf("Linux")>-1&&(v.os="Linux");class Rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new wh;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 wh,this.target=t,e&&(this.config=g.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Qo.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===zo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Jo(Jo.DATA,{updatedList:this.updatedList})),this.__updatedList=new wh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[No.CHANGE,this.__onAttrChange,this],[[zo.ADD,zo.REMOVE],this.__onChildEvent,this],[Jo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Oh,updateChange:Ch}=ho,{pushAllChildBranch:Ph,pushAllParent:Mh}=wo;const{worldBounds:Ah}=mo;class Dh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new wh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ah)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ah),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Ih,updateAllChange:Wh}=ho,Fh=ee.get("Layouter");class zh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new bh,this.target=t,e&&(this.config=g.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit($o.START),this.layoutOnce(),t.emitEvent(new $o($o.END,this.layoutedBlocks,this.times))}catch(t){Fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Fh.warn("layouting"):this.times>3?Fh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Jo.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=re.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=$o,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new $o(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Lh(t,!0),e.add(t),t.isBranch&&Ph(t,e),Mh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(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||Oh(s[t])}Oh(i)}})}(this.__levelList),function(t){t.list.forEach(Ch)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new $o(r,a,this.times)),i.emitEvent(new $o(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,re.end(e)}fullLayout(){const t=re.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=$o,r=this.getBlocks(new wh(e));e.emitEvent(new $o(i,r,this.times)),zh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new $o(s,r,this.times)),e.emitEvent(new $o(n,r,this.times)),this.addBlocks(r),re.end(t)}static fullLayout(t){Ih(t,!0),t.isBranch?wo.updateBounds(t):ho.updateBounds(t),Wh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Dh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Dh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[$o.REQUEST,this.layout,this],[$o.AGAIN,this.layoutAgain,this],[Jo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Yh=ee.get("Renderer");class Nh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit($o.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Qo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Qo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Qo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Yh.log(e.innerName,"---\x3e");try{this.emitRender(Qo.START),this.renderOnce(t),this.emitRender(Qo.END,this.totalBounds),ir.clearRecycled()}catch(t){this.rendering=!1,Yh.error(t)}Yh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Yh.warn("rendering");if(this.times>3)return Yh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(Qo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Qo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Qo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Qo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=re.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Nh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),re.end(e)}fullRender(){const t=re.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),re.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ee.showRepaint&&ee.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),v.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 qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Yh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Qo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Qo.REQUEST,this.update,this],[$o.END,this.__onLayoutEnd,this],[Qo.AGAIN,this.renderAgain,this],[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)}}Nh.clipSpread=10;const Xh={},{copyRadiusPoint:Hh}=ct,{hitRadiusPoint:Vh}=jt;class Uh{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 wh(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 wh;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||ho.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ho.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=>ho.worldHittable(t))}getPath(t){const e=new wh,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 wh;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 wh,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=Vh(i.__world,n.hitRadius?Hh(Xh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class jh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Uh(this.target=t,this),this.finder=le.finder&&le.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):he.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Gh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Kh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Zh(){return(t,e)=>{const i="_"+e;ar(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function qh(t){return(e,i)=>{ar(e,i,lr(i,t))}}Object.assign(le,{watcher:(t,e)=>new Rh(t,e),layouter:(t,e)=>new zh(t,e),renderer:(t,e,i)=>new Nh(t,e,i),selector:(t,e)=>new jh(t,e)}),v.layout=zh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new wh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Jh={},$h={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Qh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},tl={},el={},il={},sl={},nl={},rl={apply(){he.need("filter")}},ol={},al={setStyleName:()=>he.need("state"),set:()=>he.need("state")},hl={list:{},register(t,e){hl.list[t]=e},get:t=>hl.list[t]},{parse:ll,objectToCanvasData:dl}=is,{stintSet:cl}=g,{hasTransparent:ul}=$h,_l={originPaint:{}},gl=ee.get("UIData");class pl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,gl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,gl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(cl(this,"__isTransparentFill",ul(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(cl(this,"__isTransparentStroke",ul(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?ll(t):dl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){fl(this,"shadow",t)}setInnerShadow(t){fl(this,"innerShadow",t)}setFilter(t){fl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&el.compute("fill",this.__leaf),e&&el.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=_l)):(this.__isStrokes=!0,this._stroke||(this._stroke=_l))}__removePaint(t,e){e&&this.__removeInput(t),il.recycleImage(t,this),"fill"===t?(cl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(cl(this,"__isAlphaPixelStroke",void 0),cl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function fl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class ml extends pl{}class yl extends ml{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class vl extends ml{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class xl extends yl{}class wl extends pl{get __usePathBox(){return this.points||this.__pathInputed}}class bl extends pl{get __boxStroke(){return!this.__pathInputed}}class kl extends pl{get __boxStroke(){return!this.__pathInputed}}class El extends wl{}class Sl extends pl{}class Bl extends pl{get __pathInputed(){return 2}}class Tl extends ml{}const Rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ll extends pl{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=Rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ce.get("Rect",0);const n=e.__layout,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 Ol extends bl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Cl extends bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Pl,add:Ml}=R,Al={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Pl(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=nl.getShadowRenderSpread(this,e)),s&&(t=Pl(t,s)),r&&(t=Ml(t,rl.getSpread(r))),o&&(t=Ml(t,o)),a&&(t=Ml(t,a));let l=t;return i&&(l=Pl(l,nl.getInnerShadowSpread(this,i))),n&&(l=Pl(l,n)),this.__layout.renderShapeSpread=l,h?Pl(h.__updateRenderSpread(),t):t}},{stintSet:Dl}=g,Il={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Dl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Dl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Dl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!nl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Dl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Wl(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=el.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&nl.shadow(this,t,h),a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e)),n&&(s.__isFills?el.fills(n,this,t,e):el.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&nl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e)),c&&rl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?el.strokes(r,this,t,e):el.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,$h.string(e.color))}n&&(s.__isFills?el.fills(n,this,t,e):el.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e))}}else s.__pathForRender?Wl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?el.fills(s,this,t,e):el.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?el.strokes(n,this,t,e):el.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Wl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&el.stroke(n,t,e,i),s&&el.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&el.stroke(n,t,e,i)}const Fl={__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 zl;let Yl=zl=class extends dh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){F.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Un.set(this.path=t||[]),t||this.__drawPathByBox(Un),Un}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 he.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return he.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Un.set(i=[]),this.__drawPathByBox(Un,!e)),t?is.toCanvasData(i,!0):i}getPathString(t,e,i){return is.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ol.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&tl.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?nn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height: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){el.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),he.need("animate")}killAnimate(t,e){}export(t,e){return he.need("export")}syncExport(t,e){return he.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),zl.one(e)}static one(t,e,i,s,n){return ce.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Zr()(this)}static registerData(t){zr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([zr(pl)],Yl.prototype,"__",void 0),me([Zh()],Yl.prototype,"zoomLayer",void 0),me([_r("")],Yl.prototype,"id",void 0),me([_r("")],Yl.prototype,"name",void 0),me([_r("")],Yl.prototype,"className",void 0),me([Rr("pass-through")],Yl.prototype,"blendMode",void 0),me([Or(1)],Yl.prototype,"opacity",void 0),me([Cr(!0)],Yl.prototype,"visible",void 0),me([Rr(!1)],Yl.prototype,"locked",void 0),me([Lr(!1)],Yl.prototype,"dim",void 0),me([Lr(!1)],Yl.prototype,"dimskip",void 0),me([Ar(0)],Yl.prototype,"zIndex",void 0),me([Dr(!1)],Yl.prototype,"mask",void 0),me([Ir(!1)],Yl.prototype,"eraser",void 0),me([gr(0,!0)],Yl.prototype,"x",void 0),me([gr(0,!0)],Yl.prototype,"y",void 0),me([vr(100,!0)],Yl.prototype,"width",void 0),me([vr(100,!0)],Yl.prototype,"height",void 0),me([mr(1,!0)],Yl.prototype,"scaleX",void 0),me([mr(1,!0)],Yl.prototype,"scaleY",void 0),me([yr(0,!0)],Yl.prototype,"rotation",void 0),me([yr(0,!0)],Yl.prototype,"skewX",void 0),me([yr(0,!0)],Yl.prototype,"skewY",void 0),me([gr(0,!0)],Yl.prototype,"offsetX",void 0),me([gr(0,!0)],Yl.prototype,"offsetY",void 0),me([pr(0,!0)],Yl.prototype,"scrollX",void 0),me([pr(0,!0)],Yl.prototype,"scrollY",void 0),me([fr()],Yl.prototype,"origin",void 0),me([fr()],Yl.prototype,"around",void 0),me([_r(!1)],Yl.prototype,"lazy",void 0),me([xr(1)],Yl.prototype,"pixelRatio",void 0),me([Tr(0)],Yl.prototype,"renderSpread",void 0),me([br()],Yl.prototype,"path",void 0),me([kr()],Yl.prototype,"windingRule",void 0),me([kr(!0)],Yl.prototype,"closed",void 0),me([vr(0)],Yl.prototype,"padding",void 0),me([vr(!1)],Yl.prototype,"lockRatio",void 0),me([vr()],Yl.prototype,"widthRange",void 0),me([vr()],Yl.prototype,"heightRange",void 0),me([_r(!1)],Yl.prototype,"draggable",void 0),me([_r()],Yl.prototype,"dragBounds",void 0),me([_r("auto")],Yl.prototype,"dragBoundsType",void 0),me([_r(!1)],Yl.prototype,"editable",void 0),me([Wr(!0)],Yl.prototype,"hittable",void 0),me([Wr("path")],Yl.prototype,"hitFill",void 0),me([Br("path")],Yl.prototype,"hitStroke",void 0),me([Wr(!1)],Yl.prototype,"hitBox",void 0),me([Wr(!0)],Yl.prototype,"hitChildren",void 0),me([Wr(!0)],Yl.prototype,"hitSelf",void 0),me([Wr()],Yl.prototype,"hitRadius",void 0),me([Fr("")],Yl.prototype,"cursor",void 0),me([Rr()],Yl.prototype,"fill",void 0),me([Br(void 0,!0)],Yl.prototype,"stroke",void 0),me([Br("inside")],Yl.prototype,"strokeAlign",void 0),me([Br(1,!0)],Yl.prototype,"strokeWidth",void 0),me([Br(!1)],Yl.prototype,"strokeWidthFixed",void 0),me([Br("none")],Yl.prototype,"strokeCap",void 0),me([Br("miter")],Yl.prototype,"strokeJoin",void 0),me([Br()],Yl.prototype,"dashPattern",void 0),me([Br(0)],Yl.prototype,"dashOffset",void 0),me([Br(10)],Yl.prototype,"miterLimit",void 0),me([kr(0)],Yl.prototype,"cornerRadius",void 0),me([kr()],Yl.prototype,"cornerSmoothing",void 0),me([Gh()],Yl.prototype,"shadow",void 0),me([Gh()],Yl.prototype,"innerShadow",void 0),me([Gh()],Yl.prototype,"blur",void 0),me([Gh()],Yl.prototype,"backgroundBlur",void 0),me([Gh()],Yl.prototype,"grayscale",void 0),me([Gh()],Yl.prototype,"filter",void 0),me([Rr()],Yl.prototype,"placeholderColor",void 0),me([_r(100)],Yl.prototype,"placeholderDelay",void 0),me([_r({})],Yl.prototype,"data",void 0),me([Ur(dh.prototype.reset)],Yl.prototype,"reset",null),Yl=zl=me([Kr(Al),Kr(Il),jr()],Yl);let Nl=class extends Yl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Xl;me([zr(ml)],Nl.prototype,"__",void 0),me([vr(0)],Nl.prototype,"width",void 0),me([vr(0)],Nl.prototype,"height",void 0),Nl=me([Kr(xh),Zr()],Nl);const Hl=ee.get("Leafer");let Vl=Xl=class extends Nl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Xl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,g.assign(s,t));const n=this.canvas=le.canvas(s);this.__controllers.push(this.renderer=le.renderer(this,n,s),this.watcher=le.watcher(this,s),this.layouter=le.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=le.selector(this),this.interaction=le.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=le.hitCanvasManager()),this.canvasManager=new fe,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),To.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ta.RESTART):this.emitLeafer(ta.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(ta.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=g.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new qo(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new $t(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ta.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,Ce);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ta.BEFORE_READY),this.emitLeafer(ta.READY),this.emitLeafer(ta.AFTER_READY),To.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ta.VIEW_READY),To.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){To.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(ta.VIEW_COMPLETED),To.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return he.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ta(t,this))}__listenEvents(){const t=re.start("FirstCreate "+this.innerName);this.once([[ta.START,()=>re.end(t)],[$o.START,this.updateLazyBounds,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Jo.DATA,this.__onWatchData,this],[$o.END,this.__onLayoutEnd,this],[Qo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Xl.list.remove(this);try{this.stop(),this.emitLeafer(ta.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ir.clearRecycled()},100)}catch(t){Hl.error(t)}}};t?e():setTimeout(e)}};Vl.list=new wh,me([zr(vl)],Vl.prototype,"__",void 0),me([vr()],Vl.prototype,"pixelRatio",void 0),me([_r("normal")],Vl.prototype,"mode",void 0),Vl=Xl=me([Zr()],Vl);let Ul=class extends Yl{get __tag(){return"Rect"}};me([zr(bl)],Ul.prototype,"__",void 0),Ul=me([Kr(Fl),jr(),Zr()],Ul);const{add:jl,includes:Gl,scroll:Kl}=jt,Zl=Ul.prototype,ql=Nl.prototype;let Jl=class extends Nl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds: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"))&&(jl(a,r),Kl(a,i)),this.__updateRectRenderBounds(),t=!Gl(r,a),t&&"show"===o&&jl(n,a)}else this.__updateRectRenderBounds();g.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([zr(yl)],Jl.prototype,"__",void 0),me([vr(100)],Jl.prototype,"width",void 0),me([vr(100)],Jl.prototype,"height",void 0),me([_r(!1)],Jl.prototype,"resizeChildren",void 0),me([Tr("show")],Jl.prototype,"overflow",void 0),me([Ur(Zl.__updateStrokeSpread)],Jl.prototype,"__updateStrokeSpread",null),me([Ur(Zl.__updateRenderSpread)],Jl.prototype,"__updateRectRenderSpread",null),me([Ur(Zl.__updateBoxBounds)],Jl.prototype,"__updateRectBoxBounds",null),me([Ur(Zl.__updateStrokeBounds)],Jl.prototype,"__updateStrokeBounds",null),me([Ur(Zl.__updateRenderBounds)],Jl.prototype,"__updateRectRenderBounds",null),me([Ur(Zl.__updateChange)],Jl.prototype,"__updateRectChange",null),me([Ur(Zl.__render)],Jl.prototype,"__renderRect",null),me([Ur(ql.__render)],Jl.prototype,"__renderGroup",null),Jl=me([jr(),Zr()],Jl);let $l=class extends Jl{get __tag(){return"Frame"}get isFrame(){return!0}};me([zr(xl)],$l.prototype,"__",void 0),me([Rr("#FFFFFF")],$l.prototype,"fill",void 0),me([Tr("hide")],$l.prototype,"overflow",void 0),$l=me([Zr()],$l);const{moveTo:Ql,closePath:td,ellipse:ed}=Ss;let id=class extends Yl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];i?s||n?(i<1&&ed(a,r,o,r*i,o*i,0,s,n,!1),ed(a,r,o,r,o,0,n,s,!0)):(i<1&&(ed(a,r,o,r*i,o*i),Ql(a,t,o)),ed(a,r,o,r,o,0,360,0,!0)):s||n?(Ql(a,r,o),ed(a,r,o,r,o,0,s,n,!1)):ed(a,r,o,r,o),td(a),v.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([zr(kl)],id.prototype,"__",void 0),me([kr(0)],id.prototype,"innerRadius",void 0),me([kr(0)],id.prototype,"startAngle",void 0),me([kr(0)],id.prototype,"endAngle",void 0),id=me([Zr()],id);const{sin:sd,cos:nd,PI:rd}=Math,{moveTo:od,lineTo:ad,closePath:hd,drawPoints:ld}=Ss;let dd=class extends Yl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ld(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;od(e,r,0);for(let t=1;t<n;t++)ad(e,r+r*sd(2*t*rd/n),o-o*nd(2*t*rd/n));hd(e)}}};me([zr(El)],dd.prototype,"__",void 0),me([kr(3)],dd.prototype,"sides",void 0),me([kr()],dd.prototype,"points",void 0),me([kr(0)],dd.prototype,"curve",void 0),dd=me([jr(),Zr()],dd);const{sin:cd,cos:ud,PI:_d}=Math,{moveTo:gd,lineTo:pd,closePath:fd}=Ss;let md=class extends Yl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];gd(o,n,0);for(let t=1;t<2*i;t++)pd(o,n+(t%2==0?n:n*s)*cd(t*_d/i),r-(t%2==0?r:r*s)*ud(t*_d/i));fd(o)}};me([zr(Sl)],md.prototype,"__",void 0),me([kr(5)],md.prototype,"corners",void 0),me([kr(.382)],md.prototype,"innerRadius",void 0),md=me([Zr()],md);const{moveTo:yd,lineTo:vd,drawPoints:xd}=Ss,{rotate:wd,getAngle:bd,getDistance:kd,defaultPoint:Ed}=ct;let Sd=class extends Yl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&wd(i,e),i}set toPoint(t){this.width=kd(Ed,t),this.rotation=bd(Ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?xd(e,t.points,t.curve,t.closed):(yd(e,0,0),vd(e,this.width,0))}};me([zr(wl)],Sd.prototype,"__",void 0),me([Er("center")],Sd.prototype,"strokeAlign",void 0),me([vr(0)],Sd.prototype,"height",void 0),me([kr()],Sd.prototype,"points",void 0),me([kr(0)],Sd.prototype,"curve",void 0),me([kr(!1)],Sd.prototype,"closed",void 0),Sd=me([Zr()],Sd);let Bd=class extends Ul{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([zr(Ol)],Bd.prototype,"__",void 0),me([vr("")],Bd.prototype,"url",void 0),Bd=me([Zr()],Bd);const Td=Bd;let Rd=class extends Ul{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=le.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new or({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ho(Ho.LOADED,{image:t}))})}draw(t,e,i,s){const n=new vt(t.worldTransform).invert(),r=new vt;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()}};me([zr(Cl)],Rd.prototype,"__",void 0),me([Kh(100)],Rd.prototype,"width",void 0),me([Kh(100)],Rd.prototype,"height",void 0),me([Kh(1)],Rd.prototype,"pixelRatio",void 0),me([Kh(!0)],Rd.prototype,"smooth",void 0),me([_r(!1)],Rd.prototype,"safeResize",void 0),me([Kh()],Rd.prototype,"contextSettings",void 0),Rd=me([Zr()],Rd);const{copyAndSpread:Ld,includes:Od,spread:Cd,setList:Pd}=jt,{stintSet:Md}=g;let Ad=class extends Yl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Qh.number(e,n),t.__letterSpacing=Qh.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"}`,Md(t,"__padding",l&&F.fourNumber(l)),Md(t,"__clipText","show"!==h&&!t.__autoSize),Md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Cd(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),g.stintSet(this,"isOverflow",!Od(h,a)),this.isOverflow?(Pd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ld(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([zr(Ll)],Ad.prototype,"__",void 0),me([vr(0)],Ad.prototype,"width",void 0),me([vr(0)],Ad.prototype,"height",void 0),me([Rr()],Ad.prototype,"boxStyle",void 0),me([_r(!1)],Ad.prototype,"resizeFontSize",void 0),me([Rr("#000000")],Ad.prototype,"fill",void 0),me([Er("outside")],Ad.prototype,"strokeAlign",void 0),me([Wr("all")],Ad.prototype,"hitFill",void 0),me([vr("")],Ad.prototype,"text",void 0),me([vr("")],Ad.prototype,"placeholder",void 0),me([vr("caption")],Ad.prototype,"fontFamily",void 0),me([vr(12)],Ad.prototype,"fontSize",void 0),me([vr("normal")],Ad.prototype,"fontWeight",void 0),me([vr(!1)],Ad.prototype,"italic",void 0),me([vr("none")],Ad.prototype,"textCase",void 0),me([vr("none")],Ad.prototype,"textDecoration",void 0),me([vr(0)],Ad.prototype,"letterSpacing",void 0),me([vr({type:"percent",value:1.5})],Ad.prototype,"lineHeight",void 0),me([vr(0)],Ad.prototype,"paraIndent",void 0),me([vr(0)],Ad.prototype,"paraSpacing",void 0),me([vr("x")],Ad.prototype,"writingMode",void 0),me([vr("left")],Ad.prototype,"textAlign",void 0),me([vr("top")],Ad.prototype,"verticalAlign",void 0),me([vr(!0)],Ad.prototype,"autoSizeAlign",void 0),me([vr("normal")],Ad.prototype,"textWrap",void 0),me([vr("show")],Ad.prototype,"textOverflow",void 0),me([Rr(!1)],Ad.prototype,"textEditing",void 0),Ad=me([Zr()],Ad);let Dd=class extends Yl{get __tag(){return"Path"}};me([zr(Bl)],Dd.prototype,"__",void 0),me([Er("center")],Dd.prototype,"strokeAlign",void 0),Dd=me([Zr()],Dd);let Id=class extends Nl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Dd(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")}};me([zr(Tl)],Id.prototype,"__",void 0),me([(t,e)=>{ar(t,e,{get(){return this.__path}})}],Id.prototype,"path",void 0),Id=me([Kr(Xs,["set","path","paint"]),Zr()],Id);let Wd=class extends Vl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&le.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Vl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[$o.END,this.__onReady,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Qo.END,this.__onChildRenderEnd,this))}};Wd=me([Zr()],Wd);const Fd={},zd={isHoldSpaceKey:()=>zd.isHold("Space"),isHold:t=>Fd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Fd[t]||(Fd[t]=!0)},setUpCode(t){Fd[t]=!1}},Yd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Nd extends Fo{get spaceKey(){return zd.isHoldSpaceKey()}get left(){return Yd.left(this)}get right(){return Yd.right(this)}get middle(){return Yd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return zd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ge.changeName(t,e)}}const{min:Xd,max:Hd,abs:Vd}=Math,{float:Ud,sign:jd}=F,{minX:Gd,maxX:Kd,minY:Zd,maxY:qd}=jt,Jd=new qt,$d=new qt,Qd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&tc.getValidMove(t.__localBoxBounds,tc.getDragBounds(t),s,e,!0),tc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&tc.getValidScaleOf(t.__localBoxBounds,tc.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)),tc.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),tc.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=Ud(s.x),s.y=Ud(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),$d.set(e),Jd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,g,p,f=1,m=1;return tc.isInnerMode(t,e,i,"width")?(n.x<0&&Jd.scaleOf(s,f=1/n.x,1),g=Ud(Jd.minX-$d.minX),p=Ud($d.maxX-Jd.maxX),u=h&&g>0?1+g/(h*Jd.width):1,_=l&&p>0?1+p/(l*Jd.width):1,f*=Hd(u,_)):(n.x<0&&((Ud(Gd(t)-Gd(e))<=0||Ud(Kd(e)-Kd(t))<=0)&&Jd.scaleOf(s,f=1/n.x,1),Jd.unsign()),g=Ud($d.minX-Jd.minX),p=Ud(Jd.maxX-$d.maxX),u=h&&g>0?1-g/(h*Jd.width):1,_=l&&p>0?1-p/(l*Jd.width):1,f*=Xd(u,_)),tc.isInnerMode(t,e,i,"height")?(n.y<0&&Jd.scaleOf(s,1,m=1/n.y),g=Ud(Jd.minY-$d.minY),p=Ud($d.maxY-Jd.maxY),u=d&&g>0?1+g/(d*Jd.height):1,_=c&&p>0?1+p/(c*Jd.height):1,m*=Hd(u,_),r&&(u=Hd(Vd(f),Vd(m)),f=jd(f)*u,m=jd(m)*u)):(n.y<0&&((Ud(Zd(t)-Zd(e))<=0||Ud(qd(e)-qd(t))<=0)&&Jd.scaleOf(s,1,m=1/n.y),Jd.unsign()),g=Ud($d.minY-Jd.minY),p=Ud(Jd.maxY-$d.maxY),u=d&&g>0?1-g/(d*Jd.height):1,_=c&&p>0?1-p/(c*Jd.height):1,m*=Xd(u,_)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},tc=Qd;let ec=class extends Nd{};ec.POINTER="pointer",ec.BEFORE_DOWN="pointer.before_down",ec.BEFORE_MOVE="pointer.before_move",ec.BEFORE_UP="pointer.before_up",ec.DOWN="pointer.down",ec.MOVE="pointer.move",ec.UP="pointer.up",ec.OVER="pointer.over",ec.OUT="pointer.out",ec.ENTER="pointer.enter",ec.LEAVE="pointer.leave",ec.TAP="tap",ec.DOUBLE_TAP="double_tap",ec.CLICK="click",ec.DOUBLE_CLICK="double_click",ec.LONG_PRESS="long_press",ec.LONG_TAP="long_tap",ec.MENU="pointer.menu",ec.MENU_TAP="pointer.menu_tap",ec=me([qr()],ec);const ic=ec,sc={};let nc=class extends ec{static setList(t){this.list=t instanceof wh?t:new wh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ct.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Qd.axisMove(t,n),n}static limitMove(t,e){Qd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(sc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(sc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(sc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){sc.x=t?this.totalX:this.moveX,sc.y=t?this.totalY:this.moveY}};nc.BEFORE_DRAG="drag.before_drag",nc.START="drag.start",nc.DRAG="drag",nc.END="drag.end",nc.OVER="drag.over",nc.OUT="drag.out",nc.ENTER="drag.enter",nc.LEAVE="drag.leave",nc=me([qr()],nc);const rc=nc;let oc=class extends ec{static setList(t){nc.setList(t)}static setData(t){nc.setData(t)}};oc.DROP="drop",oc=me([qr()],oc);let ac=class extends nc{};ac.BEFORE_MOVE="move.before_move",ac.START="move.start",ac.MOVE="move",ac.DRAG_ANIMATE="move.drag_animate",ac.END="move.end",ac=me([qr()],ac);let hc=class extends Nd{};hc=me([qr()],hc);const lc=hc;let dc=class extends ec{};dc.BEFORE_ROTATE="rotate.before_rotate",dc.START="rotate.start",dc.ROTATE="rotate",dc.END="rotate.end",dc=me([qr()],dc);let cc=class extends nc{};cc.SWIPE="swipe",cc.LEFT="swipe.left",cc.RIGHT="swipe.right",cc.UP="swipe.up",cc.DOWN="swipe.down",cc=me([qr()],cc);let uc=class extends ec{};uc.BEFORE_ZOOM="zoom.before_zoom",uc.START="zoom.start",uc.ZOOM="zoom",uc.END="zoom.end",uc=me([qr()],uc);let _c=class extends Nd{};_c.BEFORE_DOWN="key.before_down",_c.BEFORE_UP="key.before_up",_c.DOWN="key.down",_c.HOLD="key.hold",_c.UP="key.up",_c=me([qr()],_c);const gc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?cc.UP:t>45&&t<135?cc.DOWN:t<=45&&t>=-45?cc.RIGHT:cc.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:pc.getSwipeDirection(ct.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new wh,{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=>ho.draggable(t)||!t.isLeafer&&t.hasEvent(nc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},pc=gc,fc=new wh,{getDragEventData:mc,getDropEventData:yc,getSwipeEventData:vc}=gc;class xc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=mc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=nc.list||this.draggableList||fc;return this.dragging&&(s?t?fc:new wh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(ac.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Yd.left(t),this.dragging&&(this.interaction.emit(nc.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ho.draggable(e)){this.draggableList=new wh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=mc(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(ac.BEFORE_MOVE,this.dragData),e.emit(ac.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(nc.BEFORE_DRAG,this.dragData),e.emit(nc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=r(e.draggable),l=nc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);o&&!s&&t?ho.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(nc.OUT,t,i),e.emit(nc.OVER,t,s)):e.emit(nc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(nc.LEAVE,t,i,s),e.emit(nc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=mc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(ac.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(nc.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(ct.getDistance(e,t)>n.config.pointer.swipeDistance){const t=vc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=yc(t,e,nc.data);s.path=i,this.interaction.emit(oc.DROP,s),this.interaction.emit(nc.LEAVE,t,i)}dragReset(){nc.list=nc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const wc=ee.get("emit");const bc=["move","zoom","rotate","key"];function kc(t,e,i,s,n){if(bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Sc(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&&Ec(r,e,i,s,n)}}function Ec(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Sc(t,n)&&(al.updateEventStyle&&!s&&al.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ge.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Sc(t,e){return e&&e.has(t)}const Bc={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Tc,pathCanDrag:Rc,pathHasOutside:Lc}=gc;class Oc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Yd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Yd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&zd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=g.clone(Bc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new wh(t),this.createTransformer(),this.dragger=new xc(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Yd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(ec.BEFORE_DOWN,t),this.emit(ec.DOWN,t),Yd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Yd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Yd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(ec.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ct.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(ec.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Yd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(ec.BEFORE_UP,t),this.emit(ec.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(ec.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(ec.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(_c.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,zd.setDownCode(e),this.emit(_c.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(_c.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(_c.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,zd.setUpCode(e),this.emit(_c.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new wh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(ec.OUT,t,i),this.emit(ec.OVER,t,e)):this.emit(ec.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(ec.LEAVE,t,i,e),this.emit(ec.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ec.LEAVE,t),this.dragger.dragging&&this.emit(oc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[ec.DOUBLE_TAP,ec.DOUBLE_CLICK].some(e=>Tc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;v.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&&!Lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Rc(t.path))&&!Lc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:ec.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ct.round(s),s}emitTap(t){this.emit(ec.TAP,t),this.emit(ec.CLICK,t)}emitDoubleTap(t){this.emit(ec.DOUBLE_TAP,t),this.emit(ec.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(ec.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ec.LONG_TAP,t),(Tc(t.path,ec.LONG_TAP)||Tc(t.path,ec.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(qo.RESIZE,this.__onResize,this)],t.once(ta.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Ec(n,t,e,!0,s))return;n.isApp&&kc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&kc(n,t,e,!1,s),Ec(n,t,e,!1,s))return}catch(t){wc.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 Cc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Cc.custom={};class Pc extends fe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new wh,this.pixelList=new wh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),le.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),le.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())};const{toInnerRadiusPointOf:Mc,copyRadiusPoint:Ac}=ct,{hitRadiusPoint:Dc,hitPoint:Ic}=jt,Wc={},Fc={},zc=dh.prototype;zc.hit=function(t,e=0){this.updateLayout(),Ac(Fc,t,e);const i=this.__world;return!!(e?Dc(i,Fc):Ic(i,Fc))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Fc),e,{target:this}):this.__hitWorld(Fc))},zc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(Ac(Wc,t,i.hitRadius),t=Wc),Mc(t,s,Wc),i.hitBox||r){if(jt.hitRadiusPoint(n.boxBounds,Wc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Wc,e)},zc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},zc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},zc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},zc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Yc=new vt,Nc=Yl.prototype;Nc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=v.image.hitCanvasSize,o=r.hitScale=Jt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Jt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),ir.patternLocked=!0,this.__renderShape(r,{matrix:Yc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),ir.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Nc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke: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 Xc=Yl.prototype,Hc=Ul.prototype,Vc=Jl.prototype;Hc.__updateHitCanvas=Vc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Xc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Hc.__hitFill=Vc.__hitFill=function(t){return this.__hitCanvas?Xc.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},Ad.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))},Nl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Uc=Pe.prototype;function jc(t,e,i){t.__.__font?el.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Gc(t,e,i,s,n){const r=i.__;c(t)?el.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&el.strokeArrow(t,i,s,n)}function Kc(t,e,i,s,n){const r=i.__;c(t)?el.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),el.drawTextStroke(i,s,n))}function Zc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Kc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",el.fillText(i,r,n),r.blendMode="normal",ho.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}Uc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Uc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Uc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Jt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Jt.x,Jt.y,Jt.width||1,Jt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:qc,copyAndSpread:Jc,toOuterOf:$c,getOuterOf:Qc,getByMove:tu,move:eu,getIntersectData:iu}=jt,su={};let nu;const{stintSet:ru}=g,{hasTransparent:ou}=$h;function au(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=il.image(i,t,e,o,!nu||!nu[e.url]);break;case"linear":n=sl.linearGradient(e,o);break;case"radial":n=sl.radialGradient(e,o);break;case"angular":n=sl.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;n={type:r,style:$h.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:$h.string(e)})}if(n&&(n.originPaint=e,r(n.style)&&ou(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const hu={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),nu=il.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=au(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?(ru(i,"__isAlphaPixelFill",n),ru(i,"__isTransparentFill",r)):(ru(i,"__isAlphaPixelStroke",n),ru(i,"__isTransparentStroke",r),ru(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,jc(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,il.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),jc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),jc(e,i,s),i.restoreBlendMode()):jc(e,i,s)}},fillPathOrText:jc,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)el.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Gc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Gc(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)Gc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Gc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ho.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){el.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":Zc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Kc(t,2,e,i,s):Zc(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||!il.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?el.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?el.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,_;$c(o.strokeSpread?(Jc(su,o.boxBounds,o.strokeSpread),su):o.boxBounds,r,a);let{scaleX:g,scaleY:p}=t.getRenderScaleData(!0);if(n.includes(a))_=s,h=u=a,l=r;else{let s;if(v.fullImageShadow)s=a;else{const t=o.renderShapeSpread?qc(n,R.swapAndScale(o.renderShapeSpread,g,p)):n;s=iu(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),g*=f,p*=m),u=Qc(a,c),h=tu(u,-c.e,-c.f),l=Qc(r,c),eu(l,-c.e,-c.f);const y=i.matrix;y?(d=new vt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:g,scaleY:p}}};let lu,du=new qt;const{isSame:cu}=jt;function uu(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||il.createData(n,s,i,r),!0}function _u(t,e){fu(t,Ho.LOAD,e)}function gu(t,e){fu(t,Ho.LOADED,e)}function pu(t,e,i){e.error=i,t.forceUpdate("surface"),fu(t,Ho.ERROR,e)}function fu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ho(e,i))}function mu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:yu,translate:vu}=Q,xu=new qt,wu={},bu={};function ku(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 Eu={},Su={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Bu,set:Tu,rotateOfOuter:Ru,translate:Lu,scaleOfOuter:Ou,multiplyParent:Cu,scale:Pu,rotate:Mu,skew:Au}=Q;function Du(t,e,i,s,n,r,o,a){o&&Mu(t,o),a&&Au(t,a.x,a.y),n&&Pu(t,n,r),Lu(t,e.x+i,e.y+s)}const{get:Iu,scale:Wu,copy:Fu}=Q,{getFloorScale:zu}=F,{abs:Yu}=Math;const Nu={image:function(t,e,i,s,n){let r,o;const a=ir.get(i);return lu&&i===lu.paint&&cu(s,lu.boxBounds)?r=lu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),lu=a.use>1?{leafPaint:r,paint:i,boxBounds:du.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(uu(t,e,i,a,r,s),n&&(_u(t,o),gu(t,o))):a.error?n&&pu(t,o,a.error):(n&&(mu(t,!0),_u(t,o)),r.loadId=a.load(()=>{mu(t,!1),t.destroyed||(uu(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),gu(t,o)),r.loadId=void 0},e=>{mu(t,!1),pu(t,o,e),r.loadId=void 0}),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}=il.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===r+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&qo.isResizing(i)||d||(e=v.image.isLarge(a,r,o)||a.width*r>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),il.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?il.createPattern(t,i,s,n):il.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let _,{width:g,height:p}=a;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),_&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,g,p),n.restore()):(o.scaleX&&(g*=o.scaleX,p*=o.scaleY),n.drawImage(c,0,0,g,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,ir.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=ir.patternTasker.add(()=>ye(this,void 0,void 0,function*(){il.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=il.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!v.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=il.getPatternFixScale(t,n,r);let d,c,u,{width:_,height:g}=i;l&&(n*=l,r*=l),_*=n,g*=r,h&&(c=h.x*n/Yu(s.scaleX||1),u=h.y*r/Yu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=zu(_+(c||0)),r*=zu(g+(u||0)),d=Iu(),a&&Fu(d,a),Wu(d,1/n,1/r));const p=i.getCanvas(_,g,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=v.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=il.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=xu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:o,mode:a,align:h,offset:l,scale:d,size:u,rotation:_,skew:g,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,x={mode:a},w="center"!==h&&(_||0)%180==90;let b,k;switch(jt.set(bu,0,0,w?n:s,w?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(F.getScaleData(d,u,i,wu),b=wu.scaleX,k=wu.scaleY),(h||m||f)&&(b&&jt.scale(bu,b,k,!0),h&&Lt.toPoint(h,bu,e,bu,!0,!0))):v&&!_||(b=k=jt.getFitScale(e,bu,"fit"!==a),jt.put(e,i,h,b,!1,bu),jt.scale(bu,b,k,!0)),l&&ct.move(bu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,il.stretchMode(x,e,b,k));break;case"normal":case"clip":if(bu.x||bu.y||b||p||_||g){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),il.clipMode(x,e,bu.x,bu.y,b,k,_,g,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||_||g)&&il.repeatMode(x,e,s,n,bu.x,bu.y,b,k,_,g,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(m||i)&&(x.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:ku(r,i,n.width,e&&e.x),y:ku(o,s,n.height,e&&e.y)}}(m,i&&f,bu.width,bu.height,e));break;default:b&&il.fillOrFitMode(x,e,bu.x,bu.y,b,k,_)}return x.transform||(e.x||e.y)&&vu(x.transform=yu(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=k),o&&o<1&&(x.opacity=o),y&&(x.filters=y),f&&(x.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const n=Bu(),{x:r,y:o}=e;r||o?Lu(n,r,o):n.onlyScale=!0,Pu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Bu();Lu(a,e.x+i,e.y+s),Pu(a,n,r),o&&Ru(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=Bu();Du(d,e,i,s,n,r,o,a),h&&(o||a?(Tu(Su),Ou(Su,e,h,l),Cu(d,Su)):Ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Bu();if(c)Du(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Ru(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Lu(u,s,0);break;case 180:Lu(u,i,s);break;case 270:Lu(u,0,i)}Eu.x=e.x+n,Eu.y=e.y+r,Lu(u,Eu.x,Eu.y),o&&Ou(u,Eu,o,a)}t.transform=u}},{toPoint:Xu}=Bt,{hasTransparent:Hu}=$h,Vu={},Uu={};function ju(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=$h.string(n,s)):(a=n.offset,o=$h.string(n.color,s)),e.addColorStop(a,o),!h&&Hu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Gu,getDistance:Ku}=ct,{get:Zu,rotateOfOuter:qu,scaleOfOuter:Ju}=Q,{toPoint:$u}=Bt,Qu={},t_={};function e_(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Gu(e,i);r=Zu(),n?(Ju(r,e,o/a*(s||1),1),qu(r,e,t+90)):(Ju(r,e,1,o/a*(s||1)),qu(r,e,t))}return r}const{getDistance:i_}=ct,{toPoint:s_}=Bt,n_={},r_={};const o_={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;Xu(i||"top",e,Vu),Xu(s||"bottom",e,Uu);const o=v.canvas.createLinearGradient(Vu.x,Vu.y,Uu.x,Uu.y),a={type:n,style:o};return ju(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;$u(i||"center",e,Qu),$u(s||"bottom",e,t_);const a=v.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Ku(Qu,t_)),h={type:n,style:a};ju(h,a,t.stops,r);const l=e_(e,Qu,t_,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;s_(i||"center",e,n_),s_(s||"bottom",e,r_);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,n_.x,n_.y):v.canvas.createRadialGradient(n_.x,n_.y,0,n_.x,n_.y,i_(n_,r_)),h={type:n,style:a};ju(h,a,t.stops,r);const l=e_(e,n_,r_,o||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:e_},{copy:a_,move:h_,toOffsetOutBounds:l_}=jt,{max:d_,abs:c_}=Math,u_={},__=new vt,g_={};function p_(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=c_(t.spread||0),o=d_(o,n+r-s),a=d_(a,n+r+i),h=d_(h,n+r+s),l=d_(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function f_(t,e,i){const{shapeBounds:s}=i;let n,r;v.fullImageShadow?(a_(u_,t.bounds),h_(u_,e.x-s.x,e.y-s.y),n=t.bounds,r=u_):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:m_}=jt,y_={};const v_=p_;const x_={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),g=o.length-1;l_(h,g_,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(g_.offsetX+(o.x||0)*c*f,g_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,$h.string(o.color)),n=nl.getShadowTransform(t,_,i,o,g_,f),n&&_.setTransform(n),f_(_,g_,i),n&&_.resetTransform(),s=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,r,"copy"),s=r),a?_.copyWorld(a,r,r,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),ho.copyCanvasByWorld(t,e,_,s,o.blendMode),g&&p<g&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),g=o.length-1;m_(h,y_,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(y_.offsetX+(o.x||0)*c*f,y_.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=nl.getShadowTransform(t,_,i,o,y_,f,!0),n&&_.setTransform(n),f_(_,y_,i),_.restore(),a?(_.copyWorld(_,l,r,"copy"),_.copyWorld(a,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,$h.string(o.color),"source-in"),ho.copyCanvasByWorld(t,e,_,s,o.blendMode),g&&p<g&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:p_,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 __.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),__}},isTransformShadow(t){},getInnerShadowSpread:v_},{excludeRenderBounds:w_}=mo;let b_;function k_(t,e,i,s,n,r,o,a){switch(e){case"grayscale":b_||(b_=!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);S_(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":S_(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function E_(t){return t.getSameCanvas(!1,!0)}function S_(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)}Nl.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&&(k_(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||w_(i,e)||i.__render(t,e),r=i.__.opacity,b_=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=E_(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=E_(t)),n||(n=E_(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&k_(this,o,t,n,s,r,void 0,!1),w_(i,e)||i.__render(n||t,e),d&&k_(this,o,t,n,s,r,d,!1)}k_(this,o,t,n,s,r,void 0,!0)};const B_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",T_=B_+"_#~&*+\\=|≮≯≈≠=…",R_=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function L_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const O_=L_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),C_=L_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),P_=L_(B_),M_=L_(T_),A_=L_("- —/~|┆·");var D_;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(D_||(D_={}));const{Letter:I_,Single:W_,Before:F_,After:z_,Symbol:Y_,Break:N_}=D_;function X_(t){return O_[t]?I_:A_[t]?N_:C_[t]?F_:P_[t]?z_:M_[t]?Y_:R_.test(t)?W_:I_}const H_={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function V_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:U_}=H_,{Letter:j_,Single:G_,Before:K_,After:Z_,Symbol:q_,Break:J_}=D_;let $_,Q_,tg,eg,ig,sg,ng,rg,og,ag,hg,lg,dg,cg,ug,_g,gg,pg=[];function fg(t,e){og&&!rg&&(rg=og),$_.data.push({char:t,width:e}),tg+=e}function mg(){eg+=tg,$_.width=tg,Q_.words.push($_),$_={data:[]},tg=0}function yg(){cg&&(ug.paraNumber++,Q_.paraStart=!0,cg=!1),og&&(Q_.startCharSize=rg,Q_.endCharSize=og,rg=0),Q_.width=eg,_g.width?U_(Q_):gg&&vg(),pg.push(Q_),Q_={words:[]},eg=0}function vg(){eg>(ug.maxWidth||0)&&(ug.maxWidth=eg)}const{top:xg,right:wg,bottom:bg,left:kg}=kt;function Eg(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 Sg={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[kg],n-=a[wg]+a[kg],!n&&(n=.01)):e.autoSizeAlign||(i=a[kg]),o?(s=a[xg],o-=a[xg]+a[bg],!o&&(o=.01)):e.autoSizeAlign||(s=a[xg]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){ug=t,pg=t.rows,_g=t.bounds,gg=!_g.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=v,{width:a}=_g;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;cg=!0,hg=null,rg=ng=og=tg=eg=0,$_={data:[]},Q_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)sg=e[i],"\n"===sg?(tg&&mg(),Q_.paraEnd=!0,yg(),cg=!0):(ag=X_(sg),ag===j_&&"none"!==r&&(sg=V_(sg,r,!tg)),ng=o.measureText(sg).width,s&&(s<0&&(og=ng),ng+=s),lg=ag===G_&&(hg===G_||hg===j_)||hg===G_&&ag!==Z_,dg=!(ag!==K_&&ag!==G_||hg!==q_&&hg!==Z_),ig=cg&&n?a-n:a,t&&a&&eg+tg+ng>ig&&(h?(tg&&mg(),eg&&yg()):(dg||(dg=ag===j_&&hg==Z_),lg||dg||ag===J_||ag===K_||ag===G_||tg+ng>ig?(tg&&mg(),eg&&yg()):eg&&yg()))," "===sg&&!0!==cg&&eg+tg===0||(ag===J_?(" "===sg&&tg&&mg(),fg(sg,ng),mg()):lg||dg?(tg&&mg(),fg(sg,ng)):fg(sg,ng)),hg=ag);tg&&mg(),eg&&yg(),pg.length>0&&(pg[pg.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{ug.paraNumber++,eg=o.measureText(t).width,pg.push({x:n||0,text:t,width:eg,paraStart:!0}),gg&&vg()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Eg(e,"x",t[kg]);break;case"right":Eg(e,"x",-t[wg])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Eg(e,"y",t[xg]);break;case"bottom":Eg(e,"y",-t[bg])}}(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:_,y:g,width:p,height:f}=s,m=r*n+(c?c*(t.paraNumber-1):0),y=o;if(h&&m>f)m=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;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=_,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=g,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&&(g=r&&t.paraStart?r:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-g,l?_=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+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,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&&_),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(n.splice(r),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?v.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=$h.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 Bg={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!$h.object)return t;t=$h.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 Tg(t){return t?d(t)?t:[t]:[]}Object.assign(Jh,Sg),Object.assign($h,Bg),Object.assign(el,hu),Object.assign(il,Nu),Object.assign(sl,o_),Object.assign(nl,x_),Object.assign(le,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new Eh(t,e),hitCanvasManager:()=>new Pc}),Bh();class Rg extends Fo{get list(){return Tg(this.value)}get oldList(){return Tg(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Lg(t){return(e,i)=>{const s="_"+i;ar(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?Rg.BEFORE_SELECT:Rg.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Rg(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Rg.BEFORE_SELECT="editor.before_select",Rg.SELECT="editor.select",Rg.AFTER_SELECT="editor.after_select",Rg.BEFORE_HOVER="editor.before_hover",Rg.HOVER="editor.hover";const{abs:Og}=Math,{copy:Cg}=Q,{setListWithFn:Pg}=jt,{worldBounds:Mg}=mo,Ag={a:1,b:0,c:0,d:1,e:0,f:0},Dg={x:0,y:0,width:0,height:0};class Ig extends Yl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Pg(Dg,e,Mg),t&&this.set(t),this.set(Dg),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=Og(c.scaleX),l=Og(c.scaleY);Cg(Ag,c),Ag.half=a%2,t.setWorld(Ag,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),o&&(r(o)?el.stroke(o,this,t,e):el.strokes(o,this,t,e)),h&&(r(h)?el.fill(h,this,t,e):el.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}me([Lg(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],Ig.prototype,"target",void 0),me([Rr("render-path")],Ig.prototype,"strokePathType",void 0);class Wg extends Nl{constructor(t){super(t),this.strokeArea=new Ul({strokeAlign:"center"}),this.fillArea=new Ul,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 Fg={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return zg([t],i,e),i}};function zg(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&&zg(s.children,e,i)}}const{findOne:Yg,findByBounds:Ng}=Fg;class Xg extends Nl{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Ig,this.targetStroker=new Ig,this.bounds=new qt,this.selectArea=new Wg,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 wh(Ng(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)&&!Yg(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new wh(this.editor.editBox.rect)};return Yg(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Yg(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_([[Rg.HOVER,this.onHover,this],[Rg.SELECT,this.onSelect,this]]),e.on_([[ec.MOVE,this.onPointerMove,this],[ec.BEFORE_DOWN,this.onBeforeDown,this],[ec.TAP,this.onTap,this],[nc.START,this.onDragStart,this,!0],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ac.MOVE,this.onAutoMove,this],[[uc.ZOOM,ac.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Hg,top:Vg,topRight:Ug,right:jg,bottomRight:Gg,bottom:Kg,bottomLeft:Zg,left:qg}=Et,{toPoint:Jg}=Bt,{within:$g,sign:Qg}=F,{abs:tp}=Math,ep={getScaleData(t,e,i,s,n,r,o,h){let l,d,c={},u=1,_=1;const{boxBounds:g,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=Qg(w),E=Qg(b),S=h?w:k*g.width/v,B=h?b:E*g.height/x;if(a(s))u=_=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 Vg:_=t,l="bottom";break;case jg:u=e,l="left";break;case Kg:_=o,l="top";break;case qg:u=a,l="right";break;case Hg:_=t,u=a,l="bottom-right";break;case Ug:_=t,u=e,l="bottom-left";break;case Gg:_=o,u=e,l="top-left";break;case Zg:_=o,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case Vg:case Kg:u=_;break;case qg:case jg:_=u;break;default:d=Math.sqrt(tp(u*_)),u=Qg(u)*d,_=Qg(_)*d}}const T=1!==u,R=1!==_;if(T&&(u/=S),R&&(_/=B),!o){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),_<0&&(_=1/g.height/e.scaleY)}if(Jg(r||l,g,c,!0),m){const e={x:u,y:_};Qd.limitScaleOf(t,c,e,n),u=e.x,_=e.y}if(T&&p){const e=g.width*t.scaleX;u=$g(e*u,p)/e}if(R&&f){const e=g.height*t.scaleY;_=$g(e*_,f)/e}return T&&tp(u*y.width)<1&&(u=Qg(u)/y.width),R&&tp(_*y.height)<1&&(_=Qg(_)/y.height),n&&u!==_&&(d=Math.min(tp(u),tp(_)),u=Qg(u)*d,_=Qg(_)*d),isFinite(u)||(u=1),isFinite(_)||(_=1),{origin:c,scaleX:u,scaleY:_,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case Hg:r="bottom-right";break;case Ug:r="bottom-left";break;case Gg:r="top-left";break;case Zg:r="top-right";break;default:r="center"}return Jg(n||r,t.boxBounds,o,!0),{origin:o,rotation:ct.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case Vg:case Hg:r={x:.5,y:0},n="bottom",a=1;break;case Kg:case Gg:r={x:.5,y:1},n="top",a=1;break;case qg:case Zg:r={x:0,y:.5},n="right",h=1;break;case jg:case Ug: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,Jg(s||n,t,o,!0);const c=ct.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 qg:t=jg;break;case Hg:t=Ug;break;case Zg:t=Gg;break;case jg:t=qg;break;case Ug:t=Hg;break;case Gg:t=Zg}if(i)switch(t){case Vg:t=Kg;break;case Hg:t=Zg;break;case Ug:t=Gg;break;case Kg:t=Vg;break;case Zg:t=Hg;break;case Gg:t=Ug}return t}},ip={};function sp(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 np(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:_,moveable:g,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(g||(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?_:r?c:u:v?_:y?c:u;h+=45*(ep.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(F.formatRotation(h,!0)/2);const{url:w,x:b,y:k}=x,E=w+h;ip[E]?i.cursor=ip[E]:ip[E]=i.cursor={url:rp(w,h),x:b,y:k}}function np(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function rp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class op extends Jl{constructor(t){super(t),this.useFastShadow=!0}}const ap=["top","right","bottom","left"],hp=void 0;class lp extends Nl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return r(t)||r(e)||r(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Nl,this.rect=new op({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new op({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Nl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints: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 op({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new op({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new op({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(),_=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},_[(t-1)/2%_.length]||{}));r.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:hp},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&&g.stintSet(t.__world,"ignorePixelSnap",d),np(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:_,rotateable:g,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&&jt.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&&g&&!(!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=ap.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=ap.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?ep.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:hp};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)}sp(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 nc||t instanceof ac)&&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(),r(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case ac.START:this.onTransformStart(t);break;case ac.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case uc.START:this.onTransformStart(t);break;case uc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case uc.START:this.onTransformStart(t);break;case uc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){sp(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 Ad)||t.find(t=>t instanceof Ad);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[nc.START,this.onDragStart,this],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ec.ENTER,e=>{this.enterPoint=t,sp(this,e)}],[ec.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[ec.DOUBLE_TAP,this.onDoubleTap,this],[ec.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[_c.HOLD,_c.UP],this.onKey,this],[_c.DOWN,this.onArrow,this],[[ac.START,ac.BEFORE_MOVE,ac.END],this.onMove,this,!0],[[uc.START,uc.BEFORE_ZOOM,uc.END],this.onScale,this,!0],[[dc.START,dc.BEFORE_ROTATE,dc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const dp={x:0,y:0,width:1e5,height:1e5};class cp extends Yl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,dp),Object.assign(this.__world,dp)}__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 up='\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"/>',_p={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${up}\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${up}\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${up}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},gp=new qt;function pp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{gp.setListWithFn(i,t=>t.getBounds("box","page")),0===gp.width&&(gp.width=.1),0===gp.height&&(gp.height=.1),e.reset(gp.get())}),s.add(e)}const fp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),mp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),yp={group(t,e,i){t.sort(mp);const{app:s,parent:n}=t[0];let r;r=i&&i.add?i:new Nl(i),n.addAt(r,n.children.indexOf(t[0])),t.sort(fp);const o=new vt(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(fp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(mp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},vp=ee.get("EditToolCreator");function xp(){return t=>{bp.register(t)}}const wp=xp,bp={list:{},register(t){const{tag:e}=t.prototype;kp[e]&&vp.repeat(e),kp[e]=t},get:(t,e)=>new kp[t](e)},{list:kp}=bp;class Ep extends Rg{constructor(t,e){super(t,e)}}Ep.BEFORE_OPEN="innerEditor.before_open",Ep.OPEN="innerEditor.open",Ep.BEFORE_CLOSE="innerEditor.before_close",Ep.CLOSE="innerEditor.close";class Sp extends Rg{constructor(t,e){super(t,e)}}Sp.BEFORE_GROUP="editor.before_group",Sp.GROUP="editor.group",Sp.BEFORE_UNGROUP="editor.before_ungroup",Sp.UNGROUP="editor.ungroup",Sp.BEFORE_OPEN="editor.before_open_group",Sp.OPEN="editor.open_group",Sp.BEFORE_CLOSE="editor.before_close_group",Sp.CLOSE="editor.close_group";const{updateMatrix:Bp}=ho,Tp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Rp="top-left";class Lp extends Ul{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(No.CHANGE,e=>{if(this.checkChange&&Tp[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,Bp(this.parent),Bp(this);const a=new vt(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Bp(this),this.changedTransform=new vt(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Rp,r);break;case"scaleX":t.scaleOf(Rp,r,1);break;case"scaleY":t.scaleOf(Rp,1,r);break;case"skewX":t.skewOf(Rp,r,0);break;case"skewY":t.skewOf(Rp,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Op extends Rg{constructor(t,e){super(t,e)}}Op.BEFORE_MOVE="editor.before_move",Op.MOVE="editor.move";class Cp extends Rg{constructor(t,e){super(t,e)}}Cp.BEFORE_SCALE="editor.before_scale",Cp.SCALE="editor.scale";class Pp extends Rg{constructor(t,e){super(t,e)}}Pp.BEFORE_ROTATE="editor.before_rotate",Pp.ROTATE="editor.rotate";class Mp extends Rg{constructor(t,e){super(t,e)}}Mp.BEFORE_SKEW="editor.before_skew",Mp.SKEW="editor.skew";class Ap{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const h=t.type===ac.END||t.type===nc.END,l=r(e.draggable),d=!o||h||l,c={x:t.totalX,y:t.totalY};t instanceof ac&&ct.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=nc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(o&&!l&&h?ho.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 uc?(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=ep.getScaleData(e,n.bounds,d,r,a,ep.getAround(o,t.altKey),h,!s||"scale"===l),u=e.x,_=e.y;t instanceof nc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ct.move(n.totalOffset,e.x-u,e.y-_)}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 dc)d=t.rotation,l=r?Bt.getPoint(r,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,o=ep.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=F.float(F.getGapRotation(d,o,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),ct.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=ep.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),ep.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 Op(Op.BEFORE_MOVE,h));const l=new Op(Op.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 Cp(Cp.BEFORE_SCALE,t));const r=new Cp(Cp.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 Cp(Cp.BEFORE_SCALE,u));const _=new Cp(Cp.SCALE,u);this.doScale(_),this.emitEvent(_)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new vt(ho.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 Cp(Cp.BEFORE_SCALE,o));const a=new Cp(Cp.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 Pp(Pp.BEFORE_ROTATE,d));const c=new Pp(Pp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target: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 Mp(Mp.BEFORE_SKEW,u));const _=new Mp(Mp.SKEW,u);this.doSkew(_),this.emitEvent(_)}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(ho.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new vt(e.worldTransform);return t(),new vt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Dp=class extends Nl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new wh,this.openedGroupList=new wh,this.simulateTarget=new Lp(this),this.editBox=new lp(this),this.editToolList={},this.selector=new Xg(this),this.editMask=new cp(this),this.targetEventIds=[];let i=g.clone(_p);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),he.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>g.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&&pp(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||bp.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(bp.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Sp.BEFORE_GROUP),this.target=yp.group(this.list,this.element,t),this.emitGroupEvent(Sp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.BEFORE_UNGROUP,t)),this.target=yp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Sp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Sp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Sp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Sp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ho.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Sp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||bp.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}bp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Ep.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Ep.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Ep.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Ep.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Ep(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&&(yp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(yp.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_(Qo.START,this.onRenderStart,this),i&&i.on_(No.SCROLL,this.onChildScroll,this),t.on_(Qo.CHILD_START,this.onAppRenderStart,this),t.on_(ta.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};me([(t,e)=>{ar(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}})}],Dp.prototype,"mergeConfig",void 0),me([Lg(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof wh?i:new wh(i),t.multiple&&pp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Rg(Rg.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Rg(Rg.AFTER_SELECT,s))})],Dp.prototype,"target",void 0),me([Lg(function(t,e){t.emitEvent(new Rg(Rg.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Dp.prototype,"hoverTarget",void 0),Dp=me([Kr(Ap,["editBox","editTool","emitEvent"])],Dp);class Ip{static registerInnerEditor(){bp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Nl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Wp=class extends Ip{static registerEditTool(){bp.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()}};Wp=me([xp()],Wp);const{left:Fp,right:zp}=Et,{move:Yp,copy:Np,toNumberPoints:Xp}=ct;let Hp=class extends Wp{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===Fp;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=Xp(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?(Yp(t,r,o),s&&Yp(e,-r,-o)):(s&&Yp(t,-r,-o),Yp(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;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),Np(s[7],i),Np(e[7],i),Np(s[3],a),Np(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Fp||t===zp,s[t].visible=a,e[t].visible=!o&&a}};Hp=me([xp()],Hp);const{M:Vp,L:Up,C:jp,Q:Gp,Z:Kp,N:Zp,D:qp,X:Jp,G:$p,F:Qp,O:tf,P:ef,U:sf}=De,nf={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case Vp:case Up:rf(t,e,i,n,1),n+=3;break;case jp:rf(t,e,i,n,3),n+=7;break;case Gp:rf(t,e,i,n,2),n+=5;break;case Kp:n+=1;break;case Zp:rf(t,e,i,n,2),n+=5;break;case qp:rf(t,e,i,n,2),n+=9;break;case Jp:rf(t,e,i,n,2),n+=6;break;case $p:rf(t,e,i,n,2),n+=9;break;case Qp:rf(t,e,i,n,2),n+=5;break;case tf:t[n]=$p,t.splice(n+4,0,t[n+3],0),rf(t,e,i,n,2),n+=9,r+=2;break;case ef:t[n]=Qp,t.splice(n+4,0,t[n+3]),rf(t,e,i,n,2),n+=5,r+=1;break;case sf:rf(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:rf}=nf,of=Q.get(),{topLeft:af,top:hf,topRight:lf,right:df,bottom:cf,left:uf}=Et;function _f(t,e,i){t.pathInputed?gf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function gf(t,e,i){nf.scale(t.__.path,e,i),t.path=t.__.path}function pf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):nf.scalePoints(s,e,i),t.points=s}function ff(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)of.a=e,of.d=i,s[t].transform(of,!0)}const mf=dh.prototype;function yf(t,e,i){vf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(ac.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);t.zoomLayer.move(i)}),t.on_(ac.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(ac.END,e=>{ho.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(uc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function vf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&g.assign(i,e),g.assign(t.config,i,t.userConfig)}mf.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},mf.__scaleResize=function(t,e){_f(this,t,e)},mf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},mf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Ad.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 hf:case cf:r=i,s.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case uf:case df:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case af:case lf: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),_f(this,t,e)}},Dd.prototype.__scaleResize=function(t,e){gf(this,t,e)},Sd.prototype.__scaleResize=function(t,e){this.pathInputed?gf(this,t,e):this.points?pf(this,t,e):this.width*=t},dd.prototype.__scaleResize=function(t,e){this.pathInputed?gf(this,t,e):this.points?pf(this,t,e):_f(this,t,e)},Nl.prototype.__scaleResize=function(t,e){ff(this,t,e)},Jl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||_f(this,t,e),i&&ff(this,t,e)},he.add("resize"),he.add("editor","resize"),le.editor=function(t,e){const i=new Dp(t);return e&&e.sky.add(e.editor=i),i},Jl.addAttr("textBox",!1,_r),Yl.addAttr("editConfig",void 0,_r),Yl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),_r),Yl.addAttr("editInner","PathEditor",_r),Nl.addAttr("editInner","",_r),Ad.addAttr("editInner","TextEditor",_r),Yl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Yl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Yl.setEditInner=function(t){this.changeAttr("editInner",t)};const xf=ee.get("LeaferTypeCreator"),wf={list:{},register(t,e){bf[t]&&xf.repeat(t),bf[t]=e},run(t,e){const i=bf[t];i&&i(e)}},{list:bf,register:kf}=wf;kf("viewport",yf),kf("custom",function(t){yf(t,null,!0)}),kf("design",function(t){yf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),kf("document",function(t){yf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Ef={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ct.getCenter(e.from,i.from),n=ct.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=ct.getDistance(e.from,i.from);return{move:r,scale:ct.getDistance(e.to,i.to)/o,rotation:ct.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Sf,s=Sf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Sf.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)?Sf.getType(i.totalData,e):"none"},add(t,e){e&&(ct.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Sf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Sf=Ef,{abs:Bf,max:Tf}=Math,{sign:Rf,within:Lf}=F,Of={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=Bf(s),o=Bf(n);return r>50&&(s=Tf(50,r/3)*Rf(s)),o>50&&(n=Tf(50,o/3)*Rf(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&&(v.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=Lf(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Lf(1-Bf(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let Cf,Pf,Mf,Af;class Df{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),Cf=0,Pf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Cf,totalY:Pf}),e.emit(ac.START,this.moveData)),t.path=this.moveData.path,t.totalX=Cf+=t.moveX,t.totalY=Pf+=t.moveY,e.emit(ac.BEFORE_MOVE,t),e.emit(ac.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Mf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Mf}),e.emit(uc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Mf*=t.scale,e.emit(uc.BEFORE_ZOOM,t),e.emit(uc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Af=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Af}),e.emit(dc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Af+=t.rotation,e.emit(dc.BEFORE_ROTATE,t),e.emit(dc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(ac.END,Object.assign(Object.assign({},e),{totalX:Cf,totalY:Pf})),i&&t.emit(uc.END,Object.assign(Object.assign({},i),{totalScale:Mf})),s&&t.emit(dc.END,Object.assign(Object.assign({},s),{totalRotation:Af})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const If=Vl.prototype,Wf=new qt,Ff=new mt;function zf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Yf(t,e){return Object.assign(Object.assign({},e),{scale:t})}If.initType=function(t){wf.run(t,this)},If.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(Ff.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Ff.y=0:t.includes("y")?Ff.x=0:Math.abs(Ff.x)>Math.abs(Ff.y)?Ff.y=0:Ff.x=0,i&&t.includes("limit")&&(Wf.set(this.__world).addPoint(this.zoomLayer),Qd.getValidMove(Wf,this.canvas.bounds,"auto",Ff,!0),t.includes("x")?Ff.y=0:t.includes("y")&&(Ff.x=0))}return{x:n?0:Ff.x,y:n?0:Ff.y}},If.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 Nf=Oc.prototype;Nf.createTransformer=function(){this.transformer=new Df(this)},Nf.move=function(t){this.transformer.move(t)},Nf.zoom=function(t){this.transformer.zoom(t)},Nf.rotate=function(t){this.transformer.rotate(t)},Nf.transformEnd=function(){this.transformer.transformEnd()},Nf.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):Of.getScale(t,e);if(1!==r)this.zoom(Yf(r,t));else{const s=e.getMove?e.getMove(t,e):Of.getMove(t,e);i.snap&&ct.round(s),this.move(zf(s,t))}},Nf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Ef.getData(e),{moving:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Ef.detect(n,c(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}Ef.reset()}r||(n.center=Ef.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(Yf(n.scale,t)),r&&this.move(zf(n.move,t))};const Xf=xc.prototype,{abs:Hf,min:Vf,max:Uf,hypot:jf}=Math;function Gf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Xf.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,_=0,g=3;const{dragDataList:p}=this,f=p.length;for(let t=f-1;t>=Uf(f-3,0)&&(l=p[t],!(l.time&&Date.now()-l.time>100));t--)o=g--,d+=l.moveX*o,c+=l.moveY*o,_+=o,h=jf(l.moveX,l.moveY),h>u&&(u=h);if(_&&(d/=_,c/=_),u>8){const t=1.15+Vf((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=Uf(Hf(d),Hf(c));m>r&&(h=r/m,d*=h,c*=h);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),Hf(d)<n&&Hf(c)<n)return this.dragEndReal(t);ct.move(t,d,c),this.drag(t),this.animate(y),e.emit(ac.DRAG_ANIMATE,t)};this.animate(y)}return i},Xf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Xf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},Xf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Xf.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=jt.maxX(o),d=jt.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let _=0,g=0;this.autoMoveTimer=setInterval(()=>{_+=c,g+=u,ct.move(i,c,u),ct.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},Xf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},he.add("viewport"),he.add("view"),Vl.prototype.zoom=function(t,e,i,s){let 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),_=new qt,g={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=Gf(y,"in");break;case"out":p=Gf(y,"out");break;case"fit":t=x;break;case"fit-width":(t=new qt(x)).height=0;break;case"fit-height":(t=new qt(x)).width=0}else a(t)&&(p=t/y);if(p)p=this.getValidScale(p),h.scaleOfWorld(g,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];_.setListWithFn(e,mo.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);_.set(h.getWorldBounds(e))}const{width:r,height:o}=_;let a=l.x-_.x,c=l.y-_.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,ct.scaleOf(e,_,p),_.scaleOf(_,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(a=0),ct.move(e,a,c),_.move(a,c),h.set(e,s),_}return h.worldBoxBounds};class Kf extends Nl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&g.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 Jl,this.scrollYBar=new Jl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new qt(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,_=l<1,{scrollXBar:g,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=o.shrink([2,_?p.width+6:2,u?g.height+6:2,2]);g.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:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(nc.DRAG,this.onDrag,this),e.on_(nc.DRAG,this.onDrag,this),t.on_(nc.END,this.onDragEnd,this),e.on_(nc.END,this.onDragEnd,this),this.target.on_(Qo.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())}}he.add("scroll");class Zf extends wl{}function qf(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wr(this),t.__useArrow=e,Sr(this)}}}))}let Jf=class extends Sd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){tl.register(t,e)}};me([zr(Zf)],Jf.prototype,"__",void 0),me([qf("angle")],Jf.prototype,"endArrow",void 0),Jf=me([Zr()],Jf);const{M:$f,L:Qf,C:tm,Q:em,O:im}=De,{rotate:sm,copyFrom:nm,scale:rm}=ct,om={},am={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 $f:case Qf:hm(t,l+1,e,i,s,n,r,o),l+=3;break;case tm:for(h=1;h<6;h+=2)hm(t,l+h,e,i,s,n,r,o);l+=7;break;case em:for(h=1;h<4;h+=2)hm(t,l+h,e,i,s,n,r,o);l+=5;break;case im: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){am.layout(t,0,0,1,1,e,i)}};function hm(t,e,i,s,n,r,o,a){nm(om,t[e],t[e+1]),o&&sm(om,o,a),n&&rm(om,n,r),t[e]=i+om.x,t[e+1]=s+om.y}const{layout:lm,rotate:dm}=am,{getAngle:cm}=ct,um={x:-.5},_m={connect:um,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},gm={connect:um,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},pm={connect:um,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]},fm={connect:um,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]},mm={offset:um,path:[...pm.path],dashPath:[1,-2.5,0,2,-1,0]};dm(mm.path,180,{x:-1.5,y:0});const ym={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},vm={connect:{x:.5},path:[...ym.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},xm={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]},wm={path:[...xm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},bm=g.clone(xm),km=g.clone(wm);dm(bm.path,45),dm(km.path,45);const Em={angle:_m,"angle-side":gm,arrow:fm,triangle:pm,"triangle-flip":mm,circle:vm,"circle-line":ym,square:wm,"square-line":xm,diamond:km,"diamond-line":bm,mark:{offset:um,path:[1,0,-2,2,0,2]}};function Sm(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Em[e.type]):a=e:a=Em[e];const{offset:u,connect:_,path:g,dashPath:p}=a;let f=_?_.x:0,m=u?u.x:0;const y=[...g];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&&lm(y,0,0,h,h),m&&lm(y,m,0),lm(y,s.x,s.y,n,n,cm(i,s)),r.x=(f+m)*n,y}const{M:Bm,L:Tm,C:Rm,Q:Lm,Z:Om,N:Cm,D:Pm,X:Mm,G:Am,F:Dm,O:Im,P:Wm,U:Fm}=De,{copy:zm,copyFrom:Ym,getDistancePoint:Nm}=ct,Xm={},Hm={},Vm={},Um={},jm={},Gm={list:Em,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 Bm:case Tm:(c<2||l+6>=d)&&(Ym(jm,r[l+1],r[l+2]),!c&&u&&zm(Hm,jm)),l+=3;break;case Rm:(1===c||l+7>=d-3)&&Km(r,Um,jm,l+3),l+=7;break;case Lm:(1===c||l+5>=d-3)&&Km(r,Um,jm,l+1),l+=5;break;case Om:return;case Cm:l+=5;break;case Pm:l+=9;break;case Mm:l+=6;break;case Am:l+=9;break;case Dm:l+=5;break;case Im:l+=7;break;case Wm:l+=4;break;case Fm:(1===c||l+6>=d-3)&&(Km(r,Um,jm,l+1),l+6!==d&&(jm.x-=(jm.x-Um.x)/10,jm.y-=(jm.y-Um.y)/10)),l+=6}if(c++,1===c&&h!==Bm)return;if(2===c&&u&&zm(Vm,h===Tm?jm:Um),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Sm(t,e,Vm,Hm,s,Xm,!!n);n?d.push(...i):o.push(...i),Xm.x&&(Nm(Hm,Vm,-Xm.x,!0),o[1]=Vm.x,o[2]=Vm.y)}if(i&&"none"!==i){const e=Sm(t,i,Um,jm,s,Xm,!!n);if(n?d.push(...e):o.push(...e),Xm.x){let t;switch(Nm(jm,Um,-Xm.x,!0),h){case Tm:t=l-3+1;break;case Rm:t=l-7+5;break;case Lm:t=l-5+3;break;case Fm:t=l-6+3}t&&Zm(o,Um,t)}}}else zm(Um,jm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Km(t,e,i,s){Ym(e,t[s],t[s+1]),Ym(i,t[s+2],t[s+3])}function Zm(t,e,i){t[i]=e.x,t[i+1]=e.y}he.add("arrow"),Yl.addAttr("startArrow","none",qf),Yl.addAttr("endArrow","none",qf),Object.assign(tl,Gm),Object.assign(el,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:qm,NoAndSkip:Jm,YesAndSkip:$m}=e,Qm={},ty={},ey={};class iy{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"#":Qm.id=t.substring(1),t=Qm;break;case".":ty.className=t.substring(1),t=ty;break;default:ey.tag=t,t=ey}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?g.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&&ho.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===$m){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Jm&&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_(zo.REMOVE,this.__onRemoveChild,this),this.target.on_(No.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const sy=Yl.prototype;function ny(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())}sy.find=function(t,e){return ny(this).getBy(t,this,!1,e)},sy.findOne=function(t,e){return ny(this).getBy(t,this,!0,e)},he.add("find"),le.finder=function(t){return new iy(t)};const{setPoint:ry,addPoint:oy,toBounds:ay}=wt;const hy={syncExport(t,e,i){let n;ol.running=!0;try{const r=Kn.fileType(e),o=e.includes(".");i=Kn.getExportOptions(i);const{toURL:a}=v,{download:h}=v.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:_,clip:g,trim:p,screenshot:f,padding:m,onCanvas:y}=i,x=s(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,k=Kn.isOpaqueImage(e)||b,E=new vt;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":E.set(l);break;case"local":E.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:E.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};F.getScaleData(i.scale,i.size,r,S);let B=i.pixelRatio||1,{x:T,y:R,width:L,height:O}=new qt(r).scale(S.scaleX,S.scaleY);g&&(T+=g.x,R+=g.y,L=g.width,O=g.height);const C={exporting:!0,matrix:E.scale(1/S.scaleX,1/S.scaleY).invert().translate(-T,-R).withScale(1/a*S.scaleX,1/h*S.scaleY)};let P,M=le.canvas({width:Math.floor(L),height:Math.floor(O),pixelRatio:B,smooth:x,contextSettings:w});_&&(P=t,P.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save();const A=u&&!s(b),D=t.get("fill");if(A&&(t.fill=""),v.render(t,M,C),A&&(t.fill=D),M.restore(),P&&P.__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?oy(o,n,r):ry(o={},n,r)),a++;const h=new qt;return o&&(ay(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};M=le.canvas(s),M.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=F.fourNumber(m),n=M,{width:r,height:o}=n;M=le.canvas({width:r+s+e,height:o+t+i,pixelRatio:B}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}k&&M.fillWorld(M.bounds,b||"#FFFFFF","destination-over"),y&&y(M);n={data:"canvas"===e?M:M.export(e,i),width:M.pixelWidth,height:M.pixelHeight,renderBounds:r,trimBounds:o};const I=c&&c.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return ol.running=!1,n},export(t,e,i){return ol.running=!0,function(t){ly||(ly=new $n);return new Promise(e=>{ly.add(()=>ye(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const r=()=>ye(this,void 0,void 0,function*(){if(!tr.isComplete)return v.requestRender(r);const o=ol.syncExport(t,e,i);o.data instanceof Promise&&(o.data=yield o.data),s(o),n()});t.updateLayout(),dy(t);const{leafer:o}=t;o?o.waitViewCompleted(r):r()}))}};let ly;function dy(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>dy(t))}const cy=Pe.prototype,uy=ee.get("@leafer-in/export");cy.export=function(t,e){const{quality:i,blob:s}=Kn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},cy.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{uy.error(t),i(null)})})},cy.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},cy.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{uy.error(t),i(!1)})})},he.add("export"),Object.assign(ol,hy),Yl.prototype.export=function(t,e){return ol.export(this,t,e)},Yl.prototype.syncExport=function(t,e){return ol.syncExport(this,t,e)};const _y={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},gy={top:"flex-start",middle:"center",bottom:"flex-end"},py={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function fy(t,e,i){const{style:n}=t,{fill:o,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let _;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=$h.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=$h.string(r(t)?t:t.color);break;default:s(e.r)||(i=$h.string(e))}else i=e;t.color=i}(n,o),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,c(u)?(_=u.type,u.color&&(n.textDecorationColor=$h.string(u.color))):_=u,n.textDecoration=py[_],n.textTransform=_y[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=gy[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 my=class extends Ip{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 Ad),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_(ec.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:_,f:g}=new vt(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||fy(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)}};my=me([wp()],my),he.add("text-editor","editor");class yy extends Ol{setText(t){this._text=t,this.__htmlChanged=!0}}const vy={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 xy=class extends Bd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),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=vy[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){r(t)?vy[t]=e:Object.assign(vy,t)}};me([zr(yy)],xy.prototype,"__",void 0),me([vr("")],xy.prototype,"text",void 0),me([_r("TextEditor")],xy.prototype,"editInner",void 0),me([Rr(!1)],xy.prototype,"textEditing",void 0),xy=me([Zr()],xy),he.add("html");export{Lt as AlignHelper,e as Answer,Wd as App,Bt as AroundHelper,Jf as Arrow,Zf as ArrowData,$t as AutoBounds,hi as BezierHelper,qt as Bounds,Vo as BoundsEvent,jt as BoundsHelper,Jl as Box,yl as BoxData,xh as Branch,wo as BranchHelper,Fa as BranchRender,Rd as Canvas,Cl as CanvasData,fe as CanvasManager,zo as ChildEvent,$h as ColorConvert,le as Creator,Cc as Cursor,g as DataHelper,ee as Debug,kt as Direction4,Et as Direction9,Qd as DragBoundsHelper,nc as DragEvent,xc as Dragger,oc as DropEvent,lp as EditBox,ep as EditDataHelper,op as EditPoint,Xg as EditSelect,Fg as EditSelectHelper,Wp as EditTool,bp as EditToolCreator,Dp as Editor,Rg as EditorEvent,Sp as EditorGroupEvent,yp as EditorHelper,Op as EditorMoveEvent,Pp as EditorRotateEvent,Cp as EditorScaleEvent,Mp as EditorSkewEvent,nl as Effect,id as Ellipse,kl as EllipseData,mi as EllipseHelper,Fo as Event,ge as EventCreator,aa as Eventer,ol as Export,Kn as FileHelper,rl as Filter,iy as Finder,R as FourNumberHelper,$l as Frame,xl as FrameData,Nl as Group,ml as GroupData,xy as HTMLText,yy as HTMLTextData,Pc as HitCanvasManager,Bd as Image,Ol as ImageData,Ho as ImageEvent,ir as ImageManager,w as IncrementId,Ip as InnerEditor,Ep as InnerEditorEvent,Oc as InteractionBase,gc as InteractionHelper,_c as KeyEvent,zd as Keyboard,$o as LayoutEvent,zh as Layouter,dh as Leaf,Da as LeafBounds,mo as LeafBoundsHelper,f as LeafData,xa as LeafDataProxy,ya as LeafEventer,ho as LeafHelper,Wo as LeafLayout,bh as LeafLevelList,wh as LeafList,Ta as LeafMatrix,Ia as LeafRender,Vl as Leafer,Eh as LeaferCanvas,Pe as LeaferCanvasBase,vl as LeaferData,ta as LeaferEvent,or as LeaferImage,wf as LeaferTypeCreator,Sd as Line,wl as LineData,Hp as LineEditTool,F as MathHelper,vt as Matrix,Q as MatrixHelper,ac as MoveEvent,Ef as MultiTouchHelper,rc as MyDragEvent,Td as MyImage,ic as MyPointerEvent,lc as MyTouchEvent,We as NeedConvertToCanvasCommandMap,Y as OneRadian,N as PI2,X as PI_2,el as Paint,sl as PaintGradient,il as PaintImage,Dd as Path,tl as PathArrow,Gm as PathArrowModule,In as PathBounds,Ss as PathCommandDataHelper,De as PathCommandMap,yi as PathCommandNodeHelper,is as PathConvert,Hn as PathCorner,Xs as PathCreator,Bl as PathData,nn as PathDrawer,Me as PathHelper,am as PathMatrixHelper,t as PathNodeHandleType,Ne as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Id as Pen,Tl as PenData,Uh as Picker,v as Platform,he as Plugin,mt as Point,ct as PointHelper,Yd as PointerButton,ec as PointerEvent,dd as Polygon,El as PolygonData,No as PropertyEvent,Ul as Rect,bl as RectData,Xe as RectHelper,Fl as RectRender,Qo as RenderEvent,Nh as Renderer,qo as ResizeEvent,tr as Resource,dc as RotateEvent,re as Run,Kf as ScrollBar,Wg as SelectArea,jh as Selector,md as Star,Sl as StarData,al as State,Qt as StringNumberMap,Ig as Stroker,cc as SwipeEvent,Jn as TaskItem,$n as TaskProcessor,Ad as Text,Jh as TextConvert,Ll as TextData,my as TextEditor,hc as TouchEvent,Ap as TransformTool,Df as Transformer,hl as Transition,wt as TwoPointBoundsHelper,Yl as UI,Al as UIBounds,ce as UICreator,pl as UIData,Nd as UIEvent,Il as UIRender,Qh as UnitConvert,To as WaitHelper,Jo as WatchEvent,Rh as Watcher,Of as WheelEventHelper,uc as ZoomEvent,yf as addViewport,vf as addViewportConfig,Tr as affectRenderBoundsType,Er as affectStrokeBoundsType,qf as arrowType,cr as attr,fr as autoLayoutType,vr as boundsType,Gn as canvasPatch,Ce as canvasSizeAttrs,qh as createAttr,lr as createDescriptor,Fr as cursorType,zr as dataProcessor,_r as dataType,dr as decorateLeafAttr,Nr as defineDataProcessor,ar as defineKey,ur as defineLeafAttr,Lr as dimType,wr as doBoundsType,Sr as doStrokeType,Gh as effectType,i as emptyData,Ir as eraserType,Xo as extraPropertyEventMap,V as getBoundsData,hr as getDescriptor,U as getMatrixData,H as getPointData,Wr as hitType,d as isArray,u as isData,_ as isEmptyData,o as isFinite,n as isNull,a as isNumber,c as isObject,r as isString,s as isUndefined,Yr as layoutProcessor,ra as leaferTransformAttrMap,Dr as maskType,xr as naturalBoundsType,Or as opacityType,Vn as path,br as pathInputType,kr as pathType,Un as pen,gr as positionType,xp as registerEditTool,wp as registerInnerEditor,Zr as registerUI,qr as registerUIEvent,Kh as resizeType,Ur as rewrite,jr as rewriteAble,yr as rotationType,mr as scaleType,pr as scrollType,Ar as sortType,Br as strokeType,Rr as surfaceType,Jt as tempBounds,xt as tempMatrix,yt as tempPoint,l as tryToNumber,Bh as useCanvas,Kr as useModule,kh as version,Cr as visibleType,Zh as zoomLayerType};
|
|
1
|
+
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function n(t){return null==t}function 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{floor:m,max:y}=Math,v={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||x.maxCacheSize),isSuperLarge:(t,e,i)=>x.isLarge(t,e,i,x.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,r){const s=e/r.width,n=i/r.height;d.setTransform(s,0,0,n,-r.x*s,-r.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:x}=v,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=w;let k,E,S;const{max:B}=Math,T=[0,0,0,0],R={zero:[...T],tempFour:T,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>L(T,t,e,i,s),toTempAB(t,e,i){S=i?a(t)?e:t:[],a(t)?(k=C(t),E=e):a(e)?(k=t,E=C(e)):(k=t,E=e),4!==k.length&&(k=O(k)),4!==E.length&&(E=O(E))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(P(t,e,i),L(S,B(k[0],E[0]),B(k[1],E[1]),B(k[2],E[2]),B(k[3],E[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(P(t,e,i),L(S,k[0]+E[0],k[1]+E[1],k[2]+E[2],k[3]+E[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:O(t);return L(n,h*i,l*e,r*i,o*e)}},{set:L,get:O,setTemp:C,toTempAB:P}=R,{round:M,pow:A,max:D,floor:I,PI:W}=Math,F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:A(10,e);return-0===(t=M(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&&F.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)=>D(I(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const Y=W/180,N=2*W,X=W/2;function H(){return{x:0,y:0}}function V(){return{x:0,y:0,width:0,height:0}}function U(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:G,acos:K,sqrt:Z}=Math,{float:q}=F,J={};function $(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:$(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:U,getWorld:$,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=G(e*=Y),a=j(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=Y,t.a=s+r*i,t.b=n+o*i),e&&(e*=Y,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d: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){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e: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*Y,o=G(r),a=j(r);if(s||n){const e=s*Y,i=n*Y;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)&&tt.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=Z(n*n+r*r),c=t/d;const e=n/d;u=r>0?K(e):-K(e)}else{c=Z(o*o+a*a),d=t/c;const e=o/c;u=X-(a>0?K(-e):-K(e))}const e=q(G(u)),i=j(u);d=q(d),c=q(c),g=e?q((o/c+i)/e/Y,9):0,_=e?q((r/d-i)/e/Y,9):0,u=q(u/Y)}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=Z(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{float:et}=F,{toInnerPoint:it,toOuterPoint:st}=Q,{sin:nt,cos:rt,abs:ot,sqrt:at,atan2:ht,min:lt,round:dt}=Math,ct={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?dt(t.x-.5)+.5:dt(t.x),t.y=e?dt(t.y-.5)+.5:dt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ut.defaultPoint);const s=rt(e*=Y),n=nt(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}=ut;return _t(i,t),it(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ut;return _t(i,t),st(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ut;return _t(i,t),ut.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(_t(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),it(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){it(e,t,i)},toOuterOf(t,e,i){st(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>gt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=ot(i-t),r=ot(s-e);return at(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>lt(gt(t,e,i,s),gt(i,s,n,r)),getAngle:(t,e)=>ft(t,e)/Y,getRotation:(t,e,i,s)=>(s||(s=e),ut.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/Y),getRadianFrom(t,e,i,n,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)=>ht(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=ft(t,e);return n&&(t=e),s||(e={}),e.x=t.x+rt(r)*i,e.y=t.y+nt(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)=>et(t.x)===et(e.x)&&et(t.y)===et(e.y),reset(t){ut.reset(t)}},ut=ct,{getDistanceFrom:gt,copy:_t,setRadius:pt,getAtan2:ft}=ut;class mt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ct.copy(this,t):ct.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new mt(this)}move(t,e){return ct.move(this,t,e),this}scale(t,e){return ct.scale(this,t,e),this}scaleOf(t,e,i){return ct.scaleOf(this,t,e,i),this}rotate(t,e){return ct.rotate(this,t,e),this}rotateOf(t,e){return ct.rotate(this,e,t),this}getRotation(t,e,i){return ct.getRotation(this,t,e,i)}toInnerOf(t,e){return ct.toInnerOf(this,t,e),this}toOuterOf(t,e){return ct.toOuterOf(this,t,e),this}getCenter(t){return new mt(ct.getCenter(this,t))}getDistance(t){return ct.getDistance(this,t)}getDistancePoint(t,e,i,s){return new mt(ct.getDistancePoint(this,t,e,i,s))}getAngle(t){return ct.getAngle(this,t)}getAtan2(t){return ct.getAtan2(this,t)}isSame(t){return ct.isSame(this,t)}reset(){return ct.reset(this),this}}const yt=new mt;class vt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new vt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const xt=new vt,wt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){bt(t,e,i),bt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:bt}=wt;var kt,Et;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(kt||(kt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(Et||(Et={}));const St=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];St.forEach(t=>t.type="percent");const Bt={directionData:St,tempPoint:{},get:Tt,toPoint(t,e,i,s,n,r){const o=Tt(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 Tt(t){return r(t)?St[Et[t]]:t}const{toPoint:Rt}=Bt,Lt={toPoint(t,e,i,s,n,r){Rt(t,i,s,n,e,r)}},{tempPointBounds:Ot,setPoint:Ct,addPoint:Pt,toBounds:Mt}=wt,{toOuterPoint:At}=Q,{float:Dt,fourNumber:It}=F,{floor:Wt,ceil:Ft}=Math;let zt,Yt,Nt,Xt;const Ht={},Vt={},Ut={},jt={tempBounds:Ut,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(d(i)){const e=It(i);s?Gt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Gt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Gt.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),Gt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Zt(e,t):e=t,i||(i=t),e.offsetX=Gt.maxX(i),e.offsetY=Gt.maxY(i),Gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ct.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ct.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Gt.copy(Ut,t),Gt.toOuterOf(Ut,e),Ut),getOuterOf:(t,e)=>(t=Object.assign({},t),Gt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e: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 Ht.x=t.x,Ht.y=t.y,At(e,Ht,Vt),Ct(Ot,Vt.x,Vt.y),Ht.x=t.x+t.width,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Ht.y=t.y+t.height,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Ht.x=t.x,At(e,Ht,Vt),Pt(Ot,Vt.x,Vt.y),Mt(Ot,i)},toInnerOf(t,e,i){i||(i=t),Gt.move(i,-e.e,-e.f),Gt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Gt.getFitScale(t,e));return new vt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),r(s)&&(s=Gt.getFitScale(t,e,"cover"===s)),Ut.width=n?e.width*=s:e.width*s,Ut.height=n?e.height*=s:e.height*s,Lt.toPoint(i,Ut,t,o,!0,!0)},getSpread(t,e,i){const s={};return Gt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Gt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Gt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Wt(t.x),t.y=Wt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Dt(t.x,e),t.y=Dt(t.y,e),t.width=Dt(t.width,e),t.height=Dt(t.height,e)},add(t,e,i){zt=t.x+t.width,Yt=t.y+t.height,Nt=e.x,Xt=e.y,i||(Nt+=e.width,Xt+=e.height),zt=zt>Nt?zt:Nt,Yt=Yt>Xt?Yt:Xt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=zt-t.x,t.height=Yt-t.y},addList(t,e){Gt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Gt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Gt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,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||Zt(t,n)):Kt(t,n));r&&Gt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Ot,t.x,t.y):Pt(Ot,t.x,t.y)),Mt(Ot,t)},setPoint(t,e){Gt.set(t,e.x,e.y)},addPoint(t,e){Kt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ct.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ct.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Gt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Gt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Gt.tempToOuterOf(e,i)),!Gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return zt=s+r,Yt=n+o,Nt=t.x+t.width,Xt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,zt=zt<Nt?zt:Nt,Yt=Yt<Xt?Yt:Xt,r=zt-s,o=Yt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Gt.copy(t,Gt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Gt.set(t)}},Gt=jt,{add:Kt,copy:Zt}=Gt;class qt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?jt.copy(this,t):jt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new qt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new qt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Jt=new qt;class $t{constructor(t,e,i,s,n,r){c(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:te}=F;class ee{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ee(t)}static set filter(t){this.filterList=ie(t)}static set exclude(t){this.excludeList=ie(t)}static drawRepaint(t,e){const i=te();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ee.showBounds,n=t.__nowWorld,r=te();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(se.enable){if(se.filterList.length&&se.filterList.every(t=>t!==this.name))return;if(se.excludeList.length&&se.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){se.enable&&this.warn(...t)}warn(...t){se.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ie(t){return t?r(t)&&(t=[t]):t=[],t}ee.filterList=[],ee.excludeList=[],ee.showWarn=!0;const se=ee,ne=ee.get("RunTime"),re={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ne.log(s,n,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=re,ae=[],he={list:{},add(t,...e){this.list[t]=!0,ae.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ae.forEach(t=>he.has(t,!0)));const le={editor:t=>he.need("editor")},de=ee.get("UICreator"),ce={list:{},register(t){const{__tag:e}=t.prototype;ue[e]&&de.repeat(e),ue[e]=t},get(t,e,i,n,r,o){ue[t]||de.error("not register "+t);const a=new ue[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:ue}=ce,ge=ee.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(pe[e]&&ge.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class fe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=le.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function me(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function ye(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){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 ve(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const xe=[];function we(){return(t,e)=>{xe.push(e)}}const be=[];let ke=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.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}};me([ve("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),me([ve("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),me([ve("globalAlpha")],ke.prototype,"opacity",void 0),me([ve()],ke.prototype,"fillStyle",void 0),me([ve()],ke.prototype,"strokeStyle",void 0),me([ve("lineWidth")],ke.prototype,"strokeWidth",void 0),me([ve("lineCap")],ke.prototype,"strokeCap",void 0),me([ve("lineJoin")],ke.prototype,"strokeJoin",void 0),me([ve("lineDashOffset")],ke.prototype,"dashOffset",void 0),me([ve()],ke.prototype,"miterLimit",void 0),me([ve()],ke.prototype,"shadowBlur",void 0),me([ve()],ke.prototype,"shadowColor",void 0),me([ve()],ke.prototype,"shadowOffsetX",void 0),me([ve()],ke.prototype,"shadowOffsetY",void 0),me([ve()],ke.prototype,"filter",void 0),me([ve()],ke.prototype,"font",void 0),me([ve()],ke.prototype,"fontKerning",void 0),me([ve()],ke.prototype,"fontStretch",void 0),me([ve()],ke.prototype,"fontVariantCaps",void 0),me([ve()],ke.prototype,"textAlign",void 0),me([ve()],ke.prototype,"textBaseline",void 0),me([ve()],ke.prototype,"textRendering",void 0),me([ve()],ke.prototype,"wordSpacing",void 0),me([ve()],ke.prototype,"letterSpacing",void 0),me([ve()],ke.prototype,"direction",void 0),me([we()],ke.prototype,"setTransform",null),me([we()],ke.prototype,"resetTransform",null),me([we()],ke.prototype,"getTransform",null),me([we()],ke.prototype,"save",null),me([we()],ke.prototype,"restore",null),me([we()],ke.prototype,"translate",null),me([we()],ke.prototype,"scale",null),me([we()],ke.prototype,"rotate",null),me([we()],ke.prototype,"fill",null),me([we()],ke.prototype,"stroke",null),me([we()],ke.prototype,"clip",null),me([we()],ke.prototype,"fillRect",null),me([we()],ke.prototype,"strokeRect",null),me([we()],ke.prototype,"clearRect",null),me([we()],ke.prototype,"beginPath",null),me([we()],ke.prototype,"moveTo",null),me([we()],ke.prototype,"lineTo",null),me([we()],ke.prototype,"bezierCurveTo",null),me([we()],ke.prototype,"quadraticCurveTo",null),me([we()],ke.prototype,"closePath",null),me([we()],ke.prototype,"arc",null),me([we()],ke.prototype,"arcTo",null),me([we()],ke.prototype,"ellipse",null),me([we()],ke.prototype,"rect",null),me([we()],ke.prototype,"roundRect",null),me([we()],ke.prototype,"createConicGradient",null),me([we()],ke.prototype,"createLinearGradient",null),me([we()],ke.prototype,"createPattern",null),me([we()],ke.prototype,"createRadialGradient",null),me([we()],ke.prototype,"fillText",null),me([we()],ke.prototype,"measureText",null),me([we()],ke.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Se,pixelScale:Be}=Q,{round:Te}=Math,Re=new qt,Le=new qt,Oe={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Pe extends ke{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Oe),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Se(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin: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=Le):i=Re,this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,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(Re.x,Re.y,Re.width,Re.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,Re.x,Re.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Re.x,Re.y,Re.width,Re.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Re.x,Re.y,Re.width,Re.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Re,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(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):le.canvas(Object.assign({},i));return n.save(),t&&(Ee(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Me={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ae={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},De=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},Ae),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Fe=Object.assign(Object.assign({},We),Ae),ze=De,Ye={};for(let t in ze)Ye[ze[t]]=t;const Ne={};for(let t in ze)Ne[ze[t]]=Ie[t];const Xe={drawRoundRect(t,e,i,s,n,r){const o=F.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:He,cos:Ve,hypot:Ue,atan2:je,ceil:Ge,abs:Ke,PI:Ze,sqrt:qe,pow:Je}=Math,{setPoint:$e,addPoint:Qe}=wt,{set:ti,toNumberPoints:ei}=ct,{M:ii,L:si,C:ni,Q:ri,Z:oi}=De,ai={},hi={points(t,e,i,s){let n=ei(e);if(t.push(ii,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,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=qe(Je(_,2)+Je(p,2)),m=qe(Je(h-o,2)+Je(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(ri,d,c,o,a):(_||p)&&t.push(ni,u,g,d,c,o,a),u=o+m*h,g=a+m*l);s||t.push(ri,u,g,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(si,n[e],n[e+1]);s&&t.push(oi)},rect(t,e,i,s,n){Me.creator.path=t,Me.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){Me.creator.path=[],Xe.drawRoundRect(Me.creator,e,i,s,n,r),t.push(...Me.convertToCanvasData(Me.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=je(u,c),f=je(_,g);const m=Ue(c,u),y=Ue(g,_);let v=f-p;if(v<0&&(v+=N),m<1e-12||y<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(si,s,n),h&&($e(h,e,i),Qe(h,s,n)),d&&ti(d,e,i),void(l&&ti(l,s,n));const x=c*_-g*u<0,w=x?-1:1,b=a/Ve(v/2),k=s+b*Ve(p+v/2+X*w),E=n+b*He(p+v/2+X*w);return p-=X*w,f-=X*w,ci(t,k,E,a,a,0,p/Y,f/Y,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ci(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*Y,g=He(u),_=Ve(u);let p=o*Y,f=a*Y;p>Ze&&(p-=N),f<0&&(f+=N);let m=f-p;m<0?m+=N:m>N&&(m-=N),h&&(m-=N);const y=Ge(Ke(m/X)),v=m/y,x=He(v/4),w=8/3*x*x/He(v/2);f=p+v;let b,k,E,S,B,T,R,L,O=Ve(p),C=He(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?si:ii,A,D),l&&$e(l,A,D),c&&ti(c,A,D);for(let r=0;r<y;r++)b=Ve(f),k=He(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(ni,B,T,R,L,e+E,i+S),l&&di(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&&ti(d,e+E,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ni,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){di(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,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?Qe(h,t,e):$e(h,t,e),Qe(h,o,a);for(let l=0,c=d.length;l<c;l++)li(d[l],t,e,i,s,n,r,o,a,ai),Qe(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,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 li(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:li,toTwoPointBounds:di,ellipse:ci}=hi,{sin:ui,cos:gi,sqrt:_i,atan2:pi}=Math,{ellipse:fi}=hi,mi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=r*Y,_=ui(g),p=gi(g),f=-p*c-_*u,m=-p*u+_*c,y=s*s,x=n*n,w=m*m,b=f*f,k=y*x-y*w-x*b;let E=0;if(k<0){const t=_i(1-k/(y*x));s*=t,n*=t}else E=(o===a?-1:1)*_i(k/(y*w+x*b));const S=E*s*m/n,B=-E*n*f/s,T=pi((m-B)/n,(f-S)/s),R=pi((-m-B)/n,(-f-S)/s);let L=R-T;0===a&&L>0?L-=N:1===a&&L<0&&(L+=N);const O=e+c+p*S-_*B,C=i+u+_*S+p*B,P=L<0?1:0;d||v.ellipseToCurve?fi(t,O,C,s,n,r,T/Y,R/Y,P):s!==n||r?t.push(De.G,O,C,s,n,r,T/Y,R/Y,P):t.push(De.O,O,C,s,T/Y,R/Y,P)}},yi={toCommand:t=>[],toNode:t=>[]},{M:vi,m:xi,L:wi,l:bi,H:ki,h:Ei,V:Si,v:Bi,C:Ti,c:Ri,S:Li,s:Oi,Q:Ci,q:Pi,T:Mi,t:Ai,A:Di,a:Ii,Z:Wi,z:Fi,N:zi,D:Yi,X:Ni,G:Xi,F:Hi,O:Vi,P:Ui,U:ji}=De,{rect:Gi,roundRect:Ki,arcTo:Zi,arc:qi,ellipse:Ji,quadraticCurveTo:$i}=hi,{ellipticalArc:Qi}=mi,ts=ee.get("PathConvert"),es={},is={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ne[s],a+=s===n?" ":Ye[s];for(let s=1;s<i;s++)a+=F.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Fe:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(ss.dot&&(ns(o,r),r=""),ss.dot++),"0"===r&&"."!==s&&(ns(o,r),r=""),r+=s):De[s]?(r&&(ns(o,r),r=""),ss.name=De[s],ss.length=Ie[s],ss.index=0,ns(o,ss.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&ns(o,r),r=s):r&&(ns(o,r),r=""),n=s;return r&&ns(o,r),i?is.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case xi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],g.push(vi,a,h),c+=3;break;case Ei:t[c+1]+=a;case ki:a=t[c+1],g.push(wi,a,h),c+=2;break;case Bi:t[c+1]+=h;case Si:h=t[c+1],g.push(wi,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case wi:a=t[c+1],h=t[c+2],g.push(wi,a,h),c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:o=r===Ti||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(Ti,l,d,i,s,a,h),c+=5;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ti;case Ti:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ti,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ai:t[c+1]+=a,t[c+2]+=h,n=Mi;case Mi:o=r===Ci||r===Mi,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?$i(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ci;case Ci:i=t[c+1],s=t[c+2],e?$i(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=a,t[c+7]+=h;case Di:Qi(g,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Fi:case Wi:g.push(Wi),c++;break;case zi:a=t[c+1],h=t[c+2],e?Gi(g,a,h,t[c+3],t[c+4]):rs(g,t,c,5),c+=5;break;case Yi:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(g,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?Ki(g,a,h,t[c+3],t[c+4],t[c+5]):rs(g,t,c,6),c+=6;break;case Xi:Ji(e?g:rs(g,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,es),a=es.x,h=es.y,c+=9;break;case Hi:e?Ji(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:qi(e?g:rs(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),a=es.x,h=es.y,c+=7;break;case Ui:e?qi(g,t[c+1],t[c+2],t[c+3],0,360,!1):rs(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ji:Zi(e?g:rs(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),a=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${n} [index:${c}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(vi,t.x,t.y);break;case"L":e.push(wi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ss.index===ss.length&&(ss.index=1,t.push(ss.name)),t.push(Number(e)),ss.index++,ss.dot=0}},{current:ss,pushData:ns,copyData:rs}=is,{M:os,L:as,C:hs,Q:ls,Z:ds,N:cs,D:us,X:gs,G:_s,F:ps,O:fs,P:ms,U:ys}=De,{getMinDistanceFrom:vs,getRadianFrom:xs}=ct,{tan:ws,min:bs,abs:ks}=Math,Es={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(hs,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ls,e,i,s,n)},closePath(t){t.push(ds)},rect(t,e,i,s,n){t.push(cs,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(gs,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(us,e,i,s,n,...o):t.push(cs,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){if(s===r)return Ts(t,e,i,s,a,h,l);n(o)?t.push(ps,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(_s,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(ms,e,i,s):(n(r)&&(r=0),n(o)&&(o=360),t.push(fs,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h){if(!s(a)){const t=vs(a,h,e,i,n,r);o=bs(o,bs(t/2,t/2*ks(ws(xs(a,h,e,i,n,r)/2))))}t.push(ys,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){hi.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Es),t.push(os,Es.x,Es.y),Bs(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){hi.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,Es),t.push(os,Es.x,Es.y),Ts(t,e,i,s,r,o,a)},drawPoints(t,e,i,s){hi.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=Ss,{moveTo:Rs,lineTo:Ls,quadraticCurveTo:Os,bezierCurveTo:Cs,closePath:Ps,beginPath:Ms,rect:As,roundRect:Ds,ellipse:Is,arc:Ws,arcTo:Fs,drawEllipse:zs,drawArc:Ys,drawPoints:Ns}=Ss;class Xs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Me.parse(t):t:[],this}beginPath(){return Ms(this.__path),this.paint(),this}moveTo(t,e){return Rs(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 Cs(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ps(this.__path),this.paint(),this}rect(t,e,i,s){return As(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ds(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Is(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Ws(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Fs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return zs(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 Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Hs,L:Vs,C:Us,Q:js,Z:Gs,N:Ks,D:Zs,X:qs,G:Js,F:$s,O:Qs,P:tn,U:en}=De,sn=ee.get("PathDrawer"),nn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Hs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Us:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Js:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*Y,e[s+6]*Y,e[s+7]*Y,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*Y,e[s+5]*Y,e[s+6]),s+=7;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case en:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sn.error(`command: ${i} [index:${s}]`,e)}}},{M:rn,L:on,C:an,Q:hn,Z:ln,N:dn,D:cn,X:un,G:gn,F:_n,O:pn,P:fn,U:mn}=De,{toTwoPointBounds:yn,toTwoPointBoundsByQuadraticCurve:vn,arcTo:xn,arc:wn,ellipse:bn}=hi,{addPointBounds:kn,copy:En,addPoint:Sn,setPoint:Bn,addBounds:Tn,toBounds:Rn}=wt,Ln=ee.get("PathBounds");let On,Cn,Pn;const Mn={},An={},Dn={},In={toBounds(t,e){In.toTwoPointBounds(t,An),Rn(An,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===ln||o===an||o===hn?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),o){case rn:case on:h=t[a+1],l=t[a+2],Sn(e,h,l),a+=3;break;case an:n=t[a+5],r=t[a+6],yn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Mn),kn(e,Mn),h=n,l=r,a+=7;break;case hn:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],vn(h,l,i,s,n,r,Mn),kn(e,Mn),h=n,l=r,a+=5;break;case ln:a+=1;break;case dn:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=5;break;case cn:case un:h=t[a+1],l=t[a+2],Tn(e,h,l,t[a+3],t[a+4]),a+=o===cn?9:6;break;case gn:bn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],Cn=t[a+3],Pn=t[a+4],Tn(e,h-Cn,l-Pn,2*Cn,2*Pn),h+=Cn,a+=5;break;case pn:wn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=7;break;case fn:h=t[a+1],l=t[a+2],On=t[a+3],Tn(e,h-On,l-On,2*On,2*On),h+=On,a+=4;break;case mn:xn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Mn,Dn),0===a?En(e,Mn):kn(e,Mn),h=Dn.x,l=Dn.y,a+=6;break;default:return void Ln.error(`command: ${o} [index:${a}]`,t)}}},{M:Wn,L:Fn,Z:zn}=De,{getCenterX:Yn,getCenterY:Nn}=ct,{arcTo:Xn}=Ss,Hn={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=[];for(;o<f;){switch(s=t[o],s){case Wn:l=_=t[o+1],c=p=t[o+2],o+=3,t[o]===Fn?(u=t[o+1],g=t[o+2],m.push(Wn,Yn(l,u),Nn(c,g))):m.push(Wn,l,c);break;case Fn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Fn:Xn(m,a,h,t[o+1],t[o+2],e,_,p);break;case zn:Xn(m,a,h,l,c,e,_,p);break;default:m.push(Fn,a,h)}_=a,p=h;break;case zn:n!==zn&&(Xn(m,l,c,u,g,e,_,p),m.push(zn)),o+=1;break;default:r=Ne[s];for(let e=0;e<r;e++)m.push(t[o+e]);o+=r}n=s}return s!==zn&&(m[1]=l,m[2]=c),m}};function Vn(t){return new Xs(t)}const Un=Vn();Me.creator=Vn(),Me.parse=is.parse,Me.convertToCanvasData=is.toCanvasData;const{drawRoundRect:jn}=Xe;function Gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){jn(this,t,e,i,s,n)})}(t)}const Kn={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=Zn.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{}}}},Zn=Kn;Zn.alphaPixelTypes.forEach(t=>Zn.upperCaseTypeMap[t]=t.toUpperCase());const qn=ee.get("TaskProcessor");class Jn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){qn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class $n{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&_.assign(this.config,t),this.empty()}add(t,e,i){let n,r,o,h;const l=new Jn(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.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Qn=ee.get("Resource"),tr={tasker:new $n,map:{},get isComplete(){return er.tasker.isComplete},set(t,e){er.map[t]&&Qn.repeat(t),er.map[t]=e},get:t=>er.map[t],remove(t){const e=er.map[t];e&&(e.destroy&&e.destroy(),delete er.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=le.image(s)),er.set(t,e),e},destroy(){er.map={}}},er=tr,ir={maxRecycled:10,recycledList:[],patternTasker:new $n({parallel:1}),get(t){let e=tr.get(t.url);return e||tr.set(t.url,e=le.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(v.image.isLarge(t)?t.url&&tr.remove(t.url):(t.clearLevels(),sr.recycledList.push(t)))})},recyclePaint(t){sr.recycle(t.image)},clearRecycled(t){const e=sr.recycledList;(e.length>sr.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Kn.alphaPixelTypes.some(e=>sr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Kn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Kn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},sr=ir,{IMAGE:nr,create:rr}=w;class or{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?v.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rr(nr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ir.isFormat("svg",t)&&(this.isSVG=!0),ir.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tr.tasker.add(()=>ye(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=v.image.resize(this.view,t,e,n,r,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(){}getMinLevel(){}getLevelData(t){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function ar(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function hr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function lr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function dr(t,e){return(i,s)=>ur(i,s,t,e&&e(s))}function cr(t){return t}function ur(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ar(t,e,Object.assign(n,s||{})),Nr(t,e,i)}function gr(t){return dr(t)}function _r(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wr(this))}}))}function mr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function yr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function vr(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i,e)&&wr(this)}}))}function xr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(wr(this),this.__.__removeNaturalSize())}}))}function wr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function br(t){return dr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wr(this)}}))}const kr=vr;function Er(t,e){return dr(t,t=>({set(i){this.__setAttr(t,i)&&(Sr(this),e&&(this.__.__useStroke=!0))}}))}function Sr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wr(t)}const Br=Er;function Tr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Rr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Lr(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Or(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Pr(this)}}))}function Cr(t){return dr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Mr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Mr(this,t,e,i),this.mask&&Pr(this)}}))}function Pr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Mr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wr(t))}function Ar(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Dr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ir(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Wr(t){return dr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ee.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Fr(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function zr(t){return(e,i)=>{ar(e,"__DataProcessor",{get:()=>t})}}function Yr(t){return(e,i)=>{ar(e,"__LayoutProcessor",{get:()=>t})}}function Nr(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=lr(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=hr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),ar(n,e,a)}const Xr=new ee("rewrite"),Hr=[],Vr=["destroy","constructor"];function Ur(t){return(e,i)=>{Hr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jr(){return t=>{Gr()}}function Gr(t){Hr.length&&(Hr.forEach(e=>{t&&Xr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Hr.length=0)}function Kr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Vr.includes(s)||e&&e.includes(s)))if(t.prototype){hr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Zr(){return t=>{ce.register(t)}}function qr(){return t=>{_e.register(t)}}setTimeout(()=>Gr(!0));const{copy:Jr,toInnerPoint:$r,toOuterPoint:Qr,scaleOfOuter:to,rotateOfOuter:eo,skewOfOuter:io,multiplyParent:so,divideParent:no,getLayout:ro}=Q,oo={},{round:ao}=Math,ho={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),uo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)co(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++)go(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&go(t),t.__updateChange()},updateAllChange(t){if(po(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)_o(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,r){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?Qr(t.localTransform,r,r,!0):t.parent&&$r(t.parent.scrollWorldTransform,r,r,!0),lo.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=ao(e),i=ao(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){lo.zoomOfLocal(t,fo(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),Jr(oo,o),to(oo,e,i,s),lo.hasHighPosition(t))lo.setTransform(t,oo,n,r);else{const e=t.x+oo.e-o.e,a=t.y+oo.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){lo.rotateOfLocal(t,fo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Jr(oo,n),eo(oo,e,i),lo.hasHighPosition(t)?lo.setTransform(t,oo,!1,s):t.set({x:t.x+oo.e-n.e,y:t.y+oo.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){lo.skewOfLocal(t,fo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Jr(oo,t.__localMatrix),io(oo,e,i,s),lo.setTransform(t,oo,n,r)},transformWorld(t,e,i,s){Jr(oo,t.worldTransform),so(oo,e),t.parent&&no(oo,t.parent.scrollWorldTransform),lo.setTransform(t,oo,i,s)},transform(t,e,i,s){Jr(oo,t.localTransform),so(oo,e),lo.setTransform(t,oo,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&lo.getInnerOrigin(t,n.origin),o=ro(e,r,n.around&&lo.getInnerOrigin(t,n.around));if(lo.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=lo.getInnerOrigin(t,n.origin);ct.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 to(i,lo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ct.tempToOuterOf(lo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Jr(oo,t.worldTransform),no(oo,e.scrollWorldTransform),i?oo:Object.assign({},oo)),drop(t,e,i,s){t.setTransform(lo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||lo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),v.requestRender(()=>lo.animateMove(t,e,i))}}},lo=ho,{updateAllMatrix:co,updateMatrix:uo,updateAllWorldOpacity:go,updateAllChange:_o,updateChange:po}=lo;function fo(t,e){return t.updateLayout(),t.parent?ct.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const mo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>vo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>vo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>vo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let yo;function vo(t,e){return e||(yo=0),t.__.mask&&(yo=1),yo<0?null:(yo&&(yo=-1),!0)}const{updateBounds:xo}=ho,wo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),bo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ko(e[t],e)},updateBounds(t,e){const i=[t];ko(t,i),Eo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)xo(s[t]);e&&e===i||xo(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&&So(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&&Bo(t,e,i,s,n,r,o)}},{pushAllChildBranch:bo,pushAllBranchStack:ko,updateBoundsByBranchStack:Eo,move:So,scale:Bo}=wo,To={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Ro,updateBounds:Lo}=ho,{toOuterOf:Oo,getPoints:Co,copy:Po}=jt,Mo="_localContentBounds",Ao="_worldContentBounds",Do="_worldBoxBounds",Io="_worldStrokeBounds";class Wo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Oo(this.contentBounds,this.leaf.__localMatrix,this[Mo]||(this[Mo]={})),this[Mo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Oo(this.contentBounds,this.leaf.__world,this[Ao]||(this[Ao]={})),this[Ao]}get worldBoxBounds(){return Oo(this.boxBounds,this.leaf.__world,this[Do]||(this[Do]={})),this[Do]}get worldStrokeBounds(){return Oo(this.strokeBounds,this.leaf.__world,this[Io]||(this[Io]={})),this[Io]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Lo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,v.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return Ro(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new qt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Ro(s,e,!0)}if(o||(o=Q.getLayout(r)),Po(o,a),ct.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=Co(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return 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 Fo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class zo extends Fo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}zo.ADD="child.add",zo.REMOVE="child.remove",zo.CREATED="created",zo.MOUNTED="mounted",zo.UNMOUNTED="unmounted",zo.DESTROY="destroy";const Yo="property.scroll";class No extends Fo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}No.CHANGE="property.change",No.LEAFER_CHANGE="property.leafer_change",No.SCROLL=Yo;const Xo={scrollX:Yo,scrollY:Yo};class Ho extends Fo{constructor(t,e){super(t),Object.assign(this,e)}}Ho.LOAD="image.load",Ho.LOADED="image.loaded",Ho.ERROR="image.error";class Vo extends Fo{static checkHas(t,e,i){"on"===i?e===Ko?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Uo)||t.hasEvent(jo)||t.hasEvent(Go),t.__hasWorldEvent=t.hasEvent(Ko))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Uo,t),"inner"===e&&t.emit(jo,t)),t.emit(Go,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Ko,this)}}Vo.RESIZE="bounds.resize",Vo.INNER="bounds.inner",Vo.LOCAL="bounds.local",Vo.WORLD="bounds.world";const{RESIZE:Uo,INNER:jo,LOCAL:Go,WORLD:Ko}=Vo,Zo={};[Uo,jo,Go,Ko].forEach(t=>Zo[t]=1);class qo extends Fo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(qo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}qo.RESIZE="resize";class Jo extends Fo{constructor(t,e){super(t),this.data=e}}Jo.REQUEST="watch.request",Jo.DATA="watch.data";class $o extends Fo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}$o.REQUEST="layout.request",$o.START="layout.start",$o.BEFORE="layout.before",$o.LAYOUT="layout",$o.AFTER="layout.after",$o.AGAIN="layout.again",$o.END="layout.end";class Qo extends Fo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Qo.REQUEST="render.request",Qo.CHILD_START="render.child_start",Qo.CHILD_END="render.child_end",Qo.START="render.start",Qo.BEFORE="render.before",Qo.RENDER="render",Qo.AFTER="render.after",Qo.AGAIN="render.again",Qo.END="render.end",Qo.NEXT="render.next";class ta extends Fo{}ta.START="leafer.start",ta.BEFORE_READY="leafer.before_ready",ta.READY="leafer.ready",ta.AFTER_READY="leafer.after_ready",ta.VIEW_READY="leafer.view_ready",ta.VIEW_COMPLETED="leafer.view_completed",ta.STOP="leafer.stop",ta.RESTART="leafer.restart",ta.END="leafer.end",ta.UPDATE_MODE="leafer.update_mode",ta.TRANSFORM="leafer.transform",ta.MOVE="leafer.move",ta.SCALE="leafer.scale",ta.ROTATE="leafer.rotate",ta.SKEW="leafer.skew";const{MOVE:ea,SCALE:ia,ROTATE:sa,SKEW:na}=ta,ra={x:ea,y:ea,scaleX:ia,scaleY:ia,rotation:sa,skewX:na,skewY:na},oa={};class aa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=ha(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],Zo[t]&&Vo.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=ha(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],Zo[t]&&Vo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&_e.has(t)&&(e=_e.get(t,{type:t,target:this,current:this}));const s=ha(this,i)[t];if(s){let n;for(let 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 ha(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:oa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:oa)}}const{on:la,on_:da,off:ca,off_:ua,once:ga,emit:_a,emitEvent:pa,hasEvent:fa,destroy:ma}=aa.prototype,ya={on:la,on_:da,off:ca,off_:ua,once:ga,emit:_a,emitEvent:pa,hasEvent:fa,destroyEventer:ma},va=ee.get("setAttr"),xa={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(va.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new No(No.LEAFER_CHANGE,this,t,n,e));const i=ra[t];i&&(this.emitEvent(new ta(i,this)),this.emitEvent(new ta(ta.TRANSFORM,this)))}this.emitPropertyEvent(No.CHANGE,t,n,e);const i=Xo[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 No(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:wa,multiplyParent:ba,translateInner:ka,defaultWorld:Ea}=Q,{toPoint:Sa,tempPoint:Ba}=Bt,Ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ba(this.__local||e,t?t.__scrollWorld||t.__world:Ea,i,!!e.affectScaleOrRotation,n),s&&ka(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(wa(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Sa(i.around||i.origin,t.boxBounds,Ba),ka(e,-Ba.x,-Ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ra,updateAllMatrix:La}=ho,{updateBounds:Oa}=wo,{toOuterOf:Ca,copyAndSpread:Pa,copy:Ma}=jt,{toBounds:Aa}=In,Da={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ca(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Vo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Vo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ca(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ca(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ca(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Aa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),La(this),Oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(La(this),Oa(this,this))):Ra(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Pa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ma(e.renderBounds,e.strokeBounds):Pa(e.renderBounds,e.boxBounds,i)}},Ia={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ho.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ee.showBounds&&ee.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Wa}=mo,Fa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Wa(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++)Wa(i[s],e)||i[s].__clip(t,e)}}},za={},{LEAF:Ya,create:Na}=w,{stintSet:Xa}=_,{toInnerPoint:Ha,toOuterPoint:Va,multiplyParent:Ua}=Q,{toOuterOf:ja}=jt,{copy:Ga,move:Ka}=ct,{moveLocal:Za,zoomOfLocal:qa,rotateOfLocal:Ja,skewOfLocal:$a,moveWorld:Qa,zoomOfWorld:th,rotateOfWorld:eh,skewOfWorld:ih,transform:sh,transformWorld:nh,setTransform:rh,getFlipTransform:oh,getLocalOrigin:ah,getRelativeWorld:hh,drop:lh}=ho;let dh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Wo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Na(Ya),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(zo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(zo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(zo.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(zo.MOUNTED)):this.__emitLifeEvent(zo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ua(i,t.matrix,e,void 0,i),ja(this.__layout.renderBounds,e,e),Xa(e,"half",i.half),Xa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=ir.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),za.scaleX=i,za.scaleY=s,za}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?hh(this,e):this.worldTransform,n=i?t:{};return ja(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ga(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ga(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ha(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Va(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Ka(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 Ka(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){rh(this,t,e,i)}transform(t,e,i){sh(this,t,e,i)}move(t,e,i){Za(this,t,e,i)}moveInner(t,e,i){Qa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qa(this,ah(this,t),e,i,s,n)}rotateOf(t,e,i){Ja(this,ah(this,t),e,i)}skewOf(t,e,i,s,n){$a(this,ah(this,t),e,i,s,n)}transformWorld(t,e,i){nh(this,t,e,i)}moveWorld(t,e,i){Qa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){th(this,t,e,i,s,n)}rotateOfWorld(t,e){eh(this,t,e)}skewOfWorld(t,e,i,s,n){ih(this,t,e,i,s,n)}flip(t,e){sh(this,oh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return he.need("path")}getMotionPoint(t){return he.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){lh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Nr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=vr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new zo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(zo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};dh=me([Kr(xa),Kr(Ta),Kr(Da),Kr(ya),Kr(Ia)],dh);const{setListWithFn:ch}=jt,{sort:uh}=wo,{localBoxBounds:gh,localStrokeBounds:_h,localRenderBounds:ph,maskLocalBoxBounds:fh,maskLocalStrokeBounds:mh,maskLocalRenderBounds:yh}=mo,vh=new ee("Branch");let xh=class extends dh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ch(e||this.__layout.boxBounds,this.children,this.__hasMask?fh:gh)}__updateStrokeBounds(t){ch(t||this.__layout.strokeBounds,this.children,this.__hasMask?mh:_h)}__updateRenderBounds(t){ch(t||this.__layout.renderBounds,this.children,this.__hasMask?yh:ph)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(uh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ce.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(zo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(zo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(zo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(zo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new zo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};xh=me([Kr(Fa)],xh);class wh{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 wh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const kh="1.12.3";class Eh extends Pe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Gn(OffscreenCanvasRenderingContext2D.prototype),Gn(Path2D.prototype);const{mineType:Sh}=Kn;function Bh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Sh(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:Sh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=le.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(le,{canvas:(t,e)=>new Eh(t,e),image:t=>new or(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},ar(v,"devicePixelRatio",{get:()=>1});const{userAgent:Th}=navigator;Th.indexOf("Firefox")>-1?(v.conicGradientRotate90=!0,v.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(v.fullImageShadow=!0),Th.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):Th.indexOf("Mac")>-1?v.os="Mac":Th.indexOf("Linux")>-1&&(v.os="Linux");class Rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new wh;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 wh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Qo.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===zo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Jo(Jo.DATA,{updatedList:this.updatedList})),this.__updatedList=new wh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[No.CHANGE,this.__onAttrChange,this],[[zo.ADD,zo.REMOVE],this.__onChildEvent,this],[Jo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Oh,updateChange:Ch}=ho,{pushAllChildBranch:Ph,pushAllParent:Mh}=wo;const{worldBounds:Ah}=mo;class Dh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new wh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ah)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ah),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Ih,updateAllChange:Wh}=ho,Fh=ee.get("Layouter");class zh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new bh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit($o.START),this.layoutOnce(),t.emitEvent(new $o($o.END,this.layoutedBlocks,this.times))}catch(t){Fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Fh.warn("layouting"):this.times>3?Fh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Jo.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=re.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=$o,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new $o(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Lh(t,!0),e.add(t),t.isBranch&&Ph(t,e),Mh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(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||Oh(s[t])}Oh(i)}})}(this.__levelList),function(t){t.list.forEach(Ch)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new $o(r,a,this.times)),i.emitEvent(new $o(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,re.end(e)}fullLayout(){const t=re.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=$o,r=this.getBlocks(new wh(e));e.emitEvent(new $o(i,r,this.times)),zh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new $o(s,r,this.times)),e.emitEvent(new $o(n,r,this.times)),this.addBlocks(r),re.end(t)}static fullLayout(t){Ih(t,!0),t.isBranch?wo.updateBounds(t):ho.updateBounds(t),Wh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Dh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Dh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[$o.REQUEST,this.layout,this],[$o.AGAIN,this.layoutAgain,this],[Jo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Yh=ee.get("Renderer");class Nh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit($o.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Qo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Qo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Qo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Yh.log(e.innerName,"---\x3e");try{this.emitRender(Qo.START),this.renderOnce(t),this.emitRender(Qo.END,this.totalBounds),ir.clearRecycled()}catch(t){this.rendering=!1,Yh.error(t)}Yh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Yh.warn("rendering");if(this.times>3)return Yh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(Qo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Qo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Qo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Qo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=re.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Nh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),re.end(e)}fullRender(){const t=re.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),re.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ee.showRepaint&&ee.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),v.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 qt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Yh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Qo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Qo.REQUEST,this.update,this],[$o.END,this.__onLayoutEnd,this],[Qo.AGAIN,this.renderAgain,this],[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)}}Nh.clipSpread=10;const Xh={},{copyRadiusPoint:Hh}=ct,{hitRadiusPoint:Vh}=jt;class Uh{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 wh(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 wh;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||ho.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ho.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=>ho.worldHittable(t))}getPath(t){const e=new wh,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 wh;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 wh,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=Vh(i.__world,n.hitRadius?Hh(Xh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class jh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Uh(this.target=t,this),this.finder=le.finder&&le.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):he.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Gh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Kh(t){return dr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Zh(){return(t,e)=>{const i="_"+e;ar(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function qh(t){return(e,i)=>{ar(e,i,lr(i,t))}}Object.assign(le,{watcher:(t,e)=>new Rh(t,e),layouter:(t,e)=>new zh(t,e),renderer:(t,e,i)=>new Nh(t,e,i),selector:(t,e)=>new jh(t,e)}),v.layout=zh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new wh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Jh={},$h={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Qh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},tl={},el={},il={},sl={},nl={},rl={apply(){he.need("filter")}},ol={},al={setStyleName:()=>he.need("state"),set:()=>he.need("state")},hl={list:{},register(t,e){hl.list[t]=e},get:t=>hl.list[t]},{parse:ll,objectToCanvasData:dl}=is,{stintSet:cl}=_,{hasTransparent:ul}=$h,gl={originPaint:{}},_l=ee.get("UIData");class pl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,_l.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,_l.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(cl(this,"__isTransparentFill",ul(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(cl(this,"__isTransparentStroke",ul(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?ll(t):dl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){fl(this,"shadow",t)}setInnerShadow(t){fl(this,"innerShadow",t)}setFilter(t){fl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&el.compute("fill",this.__leaf),e&&el.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gl)):(this.__isStrokes=!0,this._stroke||(this._stroke=gl))}__removePaint(t,e){e&&this.__removeInput(t),il.recycleImage(t,this),"fill"===t?(cl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(cl(this,"__isAlphaPixelStroke",void 0),cl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function fl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class ml extends pl{}class yl extends ml{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class vl extends ml{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class xl extends yl{}class wl extends pl{get __usePathBox(){return this.points||this.__pathInputed}}class bl extends pl{get __boxStroke(){return!this.__pathInputed}}class kl extends pl{get __boxStroke(){return!this.__pathInputed}}class El extends wl{}class Sl extends pl{}class Bl extends pl{get __pathInputed(){return 2}}class Tl extends ml{}const Rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ll extends pl{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=Rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ce.get("Rect",0);const n=e.__layout,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 Ol extends bl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Cl extends bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Pl,add:Ml}=R,Al={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Pl(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=nl.getShadowRenderSpread(this,e)),s&&(t=Pl(t,s)),r&&(t=Ml(t,rl.getSpread(r))),o&&(t=Ml(t,o)),a&&(t=Ml(t,a));let l=t;return i&&(l=Pl(l,nl.getInnerShadowSpread(this,i))),n&&(l=Pl(l,n)),this.__layout.renderShapeSpread=l,h?Pl(h.__updateRenderSpread(),t):t}},{stintSet:Dl}=_,Il={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Dl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Dl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Dl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!nl.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Dl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Wl(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=el.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&nl.shadow(this,t,h),a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e)),n&&(s.__isFills?el.fills(n,this,t,e):el.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&nl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e)),c&&rl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?el.strokes(r,this,t,e):el.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,$h.string(e.color))}n&&(s.__isFills?el.fills(n,this,t,e):el.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?el.strokes(r,this,t,e):el.stroke(r,this,t,e))}}else s.__pathForRender?Wl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?el.fills(s,this,t,e):el.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?el.strokes(n,this,t,e):el.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Wl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&el.stroke(n,t,e,i),s&&el.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&el.stroke(n,t,e,i)}const Fl={__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 zl;let Yl=zl=class extends dh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){F.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Un.set(this.path=t||[]),t||this.__drawPathByBox(Un),Un}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 he.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return he.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Un.set(i=[]),this.__drawPathByBox(Un,!e)),t?is.toCanvasData(i,!0):i}getPathString(t,e,i){return is.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ol.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&tl.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?nn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height: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){el.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),he.need("animate")}killAnimate(t,e){}export(t,e){return he.need("export")}syncExport(t,e){return he.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),zl.one(e)}static one(t,e,i,s,n){return ce.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Zr()(this)}static registerData(t){zr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([zr(pl)],Yl.prototype,"__",void 0),me([Zh()],Yl.prototype,"zoomLayer",void 0),me([gr("")],Yl.prototype,"id",void 0),me([gr("")],Yl.prototype,"name",void 0),me([gr("")],Yl.prototype,"className",void 0),me([Rr("pass-through")],Yl.prototype,"blendMode",void 0),me([Or(1)],Yl.prototype,"opacity",void 0),me([Cr(!0)],Yl.prototype,"visible",void 0),me([Rr(!1)],Yl.prototype,"locked",void 0),me([Lr(!1)],Yl.prototype,"dim",void 0),me([Lr(!1)],Yl.prototype,"dimskip",void 0),me([Ar(0)],Yl.prototype,"zIndex",void 0),me([Dr(!1)],Yl.prototype,"mask",void 0),me([Ir(!1)],Yl.prototype,"eraser",void 0),me([_r(0,!0)],Yl.prototype,"x",void 0),me([_r(0,!0)],Yl.prototype,"y",void 0),me([vr(100,!0)],Yl.prototype,"width",void 0),me([vr(100,!0)],Yl.prototype,"height",void 0),me([mr(1,!0)],Yl.prototype,"scaleX",void 0),me([mr(1,!0)],Yl.prototype,"scaleY",void 0),me([yr(0,!0)],Yl.prototype,"rotation",void 0),me([yr(0,!0)],Yl.prototype,"skewX",void 0),me([yr(0,!0)],Yl.prototype,"skewY",void 0),me([_r(0,!0)],Yl.prototype,"offsetX",void 0),me([_r(0,!0)],Yl.prototype,"offsetY",void 0),me([pr(0,!0)],Yl.prototype,"scrollX",void 0),me([pr(0,!0)],Yl.prototype,"scrollY",void 0),me([fr()],Yl.prototype,"origin",void 0),me([fr()],Yl.prototype,"around",void 0),me([gr(!1)],Yl.prototype,"lazy",void 0),me([xr(1)],Yl.prototype,"pixelRatio",void 0),me([Tr(0)],Yl.prototype,"renderSpread",void 0),me([br()],Yl.prototype,"path",void 0),me([kr()],Yl.prototype,"windingRule",void 0),me([kr(!0)],Yl.prototype,"closed",void 0),me([vr(0)],Yl.prototype,"padding",void 0),me([vr(!1)],Yl.prototype,"lockRatio",void 0),me([vr()],Yl.prototype,"widthRange",void 0),me([vr()],Yl.prototype,"heightRange",void 0),me([gr(!1)],Yl.prototype,"draggable",void 0),me([gr()],Yl.prototype,"dragBounds",void 0),me([gr("auto")],Yl.prototype,"dragBoundsType",void 0),me([gr(!1)],Yl.prototype,"editable",void 0),me([Wr(!0)],Yl.prototype,"hittable",void 0),me([Wr("path")],Yl.prototype,"hitFill",void 0),me([Br("path")],Yl.prototype,"hitStroke",void 0),me([Wr(!1)],Yl.prototype,"hitBox",void 0),me([Wr(!0)],Yl.prototype,"hitChildren",void 0),me([Wr(!0)],Yl.prototype,"hitSelf",void 0),me([Wr()],Yl.prototype,"hitRadius",void 0),me([Fr("")],Yl.prototype,"cursor",void 0),me([Rr()],Yl.prototype,"fill",void 0),me([Br(void 0,!0)],Yl.prototype,"stroke",void 0),me([Br("inside")],Yl.prototype,"strokeAlign",void 0),me([Br(1,!0)],Yl.prototype,"strokeWidth",void 0),me([Br(!1)],Yl.prototype,"strokeWidthFixed",void 0),me([Br("none")],Yl.prototype,"strokeCap",void 0),me([Br("miter")],Yl.prototype,"strokeJoin",void 0),me([Br()],Yl.prototype,"dashPattern",void 0),me([Br(0)],Yl.prototype,"dashOffset",void 0),me([Br(10)],Yl.prototype,"miterLimit",void 0),me([kr(0)],Yl.prototype,"cornerRadius",void 0),me([kr()],Yl.prototype,"cornerSmoothing",void 0),me([Gh()],Yl.prototype,"shadow",void 0),me([Gh()],Yl.prototype,"innerShadow",void 0),me([Gh()],Yl.prototype,"blur",void 0),me([Gh()],Yl.prototype,"backgroundBlur",void 0),me([Gh()],Yl.prototype,"grayscale",void 0),me([Gh()],Yl.prototype,"filter",void 0),me([Rr()],Yl.prototype,"placeholderColor",void 0),me([gr(100)],Yl.prototype,"placeholderDelay",void 0),me([gr({})],Yl.prototype,"data",void 0),me([Ur(dh.prototype.reset)],Yl.prototype,"reset",null),Yl=zl=me([Kr(Al),Kr(Il),jr()],Yl);let Nl=class extends Yl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Xl;me([zr(ml)],Nl.prototype,"__",void 0),me([vr(0)],Nl.prototype,"width",void 0),me([vr(0)],Nl.prototype,"height",void 0),Nl=me([Kr(xh),Zr()],Nl);const Hl=ee.get("Leafer");let Vl=Xl=class extends Nl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Xl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const n=this.canvas=le.canvas(s);this.__controllers.push(this.renderer=le.renderer(this,n,s),this.watcher=le.watcher(this,s),this.layouter=le.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=le.selector(this),this.interaction=le.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=le.hitCanvasManager()),this.canvasManager=new fe,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),To.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ta.RESTART):this.emitLeafer(ta.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(ta.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new qo(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new $t(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ta.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=_.copyAttrs({},s,Ce);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ta.BEFORE_READY),this.emitLeafer(ta.READY),this.emitLeafer(ta.AFTER_READY),To.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ta.VIEW_READY),To.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){To.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(ta.VIEW_COMPLETED),To.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return he.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ta(t,this))}__listenEvents(){const t=re.start("FirstCreate "+this.innerName);this.once([[ta.START,()=>re.end(t)],[$o.START,this.updateLazyBounds,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Jo.DATA,this.__onWatchData,this],[$o.END,this.__onLayoutEnd,this],[Qo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Xl.list.remove(this);try{this.stop(),this.emitLeafer(ta.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ir.clearRecycled()},100)}catch(t){Hl.error(t)}}};t?e():setTimeout(e)}};Vl.list=new wh,me([zr(vl)],Vl.prototype,"__",void 0),me([vr()],Vl.prototype,"pixelRatio",void 0),me([gr("normal")],Vl.prototype,"mode",void 0),Vl=Xl=me([Zr()],Vl);let Ul=class extends Yl{get __tag(){return"Rect"}};me([zr(bl)],Ul.prototype,"__",void 0),Ul=me([Kr(Fl),jr(),Zr()],Ul);const{add:jl,includes:Gl,scroll:Kl}=jt,Zl=Ul.prototype,ql=Nl.prototype;let Jl=class extends Nl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds: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"))&&(jl(a,r),Kl(a,i)),this.__updateRectRenderBounds(),t=!Gl(r,a),t&&"show"===o&&jl(n,a)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([zr(yl)],Jl.prototype,"__",void 0),me([vr(100)],Jl.prototype,"width",void 0),me([vr(100)],Jl.prototype,"height",void 0),me([gr(!1)],Jl.prototype,"resizeChildren",void 0),me([Tr("show")],Jl.prototype,"overflow",void 0),me([Ur(Zl.__updateStrokeSpread)],Jl.prototype,"__updateStrokeSpread",null),me([Ur(Zl.__updateRenderSpread)],Jl.prototype,"__updateRectRenderSpread",null),me([Ur(Zl.__updateBoxBounds)],Jl.prototype,"__updateRectBoxBounds",null),me([Ur(Zl.__updateStrokeBounds)],Jl.prototype,"__updateStrokeBounds",null),me([Ur(Zl.__updateRenderBounds)],Jl.prototype,"__updateRectRenderBounds",null),me([Ur(Zl.__updateChange)],Jl.prototype,"__updateRectChange",null),me([Ur(Zl.__render)],Jl.prototype,"__renderRect",null),me([Ur(ql.__render)],Jl.prototype,"__renderGroup",null),Jl=me([jr(),Zr()],Jl);let $l=class extends Jl{get __tag(){return"Frame"}get isFrame(){return!0}};me([zr(xl)],$l.prototype,"__",void 0),me([Rr("#FFFFFF")],$l.prototype,"fill",void 0),me([Tr("hide")],$l.prototype,"overflow",void 0),$l=me([Zr()],$l);const{moveTo:Ql,closePath:td,ellipse:ed}=Ss;let id=class extends Yl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];i?s||n?(i<1&&ed(a,r,o,r*i,o*i,0,s,n,!1),ed(a,r,o,r,o,0,n,s,!0)):(i<1&&(ed(a,r,o,r*i,o*i),Ql(a,t,o)),ed(a,r,o,r,o,0,360,0,!0)):s||n?(Ql(a,r,o),ed(a,r,o,r,o,0,s,n,!1)):ed(a,r,o,r,o),td(a),v.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([zr(kl)],id.prototype,"__",void 0),me([kr(0)],id.prototype,"innerRadius",void 0),me([kr(0)],id.prototype,"startAngle",void 0),me([kr(0)],id.prototype,"endAngle",void 0),id=me([Zr()],id);const{sin:sd,cos:nd,PI:rd}=Math,{moveTo:od,lineTo:ad,closePath:hd,drawPoints:ld}=Ss;let dd=class extends Yl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ld(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;od(e,r,0);for(let t=1;t<n;t++)ad(e,r+r*sd(2*t*rd/n),o-o*nd(2*t*rd/n));hd(e)}}};me([zr(El)],dd.prototype,"__",void 0),me([kr(3)],dd.prototype,"sides",void 0),me([kr()],dd.prototype,"points",void 0),me([kr(0)],dd.prototype,"curve",void 0),dd=me([jr(),Zr()],dd);const{sin:cd,cos:ud,PI:gd}=Math,{moveTo:_d,lineTo:pd,closePath:fd}=Ss;let md=class extends Yl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];_d(o,n,0);for(let t=1;t<2*i;t++)pd(o,n+(t%2==0?n:n*s)*cd(t*gd/i),r-(t%2==0?r:r*s)*ud(t*gd/i));fd(o)}};me([zr(Sl)],md.prototype,"__",void 0),me([kr(5)],md.prototype,"corners",void 0),me([kr(.382)],md.prototype,"innerRadius",void 0),md=me([Zr()],md);const{moveTo:yd,lineTo:vd,drawPoints:xd}=Ss,{rotate:wd,getAngle:bd,getDistance:kd,defaultPoint:Ed}=ct;let Sd=class extends Yl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&wd(i,e),i}set toPoint(t){this.width=kd(Ed,t),this.rotation=bd(Ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?xd(e,t.points,t.curve,t.closed):(yd(e,0,0),vd(e,this.width,0))}};me([zr(wl)],Sd.prototype,"__",void 0),me([Er("center")],Sd.prototype,"strokeAlign",void 0),me([vr(0)],Sd.prototype,"height",void 0),me([kr()],Sd.prototype,"points",void 0),me([kr(0)],Sd.prototype,"curve",void 0),me([kr(!1)],Sd.prototype,"closed",void 0),Sd=me([Zr()],Sd);let Bd=class extends Ul{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([zr(Ol)],Bd.prototype,"__",void 0),me([vr("")],Bd.prototype,"url",void 0),Bd=me([Zr()],Bd);const Td=Bd;let Rd=class extends Ul{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=le.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new or({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ho(Ho.LOADED,{image:t}))})}draw(t,e,i,s){const n=new vt(t.worldTransform).invert(),r=new vt;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()}};me([zr(Cl)],Rd.prototype,"__",void 0),me([Kh(100)],Rd.prototype,"width",void 0),me([Kh(100)],Rd.prototype,"height",void 0),me([Kh(1)],Rd.prototype,"pixelRatio",void 0),me([Kh(!0)],Rd.prototype,"smooth",void 0),me([gr(!1)],Rd.prototype,"safeResize",void 0),me([Kh()],Rd.prototype,"contextSettings",void 0),Rd=me([Zr()],Rd);const{copyAndSpread:Ld,includes:Od,spread:Cd,setList:Pd}=jt,{stintSet:Md}=_;let Ad=class extends Yl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Qh.number(e,n),t.__letterSpacing=Qh.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"}`,Md(t,"__padding",l&&F.fourNumber(l)),Md(t,"__clipText","show"!==h&&!t.__autoSize),Md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Cd(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",!Od(h,a)),this.isOverflow?(Pd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ld(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([zr(Ll)],Ad.prototype,"__",void 0),me([vr(0)],Ad.prototype,"width",void 0),me([vr(0)],Ad.prototype,"height",void 0),me([Rr()],Ad.prototype,"boxStyle",void 0),me([gr(!1)],Ad.prototype,"resizeFontSize",void 0),me([Rr("#000000")],Ad.prototype,"fill",void 0),me([Er("outside")],Ad.prototype,"strokeAlign",void 0),me([Wr("all")],Ad.prototype,"hitFill",void 0),me([vr("")],Ad.prototype,"text",void 0),me([vr("")],Ad.prototype,"placeholder",void 0),me([vr("caption")],Ad.prototype,"fontFamily",void 0),me([vr(12)],Ad.prototype,"fontSize",void 0),me([vr("normal")],Ad.prototype,"fontWeight",void 0),me([vr(!1)],Ad.prototype,"italic",void 0),me([vr("none")],Ad.prototype,"textCase",void 0),me([vr("none")],Ad.prototype,"textDecoration",void 0),me([vr(0)],Ad.prototype,"letterSpacing",void 0),me([vr({type:"percent",value:1.5})],Ad.prototype,"lineHeight",void 0),me([vr(0)],Ad.prototype,"paraIndent",void 0),me([vr(0)],Ad.prototype,"paraSpacing",void 0),me([vr("x")],Ad.prototype,"writingMode",void 0),me([vr("left")],Ad.prototype,"textAlign",void 0),me([vr("top")],Ad.prototype,"verticalAlign",void 0),me([vr(!0)],Ad.prototype,"autoSizeAlign",void 0),me([vr("normal")],Ad.prototype,"textWrap",void 0),me([vr("show")],Ad.prototype,"textOverflow",void 0),me([Rr(!1)],Ad.prototype,"textEditing",void 0),Ad=me([Zr()],Ad);let Dd=class extends Yl{get __tag(){return"Path"}};me([zr(Bl)],Dd.prototype,"__",void 0),me([Er("center")],Dd.prototype,"strokeAlign",void 0),Dd=me([Zr()],Dd);let Id=class extends Nl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Dd(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")}};me([zr(Tl)],Id.prototype,"__",void 0),me([(t,e)=>{ar(t,e,{get(){return this.__path}})}],Id.prototype,"path",void 0),Id=me([Kr(Xs,["set","path","paint"]),Zr()],Id);let Wd=class extends Vl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&le.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Vl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[$o.END,this.__onReady,this],[Qo.START,this.__onCreated,this],[Qo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Qo.END,this.__onChildRenderEnd,this))}};Wd=me([Zr()],Wd);const Fd={},zd={isHoldSpaceKey:()=>zd.isHold("Space"),isHold:t=>Fd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Fd[t]||(Fd[t]=!0)},setUpCode(t){Fd[t]=!1}},Yd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Nd extends Fo{get spaceKey(){return zd.isHoldSpaceKey()}get left(){return Yd.left(this)}get right(){return Yd.right(this)}get middle(){return Yd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return zd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){_e.changeName(t,e)}}const{min:Xd,max:Hd,abs:Vd}=Math,{float:Ud,sign:jd}=F,{minX:Gd,maxX:Kd,minY:Zd,maxY:qd}=jt,Jd=new qt,$d=new qt,Qd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&tc.getValidMove(t.__localBoxBounds,tc.getDragBounds(t),s,e,!0),tc.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&tc.getValidScaleOf(t.__localBoxBounds,tc.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)),tc.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),tc.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=Ud(s.x),s.y=Ud(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),$d.set(e),Jd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,g,_,p,f=1,m=1;return tc.isInnerMode(t,e,i,"width")?(n.x<0&&Jd.scaleOf(s,f=1/n.x,1),_=Ud(Jd.minX-$d.minX),p=Ud($d.maxX-Jd.maxX),u=h&&_>0?1+_/(h*Jd.width):1,g=l&&p>0?1+p/(l*Jd.width):1,f*=Hd(u,g)):(n.x<0&&((Ud(Gd(t)-Gd(e))<=0||Ud(Kd(e)-Kd(t))<=0)&&Jd.scaleOf(s,f=1/n.x,1),Jd.unsign()),_=Ud($d.minX-Jd.minX),p=Ud(Jd.maxX-$d.maxX),u=h&&_>0?1-_/(h*Jd.width):1,g=l&&p>0?1-p/(l*Jd.width):1,f*=Xd(u,g)),tc.isInnerMode(t,e,i,"height")?(n.y<0&&Jd.scaleOf(s,1,m=1/n.y),_=Ud(Jd.minY-$d.minY),p=Ud($d.maxY-Jd.maxY),u=d&&_>0?1+_/(d*Jd.height):1,g=c&&p>0?1+p/(c*Jd.height):1,m*=Hd(u,g),r&&(u=Hd(Vd(f),Vd(m)),f=jd(f)*u,m=jd(m)*u)):(n.y<0&&((Ud(Zd(t)-Zd(e))<=0||Ud(qd(e)-qd(t))<=0)&&Jd.scaleOf(s,1,m=1/n.y),Jd.unsign()),_=Ud($d.minY-Jd.minY),p=Ud(Jd.maxY-$d.maxY),u=d&&_>0?1-_/(d*Jd.height):1,g=c&&p>0?1-p/(c*Jd.height):1,m*=Xd(u,g)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},tc=Qd;let ec=class extends Nd{};ec.POINTER="pointer",ec.BEFORE_DOWN="pointer.before_down",ec.BEFORE_MOVE="pointer.before_move",ec.BEFORE_UP="pointer.before_up",ec.DOWN="pointer.down",ec.MOVE="pointer.move",ec.UP="pointer.up",ec.OVER="pointer.over",ec.OUT="pointer.out",ec.ENTER="pointer.enter",ec.LEAVE="pointer.leave",ec.TAP="tap",ec.DOUBLE_TAP="double_tap",ec.CLICK="click",ec.DOUBLE_CLICK="double_click",ec.LONG_PRESS="long_press",ec.LONG_TAP="long_tap",ec.MENU="pointer.menu",ec.MENU_TAP="pointer.menu_tap",ec=me([qr()],ec);const ic=ec,sc={};let nc=class extends ec{static setList(t){this.list=t instanceof wh?t:new wh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ct.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Qd.axisMove(t,n),n}static limitMove(t,e){Qd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(sc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(sc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(sc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){sc.x=t?this.totalX:this.moveX,sc.y=t?this.totalY:this.moveY}};nc.BEFORE_DRAG="drag.before_drag",nc.START="drag.start",nc.DRAG="drag",nc.END="drag.end",nc.OVER="drag.over",nc.OUT="drag.out",nc.ENTER="drag.enter",nc.LEAVE="drag.leave",nc=me([qr()],nc);const rc=nc;let oc=class extends ec{static setList(t){nc.setList(t)}static setData(t){nc.setData(t)}};oc.DROP="drop",oc=me([qr()],oc);let ac=class extends nc{};ac.BEFORE_MOVE="move.before_move",ac.START="move.start",ac.MOVE="move",ac.DRAG_ANIMATE="move.drag_animate",ac.END="move.end",ac.PULL_DOWN="move.pull_down",ac.REACH_BOTTOM="move.reach_bottom",ac=me([qr()],ac);let hc=class extends Nd{};hc=me([qr()],hc);const lc=hc;let dc=class extends ec{};dc.BEFORE_ROTATE="rotate.before_rotate",dc.START="rotate.start",dc.ROTATE="rotate",dc.END="rotate.end",dc=me([qr()],dc);let cc=class extends nc{};cc.SWIPE="swipe",cc.LEFT="swipe.left",cc.RIGHT="swipe.right",cc.UP="swipe.up",cc.DOWN="swipe.down",cc=me([qr()],cc);let uc=class extends ec{};uc.BEFORE_ZOOM="zoom.before_zoom",uc.START="zoom.start",uc.ZOOM="zoom",uc.END="zoom.end",uc=me([qr()],uc);let gc=class extends Nd{};gc.BEFORE_DOWN="key.before_down",gc.BEFORE_UP="key.before_up",gc.DOWN="key.down",gc.HOLD="key.hold",gc.UP="key.up",gc=me([qr()],gc);const _c={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?cc.UP:t>45&&t<135?cc.DOWN:t<=45&&t>=-45?cc.RIGHT:cc.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:pc.getSwipeDirection(ct.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new wh,{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=>ho.draggable(t)||!t.isLeafer&&t.hasEvent(nc.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},pc=_c,fc=new wh,{getDragEventData:mc,getDropEventData:yc,getSwipeEventData:vc}=_c;class xc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=mc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=nc.list||this.draggableList||fc;return this.dragging&&(s?t?fc:new wh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(ac.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Yd.left(t),this.dragging&&(this.interaction.emit(nc.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ho.draggable(e)){this.draggableList=new wh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=mc(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(ac.BEFORE_MOVE,this.dragData),e.emit(ac.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(nc.BEFORE_DRAG,this.dragData),e.emit(nc.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,h=!o||!!t;s.forEach(e=>{if(e.draggable){const s=r(e.draggable),l=nc.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);o&&!s&&t?ho.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(nc.OUT,t,i),e.emit(nc.OVER,t,s)):e.emit(nc.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(nc.LEAVE,t,i,s),e.emit(nc.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=mc(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(ac.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(nc.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(ct.getDistance(e,t)>n.config.pointer.swipeDistance){const t=vc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=yc(t,e,nc.data);s.path=i,this.interaction.emit(oc.DROP,s),this.interaction.emit(nc.LEAVE,t,i)}dragReset(){nc.list=nc.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const wc=ee.get("emit");const bc=["move","zoom","rotate","key"];function kc(t,e,i,s,n){if(bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Sc(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&&Ec(r,e,i,s,n)}}function Ec(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Sc(t,n)&&(al.updateEventStyle&&!s&&al.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=_e.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Sc(t,e){return e&&e.has(t)}const Bc={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Tc,pathCanDrag:Rc,pathHasOutside:Lc}=_c;class Oc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Yd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Yd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&zd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=_.clone(Bc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new wh(t),this.createTransformer(),this.dragger=new xc(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Yd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(ec.BEFORE_DOWN,t),this.emit(ec.DOWN,t),Yd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Yd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Yd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(ec.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ct.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(ec.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Yd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(ec.BEFORE_UP,t),this.emit(ec.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(ec.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(ec.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,zd.setDownCode(e),this.emit(gc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(gc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,zd.setUpCode(e),this.emit(gc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new wh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(ec.OUT,t,i),this.emit(ec.OVER,t,e)):this.emit(ec.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(ec.LEAVE,t,i,e),this.emit(ec.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ec.LEAVE,t),this.dragger.dragging&&this.emit(oc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[ec.DOUBLE_TAP,ec.DOUBLE_CLICK].some(e=>Tc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:r}=this;v.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&&!Lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Rc(t.path))&&!Lc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:ec.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ct.round(s),s}emitTap(t){this.emit(ec.TAP,t),this.emit(ec.CLICK,t)}emitDoubleTap(t){this.emit(ec.DOUBLE_TAP,t),this.emit(ec.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(ec.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ec.LONG_TAP,t),(Tc(t.path,ec.LONG_TAP)||Tc(t.path,ec.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(qo.RESIZE,this.__onResize,this)],t.once(ta.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Ec(n,t,e,!0,s))return;n.isApp&&kc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&kc(n,t,e,!1,s),Ec(n,t,e,!1,s))return}catch(t){wc.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 Cc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Cc.custom={};class Pc extends fe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new wh,this.pixelList=new wh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),le.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),le.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())};const{toInnerRadiusPointOf:Mc,copyRadiusPoint:Ac}=ct,{hitRadiusPoint:Dc,hitPoint:Ic}=jt,Wc={},Fc={},zc=dh.prototype;zc.hit=function(t,e=0){this.updateLayout(),Ac(Fc,t,e);const i=this.__world;return!!(e?Dc(i,Fc):Ic(i,Fc))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Fc),e,{target:this}):this.__hitWorld(Fc))},zc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(Ac(Wc,t,i.hitRadius),t=Wc),Mc(t,s,Wc),i.hitBox||r){if(jt.hitRadiusPoint(n.boxBounds,Wc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(Wc,e)},zc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},zc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},zc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},zc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Yc=new vt,Nc=Yl.prototype;Nc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=v.image.hitCanvasSize,o=r.hitScale=Jt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Jt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),ir.patternLocked=!0,this.__renderShape(r,{matrix:Yc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),ir.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Nc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke: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 Xc=Yl.prototype,Hc=Ul.prototype,Vc=Jl.prototype;Hc.__updateHitCanvas=Vc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Xc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Hc.__hitFill=Vc.__hitFill=function(t){return this.__hitCanvas?Xc.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},Ad.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))},Nl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Uc=Pe.prototype;function jc(t,e,i){t.__.__font?el.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Gc(t,e,i,s,n){const r=i.__;c(t)?el.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&el.strokeArrow(t,i,s,n)}function Kc(t,e,i,s,n){const r=i.__;c(t)?el.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),el.drawTextStroke(i,s,n))}function Zc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Kc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",el.fillText(i,r,n),r.blendMode="normal",ho.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}Uc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Uc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Uc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Jt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Jt.x,Jt.y,Jt.width||1,Jt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:qc,copyAndSpread:Jc,toOuterOf:$c,getOuterOf:Qc,getByMove:tu,move:eu,getIntersectData:iu}=jt,su={};let nu;const{stintSet:ru}=_,{hasTransparent:ou}=$h;function au(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=il.image(i,t,e,o,!nu||!nu[e.url]);break;case"linear":n=sl.linearGradient(e,o);break;case"radial":n=sl.radialGradient(e,o);break;case"angular":n=sl.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;n={type:r,style:$h.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:$h.string(e)})}if(n&&(n.originPaint=e,r(n.style)&&ou(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const hu={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),nu=il.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=au(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?(ru(i,"__isAlphaPixelFill",n),ru(i,"__isTransparentFill",r)):(ru(i,"__isAlphaPixelStroke",n),ru(i,"__isTransparentStroke",r),ru(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,jc(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,il.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),jc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),jc(e,i,s),i.restoreBlendMode()):jc(e,i,s)}},fillPathOrText:jc,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)el.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Gc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Gc(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)Gc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Gc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ho.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){el.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":Zc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Kc(t,2,e,i,s):Zc(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||!il.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?el.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?el.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;$c(o.strokeSpread?(Jc(su,o.boxBounds,o.strokeSpread),su):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(v.fullImageShadow)s=a;else{const t=o.renderShapeSpread?qc(n,R.swapAndScale(o.renderShapeSpread,_,p)):n;s=iu(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=Qc(a,c),h=tu(u,-c.e,-c.f),l=Qc(r,c),eu(l,-c.e,-c.f);const y=i.matrix;y?(d=new vt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:_,scaleY:p}}};let lu,du=new qt;const{isSame:cu}=jt;function uu(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||il.createData(n,s,i,r),!0}function gu(t,e){fu(t,Ho.LOAD,e)}function _u(t,e){fu(t,Ho.LOADED,e)}function pu(t,e,i){e.error=i,t.forceUpdate("surface"),fu(t,Ho.ERROR,e)}function fu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ho(e,i))}function mu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:yu,translate:vu}=Q,xu=new qt,wu={},bu={};function ku(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 Eu={},Su={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Bu,set:Tu,rotateOfOuter:Ru,translate:Lu,scaleOfOuter:Ou,multiplyParent:Cu,scale:Pu,rotate:Mu,skew:Au}=Q;function Du(t,e,i,s,n,r,o,a){o&&Mu(t,o),a&&Au(t,a.x,a.y),n&&Pu(t,n,r),Lu(t,e.x+i,e.y+s)}const{get:Iu,scale:Wu,copy:Fu}=Q,{getFloorScale:zu}=F,{abs:Yu}=Math;const Nu={image:function(t,e,i,s,n){let r,o;const a=ir.get(i);return lu&&i===lu.paint&&cu(s,lu.boxBounds)?r=lu.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),lu=a.use>1?{leafPaint:r,paint:i,boxBounds:du.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(uu(t,e,i,a,r,s),n&&(gu(t,o),_u(t,o))):a.error?n&&pu(t,o,a.error):(n&&(mu(t,!0),gu(t,o)),r.loadId=a.load(()=>{mu(t,!1),t.destroyed||(uu(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),_u(t,o)),r.loadId=void 0},e=>{mu(t,!1),pu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize()),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}=il.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===r+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&qo.isResizing(i)||d||(e=v.image.isLarge(a,r,o)||a.width*r>8096||a.height*o>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),il.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?il.createPattern(t,i,s,n):il.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,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,ir.recyclePaint(s),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=ir.patternTasker.add(()=>ye(this,void 0,void 0,function*(){il.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=il.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!v.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=il.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/Yu(s.scaleX||1),u=h.y*r/Yu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=zu(g+(c||0)),r*=zu(_+(u||0)),d=Iu(),a&&Fu(d,a),Wu(d,1/n,1/r));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=v.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=il.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=xu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:o,mode:a,align:h,offset:l,scale:d,size:u,rotation:g,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,x={mode:a},w="center"!==h&&(g||0)%180==90;let b,k;switch(jt.set(bu,0,0,w?n:s,w?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(F.getScaleData(d,u,i,wu),b=wu.scaleX,k=wu.scaleY),(h||m||f)&&(b&&jt.scale(bu,b,k,!0),h&&Lt.toPoint(h,bu,e,bu,!0,!0))):v&&!g||(b=k=jt.getFitScale(e,bu,"fit"!==a),jt.put(e,i,h,b,!1,bu),jt.scale(bu,b,k,!0)),l&&ct.move(bu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,il.stretchMode(x,e,b,k));break;case"normal":case"clip":if(bu.x||bu.y||b||p||g||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),il.clipMode(x,e,bu.x,bu.y,b,k,g,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||_)&&il.repeatMode(x,e,s,n,bu.x,bu.y,b,k,g,_,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(m||i)&&(x.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:ku(r,i,n.width,e&&e.x),y:ku(o,s,n.height,e&&e.y)}}(m,i&&f,bu.width,bu.height,e));break;default:b&&il.fillOrFitMode(x,e,bu.x,bu.y,b,k,g)}return x.transform||(e.x||e.y)&&vu(x.transform=yu(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=k),o&&o<1&&(x.opacity=o),y&&(x.filters=y),f&&(x.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const n=Bu(),{x:r,y:o}=e;r||o?Lu(n,r,o):n.onlyScale=!0,Pu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Bu();Lu(a,e.x+i,e.y+s),Pu(a,n,r),o&&Ru(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=Bu();Du(d,e,i,s,n,r,o,a),h&&(o||a?(Tu(Su),Ou(Su,e,h,l),Cu(d,Su)):Ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Bu();if(c)Du(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Ru(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Lu(u,s,0);break;case 180:Lu(u,i,s);break;case 270:Lu(u,0,i)}Eu.x=e.x+n,Eu.y=e.y+r,Lu(u,Eu.x,Eu.y),o&&Ou(u,Eu,o,a)}t.transform=u}},{toPoint:Xu}=Bt,{hasTransparent:Hu}=$h,Vu={},Uu={};function ju(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=$h.string(n,s)):(a=n.offset,o=$h.string(n.color,s)),e.addColorStop(a,o),!h&&Hu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Gu,getDistance:Ku}=ct,{get:Zu,rotateOfOuter:qu,scaleOfOuter:Ju}=Q,{toPoint:$u}=Bt,Qu={},tg={};function eg(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Gu(e,i);r=Zu(),n?(Ju(r,e,o/a*(s||1),1),qu(r,e,t+90)):(Ju(r,e,1,o/a*(s||1)),qu(r,e,t))}return r}const{getDistance:ig}=ct,{toPoint:sg}=Bt,ng={},rg={};const og={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;Xu(i||"top",e,Vu),Xu(s||"bottom",e,Uu);const o=v.canvas.createLinearGradient(Vu.x,Vu.y,Uu.x,Uu.y),a={type:n,style:o};return ju(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;$u(i||"center",e,Qu),$u(s||"bottom",e,tg);const a=v.canvas.createRadialGradient(Qu.x,Qu.y,0,Qu.x,Qu.y,Ku(Qu,tg)),h={type:n,style:a};ju(h,a,t.stops,r);const l=eg(e,Qu,tg,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;sg(i||"center",e,ng),sg(s||"bottom",e,rg);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,ng.x,ng.y):v.canvas.createRadialGradient(ng.x,ng.y,0,ng.x,ng.y,ig(ng,rg)),h={type:n,style:a};ju(h,a,t.stops,r);const l=eg(e,ng,rg,o||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:eg},{copy:ag,move:hg,toOffsetOutBounds:lg}=jt,{max:dg,abs:cg}=Math,ug={},gg=new vt,_g={};function pg(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=cg(t.spread||0),o=dg(o,n+r-s),a=dg(a,n+r+i),h=dg(h,n+r+s),l=dg(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function fg(t,e,i){const{shapeBounds:s}=i;let n,r;v.fullImageShadow?(ag(ug,t.bounds),hg(ug,e.x-s.x,e.y-s.y),n=t.bounds,r=ug):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:mg}=jt,yg={};const vg=pg;const xg={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;lg(h,_g,l),o.forEach((o,p)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}g.setWorldShadow(_g.offsetX+(o.x||0)*c*f,_g.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,$h.string(o.color)),n=nl.getShadowTransform(t,g,i,o,_g,f),n&&g.setTransform(n),fg(g,_g,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")),ho.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;mg(h,yg,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(yg.offsetX+(o.x||0)*c*f,yg.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=nl.getShadowTransform(t,g,i,o,yg,f,!0),n&&g.setTransform(n),fg(g,yg,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,$h.string(o.color),"source-in"),ho.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:pg,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 gg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),gg}},isTransformShadow(t){},getInnerShadowSpread:vg},{excludeRenderBounds:wg}=mo;let bg;function kg(t,e,i,s,n,r,o,a){switch(e){case"grayscale":bg||(bg=!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);Sg(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Sg(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Eg(t){return t.getSameCanvas(!1,!0)}function Sg(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)}Nl.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&&(kg(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||wg(i,e)||i.__render(t,e),r=i.__.opacity,bg=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Eg(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Eg(t)),n||(n=Eg(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&kg(this,o,t,n,s,r,void 0,!1),wg(i,e)||i.__render(n||t,e),d&&kg(this,o,t,n,s,r,d,!1)}kg(this,o,t,n,s,r,void 0,!0)};const Bg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Tg=Bg+"_#~&*+\\=|≮≯≈≠=…",Rg=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 Lg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Og=Lg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Cg=Lg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Pg=Lg(Bg),Mg=Lg(Tg),Ag=Lg("- —/~|┆·");var Dg;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Dg||(Dg={}));const{Letter:Ig,Single:Wg,Before:Fg,After:zg,Symbol:Yg,Break:Ng}=Dg;function Xg(t){return Og[t]?Ig:Ag[t]?Ng:Cg[t]?Fg:Pg[t]?zg:Mg[t]?Yg:Rg.test(t)?Wg:Ig}const Hg={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 Vg(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:Ug}=Hg,{Letter:jg,Single:Gg,Before:Kg,After:Zg,Symbol:qg,Break:Jg}=Dg;let $g,Qg,t_,e_,i_,s_,n_,r_,o_,a_,h_,l_,d_,c_,u_,g_,__,p_=[];function f_(t,e){o_&&!r_&&(r_=o_),$g.data.push({char:t,width:e}),t_+=e}function m_(){e_+=t_,$g.width=t_,Qg.words.push($g),$g={data:[]},t_=0}function y_(){c_&&(u_.paraNumber++,Qg.paraStart=!0,c_=!1),o_&&(Qg.startCharSize=r_,Qg.endCharSize=o_,r_=0),Qg.width=e_,g_.width?Ug(Qg):__&&v_(),p_.push(Qg),Qg={words:[]},e_=0}function v_(){e_>(u_.maxWidth||0)&&(u_.maxWidth=e_)}const{top:x_,right:w_,bottom:b_,left:k_}=kt;function E_(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 S_={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[k_],n-=a[w_]+a[k_],!n&&(n=.01)):e.autoSizeAlign||(i=a[k_]),o?(s=a[x_],o-=a[x_]+a[b_],!o&&(o=.01)):e.autoSizeAlign||(s=a[x_]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){u_=t,p_=t.rows,g_=t.bounds,__=!g_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=v,{width:a}=g_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;c_=!0,h_=null,r_=n_=o_=t_=e_=0,$g={data:[]},Qg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)s_=e[i],"\n"===s_?(t_&&m_(),Qg.paraEnd=!0,y_(),c_=!0):(a_=Xg(s_),a_===jg&&"none"!==r&&(s_=Vg(s_,r,!t_)),n_=o.measureText(s_).width,s&&(s<0&&(o_=n_),n_+=s),l_=a_===Gg&&(h_===Gg||h_===jg)||h_===Gg&&a_!==Zg,d_=!(a_!==Kg&&a_!==Gg||h_!==qg&&h_!==Zg),i_=c_&&n?a-n:a,t&&a&&e_+t_+n_>i_&&(h?(t_&&m_(),e_&&y_()):(d_||(d_=a_===jg&&h_==Zg),l_||d_||a_===Jg||a_===Kg||a_===Gg||t_+n_>i_?(t_&&m_(),e_&&y_()):e_&&y_()))," "===s_&&!0!==c_&&e_+t_===0||(a_===Jg?(" "===s_&&t_&&m_(),f_(s_,n_),m_()):l_||d_?(t_&&m_(),f_(s_,n_)):f_(s_,n_)),h_=a_);t_&&m_(),e_&&y_(),p_.length>0&&(p_[p_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{u_.paraNumber++,e_=o.measureText(t).width,p_.push({x:n||0,text:t,width:e_,paraStart:!0}),__&&v_()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":E_(e,"x",t[k_]);break;case"right":E_(e,"x",-t[w_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":E_(e,"y",t[x_]);break;case"bottom":E_(e,"y",-t[b_])}}(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(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){if(!s)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(n.splice(r),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?v.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=$h.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 B_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!$h.object)return t;t=$h.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 T_(t){return t?d(t)?t:[t]:[]}Object.assign(Jh,S_),Object.assign($h,B_),Object.assign(el,hu),Object.assign(il,Nu),Object.assign(sl,og),Object.assign(nl,xg),Object.assign(le,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new Eh(t,e),hitCanvasManager:()=>new Pc}),Bh();class R_ extends Fo{get list(){return T_(this.value)}get oldList(){return T_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function L_(t){return(e,i)=>{const s="_"+i;ar(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?R_.BEFORE_SELECT:R_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new R_(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}R_.BEFORE_SELECT="editor.before_select",R_.SELECT="editor.select",R_.AFTER_SELECT="editor.after_select",R_.BEFORE_HOVER="editor.before_hover",R_.HOVER="editor.hover";const{abs:O_}=Math,{copy:C_}=Q,{setListWithFn:P_}=jt,{worldBounds:M_}=mo,A_={a:1,b:0,c:0,d:1,e:0,f:0},D_={x:0,y:0,width:0,height:0};class I_ extends Yl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(P_(D_,e,M_),t&&this.set(t),this.set(D_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const 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=O_(c.scaleX),l=O_(c.scaleY);C_(A_,c),A_.half=a%2,t.setWorld(A_,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),o&&(r(o)?el.stroke(o,this,t,e):el.strokes(o,this,t,e)),h&&(r(h)?el.fill(h,this,t,e):el.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}me([L_(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],I_.prototype,"target",void 0),me([Rr("render-path")],I_.prototype,"strokePathType",void 0);class W_ extends Nl{constructor(t){super(t),this.strokeArea=new Ul({strokeAlign:"center"}),this.fillArea=new Ul,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 F_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return z_([t],i,e),i}};function z_(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&&z_(s.children,e,i)}}const{findOne:Y_,findByBounds:N_}=F_;class X_ extends Nl{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new I_,this.targetStroker=new I_,this.bounds=new qt,this.selectArea=new W_,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 wh(N_(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)&&!Y_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new wh(this.editor.editBox.rect)};return Y_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Y_(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_([[R_.HOVER,this.onHover,this],[R_.SELECT,this.onSelect,this]]),e.on_([[ec.MOVE,this.onPointerMove,this],[ec.BEFORE_DOWN,this.onBeforeDown,this],[ec.TAP,this.onTap,this],[nc.START,this.onDragStart,this,!0],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ac.MOVE,this.onAutoMove,this],[[uc.ZOOM,ac.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:H_,top:V_,topRight:U_,right:j_,bottomRight:G_,bottom:K_,bottomLeft:Z_,left:q_}=Et,{toPoint:J_}=Bt,{within:$_,sign:Q_}=F,{abs:tp}=Math,ep={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=Q_(w),E=Q_(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 V_:g=t,l="bottom";break;case j_:u=e,l="left";break;case K_:g=o,l="top";break;case q_:u=a,l="right";break;case H_:g=t,u=a,l="bottom-right";break;case U_:g=t,u=e,l="bottom-left";break;case G_:g=o,u=e,l="top-left";break;case Z_:g=o,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case V_:case K_:u=g;break;case q_:case j_:g=u;break;default:d=Math.sqrt(tp(u*g)),u=Q_(u)*d,g=Q_(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(J_(r||l,_,c,!0),m){const e={x:u,y:g};Qd.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=$_(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=$_(e*g,f)/e}return T&&tp(u*y.width)<1&&(u=Q_(u)/y.width),R&&tp(g*y.height)<1&&(g=Q_(g)/y.height),n&&u!==g&&(d=Math.min(tp(u),tp(g)),u=Q_(u)*d,g=Q_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case H_:r="bottom-right";break;case U_:r="bottom-left";break;case G_:r="top-left";break;case Z_:r="top-right";break;default:r="center"}return J_(n||r,t.boxBounds,o,!0),{origin:o,rotation:ct.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case V_:case H_:r={x:.5,y:0},n="bottom",a=1;break;case K_:case G_:r={x:.5,y:1},n="top",a=1;break;case q_:case Z_:r={x:0,y:.5},n="right",h=1;break;case j_:case U_: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,J_(s||n,t,o,!0);const c=ct.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=j_;break;case H_:t=U_;break;case Z_:t=G_;break;case j_:t=q_;break;case U_:t=H_;break;case G_:t=Z_}if(i)switch(t){case V_:t=K_;break;case H_:t=Z_;break;case U_:t=G_;break;case K_:t=V_;break;case Z_:t=H_;break;case G_:t=U_}return t}},ip={};function sp(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 np(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*(ep.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(F.formatRotation(h,!0)/2);const{url:w,x:b,y:k}=x,E=w+h;ip[E]?i.cursor=ip[E]:ip[E]=i.cursor={url:rp(w,h),x:b,y:k}}function np(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function rp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class op extends Jl{constructor(t){super(t),this.useFastShadow=!0}}const ap=["top","right","bottom","left"],hp=void 0;class lp extends Nl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return r(t)||r(e)||r(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Nl,this.rect=new op({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new op({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Nl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints: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 op({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new op({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new op({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:hp},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),np(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&&jt.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=ap.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=ap.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?ep.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:hp};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)}sp(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 nc||t instanceof ac)&&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(),r(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case ac.START:this.onTransformStart(t);break;case ac.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case uc.START:this.onTransformStart(t);break;case uc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),r(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case uc.START:this.onTransformStart(t);break;case uc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){sp(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 Ad)||t.find(t=>t instanceof Ad);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[nc.START,this.onDragStart,this],[nc.DRAG,this.onDrag,this],[nc.END,this.onDragEnd,this],[ec.ENTER,e=>{this.enterPoint=t,sp(this,e)}],[ec.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[ec.DOUBLE_TAP,this.onDoubleTap,this],[ec.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[gc.HOLD,gc.UP],this.onKey,this],[gc.DOWN,this.onArrow,this],[[ac.START,ac.BEFORE_MOVE,ac.END],this.onMove,this,!0],[[uc.START,uc.BEFORE_ZOOM,uc.END],this.onScale,this,!0],[[dc.START,dc.BEFORE_ROTATE,dc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const dp={x:0,y:0,width:1e5,height:1e5};class cp extends Yl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,dp),Object.assign(this.__world,dp)}__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 up='\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"/>',gp={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${up}\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${up}\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${up}\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},_p=new qt;function pp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{_p.setListWithFn(i,t=>t.getBounds("box","page")),0===_p.width&&(_p.width=.1),0===_p.height&&(_p.height=.1),e.reset(_p.get())}),s.add(e)}const fp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),mp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),yp={group(t,e,i){t.sort(mp);const{app:s,parent:n}=t[0];let r;r=i&&i.add?i:new Nl(i),n.addAt(r,n.children.indexOf(t[0])),t.sort(fp);const o=new vt(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(fp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(mp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},vp=ee.get("EditToolCreator");function xp(){return t=>{bp.register(t)}}const wp=xp,bp={list:{},register(t){const{tag:e}=t.prototype;kp[e]&&vp.repeat(e),kp[e]=t},get:(t,e)=>new kp[t](e)},{list:kp}=bp;class Ep extends R_{constructor(t,e){super(t,e)}}Ep.BEFORE_OPEN="innerEditor.before_open",Ep.OPEN="innerEditor.open",Ep.BEFORE_CLOSE="innerEditor.before_close",Ep.CLOSE="innerEditor.close";class Sp extends R_{constructor(t,e){super(t,e)}}Sp.BEFORE_GROUP="editor.before_group",Sp.GROUP="editor.group",Sp.BEFORE_UNGROUP="editor.before_ungroup",Sp.UNGROUP="editor.ungroup",Sp.BEFORE_OPEN="editor.before_open_group",Sp.OPEN="editor.open_group",Sp.BEFORE_CLOSE="editor.before_close_group",Sp.CLOSE="editor.close_group";const{updateMatrix:Bp}=ho,Tp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Rp="top-left";class Lp extends Ul{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(No.CHANGE,e=>{if(this.checkChange&&Tp[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,Bp(this.parent),Bp(this);const a=new vt(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Bp(this),this.changedTransform=new vt(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Rp,r);break;case"scaleX":t.scaleOf(Rp,r,1);break;case"scaleY":t.scaleOf(Rp,1,r);break;case"skewX":t.skewOf(Rp,r,0);break;case"skewY":t.skewOf(Rp,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Op extends R_{constructor(t,e){super(t,e)}}Op.BEFORE_MOVE="editor.before_move",Op.MOVE="editor.move";class Cp extends R_{constructor(t,e){super(t,e)}}Cp.BEFORE_SCALE="editor.before_scale",Cp.SCALE="editor.scale";class Pp extends R_{constructor(t,e){super(t,e)}}Pp.BEFORE_ROTATE="editor.before_rotate",Pp.ROTATE="editor.rotate";class Mp extends R_{constructor(t,e){super(t,e)}}Mp.BEFORE_SKEW="editor.before_skew",Mp.SKEW="editor.skew";class Ap{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const h=t.type===ac.END||t.type===nc.END,l=r(e.draggable),d=!o||h||l,c={x:t.totalX,y:t.totalY};t instanceof ac&&ct.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=nc.getValidMove(e,s.point,c,d),(n.x||n.y)&&(o&&!l&&h?ho.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 uc?(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=ep.getScaleData(e,n.bounds,d,r,a,ep.getAround(o,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof nc&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ct.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:r,rotateGap:o,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof dc)d=t.rotation,l=r?Bt.getPoint(r,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,o=ep.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=F.float(F.getGapRotation(d,o,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),ct.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=ep.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),ep.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 Op(Op.BEFORE_MOVE,h));const l=new Op(Op.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 Cp(Cp.BEFORE_SCALE,t));const r=new Cp(Cp.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 Cp(Cp.BEFORE_SCALE,u));const g=new Cp(Cp.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 vt(ho.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 Cp(Cp.BEFORE_SCALE,o));const a=new Cp(Cp.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 Pp(Pp.BEFORE_ROTATE,d));const c=new Pp(Pp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target: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 Mp(Mp.BEFORE_SKEW,u));const g=new Mp(Mp.SKEW,u);this.doSkew(g),this.emitEvent(g)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ho.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new vt(e.worldTransform);return t(),new vt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Dp=class extends Nl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new wh,this.openedGroupList=new wh,this.simulateTarget=new Lp(this),this.editBox=new lp(this),this.editToolList={},this.selector=new X_(this),this.editMask=new cp(this),this.targetEventIds=[];let i=_.clone(gp);t&&(i=_.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),he.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>_.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&pp(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||bp.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(bp.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Sp.BEFORE_GROUP),this.target=yp.group(this.list,this.element,t),this.emitGroupEvent(Sp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.BEFORE_UNGROUP,t)),this.target=yp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Sp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Sp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Sp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Sp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Sp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ho.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Sp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||bp.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}bp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Ep.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Ep.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Ep.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Ep.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Ep(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&&(yp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(yp.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_(Qo.START,this.onRenderStart,this),i&&i.on_(No.SCROLL,this.onChildScroll,this),t.on_(Qo.CHILD_START,this.onAppRenderStart,this),t.on_(ta.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};me([(t,e)=>{ar(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}})}],Dp.prototype,"mergeConfig",void 0),me([L_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof wh?i:new wh(i),t.multiple&&pp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new R_(R_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new R_(R_.AFTER_SELECT,s))})],Dp.prototype,"target",void 0),me([L_(function(t,e){t.emitEvent(new R_(R_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Dp.prototype,"hoverTarget",void 0),Dp=me([Kr(Ap,["editBox","editTool","emitEvent"])],Dp);class Ip{static registerInnerEditor(){bp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Nl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Wp=class extends Ip{static registerEditTool(){bp.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()}};Wp=me([xp()],Wp);const{left:Fp,right:zp}=Et,{move:Yp,copy:Np,toNumberPoints:Xp}=ct;let Hp=class extends Wp{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===Fp;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=Xp(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?(Yp(t,r,o),s&&Yp(e,-r,-o)):(s&&Yp(t,-r,-o),Yp(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;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),Np(s[7],i),Np(e[7],i),Np(s[3],a),Np(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Fp||t===zp,s[t].visible=a,e[t].visible=!o&&a}};Hp=me([xp()],Hp);const{M:Vp,L:Up,C:jp,Q:Gp,Z:Kp,N:Zp,D:qp,X:Jp,G:$p,F:Qp,O:tf,P:ef,U:sf}=De,nf={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case Vp:case Up:rf(t,e,i,n,1),n+=3;break;case jp:rf(t,e,i,n,3),n+=7;break;case Gp:rf(t,e,i,n,2),n+=5;break;case Kp:n+=1;break;case Zp:rf(t,e,i,n,2),n+=5;break;case qp:rf(t,e,i,n,2),n+=9;break;case Jp:rf(t,e,i,n,2),n+=6;break;case $p:rf(t,e,i,n,2),n+=9;break;case Qp:rf(t,e,i,n,2),n+=5;break;case tf:t[n]=$p,t.splice(n+4,0,t[n+3],0),rf(t,e,i,n,2),n+=9,r+=2;break;case ef:t[n]=Qp,t.splice(n+4,0,t[n+3]),rf(t,e,i,n,2),n+=5,r+=1;break;case sf:rf(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:rf}=nf,of=Q.get(),{topLeft:af,top:hf,topRight:lf,right:df,bottom:cf,left:uf}=Et;function gf(t,e,i){t.pathInputed?_f(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function _f(t,e,i){nf.scale(t.__.path,e,i),t.path=t.__.path}function pf(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):nf.scalePoints(s,e,i),t.points=s}function ff(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)of.a=e,of.d=i,s[t].transform(of,!0)}const mf=dh.prototype;function yf(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function vf(t,e,i){xf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(ac.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(yf(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_(ac.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(ac.END,e=>{ho.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(uc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function xf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&_.assign(i,e),_.assign(t.config,i,t.userConfig)}mf.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},mf.__scaleResize=function(t,e){gf(this,t,e)},mf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},mf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Ad.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 hf:case cf:r=i,s.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case uf:case df:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case af:case lf: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),gf(this,t,e)}},Dd.prototype.__scaleResize=function(t,e){_f(this,t,e)},Sd.prototype.__scaleResize=function(t,e){this.pathInputed?_f(this,t,e):this.points?pf(this,t,e):this.width*=t},dd.prototype.__scaleResize=function(t,e){this.pathInputed?_f(this,t,e):this.points?pf(this,t,e):gf(this,t,e)},Nl.prototype.__scaleResize=function(t,e){ff(this,t,e)},Jl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||gf(this,t,e),i&&ff(this,t,e)},he.add("resize"),he.add("editor","resize"),le.editor=function(t,e){const i=new Dp(t);return e&&e.sky.add(e.editor=i),i},Jl.addAttr("textBox",!1,gr),Yl.addAttr("editConfig",void 0,gr),Yl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),gr),Yl.addAttr("editInner","PathEditor",gr),Nl.addAttr("editInner","",gr),Ad.addAttr("editInner","TextEditor",gr),Yl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Yl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Yl.setEditInner=function(t){this.changeAttr("editInner",t)};const wf=ee.get("LeaferTypeCreator"),bf={list:{},register(t,e){kf[t]&&wf.repeat(t),kf[t]=e},run(t,e){const i=kf[t];i&&i(e)}},{list:kf,register:Ef}=bf;Ef("viewport",vf),Ef("custom",function(t){vf(t,null,!0)}),Ef("design",function(t){vf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Ef("document",function(t){vf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Sf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ct.getCenter(e.from,i.from),n=ct.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=ct.getDistance(e.from,i.from);return{move:r,scale:ct.getDistance(e.to,i.to)/o,rotation:ct.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Bf,s=Bf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Bf.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)?Bf.getType(i.totalData,e):"none"},add(t,e){e&&(ct.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Bf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Bf=Sf,{abs:Tf,max:Rf}=Math,{sign:Lf,within:Of}=F,Cf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=Tf(s),o=Tf(n);return r>50&&(s=Rf(50,r/3)*Lf(s)),o>50&&(n=Rf(50,o/3)*Lf(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&&(v.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=Of(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Of(1-Tf(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let Pf,Mf,Af,Df;class If{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Pf=0,Mf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Pf,totalY:Mf}),e.emit(ac.START,this.moveData)),t.path=this.moveData.path,t.totalX=Pf+=t.moveX,t.totalY=Mf+=t.moveY,e.emit(ac.BEFORE_MOVE,t),e.emit(ac.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Af=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Af}),e.emit(uc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Af*=t.scale,e.emit(uc.BEFORE_ZOOM,t),e.emit(uc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Df=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Df}),e.emit(dc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Df+=t.rotation,e.emit(dc.BEFORE_ROTATE,t),e.emit(dc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(ac.END,Object.assign(Object.assign({},e),{totalX:Pf,totalY:Mf})),i&&t.emit(uc.END,Object.assign(Object.assign({},i),{totalScale:Af})),s&&t.emit(dc.END,Object.assign(Object.assign({},s),{totalRotation:Df})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Wf=Vl.prototype,Ff=new qt,zf=new mt;function Yf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Nf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Wf.initType=function(t){bf.run(t,this)},Wf.getValidMove=function(t,e,i=!0){const{disabled:s}=this.app.config.move;zf.set(t,e);const n=yf(this);return n&&(n.includes("x")?zf.y=0:n.includes("y")?zf.x=0:Math.abs(zf.x)>Math.abs(zf.y)?zf.y=0:zf.x=0,i&&n.includes("limit")&&(Ff.set(this.__world).addPoint(this.zoomLayer),Qd.getValidMove(Ff,this.canvas.bounds,"auto",zf,!0),n.includes("x")?zf.y=0:n.includes("y")&&(zf.x=0))),{x:s?0:zf.x,y:s?0:zf.y}},Wf.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 Xf=Oc.prototype;Xf.createTransformer=function(){this.transformer=new If(this)},Xf.move=function(t){this.transformer.move(t)},Xf.zoom=function(t){this.transformer.zoom(t)},Xf.rotate=function(t){this.transformer.rotate(t)},Xf.transformEnd=function(){this.transformer.transformEnd()},Xf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed: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):Cf.getScale(t,e);if(1!==r)this.zoom(Nf(r,t));else{const s=e.getMove?e.getMove(t,e):Cf.getMove(t,e);i.snap&&ct.round(s),this.move(Yf(s,t))}},Xf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Sf.getData(e),{moving:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Sf.detect(n,c(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}Sf.reset()}r||(n.center=Sf.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(Nf(n.scale,t)),r&&this.move(Yf(n.move,t))};const Hf=xc.prototype,{abs:Vf,min:Uf,max:jf,hypot:Gf}=Math;function Kf(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}Hf.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>=jf(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=Gf(l.moveX,l.moveY),h>u&&(u=h);if(g&&(d/=g,c/=g),u>8){const t=1.15+Uf((u-8)/17,1)*(1.6-1.15);d*=t,c*=t}const m=jf(Vf(d),Vf(c));m>r&&(h=r/m,d*=h,c*=h);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),Vf(d)<n&&Vf(c)<n)return this.dragEndReal(t);ct.move(t,d,c),this.drag(t),this.animate(y),e.emit(ac.DRAG_ANIMATE,t)};this.animate(y)}return i},Hf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Hf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},Hf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Hf.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=jt.maxX(o),d=jt.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,ct.move(i,c,u),ct.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Hf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},he.add("viewport"),he.add("view"),Vl.prototype.zoom=function(t,e,i,s){let 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 qt,_={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=Kf(y,"in");break;case"out":p=Kf(y,"out");break;case"fit":t=x;break;case"fit-width":(t=new qt(x)).height=0;break;case"fit-height":(t=new qt(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,mo.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,ct.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(a=0),ct.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class Zf extends Nl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&_.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;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 Jl,this.scrollYBar=new Jl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new qt(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_(nc.DRAG,this.onDrag,this),e.on_(nc.DRAG,this.onDrag,this),t.on_(nc.END,this.onDragEnd,this),e.on_(nc.END,this.onDragEnd,this),this.target.on_(Qo.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())}}he.add("scroll");class qf extends wl{}function Jf(t){return dr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wr(this),t.__useArrow=e,Sr(this)}}}))}let $f=class extends Sd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){tl.register(t,e)}};me([zr(qf)],$f.prototype,"__",void 0),me([Jf("angle")],$f.prototype,"endArrow",void 0),$f=me([Zr()],$f);const{M:Qf,L:tm,C:em,Q:im,O:sm}=De,{rotate:nm,copyFrom:rm,scale:om}=ct,am={},hm={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 Qf:case tm:lm(t,l+1,e,i,s,n,r,o),l+=3;break;case em:for(h=1;h<6;h+=2)lm(t,l+h,e,i,s,n,r,o);l+=7;break;case im:for(h=1;h<4;h+=2)lm(t,l+h,e,i,s,n,r,o);l+=5;break;case sm: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){hm.layout(t,0,0,1,1,e,i)}};function lm(t,e,i,s,n,r,o,a){rm(am,t[e],t[e+1]),o&&nm(am,o,a),n&&om(am,n,r),t[e]=i+am.x,t[e+1]=s+am.y}const{layout:dm,rotate:cm}=hm,{getAngle:um}=ct,gm={x:-.5},_m={connect:gm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},pm={connect:gm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},fm={connect:gm,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]},mm={connect:gm,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]},ym={offset:gm,path:[...fm.path],dashPath:[1,-2.5,0,2,-1,0]};cm(ym.path,180,{x:-1.5,y:0});const vm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},xm={connect:{x:.5},path:[...vm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},wm={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]},bm={path:[...wm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},km=_.clone(wm),Em=_.clone(bm);cm(km.path,45),cm(Em.path,45);const Sm={angle:_m,"angle-side":pm,arrow:mm,triangle:fm,"triangle-flip":ym,circle:xm,"circle-line":vm,square:bm,"square-line":wm,diamond:Em,"diamond-line":km,mark:{offset:gm,path:[1,0,-2,2,0,2]}};function Bm(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Sm[e.type]):a=e:a=Sm[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&&dm(y,0,0,h,h),m&&dm(y,m,0),dm(y,s.x,s.y,n,n,um(i,s)),r.x=(f+m)*n,y}const{M:Tm,L:Rm,C:Lm,Q:Om,Z:Cm,N:Pm,D:Mm,X:Am,G:Dm,F:Im,O:Wm,P:Fm,U:zm}=De,{copy:Ym,copyFrom:Nm,getDistancePoint:Xm}=ct,Hm={},Vm={},Um={},jm={},Gm={},Km={list:Sm,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 Tm:case Rm:(c<2||l+6>=d)&&(Nm(Gm,r[l+1],r[l+2]),!c&&u&&Ym(Vm,Gm)),l+=3;break;case Lm:(1===c||l+7>=d-3)&&Zm(r,jm,Gm,l+3),l+=7;break;case Om:(1===c||l+5>=d-3)&&Zm(r,jm,Gm,l+1),l+=5;break;case Cm:return;case Pm:l+=5;break;case Mm:l+=9;break;case Am:l+=6;break;case Dm:l+=9;break;case Im:l+=5;break;case Wm:l+=7;break;case Fm:l+=4;break;case zm:(1===c||l+6>=d-3)&&(Zm(r,jm,Gm,l+1),l+6!==d&&(Gm.x-=(Gm.x-jm.x)/10,Gm.y-=(Gm.y-jm.y)/10)),l+=6}if(c++,1===c&&h!==Tm)return;if(2===c&&u&&Ym(Um,h===Rm?Gm:jm),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Bm(t,e,Um,Vm,s,Hm,!!n);n?d.push(...i):o.push(...i),Hm.x&&(Xm(Vm,Um,-Hm.x,!0),o[1]=Um.x,o[2]=Um.y)}if(i&&"none"!==i){const e=Bm(t,i,jm,Gm,s,Hm,!!n);if(n?d.push(...e):o.push(...e),Hm.x){let t;switch(Xm(Gm,jm,-Hm.x,!0),h){case Rm:t=l-3+1;break;case Lm:t=l-7+5;break;case Om:t=l-5+3;break;case zm:t=l-6+3}t&&qm(o,jm,t)}}}else Ym(jm,Gm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Zm(t,e,i,s){Nm(e,t[s],t[s+1]),Nm(i,t[s+2],t[s+3])}function qm(t,e,i){t[i]=e.x,t[i+1]=e.y}he.add("arrow"),Yl.addAttr("startArrow","none",Jf),Yl.addAttr("endArrow","none",Jf),Object.assign(tl,Km),Object.assign(el,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:Jm,NoAndSkip:$m,YesAndSkip:Qm}=e,ty={},ey={},iy={};class sy{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"#":ty.id=t.substring(1),t=ty;break;case".":ey.className=t.substring(1),t=ey;break;default:iy.tag=t,t=iy}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&&ho.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===Jm||r===Qm){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<$m&&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_(zo.REMOVE,this.__onRemoveChild,this),this.target.on_(No.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const ny=Yl.prototype;function ry(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=le.selector())}ny.find=function(t,e){return ry(this).getBy(t,this,!1,e)},ny.findOne=function(t,e){return ry(this).getBy(t,this,!0,e)},he.add("find"),le.finder=function(t){return new sy(t)};const{setPoint:oy,addPoint:ay,toBounds:hy}=wt;const ly={syncExport(t,e,i){let n;ol.running=!0;try{const r=Kn.fileType(e),o=e.includes(".");i=Kn.getExportOptions(i);const{toURL:a}=v,{download:h}=v.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,x=s(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,k=Kn.isOpaqueImage(e)||b,E=new vt;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":E.set(l);break;case"local":E.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:E.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};F.getScaleData(i.scale,i.size,r,S);let B=i.pixelRatio||1,{x:T,y:R,width:L,height:O}=new qt(r).scale(S.scaleX,S.scaleY);_&&(T+=_.x,R+=_.y,L=_.width,O=_.height);const C={exporting:!0,matrix:E.scale(1/S.scaleX,1/S.scaleY).invert().translate(-T,-R).withScale(1/a*S.scaleX,1/h*S.scaleY)};let P,M=le.canvas({width:Math.floor(L),height:Math.floor(O),pixelRatio:B,smooth:x,contextSettings:w});g&&(P=t,P.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save();const A=u&&!s(b),D=t.get("fill");if(A&&(t.fill=""),v.render(t,M,C),A&&(t.fill=D),M.restore(),P&&P.__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?ay(o,n,r):oy(o={},n,r)),a++;const h=new qt;return o&&(hy(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};M=le.canvas(s),M.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=F.fourNumber(m),n=M,{width:r,height:o}=n;M=le.canvas({width:r+s+e,height:o+t+i,pixelRatio:B}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}k&&M.fillWorld(M.bounds,b||"#FFFFFF","destination-over"),y&&y(M);n={data:"canvas"===e?M:M.export(e,i),width:M.pixelWidth,height:M.pixelHeight,renderBounds:r,trimBounds:o};const I=c&&c.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return ol.running=!1,n},export(t,e,i){return ol.running=!0,function(t){dy||(dy=new $n);return new Promise(e=>{dy.add(()=>ye(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const r=()=>ye(this,void 0,void 0,function*(){if(!tr.isComplete)return v.requestRender(r);const o=ol.syncExport(t,e,i);o.data instanceof Promise&&(o.data=yield o.data),s(o),n()});t.updateLayout(),cy(t);const{leafer:o}=t;o?o.waitViewCompleted(r):r()}))}};let dy;function cy(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>cy(t))}const uy=Pe.prototype,gy=ee.get("@leafer-in/export");uy.export=function(t,e){const{quality:i,blob:s}=Kn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},uy.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{gy.error(t),i(null)})})},uy.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},uy.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{gy.error(t),i(!1)})})},he.add("export"),Object.assign(ol,ly),Yl.prototype.export=function(t,e){return ol.export(this,t,e)},Yl.prototype.syncExport=function(t,e){return ol.syncExport(this,t,e)};const _y={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},py={top:"flex-start",middle:"center",bottom:"flex-end"},fy={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function my(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=$h.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=$h.string(r(t)?t:t.color);break;default:s(e.r)||(i=$h.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=$h.string(u.color))):g=u,n.textDecoration=fy[g],n.textTransform=_y[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=py[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 yy=class extends Ip{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 Ad),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_(ec.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 vt(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||my(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)}};yy=me([wp()],yy),he.add("text-editor","editor");class vy extends Ol{setText(t){this._text=t,this.__htmlChanged=!0}}const xy={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 wy=class extends Bd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),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=xy[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){r(t)?xy[t]=e:Object.assign(xy,t)}};me([zr(vy)],wy.prototype,"__",void 0),me([vr("")],wy.prototype,"text",void 0),me([gr("TextEditor")],wy.prototype,"editInner",void 0),me([Rr(!1)],wy.prototype,"textEditing",void 0),wy=me([Zr()],wy),he.add("html");export{Lt as AlignHelper,e as Answer,Wd as App,Bt as AroundHelper,$f as Arrow,qf as ArrowData,$t as AutoBounds,hi as BezierHelper,qt as Bounds,Vo as BoundsEvent,jt as BoundsHelper,Jl as Box,yl as BoxData,xh as Branch,wo as BranchHelper,Fa as BranchRender,Rd as Canvas,Cl as CanvasData,fe as CanvasManager,zo as ChildEvent,$h as ColorConvert,le as Creator,Cc as Cursor,_ as DataHelper,ee as Debug,kt as Direction4,Et as Direction9,Qd as DragBoundsHelper,nc as DragEvent,xc as Dragger,oc as DropEvent,lp as EditBox,ep as EditDataHelper,op as EditPoint,X_ as EditSelect,F_ as EditSelectHelper,Wp as EditTool,bp as EditToolCreator,Dp as Editor,R_ as EditorEvent,Sp as EditorGroupEvent,yp as EditorHelper,Op as EditorMoveEvent,Pp as EditorRotateEvent,Cp as EditorScaleEvent,Mp as EditorSkewEvent,nl as Effect,id as Ellipse,kl as EllipseData,mi as EllipseHelper,Fo as Event,_e as EventCreator,aa as Eventer,ol as Export,Kn as FileHelper,rl as Filter,sy as Finder,R as FourNumberHelper,$l as Frame,xl as FrameData,Nl as Group,ml as GroupData,wy as HTMLText,vy as HTMLTextData,Pc as HitCanvasManager,Bd as Image,Ol as ImageData,Ho as ImageEvent,ir as ImageManager,w as IncrementId,Ip as InnerEditor,Ep as InnerEditorEvent,Oc as InteractionBase,_c as InteractionHelper,gc as KeyEvent,zd as Keyboard,$o as LayoutEvent,zh as Layouter,dh as Leaf,Da as LeafBounds,mo as LeafBoundsHelper,f as LeafData,xa as LeafDataProxy,ya as LeafEventer,ho as LeafHelper,Wo as LeafLayout,bh as LeafLevelList,wh as LeafList,Ta as LeafMatrix,Ia as LeafRender,Vl as Leafer,Eh as LeaferCanvas,Pe as LeaferCanvasBase,vl as LeaferData,ta as LeaferEvent,or as LeaferImage,bf as LeaferTypeCreator,Sd as Line,wl as LineData,Hp as LineEditTool,F as MathHelper,vt as Matrix,Q as MatrixHelper,ac as MoveEvent,Sf as MultiTouchHelper,rc as MyDragEvent,Td as MyImage,ic as MyPointerEvent,lc as MyTouchEvent,We as NeedConvertToCanvasCommandMap,Y as OneRadian,N as PI2,X as PI_2,el as Paint,sl as PaintGradient,il as PaintImage,Dd as Path,tl as PathArrow,Km as PathArrowModule,In as PathBounds,Ss as PathCommandDataHelper,De as PathCommandMap,yi as PathCommandNodeHelper,is as PathConvert,Hn as PathCorner,Xs as PathCreator,Bl as PathData,nn as PathDrawer,Me as PathHelper,hm as PathMatrixHelper,t as PathNodeHandleType,Ne as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Id as Pen,Tl as PenData,Uh as Picker,v as Platform,he as Plugin,mt as Point,ct as PointHelper,Yd as PointerButton,ec as PointerEvent,dd as Polygon,El as PolygonData,No as PropertyEvent,Ul as Rect,bl as RectData,Xe as RectHelper,Fl as RectRender,Qo as RenderEvent,Nh as Renderer,qo as ResizeEvent,tr as Resource,dc as RotateEvent,re as Run,Zf as ScrollBar,W_ as SelectArea,jh as Selector,md as Star,Sl as StarData,al as State,Qt as StringNumberMap,I_ as Stroker,cc as SwipeEvent,Jn as TaskItem,$n as TaskProcessor,Ad as Text,Jh as TextConvert,Ll as TextData,yy as TextEditor,hc as TouchEvent,Ap as TransformTool,If as Transformer,hl as Transition,wt as TwoPointBoundsHelper,Yl as UI,Al as UIBounds,ce as UICreator,pl as UIData,Nd as UIEvent,Il as UIRender,Qh as UnitConvert,To as WaitHelper,Jo as WatchEvent,Rh as Watcher,Cf as WheelEventHelper,uc as ZoomEvent,vf as addViewport,xf as addViewportConfig,Tr as affectRenderBoundsType,Er as affectStrokeBoundsType,Jf as arrowType,cr as attr,fr as autoLayoutType,vr as boundsType,Gn as canvasPatch,Ce as canvasSizeAttrs,qh as createAttr,lr as createDescriptor,Fr as cursorType,zr as dataProcessor,gr as dataType,dr as decorateLeafAttr,Nr as defineDataProcessor,ar as defineKey,ur as defineLeafAttr,Lr as dimType,wr as doBoundsType,Sr as doStrokeType,Gh as effectType,i as emptyData,Ir as eraserType,Xo as extraPropertyEventMap,V as getBoundsData,hr as getDescriptor,U as getMatrixData,H as getPointData,Wr 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,Yr as layoutProcessor,ra as leaferTransformAttrMap,Dr as maskType,xr as naturalBoundsType,Or as opacityType,Vn as path,br as pathInputType,kr as pathType,Un as pen,_r as positionType,xp as registerEditTool,wp as registerInnerEditor,Zr as registerUI,qr as registerUIEvent,Kh as resizeType,Ur as rewrite,jr as rewriteAble,yr as rotationType,mr as scaleType,pr as scrollType,Ar as sortType,Br as strokeType,Rr as surfaceType,Jt as tempBounds,xt as tempMatrix,yt as tempPoint,l as tryToNumber,Bh as useCanvas,Kr as useModule,kh as version,Cr as visibleType,Zh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|