@leafer/worker 1.9.12 → 1.10.0
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 +588 -526
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +612 -544
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";const e={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",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const o={};function r(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;function u(t){return"string"==typeof t&&c.test(t)?+t:t}const{isArray:p}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!p(t)}function f(t){return"{}"===JSON.stringify(t)}const m={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return y(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=m;class v{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(p(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}let w,x,b;const{max:E}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(S,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=P(t),x=e):d(e)?(w=t,x=P(e)):(w=t,x=e),4!==w.length&&(w=T(w)),4!==x.length&&(x=T(x))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(R(t,e,i),B(b,E(w[0],x[0]),E(w[1],x[1]),E(w[2],x[2]),E(w[3],x[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(R(t,e,i),B(b,w[0]+x[0],w[1]+x[1],w[2]+x[2],w[3]+x[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,a,h]=4===t.length?t:T(t);return B(n,a*i,h*e,o*i,r*e)}},{set:B,get:T,setTemp:P,toTempAB:R}=k,{round:L,pow:C,PI:O}=Math,A={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),A.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:C(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&A.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:D,randColor:t=>`rgba(${D(255)},${D(255)},${D(255)},${t||1})`};function D(t){return Math.round(Math.random()*t)}const M=O/180,I=2*O,F=O/2;function W(){return{x:0,y:0}}function z(){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:H,cos:N,acos:Y,sqrt:X}=Math,{float:V}=A,G={};function j(){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 K={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:j(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:U,getWorld:j,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){Z.toInnerPoint(t,e,G),Z.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){Z.translateInner(t,e.x,e.y),Z.scale(t,i,s),Z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=N(e*=M),a=H(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){Z.toInnerPoint(t,e,G),Z.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){Z.translateInner(t,e.x,e.y),Z.rotate(t,i),Z.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=M,t.a=s+o*i,t.b=n+r*i),e&&(e*=M,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){Z.toInnerPoint(t,e,G),Z.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){Z.translateInner(t,e.x,e.y),Z.skew(t,i,s),Z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n){const{e:o,f:a}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Z.multiply(t,Z.tempInvert(e))},divideParent(t,e){Z.multiplyParent(t,Z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Z;return Z.copy(e,t),Z.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*M,r=N(o),a=H(o);if(s||n){const e=s*M,i=n*M;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&Z.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,p,g,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=X(n*n+o*o),c=t/d;const e=n/d;u=o>0?Y(e):-Y(e)}else{c=X(r*r+a*a),d=t/c;const e=r/c;u=F-(a>0?Y(-e):-Y(e))}const e=V(N(u)),i=H(u);d=V(d),c=V(c),p=e?V((r/c+i)/e/M,9):0,g=e?V((o/d-i)/e/M,9):0,u=V(u/M)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=X(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){Z.set(t)}},Z=K,{toInnerPoint:q,toOuterPoint:J}=K,{sin:$,cos:Q,abs:tt,sqrt:et,atan2:it,min:st,round:nt}=Math,ot={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?nt(t.x-.5)+.5:nt(t.x),t.y=e?nt(t.y-.5)+.5:nt(t.y)},move(t,e,i){g(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=rt.defaultPoint);const s=Q(e*=M),n=$(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=rt;return ht(i,t),q(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=rt;return ht(i,t),J(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=rt;return ht(i,t),rt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),q(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){q(e,t,i)},toOuterOf(t,e,i){J(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)=>at(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=tt(i-t),o=tt(s-e);return et(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>st(at(t,e,i,s),at(i,s,n,o)),getAngle:(t,e)=>lt(t,e)/M,getRotation:(t,e,i,s)=>(s||(s=e),rt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/M),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>it(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=lt(t,e);return(e=s?e:{}).x=t.x+Q(n)*i,e.y=t.y+$(n)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){rt.reset(t)}},rt=ot,{getDistanceFrom:at,copy:ht,getAtan2:lt}=rt;class dt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new dt(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new dt(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i){return new dt(ot.getDistancePoint(this,t,e,i))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}reset(){return ot.reset(this),this}}const ct=new dt;class ut{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return g(t)?K.copy(this,t):K.set(this,t,e,i,s,n,o),this}setWith(t){return K.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new ut(this)}translate(t,e){return K.translate(this,t,e),this}translateInner(t,e){return K.translateInner(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleWith(t,e){return K.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return K.pixelScale(this,t),this}scaleOfOuter(t,e,i){return K.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return K.scaleOfInner(this,t,e,i),this}rotate(t){return K.rotate(this,t),this}rotateOfOuter(t,e){return K.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return K.rotateOfInner(this,t,e),this}skew(t,e){return K.skew(this,t,e),this}skewOfOuter(t,e,i){return K.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return K.skewOfInner(this,t,e,i),this}multiply(t){return K.multiply(this,t),this}multiplyParent(t){return K.multiplyParent(this,t),this}divide(t){return K.divide(this,t),this}divideParent(t){return K.divideParent(this,t),this}invert(){return K.invert(this),this}invertWith(){return K.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){K.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){K.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return K.setLayout(this,t,e,i),this}getLayout(t,e,i){return K.getLayout(this,t,e,i)}withScale(t,e){return K.withScale(this,t,e)}reset(){K.reset(this)}}const pt=new ut,gt={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){_t(t,e,i),_t(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:_t}=gt;var ft,mt;t.Direction4=void 0,(ft=t.Direction4||(t.Direction4={}))[ft.top=0]="top",ft[ft.right=1]="right",ft[ft.bottom=2]="bottom",ft[ft.left=3]="left",t.Direction9=void 0,(mt=t.Direction9||(t.Direction9={}))[mt.topLeft=0]="topLeft",mt[mt.top=1]="top",mt[mt.topRight=2]="topRight",mt[mt.right=3]="right",mt[mt.bottomRight=4]="bottomRight",mt[mt.bottom=5]="bottom",mt[mt.bottomLeft=6]="bottomLeft",mt[mt.left=7]="left",mt[mt.center=8]="center",mt[mt["top-left"]=0]="top-left",mt[mt["top-right"]=2]="top-right",mt[mt["bottom-right"]=4]="bottom-right",mt[mt["bottom-left"]=6]="bottom-left";const yt=[{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}];yt.forEach(t=>t.type="percent");const vt={directionData:yt,tempPoint:{},get:wt,toPoint(t,e,i,s,n,o){const r=wt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),vt.toPoint(t,e,i,!0),i)};function wt(e){return h(e)?yt[t.Direction9[e]]:e}const{toPoint:xt}=vt,bt={toPoint(t,e,i,s,n,o){xt(t,i,s,n,e,o)}},{tempPointBounds:Et,setPoint:St,addPoint:kt,toBounds:Bt}=gt,{toOuterPoint:Tt}=K,{float:Pt,fourNumber:Rt}=A,{floor:Lt,ceil:Ct}=Math;let Ot,At,Dt,Mt;const It={},Ft={},Wt={},zt={tempBounds:Wt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:o,y:r,width:a,height:h}=e;if(p(i)){const e=Rt(i);s?Ut.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ut.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ut.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ut.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Nt(e,t):e=t,i||(i=t),e.offsetX=Ut.maxX(i),e.offsetY=Ut.maxY(i),Ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ut.copy(Wt,t),Ut.toOuterOf(Wt,e),Wt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ut.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else It.x=t.x,It.y=t.y,Tt(e,It,Ft),St(Et,Ft.x,Ft.y),It.x=t.x+t.width,Tt(e,It,Ft),kt(Et,Ft.x,Ft.y),It.y=t.y+t.height,Tt(e,It,Ft),kt(Et,Ft.x,Ft.y),It.x=t.x,Tt(e,It,Ft),kt(Et,Ft.x,Ft.y),Bt(Et,i)},toInnerOf(t,e,i){i||(i=t),Ut.move(i,-e.e,-e.f),Ut.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ut.getFitScale(t,e));return new ut(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),h(s)&&(s=Ut.getFitScale(t,e,"cover"===s)),Wt.width=n?e.width*=s:e.width*s,Wt.height=n?e.height*=s:e.height*s,bt.toPoint(i,Wt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ut.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ut.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ut.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Lt(t.x),t.y=Lt(t.y),t.width=e>t.x?Ct(t.width+e-t.x):Ct(t.width),t.height=i>t.y?Ct(t.height+i-t.y):Ct(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=Pt(t.x,e),t.y=Pt(t.y,e),t.width=Pt(t.width,e),t.height=Pt(t.height,e)},add(t,e,i){Ot=t.x+t.width,At=t.y+t.height,Dt=e.x,Mt=e.y,i||(Dt+=e.width,Mt+=e.height),Ot=Ot>Dt?Ot:Dt,At=At>Mt?At:Mt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ot-t.x,t.height=At-t.y},addList(t,e){Ut.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ut.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ut.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||Nt(t,n)):Ht(t,n));o&&Ut.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?St(Et,t.x,t.y):kt(Et,t.x,t.y)),Bt(Et,t)},setPoint(t,e){Ut.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ot.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ut.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ut.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ut.tempToOuterOf(e,i)),!Ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return Ot=s+o,At=n+r,Dt=t.x+t.width,Mt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ot=Ot<Dt?Ot:Dt,At=At<Mt?At:Mt,o=Ot-s,r=At-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Ut.copy(t,Ut.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ut.set(t)}},Ut=zt,{add:Ht,copy:Nt}=Ut;class Yt{get minX(){return zt.minX(this)}get minY(){return zt.minY(this)}get maxX(){return zt.maxX(this)}get maxY(){return zt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?zt.copy(this,t):zt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Yt(this)}move(t,e){return zt.move(this,t,e),this}scale(t,e,i){return zt.scale(this,t,e,i),this}scaleOf(t,e,i){return zt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return zt.toOuterOf(this,t,e),this}toInnerOf(t,e){return zt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return zt.getFitMatrix(this,t,e)}put(t,e,i){zt.put(this,t,e,i)}spread(t,e){return zt.spread(this,t,e),this}shrink(t,e){return zt.shrink(this,t,e),this}ceil(){return zt.ceil(this),this}unsign(){return zt.unsign(this),this}float(t){return zt.float(this,t),this}add(t){return zt.add(this,t),this}addList(t){return zt.setList(this,t,!0),this}setList(t){return zt.setList(this,t),this}addListWithFn(t,e){return zt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return zt.setListWithFn(this,t,e),this}setPoint(t){return zt.setPoint(this,t),this}setPoints(t){return zt.setPoints(this,t),this}addPoint(t){return zt.addPoint(this,t),this}getPoints(){return zt.getPoints(this)}hitPoint(t,e){return zt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return zt.hitRadiusPoint(this,t,e)}hit(t,e){return zt.hit(this,t,e)}includes(t,e){return zt.includes(this,t,e)}intersect(t,e){return zt.intersect(this,t,e),this}getIntersect(t,e){return new Yt(zt.getIntersectData(this,t,e))}isSame(t){return zt.isSame(this,t)}isEmpty(){return zt.isEmpty(this)}reset(){zt.reset(this)}}const Xt=new Yt;class Vt{constructor(t,e,i,s,n,o){g(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new Yt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Gt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:jt}=A;class Kt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Kt(t)}static set filter(t){this.filterList=Zt(t)}static set exclude(t){this.excludeList=Zt(t)}static drawRepaint(t,e){const i=jt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Kt.showBounds,n=t.__nowWorld,o=jt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(qt.enable){if(qt.filterList.length&&qt.filterList.every(t=>t!==this.name))return;if(qt.excludeList.length&&qt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){qt.enable&&this.warn(...t)}warn(...t){qt.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 Zt(t){return t?h(t)&&(t=[t]):t=[],t}Kt.filterList=[],Kt.excludeList=[],Kt.showWarn=!0;const qt=Kt,Jt=Kt.get("RunTime"),$t={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Qt.currentId=Qt.idMap[s]=e?performance.now():Date.now(),Qt.currentName=Qt.nameMap[s]=t,Qt.nameToIdMap[t]=s,s},end(t,e){const i=Qt.idMap[t],s=Qt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Qt.idMap[t]=Qt.nameMap[t]=Qt.nameToIdMap[s]=void 0,Jt.log(s,n,"ms")},endOfName(t,e){const i=Qt.nameToIdMap[t];r(i)||Qt.end(i,e)}},Qt=$t,te=[],ee={list:{},add(t,...e){this.list[t]=!0,te.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(()=>te.forEach(t=>ee.has(t,!0)));const ie={editor:t=>ee.need("editor")},se=Kt.get("UICreator"),ne={list:{},register(t){const{__tag:e}=t.prototype;oe[e]&&se.repeat(e),oe[e]=t},get(t,e,i,s,n,o){oe[t]||se.error("not register "+t);const a=new oe[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:oe}=ne,re=Kt.get("EventCreator"),ae={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(he[e]&&re.repeat(e),he[e]=t)})},changeName(t,e){const i=he[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,he[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new he[t](...e)},{nameList:he}=ae;class le{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=ie.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 de(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function ce(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ue(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 pe=[];function ge(){return(t,e)=>{pe.push(e)}}const _e=[];class fe{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||_e)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;pe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){g(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}de([ue("imageSmoothingEnabled")],fe.prototype,"smooth",void 0),de([ue("imageSmoothingQuality")],fe.prototype,"smoothLevel",void 0),de([ue("globalAlpha")],fe.prototype,"opacity",void 0),de([ue()],fe.prototype,"fillStyle",void 0),de([ue()],fe.prototype,"strokeStyle",void 0),de([ue("lineWidth")],fe.prototype,"strokeWidth",void 0),de([ue("lineCap")],fe.prototype,"strokeCap",void 0),de([ue("lineJoin")],fe.prototype,"strokeJoin",void 0),de([ue("lineDashOffset")],fe.prototype,"dashOffset",void 0),de([ue()],fe.prototype,"miterLimit",void 0),de([ue()],fe.prototype,"shadowBlur",void 0),de([ue()],fe.prototype,"shadowColor",void 0),de([ue()],fe.prototype,"shadowOffsetX",void 0),de([ue()],fe.prototype,"shadowOffsetY",void 0),de([ue()],fe.prototype,"filter",void 0),de([ue()],fe.prototype,"font",void 0),de([ue()],fe.prototype,"fontKerning",void 0),de([ue()],fe.prototype,"fontStretch",void 0),de([ue()],fe.prototype,"fontVariantCaps",void 0),de([ue()],fe.prototype,"textAlign",void 0),de([ue()],fe.prototype,"textBaseline",void 0),de([ue()],fe.prototype,"textRendering",void 0),de([ue()],fe.prototype,"wordSpacing",void 0),de([ue()],fe.prototype,"letterSpacing",void 0),de([ue()],fe.prototype,"direction",void 0),de([ge()],fe.prototype,"setTransform",null),de([ge()],fe.prototype,"resetTransform",null),de([ge()],fe.prototype,"getTransform",null),de([ge()],fe.prototype,"save",null),de([ge()],fe.prototype,"restore",null),de([ge()],fe.prototype,"translate",null),de([ge()],fe.prototype,"scale",null),de([ge()],fe.prototype,"rotate",null),de([ge()],fe.prototype,"fill",null),de([ge()],fe.prototype,"stroke",null),de([ge()],fe.prototype,"clip",null),de([ge()],fe.prototype,"fillRect",null),de([ge()],fe.prototype,"strokeRect",null),de([ge()],fe.prototype,"clearRect",null),de([ge()],fe.prototype,"beginPath",null),de([ge()],fe.prototype,"moveTo",null),de([ge()],fe.prototype,"lineTo",null),de([ge()],fe.prototype,"bezierCurveTo",null),de([ge()],fe.prototype,"quadraticCurveTo",null),de([ge()],fe.prototype,"closePath",null),de([ge()],fe.prototype,"arc",null),de([ge()],fe.prototype,"arcTo",null),de([ge()],fe.prototype,"ellipse",null),de([ge()],fe.prototype,"rect",null),de([ge()],fe.prototype,"roundRect",null),de([ge()],fe.prototype,"createConicGradient",null),de([ge()],fe.prototype,"createLinearGradient",null),de([ge()],fe.prototype,"createPattern",null),de([ge()],fe.prototype,"createRadialGradient",null),de([ge()],fe.prototype,"fillText",null),de([ge()],fe.prototype,"measureText",null),de([ge()],fe.prototype,"strokeText",null);const{copy:me,multiplyParent:ye,pixelScale:ve}=K,{round:we}=Math,xe=new Yt,be=new Yt,Ee={width:1,height:1,pixelRatio:1},Se=["width","height","pixelRatio"];class ke extends fe{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,s){super(),this.size={},this.worldTransform={},t||(t=Ee),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r||e.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;m.copyAttrs(s,t,Se),Se.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Yt(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&&ye(t,e,n),ve(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=we(n.e-.5)+.5,n.f=we(n.f-.5)+.5):(n.e=we(n.e),n.f=we(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=be):i=xe,this.drawImage(t.view,xe.x,xe.y,xe.width,xe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,zt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,xe.x,xe.y,xe.width,xe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o=!0){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(xe.x,xe.y,xe.width,xe.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,xe.x,xe.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(xe.x,xe.y,xe.width,xe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(xe.x,xe.y,xe.width,xe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(xe.x,xe.y,xe.width,xe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(xe.x,xe.y,xe.width,xe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(xe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(be,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):ie.canvas(Object.assign({},i));return n.save(),t&&(me(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 Be={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Te={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Pe=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},Te),Re={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},Le={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},Ce=Object.assign(Object.assign({},Le),Te),Oe=Pe,Ae={};for(let t in Oe)Ae[Oe[t]]=t;const De={};for(let t in Oe)De[Oe[t]]=Re[t];const Me={drawRoundRect(t,e,i,s,n,o){const r=A.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ie,cos:Fe,hypot:We,atan2:ze,ceil:Ue,abs:He,PI:Ne,sqrt:Ye,pow:Xe}=Math,{setPoint:Ve,addPoint:Ge}=gt,{set:je,toNumberPoints:Ke}=ot,{M:Ze,L:qe,C:Je,Q:$e,Z:Qe}=Pe,ti={},ei={points(t,e,i,s){let n=Ke(e);if(t.push(Ze,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],g=Ye(Xe(r-e,2)+Xe(a-o,2)),_=Ye(Xe(h-r,2)+Xe(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=o,d=r-g*h,c=a-g*l,2===i?s||t.push($e,d,c,r,a):t.push(Je,u,p,d,c,r,a),u=r+_*h,p=a+_*l);s||t.push($e,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(qe,n[e],n[e+1]);s&&t.push(Qe)},rect(t,e,i,s,n){Be.creator.path=t,Be.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){Be.creator.path=[],Me.drawRoundRect(Be.creator,e,i,s,n,o),t.push(...Be.convertToCanvasData(Be.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,p=o-s,g=r-n;let _=ze(u,c),f=ze(g,p);const m=We(c,u),y=We(p,g);let v=f-_;if(v<0&&(v+=I),m<1e-12||y<1e-12||v<1e-12||He(v-Ne)<1e-12)return t&&t.push(qe,s,n),h&&(Ve(h,e,i),Ge(h,s,n)),d&&je(d,e,i),void(l&&je(l,s,n));const w=c*g-p*u<0,x=w?-1:1,b=a/Fe(v/2),E=s+b*Fe(_+v/2+F*x),S=n+b*Ie(_+v/2+F*x);return _-=F*x,f-=F*x,ni(t,E,S,a,a,0,_/M,f/M,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>ni(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*M,p=Ie(u),g=Fe(u);let _=r*M,f=a*M;_>Ne&&(_-=I),f<0&&(f+=I);let m=f-_;m<0?m+=I:m>I&&(m-=I),h&&(m-=I);const y=Ue(He(m/F)),v=m/y,w=Ie(v/4),x=8/3*w*w/Ie(v/2);f=_+v;let b,E,S,k,B,T,P,R,L=Fe(_),C=Ie(_),O=S=g*s*L-p*n*C,A=k=p*s*L+g*n*C,D=e+S,W=i+k;t&&t.push(t.length?qe:Ze,D,W),l&&Ve(l,D,W),c&&je(c,D,W);for(let o=0;o<y;o++)b=Fe(f),E=Ie(f),S=g*s*b-p*n*E,k=p*s*b+g*n*E,B=e+O-x*(g*s*C+p*n*L),T=i+A-x*(p*s*C-g*n*L),P=e+S+x*(g*s*E+p*n*b),R=i+k+x*(p*s*E-g*n*b),t&&t.push(Je,B,T,P,R,e+S,i+k),l&&si(e+O,i+A,B,T,P,R,e+S,i+k,l,!0),O=S,A=k,L=b,C=E,_=f,f+=v;d&&je(d,e+S,i+k)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Je,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){si(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,p,g,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Ge(h,t,e):Ve(h,t,e),Ge(h,r,a);for(let l=0,c=d.length;l<c;l++)ii(d[l],t,e,i,s,n,o,r,a,ti),Ge(h,ti.x,ti.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*o+g*a,l.y=c*i+u*n+p*r+g*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ii(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:ii,toTwoPointBounds:si,ellipse:ni}=ei,{sin:oi,cos:ri,sqrt:ai,atan2:hi}=Math,{ellipse:li}=ei,di={ellipticalArc(t,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,g=r*M,_=oi(g),f=ri(g),m=-f*u-_*p,y=-f*p+_*u,v=n*n,w=o*o,x=y*y,b=m*m,E=v*w-v*x-w*b;let S=0;if(E<0){const t=ai(1-E/(v*w));n*=t,o*=t}else S=(a===h?-1:1)*ai(E/(v*x+w*b));const k=S*n*y/o,B=-S*o*m/n,T=hi((y-B)/o,(m-k)/n),P=hi((-y-B)/o,(-m-k)/n);let R=P-T;0===h&&R>0?R-=I:1===h&&R<0&&(R+=I);const L=i+u+f*k-_*B,C=s+p+_*k+f*B,O=R<0?1:0;c||e.ellipseToCurve?li(t,L,C,n,o,r,T/M,P/M,O):n!==o||r?t.push(Pe.G,L,C,n,o,r,T/M,P/M,O):t.push(Pe.O,L,C,n,T/M,P/M,O)}},{M:ci,m:ui,L:pi,l:gi,H:_i,h:fi,V:mi,v:yi,C:vi,c:wi,S:xi,s:bi,Q:Ei,q:Si,T:ki,t:Bi,A:Ti,a:Pi,Z:Ri,z:Li,N:Ci,D:Oi,X:Ai,G:Di,F:Mi,O:Ii,P:Fi,U:Wi}=Pe,{rect:zi,roundRect:Ui,arcTo:Hi,arc:Ni,ellipse:Yi,quadraticCurveTo:Xi}=ei,{ellipticalArc:Vi}=di,Gi=Kt.get("PathConvert"),ji={},Ki={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=De[s],a+=s===n?" ":Ae[s];for(let s=1;s<i;s++)a+=A.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?Ce:Le;for(let e=0,h=t.length;e<h;e++)s=t[e],Gt[s]?("."===s&&(Zi.dot&&(qi(r,o),o=""),Zi.dot++),"0"===o&&"."!==s&&(qi(r,o),o=""),o+=s):Pe[s]?(o&&(qi(r,o),o=""),Zi.name=Pe[s],Zi.length=Re[s],Zi.index=0,qi(r,Zi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&qi(r,o),o=s):o&&(qi(r,o),o=""),n=s;return o&&qi(r,o),i?Ki.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case ui:t[c+1]+=a,t[c+2]+=h;case ci:a=t[c+1],h=t[c+2],p.push(ci,a,h),c+=3;break;case fi:t[c+1]+=a;case _i:a=t[c+1],p.push(pi,a,h),c+=2;break;case yi:t[c+1]+=h;case mi:h=t[c+1],p.push(pi,a,h),c+=2;break;case gi:t[c+1]+=a,t[c+2]+=h;case pi:a=t[c+1],h=t[c+2],p.push(pi,a,h),c+=3;break;case bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=xi;case xi:r=o===vi||o===xi,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(vi,l,d,i,s,a,h),c+=5;break;case wi: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=vi;case vi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(vi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Bi:t[c+1]+=a,t[c+2]+=h,n=ki;case ki:r=o===Ei||o===ki,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Xi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Ei,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Si:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ei;case Ei:i=t[c+1],s=t[c+2],e?Xi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Ei,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Pi:t[c+6]+=a,t[c+7]+=h;case Ti:Vi(p,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 Li:case Ri:p.push(Ri),c++;break;case Ci:a=t[c+1],h=t[c+2],e?zi(p,a,h,t[c+3],t[c+4]):Ji(p,t,c,5),c+=5;break;case Oi:a=t[c+1],h=t[c+2],e?Ui(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ji(p,t,c,9),c+=9;break;case Ai:a=t[c+1],h=t[c+2],e?Ui(p,a,h,t[c+3],t[c+4],t[c+5]):Ji(p,t,c,6),c+=6;break;case Di:Yi(e?p:Ji(p,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,ji),a=ji.x,h=ji.y,c+=9;break;case Mi:e?Yi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ji(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ii:Ni(e?p:Ji(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ji),a=ji.x,h=ji.y,c+=7;break;case Fi:e?Ni(p,t[c+1],t[c+2],t[c+3],0,360,!1):Ji(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Wi:Hi(e?p:Ji(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ji),a=ji.x,h=ji.y,c+=6;break;default:return Gi.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ci,t.x,t.y);break;case"L":e.push(pi,t.x,t.y);break;case"C":e.push(vi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ei,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ri)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Zi.index===Zi.length&&(Zi.index=1,t.push(Zi.name)),t.push(Number(e)),Zi.index++,Zi.dot=0}},{current:Zi,pushData:qi,copyData:Ji}=Ki,{M:$i,L:Qi,C:ts,Q:es,Z:is,N:ss,D:ns,X:os,G:rs,F:as,O:hs,P:ls,U:ds}=Pe,{getMinDistanceFrom:cs,getRadianFrom:us}=ot,{tan:ps,min:gs,abs:_s}=Math,fs={},ms={beginPath(t){t.length=0},moveTo(t,e,i){t.push($i,e,i)},lineTo(t,e,i){t.push(Qi,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(ts,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(es,e,i,s,n)},closePath(t){t.push(is)},rect(t,e,i,s,n){t.push(ss,e,i,s,n)},roundRect(t,e,i,s,n,o){if(d(o))t.push(os,e,i,s,n,o);else{const r=A.fourNumber(o);r?t.push(ns,e,i,s,n,...r):t.push(ss,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,h,l){a(o)?t.push(as,e,i,s,n):(a(r)&&(r=0),a(h)&&(h=360),t.push(rs,e,i,s,n,o,r,h,l?1:0))},arc(t,e,i,s,n,o,r){a(n)?t.push(ls,e,i,s):(a(o)&&(o=360),t.push(hs,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,a,h){if(!r(a)){const t=cs(a,h,e,i,s,n);o=gs(o,gs(t/2,t/2*_s(ps(us(a,h,e,i,s,n)/2))))}t.push(ds,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,h,l){ei.ellipse(null,e,i,s,n,a(o)?0:o,a(r)?0:r,a(h)?360:h,l,null,null,fs),t.push($i,fs.x,fs.y),ys(t,e,i,s,n,o,r,h,l)},drawArc(t,e,i,s,n,o,r){ei.arc(null,e,i,s,a(n)?0:n,a(o)?360:o,r,null,null,fs),t.push($i,fs.x,fs.y),vs(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){ei.points(t,e,i,s)}},{ellipse:ys,arc:vs}=ms,{moveTo:ws,lineTo:xs,quadraticCurveTo:bs,bezierCurveTo:Es,closePath:Ss,beginPath:ks,rect:Bs,roundRect:Ts,ellipse:Ps,arc:Rs,arcTo:Ls,drawEllipse:Cs,drawArc:Os,drawPoints:As}=ms;class Ds{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Be.parse(t):t:[],this}beginPath(){return ks(this.__path),this.paint(),this}moveTo(t,e){return ws(this.__path,t,e),this.paint(),this}lineTo(t,e){return xs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Es(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return bs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ss(this.__path),this.paint(),this}rect(t,e,i,s){return Bs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ts(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return Ps(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Rs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return Ls(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return Cs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Os(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return As(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ms,L:Is,C:Fs,Q:Ws,Z:zs,N:Us,D:Hs,X:Ns,G:Ys,F:Xs,O:Vs,P:Gs,U:js}=Pe,Ks=Kt.get("PathDrawer"),Zs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Ms:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Is:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Fs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ws:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case zs:t.closePath(),s+=1;break;case Us:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs: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 Ns:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ys:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*M,e[s+6]*M,e[s+7]*M,e[s+8]),s+=9;break;case Xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,I,!1),s+=5;break;case Vs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*M,e[s+5]*M,e[s+6]),s+=7;break;case Gs:t.arc(e[s+1],e[s+2],e[s+3],0,I,!1),s+=4;break;case js:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ks.error(`command: ${i} [index:${s}]`,e)}}},{M:qs,L:Js,C:$s,Q:Qs,Z:tn,N:en,D:sn,X:nn,G:on,F:rn,O:an,P:hn,U:ln}=Pe,{toTwoPointBounds:dn,toTwoPointBoundsByQuadraticCurve:cn,arcTo:un,arc:pn,ellipse:gn}=ei,{addPointBounds:_n,copy:fn,addPoint:mn,setPoint:yn,addBounds:vn,toBounds:wn}=gt,xn=Kt.get("PathBounds");let bn,En,Sn;const kn={},Bn={},Tn={},Pn={toBounds(t,e){Pn.toTwoPointBounds(t,Bn),wn(Bn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return yn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===tn||r===$s||r===Qs?yn(e,h,l):yn(e,t[a+1],t[a+2])),r){case qs:case Js:h=t[a+1],l=t[a+2],mn(e,h,l),a+=3;break;case $s:n=t[a+5],o=t[a+6],dn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,kn),_n(e,kn),h=n,l=o,a+=7;break;case Qs:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],cn(h,l,i,s,n,o,kn),_n(e,kn),h=n,l=o,a+=5;break;case tn:a+=1;break;case en:h=t[a+1],l=t[a+2],vn(e,h,l,t[a+3],t[a+4]),a+=5;break;case sn:case nn:h=t[a+1],l=t[a+2],vn(e,h,l,t[a+3],t[a+4]),a+=r===sn?9:6;break;case on:gn(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],kn,Tn),0===a?fn(e,kn):_n(e,kn),h=Tn.x,l=Tn.y,a+=9;break;case rn:h=t[a+1],l=t[a+2],En=t[a+3],Sn=t[a+4],vn(e,h-En,l-Sn,2*En,2*Sn),h+=En,a+=5;break;case an:pn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],kn,Tn),0===a?fn(e,kn):_n(e,kn),h=Tn.x,l=Tn.y,a+=7;break;case hn:h=t[a+1],l=t[a+2],bn=t[a+3],vn(e,h-bn,l-bn,2*bn,2*bn),h+=bn,a+=4;break;case ln:un(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],kn,Tn),0===a?fn(e,kn):_n(e,kn),h=Tn.x,l=Tn.y,a+=6;break;default:return void xn.error(`command: ${r} [index:${a}]`,t)}}},{M:Rn,L:Ln,Z:Cn}=Pe,{getCenterX:On,getCenterY:An}=ot,{arcTo:Dn}=ms,Mn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case Rn:l=p=t[r+1],d=g=t[r+2],r+=3,t[r]===Ln?(c=t[r+1],u=t[r+2],f.push(Rn,On(l,c),An(d,u))):f.push(Rn,l,d);break;case Ln:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Ln:Dn(f,a,h,t[r+1],t[r+2],e,p,g);break;case Cn:Dn(f,a,h,l,d,e,p,g);break;default:f.push(Ln,a,h)}p=a,g=h;break;case Cn:n!==Cn&&(Dn(f,l,d,c,u,e,p,g),f.push(Cn)),r+=1;break;default:o=De[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==Cn&&(f[1]=l,f[2]=d),f}};function In(t){return new Ds(t)}const Fn=In();Be.creator=In(),Be.parse=Ki.parse,Be.convertToCanvasData=Ki.toCanvasData;const{drawRoundRect:Wn}=Me;function zn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Wn(this,t,e,i,s,n)})}(t)}const Un={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Hn.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{}}}},Hn=Un;Hn.alphaPixelTypes.forEach(t=>Hn.upperCaseTypeMap[t]=t.toUpperCase());const Nn=Kt.get("TaskProcessor");class Yn{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return ce(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Nn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Xn{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&&m.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const a=new Yn(t);return a.parent=this,d(e)?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),r(o)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},o)),this.isComplete=!1,a}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];if(t)return t.isCancel?(this.index++,void this.runTask()):void t.run().then(()=>{this.onTask(t),this.index++,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 Vn=Kt.get("Resource"),Gn={tasker:new Xn,map:{},get isComplete(){return jn.tasker.isComplete},set(t,e){jn.map[t]&&Vn.repeat(t),jn.map[t]=e},get:t=>jn.map[t],remove(t){const e=jn.map[t];e&&(e.destroy&&e.destroy(),delete jn.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 h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ie.image(s)),jn.set(t,e),e},destroy(){jn.map={}}},jn=Gn,Kn={maxRecycled:10,recycledList:[],patternTasker:new Xn,get(t){let e=Gn.get(t.url);return e||Gn.set(t.url,e=ie.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Zn.recycledList.push(t)})},clearRecycled(){const t=Zn.recycledList;t.length>Zn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Gn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Un.alphaPixelTypes.some(e=>Zn.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Un.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Un.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Zn.recycledList=[]}},Zn=Kn,{IMAGE:qn,create:Jn}=i,{floor:$n,max:Qn}=Math;class to{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Jn(qn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Kn.isFormat("svg",t)&&(this.isSVG=!0),Kn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),Gn.tasker.add(()=>ce(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,i),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)}onProgress(t){this.progress=t}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,i,s,n,o,r,a){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=e.origin.createCanvas(Qn($n(t+(o||0)),1),Qn($n(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&m.stintSet(n,"transform",s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function eo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function io(t,e){return Object.getOwnPropertyDescriptor(t,e)}function so(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function no(t,e){return(i,s)=>ro(i,s,t,e&&e(s))}function oo(t){return t}function ro(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};eo(t,e,Object.assign(n,s||{})),Mo(t,e,i)}function ao(t){return no(t)}function ho(t,e){return no(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function lo(t,e){return no(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function co(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),fo(this))}}))}function uo(t,e){return no(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function po(t,e){return no(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function go(t,e){return no(t,t=>({set(i){this.__setAttr(t,i,e)&&fo(this)}}))}function _o(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(fo(this),this.__.__removeNaturalSize())}}))}function fo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function mo(t){return no(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),fo(this)}}))}const yo=go;function vo(t,e){return no(t,t=>({set(i){this.__setAttr(t,i)&&(wo(this),e&&(this.__.__useStroke=!0))}}))}function wo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&fo(t)}const xo=vo;function bo(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eo(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function So(t){return no(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;m.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function ko(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&To(this)}}))}function Bo(t){return no(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Po(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Po(this,t,e,i),this.mask&&To(this)}}))}function To(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Po(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||fo(t))}function Ro(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Lo(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Co(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Oo(t){return no(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Kt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ao(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Do(t){return(e,i)=>{eo(e,"__DataProcessor",{get:()=>t})}}function Mo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=so(e,i);if(r(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(g(i)){const t=f(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:m.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=io(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),eo(s,e,a)}const Io=new Kt("rewrite"),Fo=[],Wo=["destroy","constructor"];function zo(t){return(e,i)=>{Fo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Uo(){return t=>{Ho()}}function Ho(t){Fo.length&&(Fo.forEach(e=>{t&&Io.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Fo.length=0)}function No(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Wo.includes(s)||e&&e.includes(s)))if(t.prototype){io(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Yo(){return t=>{ne.register(t)}}function Xo(){return t=>{ae.register(t)}}setTimeout(()=>Ho(!0));const{copy:Vo,toInnerPoint:Go,toOuterPoint:jo,scaleOfOuter:Ko,rotateOfOuter:Zo,skewOfOuter:qo,multiplyParent:Jo,divideParent:$o,getLayout:Qo}=K,tr={},{round:er}=Math,ir={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),or(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)nr(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++)rr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&rr(t),t.__updateChange()},updateAllChange(t){if(hr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ar(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,i,s,n,o,r){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,o,r):i.copyWorldToInner(s,n,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=g(e)?Object.assign({},e):{x:e,y:i};s?jo(t.localTransform,o,o,!0):t.parent&&Go(t.parent.scrollWorldTransform,o,o,!0),sr.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){g(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=er(e),i=er(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){sr.zoomOfLocal(t,lr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(d(s)||(s&&(o=s),s=i),Vo(tr,r),Ko(tr,e,i,s),sr.hasHighPosition(t))sr.setTransform(t,tr,n,o);else{const e=t.x+tr.e-r.e,a=t.y+tr.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){sr.rotateOfLocal(t,lr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Vo(tr,n),Zo(tr,e,i),sr.hasHighPosition(t)?sr.setTransform(t,tr,!1,s):t.set({x:t.x+tr.e-n.e,y:t.y+tr.f-n.f,rotation:A.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){sr.skewOfLocal(t,lr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Vo(tr,t.__localMatrix),qo(tr,e,i,s),sr.setTransform(t,tr,n,o)},transformWorld(t,e,i,s){Vo(tr,t.worldTransform),Jo(tr,e),t.parent&&$o(tr,t.parent.scrollWorldTransform),sr.setTransform(t,tr,i,s)},transform(t,e,i,s){Vo(tr,t.localTransform),Jo(tr,e),sr.setTransform(t,tr,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&sr.getInnerOrigin(t,n.origin),r=Qo(e,o,n.around&&sr.getInnerOrigin(t,n.around));if(sr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){zt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=sr.getInnerOrigin(t,n.origin);ot.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Ko(i,sr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(sr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return vt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Vo(tr,t.worldTransform),$o(tr,e.scrollWorldTransform),i?tr:Object.assign({},tr)),drop(t,e,i,s){t.setTransform(sr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||sr.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,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,t.move(n,o),e.requestRender(()=>sr.animateMove(t,i,s))}}},sr=ir,{updateAllMatrix:nr,updateMatrix:or,updateAllWorldOpacity:rr,updateAllChange:ar,updateChange:hr}=sr;function lr(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const dr={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)=>ur(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ur(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ur(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 cr;function ur(t,e){return e||(cr=0),t.__.mask&&(cr=1),cr<0?null:(cr&&(cr=-1),!0)}const{updateBounds:pr}=ir,gr={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),_r(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)fr(e[t],e)},updateBounds(t,e){const i=[t];fr(t,i),mr(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++)pr(s[t]);e&&e===i||pr(i)}}},{pushAllChildBranch:_r,pushAllBranchStack:fr,updateBoundsByBranchStack:mr}=gr,yr={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:vr,updateBounds:wr}=ir,{toOuterOf:xr,getPoints:br,copy:Er}=zt,Sr="_localContentBounds",kr="_worldContentBounds",Br="_worldBoxBounds",Tr="_worldStrokeBounds";class Pr{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 xr(this.contentBounds,this.leaf.__localMatrix,this[Sr]||(this[Sr]={})),this[Sr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return xr(this.contentBounds,this.leaf.__world,this[kr]||(this[kr]={})),this[kr]}get worldBoxBounds(){return xr(this.boxBounds,this.leaf.__world,this[Br]||(this[Br]={})),this[Br]}get worldStrokeBounds(){return xr(this.strokeBounds,this.leaf.__world,this[Tr]||(this[Tr]={})),this[Tr]}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:i}=t;if(t.isApp)return wr(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.layout(s),delete s.__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 K.defaultMatrix;case"page":t=e.zoomLayer;default:return vr(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 Yt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=K.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=vr(s,e,!0)}if(r||(r=K.getLayout(o)),Er(r,a),ot.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=br(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Rr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class Lr extends Rr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Lr.ADD="child.add",Lr.REMOVE="child.remove",Lr.CREATED="created",Lr.MOUNTED="mounted",Lr.UNMOUNTED="unmounted",Lr.DESTROY="destroy";const Cr="property.scroll";class Or extends Rr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Or.CHANGE="property.change",Or.LEAFER_CHANGE="property.leafer_change",Or.SCROLL=Cr;const Ar={scrollX:Cr,scrollY:Cr};class Dr extends Rr{constructor(t,e){super(t),Object.assign(this,e)}}Dr.LOAD="image.load",Dr.LOADED="image.loaded",Dr.ERROR="image.error";class Mr extends Rr{static checkHas(t,e,i){"on"===i?e===zr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ir)||t.hasEvent(Fr)||t.hasEvent(Wr),t.__hasWorldEvent=t.hasEvent(zr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ir,t),"inner"===e&&t.emit(Fr,t)),t.emit(Wr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zr,this)}}Mr.RESIZE="bounds.resize",Mr.INNER="bounds.inner",Mr.LOCAL="bounds.local",Mr.WORLD="bounds.world";const{RESIZE:Ir,INNER:Fr,LOCAL:Wr,WORLD:zr}=Mr,Ur={};[Ir,Fr,Wr,zr].forEach(t=>Ur[t]=1);class Hr extends Rr{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){g(t)?(super(Hr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Hr.RESIZE="resize";class Nr extends Rr{constructor(t,e){super(t),this.data=e}}Nr.REQUEST="watch.request",Nr.DATA="watch.data";class Yr extends Rr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Yr.REQUEST="layout.request",Yr.START="layout.start",Yr.BEFORE="layout.before",Yr.LAYOUT="layout",Yr.AFTER="layout.after",Yr.AGAIN="layout.again",Yr.END="layout.end";class Xr extends Rr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Xr.REQUEST="render.request",Xr.CHILD_START="render.child_start",Xr.CHILD_END="render.child_end",Xr.START="render.start",Xr.BEFORE="render.before",Xr.RENDER="render",Xr.AFTER="render.after",Xr.AGAIN="render.again",Xr.END="render.end",Xr.NEXT="render.next";class Vr extends Rr{}Vr.START="leafer.start",Vr.BEFORE_READY="leafer.before_ready",Vr.READY="leafer.ready",Vr.AFTER_READY="leafer.after_ready",Vr.VIEW_READY="leafer.view_ready",Vr.VIEW_COMPLETED="leafer.view_completed",Vr.STOP="leafer.stop",Vr.RESTART="leafer.restart",Vr.END="leafer.end",Vr.UPDATE_MODE="leafer.update_mode",Vr.TRANSFORM="leafer.transform",Vr.MOVE="leafer.move",Vr.SCALE="leafer.scale",Vr.ROTATE="leafer.rotate",Vr.SKEW="leafer.skew";const{MOVE:Gr,SCALE:jr,ROTATE:Kr,SKEW:Zr}=Vr,qr={x:Gr,y:Gr,scaleX:jr,scaleY:jr,rotation:Kr,skewX:Zr,skewY:Zr},Jr={};class $r{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(p(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)p(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 r=Qr(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Ur[t]&&Mr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Qr(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Ur[t]&&Mr.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):p(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=p(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):p(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 p(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ae.has(t)&&(e=ae.get(t,{type:t,target:this,current:this}));const s=Qr(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],o=s&&s[t];return!!(r(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Qr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Jr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Jr)}}const{on:ta,on_:ea,off:ia,off_:sa,once:na,emit:oa,emitEvent:ra,hasEvent:aa,destroy:ha}=$r.prototype,la={on:ta,on_:ea,off:ia,off_:sa,once:na,emit:oa,emitEvent:ra,hasEvent:aa,destroyEventer:ha},da=Kt.get("setAttr"),ca={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||r(e)||(da.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Or(Or.LEAFER_CHANGE,this,t,s,e));const i=qr[t];i&&(this.emitEvent(new Vr(i,this)),this.emitEvent(new Vr(Vr.TRANSFORM,this)))}this.emitPropertyEvent(Or.CHANGE,t,s,e);const i=Ar[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Or(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ua,multiplyParent:pa,translateInner:ga,defaultWorld:_a}=K,{toPoint:fa,tempPoint:ma}=vt,ya={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;pa(this.__local||e,t?t.__scrollWorld||t.__world:_a,i,!!e.affectScaleOrRotation,n),s&&ga(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)&&(ua(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)&&(fa(i.around||i.origin,t.boxBounds,ma),ga(e,-ma.x,-ma.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:va,updateAllMatrix:wa}=ir,{updateBounds:xa}=gr,{toOuterOf:ba,copyAndSpread:Ea,copy:Sa}=zt,{toBounds:ka}=Pn,Ba={__updateWorldBounds(){const t=this.__layout;ba(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Mr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Mr.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(),ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?ka(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(),wa(this),xa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wa(this),xa(this,this))):va(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ea(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;d(i)&&i<=0?Sa(e.renderBounds,e.strokeBounds):Ea(e.renderBounds,e.boxBounds,i)}},Ta={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ir.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Kt.showBounds&&Kt.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:Pa}=dr,Ra={__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++)Pa(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++)Pa(i[s],e)||i[s].__clip(t,e)}}},La={},{LEAF:Ca,create:Oa}=i,{stintSet:Aa}=m,{toInnerPoint:Da,toOuterPoint:Ma,multiplyParent:Ia}=K,{toOuterOf:Fa}=zt,{copy:Wa,move:za}=ot,{moveLocal:Ua,zoomOfLocal:Ha,rotateOfLocal:Na,skewOfLocal:Ya,moveWorld:Xa,zoomOfWorld:Va,rotateOfWorld:Ga,skewOfWorld:ja,transform:Ka,transformWorld:Za,setTransform:qa,getFlipTransform:Ja,getLocalOrigin:$a,getRelativeWorld:Qa,drop:th}=ir;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return v}get __LayoutProcessor(){return Pr}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=Oa(Ca),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Lr.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(Lr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Lr.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(Lr.MOUNTED)):this.__emitLifeEvent(Lr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ia(i,t.matrix,e,void 0,i),Fa(this.__layout.renderBounds,e,e),Aa(e,"half",i.half),Aa(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}=Kn.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),La.scaleX=i,La.scaleY=s,La}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?Qa(this,e):this.worldTransform,n=i?t:{};return Fa(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Wa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Wa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Da(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ma(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return za(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return za(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){qa(this,t,e,i)}transform(t,e,i){Ka(this,t,e,i)}move(t,e,i){Ua(this,t,e,i)}moveInner(t,e,i){Xa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ha(this,$a(this,t),e,i,s,n)}rotateOf(t,e,i){Na(this,$a(this,t),e,i)}skewOf(t,e,i,s,n){Ya(this,$a(this,t),e,i,s,n)}transformWorld(t,e,i){Za(this,t,e,i)}moveWorld(t,e,i){Xa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Va(this,t,e,i,s,n)}rotateOfWorld(t,e){Ga(this,t,e)}skewOfWorld(t,e,i,s,n){ja(this,t,e,i,s,n)}flip(t,e){Ka(this,Ja(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ee.need("path")}getMotionPoint(t){return ee.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){th(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):Mo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=go),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Lr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Lr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=de([No(ca),No(ya),No(Ba),No(la),No(Ta)],t.Leaf);const{setListWithFn:eh}=zt,{sort:ih}=gr,{localBoxBounds:sh,localStrokeBounds:nh,localRenderBounds:oh,maskLocalBoxBounds:rh,maskLocalStrokeBounds:ah,maskLocalRenderBounds:hh}=dr,lh=new Kt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){eh(e||this.__layout.boxBounds,this.children,this.__hasMask?rh:sh)}__updateStrokeBounds(t){eh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ah:nh)}__updateRenderBounds(t){eh(t||this.__layout.renderBounds,this.children,this.__hasMask?hh:oh)}__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(ih),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return lh.warn("add self or destroyed");const i=r(e);if(!t.__){if(p(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ne.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Lr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Lr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Lr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Lr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Lr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=de([No(Ra)],t.Branch);class dh{get length(){return this.list.length}constructor(t){this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new dh;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 ch{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class uh extends ke{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.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}}zn(OffscreenCanvasRenderingContext2D.prototype),zn(Path2D.prototype);const{mineType:ph}=Un;function gh(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:ph(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:ph(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=ie.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(ie,{canvas:(t,e)=>new uh(t,e),image:t=>new to(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},eo(e,"devicePixelRatio",{get:()=>1});const{userAgent:_h}=navigator;_h.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),_h.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):_h.indexOf("Mac")>-1?e.os="Mac":_h.indexOf("Linux")>-1&&(e.os="Linux");class fh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new dh;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 dh,this.target=t,e&&(this.config=m.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(Xr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Lr.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 Nr(Nr.DATA,{updatedList:this.updatedList})),this.__updatedList=new dh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Or.CHANGE,this.__onAttrChange,this],[[Lr.ADD,Lr.REMOVE],this.__onChildEvent,this],[Nr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:mh,updateBounds:yh,updateChange:vh}=ir,{pushAllChildBranch:wh,pushAllParent:xh}=gr;const{worldBounds:bh}=dr;class Eh{constructor(t){this.updatedBounds=new Yt,this.beforeBounds=new Yt,this.afterBounds=new Yt,p(t)&&(t=new dh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,bh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,bh),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:Sh,updateAllChange:kh}=ir,Bh=Kt.get("Layouter");class Th{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ch,this.target=t,e&&(this.config=m.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(Yr.START),this.layoutOnce(),t.emitEvent(new Yr(Yr.END,this.layoutedBlocks,this.times))}catch(t){Bh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Bh.warn("layouting"):this.times>3?Bh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Nr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=$t.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Yr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Yr(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?(mh(t,!0),e.add(t),t.isBranch&&wh(t,e),xh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),xh(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||yh(s[t])}yh(i)}})}(this.__levelList),function(t){t.list.forEach(vh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Yr(o,a,this.times)),i.emitEvent(new Yr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,$t.end(e)}fullLayout(){const t=$t.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Yr,o=this.getBlocks(new dh(e));e.emitEvent(new Yr(i,o,this.times)),Th.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Yr(s,o,this.times)),e.emitEvent(new Yr(n,o,this.times)),this.addBlocks(o),$t.end(t)}static fullLayout(t){Sh(t,!0),t.isBranch?gr.updateBounds(t):ir.updateBounds(t),kh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Eh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Eh(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_([[Yr.REQUEST,this.layout,this],[Yr.AGAIN,this.layoutAgain,this],[Nr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ph=Kt.get("Renderer");class Rh{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=m.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Yr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Xr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Xr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Xr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Yt,Ph.log(e.innerName,"---\x3e");try{this.emitRender(Xr.START),this.renderOnce(t),this.emitRender(Xr.END,this.totalBounds),Kn.clearRecycled()}catch(t){this.rendering=!1,Ph.error(t)}Ph.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ph.warn("rendering");if(this.times>3)return Ph.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Yt,this.renderOptions={},t)this.emitRender(Xr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Xr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Xr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Xr.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=$t.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Yt(s);i.save(),s.spread(Rh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),$t.end(e)}fullRender(){const t=$t.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),$t.end(t)}__render(t,i){const{canvas:s}=this,n=t.includes(this.target.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),Kt.showRepaint&&Kt.drawRepaint(s,t),e.render(this.target,s,o),this.renderBounds=i=i||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Yt;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 i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(i);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};e.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Yt(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 Yt(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||Ph.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 Xr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Xr.REQUEST,this.update,this],[Yr.END,this.__onLayoutEnd,this],[Xr.AGAIN,this.renderAgain,this],[Hr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Rh.clipSpread=10;const{hitRadiusPoint:Lh}=zt;class Ch{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new dh(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new dh;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||ir.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ir.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=>ir.worldHittable(t))}getPath(t){const e=new dh,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 dh;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 dh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Lh(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Oh{constructor(t,e){this.config={},e&&(this.config=m.default(e,this.config)),this.picker=new Ch(this.target=t,this),this.finder=ie.finder&&ie.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}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):ee.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ah(t){return no(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Dh(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Mh(){return(t,e)=>{const i="_"+e;eo(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ie,{watcher:(t,e)=>new fh(t,e),layouter:(t,e)=>new Th(t,e),renderer:(t,e,i)=>new Rh(t,e,i),selector:(t,e)=>new Oh(t,e)}),e.layout=Th.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new dh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Ih={},Fh={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}},Wh={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},zh={},Uh={},Hh={},Nh={},Yh={},Xh={apply(){ee.need("filter")}},Vh={},Gh={setStyleName:()=>ee.need("state"),set:()=>ee.need("state")},jh={list:{},register(t,e){jh.list[t]=e},get:t=>jh.list[t]},{parse:Kh,objectToCanvasData:Zh}=Ki,{stintSet:qh}=m,{hasTransparent:Jh}=Fh,$h={},Qh=Kt.get("UIData");class tl extends v{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,Qh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Qh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(qh(this,"__isTransparentFill",Jh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(qh(this,"__isTransparentStroke",Jh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?Kh(t):Zh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){el(this,"shadow",t)}setInnerShadow(t){el(this,"innerShadow",t)}setFilter(t){el(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Uh.compute("fill",this.__leaf),e&&Uh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=$h)):(this.__isStrokes=!0,this._stroke||(this._stroke=$h))}__removePaint(t,e){e&&this.__removeInput(t),Hh.recycleImage(t,this),"fill"===t?(qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(qh(this,"__isAlphaPixelStroke",void 0),qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function el(t,e,i){t.__setInput(e,i),p(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 il extends tl{}class sl extends il{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 nl extends il{__getInputData(t,e){const i=super.__getInputData(t,e);return Se.forEach(t=>delete i[t]),i}}class ol extends sl{}class rl extends tl{get __usePathBox(){return this.points||this.__pathInputed}}class al extends tl{get __boxStroke(){return!this.__pathInputed}}class hl extends tl{get __boxStroke(){return!this.__pathInputed}}class ll extends rl{}class dl extends tl{}class cl extends tl{get __pathInputed(){return 2}}class ul extends il{}const pl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class gl extends tl{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=pl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ne.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class _l extends al{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 fl extends al{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:ml,add:yl}=k,vl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=ml(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Yh.getShadowRenderSpread(this,e)),s&&(t=ml(t,s)),o&&(t=yl(t,Xh.getSpread(o))),r&&(t=yl(t,r)),a&&(t=yl(t,a));let l=t;return i&&(l=ml(l,Yh.getInnerShadowSpread(this,i))),n&&(l=ml(l,n)),this.__layout.renderShapeSpread=l,h?ml(h.__updateRenderSpread(),t):t}},{stintSet:wl}=m,xl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;wl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Yh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){bl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Uh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Yh.shadow(this,t,h),a&&(s.__isStrokes?Uh.strokes(o,this,t):Uh.stroke(o,this,t)),n&&(s.__isFills?Uh.fills(n,this,t):Uh.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Yh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Uh.strokes(o,this,t):Uh.stroke(o,this,t)),c&&Xh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Uh.strokes(o,this,t):Uh.stroke(o,this,t)),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,Fh.string(e.color))}n&&(s.__isFills?Uh.fills(n,this,t):Uh.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Uh.strokes(o,this,t):Uh.stroke(o,this,t))}}else s.__pathInputed?bl(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?Uh.fills(s,this,t):Uh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Uh.strokes(n,this,t):Uh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function bl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Uh.stroke(n,t,e),s&&Uh.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&Uh.stroke(n,t,e)}const El={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Sl,kl;t.UI=Sl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){A.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Fn.set(this.path=t||[]),t||this.__drawPathByBox(Fn),Fn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ee.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ee.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Fn.set(i=[]),this.__drawPathByBox(Fn)),t?Ki.toCanvasData(i,!0):i}getPathString(t,e,i){return Ki.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Vh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Mn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&zh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Zs.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,d(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Uh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),ee.need("animate")}killAnimate(t,e){}export(t,e){return ee.need("export")}syncExport(t,e){return ee.need("export")}clone(t){const e=m.clone(this.toJSON());return t&&Object.assign(e,t),Sl.one(e)}static one(t,e,i,s,n){return ne.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Yo()(this)}static registerData(t){Do(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},de([Do(tl)],t.UI.prototype,"__",void 0),de([Mh()],t.UI.prototype,"zoomLayer",void 0),de([ao("")],t.UI.prototype,"id",void 0),de([ao("")],t.UI.prototype,"name",void 0),de([ao("")],t.UI.prototype,"className",void 0),de([Eo("pass-through")],t.UI.prototype,"blendMode",void 0),de([ko(1)],t.UI.prototype,"opacity",void 0),de([Bo(!0)],t.UI.prototype,"visible",void 0),de([Eo(!1)],t.UI.prototype,"locked",void 0),de([So(!1)],t.UI.prototype,"dim",void 0),de([So(!1)],t.UI.prototype,"dimskip",void 0),de([Ro(0)],t.UI.prototype,"zIndex",void 0),de([Lo(!1)],t.UI.prototype,"mask",void 0),de([Co(!1)],t.UI.prototype,"eraser",void 0),de([ho(0,!0)],t.UI.prototype,"x",void 0),de([ho(0,!0)],t.UI.prototype,"y",void 0),de([go(100,!0)],t.UI.prototype,"width",void 0),de([go(100,!0)],t.UI.prototype,"height",void 0),de([uo(1,!0)],t.UI.prototype,"scaleX",void 0),de([uo(1,!0)],t.UI.prototype,"scaleY",void 0),de([po(0,!0)],t.UI.prototype,"rotation",void 0),de([po(0,!0)],t.UI.prototype,"skewX",void 0),de([po(0,!0)],t.UI.prototype,"skewY",void 0),de([ho(0,!0)],t.UI.prototype,"offsetX",void 0),de([ho(0,!0)],t.UI.prototype,"offsetY",void 0),de([lo(0,!0)],t.UI.prototype,"scrollX",void 0),de([lo(0,!0)],t.UI.prototype,"scrollY",void 0),de([co()],t.UI.prototype,"origin",void 0),de([co()],t.UI.prototype,"around",void 0),de([ao(!1)],t.UI.prototype,"lazy",void 0),de([_o(1)],t.UI.prototype,"pixelRatio",void 0),de([bo(0)],t.UI.prototype,"renderSpread",void 0),de([mo()],t.UI.prototype,"path",void 0),de([yo()],t.UI.prototype,"windingRule",void 0),de([yo(!0)],t.UI.prototype,"closed",void 0),de([go(0)],t.UI.prototype,"padding",void 0),de([go(!1)],t.UI.prototype,"lockRatio",void 0),de([go()],t.UI.prototype,"widthRange",void 0),de([go()],t.UI.prototype,"heightRange",void 0),de([ao(!1)],t.UI.prototype,"draggable",void 0),de([ao()],t.UI.prototype,"dragBounds",void 0),de([ao("auto")],t.UI.prototype,"dragBoundsType",void 0),de([ao(!1)],t.UI.prototype,"editable",void 0),de([Oo(!0)],t.UI.prototype,"hittable",void 0),de([Oo("path")],t.UI.prototype,"hitFill",void 0),de([xo("path")],t.UI.prototype,"hitStroke",void 0),de([Oo(!1)],t.UI.prototype,"hitBox",void 0),de([Oo(!0)],t.UI.prototype,"hitChildren",void 0),de([Oo(!0)],t.UI.prototype,"hitSelf",void 0),de([Oo()],t.UI.prototype,"hitRadius",void 0),de([Ao("")],t.UI.prototype,"cursor",void 0),de([Eo()],t.UI.prototype,"fill",void 0),de([xo(void 0,!0)],t.UI.prototype,"stroke",void 0),de([xo("inside")],t.UI.prototype,"strokeAlign",void 0),de([xo(1,!0)],t.UI.prototype,"strokeWidth",void 0),de([xo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),de([xo("none")],t.UI.prototype,"strokeCap",void 0),de([xo("miter")],t.UI.prototype,"strokeJoin",void 0),de([xo()],t.UI.prototype,"dashPattern",void 0),de([xo(0)],t.UI.prototype,"dashOffset",void 0),de([xo(10)],t.UI.prototype,"miterLimit",void 0),de([yo(0)],t.UI.prototype,"cornerRadius",void 0),de([yo()],t.UI.prototype,"cornerSmoothing",void 0),de([Ah()],t.UI.prototype,"shadow",void 0),de([Ah()],t.UI.prototype,"innerShadow",void 0),de([Ah()],t.UI.prototype,"blur",void 0),de([Ah()],t.UI.prototype,"backgroundBlur",void 0),de([Ah()],t.UI.prototype,"grayscale",void 0),de([Ah()],t.UI.prototype,"filter",void 0),de([Eo()],t.UI.prototype,"placeholderColor",void 0),de([ao(100)],t.UI.prototype,"placeholderDelay",void 0),de([ao({})],t.UI.prototype,"data",void 0),de([zo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Sl=de([No(vl),No(xl),Uo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},de([Do(il)],t.Group.prototype,"__",void 0),de([go(0)],t.Group.prototype,"width",void 0),de([go(0)],t.Group.prototype,"height",void 0),t.Group=de([No(t.Branch),Yo()],t.Group);const Bl=Kt.get("Leafer");t.Leafer=kl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Gn.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),kl.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,m.assign(s,t));const n=this.canvas=ie.canvas(s);this.__controllers.push(this.renderer=ie.renderer(this,n,s),this.watcher=ie.watcher(this,s),this.layouter=ie.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=ie.selector(this),this.interaction=ie.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ie.hitCanvasManager()),this.canvasManager=new le,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))),yr.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(Vr.RESTART):this.emitLeafer(Vr.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(Vr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=m.copyAttrs({},t,Se);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Yt(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=m.copyAttrs({},this.canvas,Se);e.resize(t),this.updateLazyBounds(),this.__onResize(new Hr(t,i))}__onResize(t){this.emitEvent(t),m.copyAttrs(this.__,t,Se),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 Vt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Se.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(Vr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=m.copyAttrs({},s,Se);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(Vr.BEFORE_READY),this.emitLeafer(Vr.READY),this.emitLeafer(Vr.AFTER_READY),yr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Vr.VIEW_READY),yr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){yr.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(Vr.VIEW_COMPLETED),yr.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 ee.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 Vr(t,this))}__listenEvents(){const t=$t.start("FirstCreate "+this.innerName);this.once([[Vr.START,()=>$t.end(t)],[Yr.START,this.updateLazyBounds,this],[Xr.START,this.__onCreated,this],[Xr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Nr.DATA,this.__onWatchData,this],[Yr.END,this.__onLayoutEnd,this],[Xr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){kl.list.remove(this);try{this.stop(),this.emitLeafer(Vr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Kn.clearRecycled()},100)}catch(t){Bl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new dh,de([Do(nl)],t.Leafer.prototype,"__",void 0),de([go()],t.Leafer.prototype,"pixelRatio",void 0),de([ao("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=kl=de([Yo()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},de([Do(al)],t.Rect.prototype,"__",void 0),t.Rect=de([No(El),Uo(),Yo()],t.Rect);const{add:Tl,includes:Pl,scroll:Rl}=zt,Ll=t.Rect.prototype,Cl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(Tl(a,o),Rl(a,i)),this.__updateRectRenderBounds(),t=!Pl(o,a),t&&"show"===r&&Tl(n,a)}else this.__updateRectRenderBounds();m.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))}},de([Do(sl)],t.Box.prototype,"__",void 0),de([go(100)],t.Box.prototype,"width",void 0),de([go(100)],t.Box.prototype,"height",void 0),de([ao(!1)],t.Box.prototype,"resizeChildren",void 0),de([bo("show")],t.Box.prototype,"overflow",void 0),de([zo(Ll.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),de([zo(Ll.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),de([zo(Ll.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),de([zo(Ll.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),de([zo(Ll.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),de([zo(Ll.__updateChange)],t.Box.prototype,"__updateRectChange",null),de([zo(Ll.__render)],t.Box.prototype,"__renderRect",null),de([zo(Cl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=de([Uo(),Yo()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},de([Do(ol)],t.Frame.prototype,"__",void 0),de([Eo("#FFFFFF")],t.Frame.prototype,"fill",void 0),de([bo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=de([Yo()],t.Frame);const{moveTo:Ol,closePath:Al,ellipse:Dl}=ms;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Dl(h,r,a,r*s,a*s,0,n,o,!1),Dl(h,r,a,r,a,0,o,n,!0),s<1&&Al(h)):(s<1&&(Dl(h,r,a,r*s,a*s),Ol(h,t,a)),Dl(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Ol(h,r,a),Dl(h,r,a,r,a,0,n,o,!1),Al(h)):Dl(h,r,a,r,a)}},de([Do(hl)],t.Ellipse.prototype,"__",void 0),de([yo(0)],t.Ellipse.prototype,"innerRadius",void 0),de([yo(0)],t.Ellipse.prototype,"startAngle",void 0),de([yo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=de([Yo()],t.Ellipse);const{sin:Ml,cos:Il,PI:Fl}=Math,{moveTo:Wl,lineTo:zl,closePath:Ul,drawPoints:Hl}=ms;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Hl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Wl(e,o,0);for(let t=1;t<n;t++)zl(e,o+o*Ml(2*t*Fl/n),r-r*Il(2*t*Fl/n));Ul(e)}}},de([Do(ll)],t.Polygon.prototype,"__",void 0),de([yo(3)],t.Polygon.prototype,"sides",void 0),de([yo()],t.Polygon.prototype,"points",void 0),de([yo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=de([Uo(),Yo()],t.Polygon);const{sin:Nl,cos:Yl,PI:Xl}=Math,{moveTo:Vl,lineTo:Gl,closePath:jl}=ms;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Vl(r,n,0);for(let t=1;t<2*i;t++)Gl(r,n+(t%2==0?n:n*s)*Nl(t*Xl/i),o-(t%2==0?o:o*s)*Yl(t*Xl/i));jl(r)}},de([Do(dl)],t.Star.prototype,"__",void 0),de([yo(5)],t.Star.prototype,"corners",void 0),de([yo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=de([Yo()],t.Star);const{moveTo:Kl,lineTo:Zl,drawPoints:ql}=ms,{rotate:Jl,getAngle:$l,getDistance:Ql,defaultPoint:td}=ot;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Jl(i,e),i}set toPoint(t){this.width=Ql(td,t),this.rotation=$l(td,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ql(e,t.points,t.curve,t.closed):(Kl(e,0,0),Zl(e,this.width,0))}},de([Do(rl)],t.Line.prototype,"__",void 0),de([vo("center")],t.Line.prototype,"strokeAlign",void 0),de([go(0)],t.Line.prototype,"height",void 0),de([yo()],t.Line.prototype,"points",void 0),de([yo(0)],t.Line.prototype,"curve",void 0),de([yo(!1)],t.Line.prototype,"closed",void 0),t.Line=de([Yo()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}},de([Do(_l)],t.Image.prototype,"__",void 0),de([go("")],t.Image.prototype,"url",void 0),t.Image=de([Yo()],t.Image);const ed=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ie.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new to({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ut(t.worldTransform).invert(),o=new ut;e&&o.translate(e.x,e.y),i&&(d(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},de([Do(fl)],t.Canvas.prototype,"__",void 0),de([Dh(100)],t.Canvas.prototype,"width",void 0),de([Dh(100)],t.Canvas.prototype,"height",void 0),de([Dh(1)],t.Canvas.prototype,"pixelRatio",void 0),de([Dh(!0)],t.Canvas.prototype,"smooth",void 0),de([ao(!1)],t.Canvas.prototype,"safeResize",void 0),de([Dh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=de([Yo()],t.Canvas);const{copyAndSpread:id,includes:sd,spread:nd,setList:od}=zt;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Wh.number(e,n),t.__letterSpacing=Wh.number(i,n),t.__padding=l?A.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Ih.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&nd(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),m.stintSet(this,"isOverflow",!sd(h,a)),this.isOverflow?(od(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;id(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()}},de([Do(gl)],t.Text.prototype,"__",void 0),de([go(0)],t.Text.prototype,"width",void 0),de([go(0)],t.Text.prototype,"height",void 0),de([Eo()],t.Text.prototype,"boxStyle",void 0),de([ao(!1)],t.Text.prototype,"resizeFontSize",void 0),de([Eo("#000000")],t.Text.prototype,"fill",void 0),de([vo("outside")],t.Text.prototype,"strokeAlign",void 0),de([Oo("all")],t.Text.prototype,"hitFill",void 0),de([go("")],t.Text.prototype,"text",void 0),de([go("")],t.Text.prototype,"placeholder",void 0),de([go("caption")],t.Text.prototype,"fontFamily",void 0),de([go(12)],t.Text.prototype,"fontSize",void 0),de([go("normal")],t.Text.prototype,"fontWeight",void 0),de([go(!1)],t.Text.prototype,"italic",void 0),de([go("none")],t.Text.prototype,"textCase",void 0),de([go("none")],t.Text.prototype,"textDecoration",void 0),de([go(0)],t.Text.prototype,"letterSpacing",void 0),de([go({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),de([go(0)],t.Text.prototype,"paraIndent",void 0),de([go(0)],t.Text.prototype,"paraSpacing",void 0),de([go("x")],t.Text.prototype,"writingMode",void 0),de([go("left")],t.Text.prototype,"textAlign",void 0),de([go("top")],t.Text.prototype,"verticalAlign",void 0),de([go(!0)],t.Text.prototype,"autoSizeAlign",void 0),de([go("normal")],t.Text.prototype,"textWrap",void 0),de([go("show")],t.Text.prototype,"textOverflow",void 0),de([Eo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=de([Yo()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},de([Do(cl)],t.Path.prototype,"__",void 0),de([vo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=de([Yo()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},de([Do(ul)],t.Pen.prototype,"__",void 0),de([(t,e)=>{eo(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=de([No(Ds,["set","path","paint"]),Yo()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ie.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&m.assign(e,t),this.autoLayout&&m.copyAttrs(e,this,Se),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Yr.END,this.__onReady,this],[Xr.START,this.__onCreated,this],[Xr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Xr.END,this.__onChildRenderEnd,this))}},t.App=de([Yo()],t.App);const rd={},ad={isHoldSpaceKey:()=>ad.isHold("Space"),isHold:t=>rd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){rd[t]||(rd[t]=!0)},setUpCode(t){rd[t]=!1}},hd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class ld extends Rr{get spaceKey(){return ad.isHoldSpaceKey()}get left(){return hd.left(this)}get right(){return hd.right(this)}get middle(){return hd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return ad.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ae.changeName(t,e)}}const{min:dd,max:cd,abs:ud}=Math,{float:pd,sign:gd}=A,{minX:_d,maxX:fd,minY:md,maxY:yd}=zt,vd=new Yt,wd=new Yt,xd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&bd.getValidMove(t.__localBoxBounds,bd.getDragBounds(t),s,e,!0),bd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&bd.getValidScaleOf(t.__localBoxBounds,bd.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),bd.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),bd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=pd(s.x),s.y=pd(s.y),s},getValidScaleOf(t,e,i,s,n,o,r){r||(n=Object.assign({},n)),wd.set(e),vd.set(t).scaleOf(s,n.x,n.y);const a=(s.x-t.x)/t.width,h=1-a,d=(s.y-t.y)/t.height,c=1-d;let u,p,g,_,f=1,m=1;return bd.isInnerMode(t,e,i,"width")?(n.x<0&&vd.scaleOf(s,f=1/n.x,1),g=pd(vd.minX-wd.minX),_=pd(wd.maxX-vd.maxX),u=a&&g>0?1+g/(a*vd.width):1,p=h&&_>0?1+_/(h*vd.width):1,f*=cd(u,p)):(n.x<0&&((pd(_d(t)-_d(e))<=0||pd(fd(e)-fd(t))<=0)&&vd.scaleOf(s,f=1/n.x,1),vd.unsign()),g=pd(wd.minX-vd.minX),_=pd(vd.maxX-wd.maxX),u=a&&g>0?1-g/(a*vd.width):1,p=h&&_>0?1-_/(h*vd.width):1,f*=dd(u,p)),bd.isInnerMode(t,e,i,"height")?(n.y<0&&vd.scaleOf(s,1,m=1/n.y),g=pd(vd.minY-wd.minY),_=pd(wd.maxY-vd.maxY),u=d&&g>0?1+g/(d*vd.height):1,p=c&&_>0?1+_/(c*vd.height):1,m*=cd(u,p),o&&(u=cd(ud(f),ud(m)),f=gd(f)*u,m=gd(m)*u)):(n.y<0&&((pd(md(t)-md(e))<=0||pd(yd(e)-yd(t))<=0)&&vd.scaleOf(s,1,m=1/n.y),vd.unsign()),g=pd(wd.minY-vd.minY),_=pd(vd.maxY-wd.maxY),u=d&&g>0?1-g/(d*vd.height):1,p=c&&_>0?1-_/(c*vd.height):1,m*=dd(u,p)),n.x*=l(f)?f:1,n.y*=l(m)?m:1,n}},bd=xd;t.PointerEvent=class extends ld{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=de([Xo()],t.PointerEvent);const Ed=t.PointerEvent,Sd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof dh?t:new dh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return ot.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),xd.axisMove(t,n),n}static limitMove(t,e){xd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Sd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Sd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Sd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return zt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),zt.unsign(i),i}assignMove(t){Sd.x=t?this.totalX:this.moveX,Sd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=de([Xo()],t.DragEvent);const kd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=de([Xo()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=de([Xo()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=de([Xo()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=de([Xo()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=de([Xo()],t.ZoomEvent),t.KeyEvent=class extends ld{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=de([Xo()],t.KeyEvent);const Bd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Td.getSwipeDirection(ot.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new dh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ir.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Td=Bd,Pd=new dh,{getDragEventData:Rd,getDropEventData:Ld,getSwipeEventData:Cd}=Bd;class Od{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Rd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||Pd;return this.dragging&&(n?e?Pd:new dh(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&hd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ir.draggable(e)){this.draggableList=new dh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=Rd(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:r}=i.p,a=!r||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},a||n);r&&!n&&e?ir.animateMove(i,l,d(r)?r:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=Rd(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(ot.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Cd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Ld(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Ad=Kt.get("emit");const Dd=["move","zoom","rotate","key"];function Md(t,e,i,s,n){if(Dd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Fd(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&Id(o,e,i,s,n)}}function Id(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Fd(t,n)&&(Gh.updateEventStyle&&!s&&Gh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ae.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Fd(t,e){return e&&e.has(t)}const Wd={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:zd,pathCanDrag:Ud,pathHasOutside:Hd}=Bd;class Nd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&hd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&hd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&ad.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=m.clone(Wd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new dh(t),this.createTransformer(),this.dragger=new Od(this),s&&(this.config=m.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(hd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),hd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=hd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&hd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ot.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;hd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,ad.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,ad.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new dh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>zd(e.path,t));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.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&&!Hd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Ud(t.path))&&!Hd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&ot.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(zd(e.path,t.PointerEvent.LONG_TAP)||zd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Yt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Hr.RESIZE,this.__onResize,this)],t.once(Vr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],Id(n,t,e,!0,s))return;n.isApp&&Md(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Md(n,t,e,!1,s),Id(n,t,e,!1,s))return}catch(t){Ad.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 Yd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Yd.custom={};class Xd extends le{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new dh,this.pixelList=new dh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ie.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ie.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()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=ie.selector())};const{toInnerRadiusPointOf:Vd,copy:Gd,setRadius:jd}=ot,{hitRadiusPoint:Kd,hitPoint:Zd}=zt,qd={},Jd={},$d=t.Leaf.prototype;$d.hit=function(t,i=0){this.updateLayout(),Gd(Jd,t),jd(Jd,i);const s=this.__world;return!!(i?Kd(s,Jd):Zd(s,Jd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},Jd),i,{target:this}):this.__hitWorld(Jd))},$d.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Gd(qd,t),jd(t=qd,e.hitRadius)),Vd(t,i,qd),e.hitBox||n){if(zt.hitRadiusPoint(s.boxBounds,qd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(qd)},$d.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},$d.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},$d.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},$d.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Qd=new ut,tc=t.UI.prototype;tc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const i=this.__,s=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,o=s||n;this.__hitCanvas||(this.__hitCanvas=o?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,o=e.image.hitCanvasSize,a=r.hitScale=Xt.set(0,0,o,o).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Xt.set(t).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),Kn.patternLocked=!0,this.__renderShape(r,{matrix:Qd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l),ignoreFill:!s,ignoreStroke:!n}),Kn.patternLocked=!1,r.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(i)},tc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const ec=t.UI.prototype,ic=t.Rect.prototype,sc=t.Box.prototype;ic.__updateHitCanvas=sc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?ec.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ic.__hitFill=sc.__hitFill=function(t){return this.__hitCanvas?ec.__hitFill.call(this,t):zt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,i){return i||(i=o),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const nc=ke.prototype;function oc(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[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(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,o)))}}function rc(t,e){t.__.__font?oc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ac(t,e,i){switch(e.__.strokeAlign){case"center":hc(t,1,e,i);break;case"inside":lc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?hc(t,2,e,i):lc(t,"outside",e,i)}}function hc(t,e,i,s){const n=i.__;g(t)?cc(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),dc(i,s))}function lc(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,hc(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",oc(i,n),n.blendMode="normal",ir.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function dc(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(o){const{decorationHeight:t}=s;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function cc(t,e,i,s,n){let o;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||n.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Hh.checkImage(s,n,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?n.setStroke(o.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(o.style,r.__strokeWidth*e,r)}else n.strokeStyle=o.style;o.blendMode?(n.saveBlendMode(o.blendMode),i?dc(s,n):n.stroke(),n.restoreBlendMode()):i?dc(s,n):n.stroke()}}function uc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)ac(t,e,i);else switch(s.strokeAlign){case"center":pc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),pc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)pc(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),pc(t,2,e,o),o.clipUI(s),o.clearWorld(n),ir.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function pc(t,e,i,s){const n=i.__;g(t)?cc(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Uh.strokeArrow(t,i,s)}nc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},nc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},nc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Xt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Xt.x,Xt.y,Xt.width||1,Xt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:gc,copyAndSpread:_c,toOuterOf:fc,getOuterOf:mc,getByMove:yc,move:vc,getIntersectData:wc}=zt,xc={};let bc;const{stintSet:Ec}=m,{hasTransparent:Sc}=Fh;function kc(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Hh.image(i,t,e,n,!bc||!bc[e.url]);break;case"linear":s=Nh.linearGradient(e,n);break;case"radial":s=Nh.radialGradient(e,n);break;case"angular":s=Nh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:Fh.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:Fh.string(e)})}if(s){if(h(s.style)&&Sc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const Bc={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];p(a)||(a=[a]),bc=Hh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=kc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(Ec(i,"__isAlphaPixelFill",n),Ec(i,"__isTransparentFill",o)):(Ec(i,"__isAlphaPixelStroke",n),Ec(i,"__isTransparentStroke",o),Ec(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,rc(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(Hh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),rc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),rc(e,i),i.restoreBlendMode()):rc(e,i)}},fillPathOrText:rc,fillText:oc,stroke:uc,strokes:function(t,e,i){uc(t,e,i)},strokeText:ac,drawTextStroke:dc,shape:function(t,i,s){const n=i.getSameCanvas(),o=i.bounds,r=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,d,c,u,p,g;fc(a.strokeSpread?(_c(xc,a.boxBounds,a.strokeSpread),xc):a.boxBounds,r,h);let{scaleX:_,scaleY:f}=t.getRenderScaleData(!0);if(o.includes(h))g=n,l=p=h,d=r;else{let n;if(e.fullImageShadow)n=h;else{const t=a.renderShapeSpread?gc(o,k.swapAndScale(a.renderShapeSpread,_,f)):o;n=wc(t,h)}u=o.getFitMatrix(n);let{a:m,d:y}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),_*=m,f*=y),p=mc(h,u),l=yc(p,-u.e,-u.f),d=mc(r,u),vc(d,-u.e,-u.f);const v=s.matrix;v?(c=new ut(u),c.multiply(v),m*=v.scaleX,y*=v.scaleY):c=u,c.withScale(m,y),s=Object.assign(Object.assign({},s),{matrix:c})}return t.__renderShape(n,s),{canvas:n,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:g,shapeBounds:p,scaleX:_,scaleY:f}}};let Tc={},Pc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Rc,set:Lc,rotateOfOuter:Cc,translate:Oc,scaleOfOuter:Ac,multiplyParent:Dc,scale:Mc,rotate:Ic,skew:Fc}=K;function Wc(t,e,i,s){const n=Rc();Oc(n,e.x,e.y),i&&Mc(n,i,s),t.transform=n}function zc(t,e,i,s,n,o,r){const a=Rc();Oc(a,e.x+i,e.y+s),Mc(a,n,o),r&&Cc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Uc(t,e,i,s,n,o,r,a,h,l){const d=Rc();Nc(d,e,i,s,n,o,r,a),h&&(r||a?(Lc(Pc),Ac(Pc,e,h,l),Dc(d,Pc)):Ac(d,e,h,l)),t.transform=d}function Hc(t,e,i,s,n,o,r,a,h,l,d,c){const u=Rc();if(c)Nc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Cc(u,{x:i/2,y:s/2},h);else switch(Ic(u,h),h){case 90:Oc(u,s,0);break;case 180:Oc(u,i,s);break;case 270:Oc(u,0,i)}Tc.x=e.x+n,Tc.y=e.y+o,Oc(u,Tc.x,Tc.y),r&&Ac(u,Tc,r,a)}t.transform=u}function Nc(t,e,i,s,n,o,r,a){r&&Ic(t,r),a&&Fc(t,a.x,a.y),n&&Mc(t,n,o),Oc(t,e.x+i,e.y+s)}const{get:Yc,translate:Xc}=K,Vc=new Yt,Gc={},jc={};function Kc(t,e,i,s){const{changeful:n,sync:o,scaleFixed:r}=i;n&&(t.changeful=n),o&&(t.sync=o),r&&(t.scaleFixed=r),t.data=Zc(i,s,e)}function Zc(t,e,i){t.padding&&(e=Vc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:a,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==a&&(u||0)%180==90;let b,E;switch(zt.set(jc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(A.getScaleData(d,c,i,Gc),b=Gc.scaleX,E=Gc.scaleY),(a||m||f)&&(b&&zt.scale(jc,b,E,!0),a&&bt.toPoint(a,jc,e,jc,!0,!0))):v&&!u||(b=E=zt.getFitScale(e,jc,"fit"!==r),zt.put(e,i,a,b,!1,jc),zt.scale(jc,b,E,!0)),l&&ot.move(jc,l),r){case"stretch":v||(b=e.width/s,E=e.height/n,Wc(w,e,b,E));break;case"normal":case"clip":if(jc.x||jc.y||b||_||u||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Uc(w,e,jc.x,jc.y,b,E,u,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||u||p)&&Hc(w,e,s,n,jc.x,jc.y,b,E,u,p,a,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;g(t)?(o=t.x,r=t.y):o=r=t;return{x:qc(o,i,n.width,e&&e.x),y:qc(r,s,n.height,e&&e.y)}}(m,i&&f,jc.width,jc.height,e));break;default:b&&zc(w,e,jc.x,jc.y,b,E,u)}return w.transform||(e.x||e.y)&&Xc(w.transform=Yc(),e.x,e.y),w.width=s,w.height=n,b&&(w.scaleX=b,w.scaleY=E),o&&(w.opacity=o),y&&(w.filters=y),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function qc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Jc,$c=new Yt;const{isSame:Qc}=zt;function tu(t,e,i,s,n,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Kc(n,s,i,o),!0}function eu(t,e){nu(t,Dr.LOAD,e)}function iu(t,e){nu(t,Dr.LOADED,e)}function su(t,e,i){e.error=i,t.forceUpdate("surface"),nu(t,Dr.ERROR,e)}function nu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Dr(e,i))}function ou(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:ru,scale:au,copy:hu}=K,{floor:lu,ceil:du,max:cu,abs:uu}=Math;function pu(t,i,s){let{scaleX:n,scaleY:o}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:p,scaleY:g,transform:_,repeat:f,gap:m}=h;n*=s,o*=s,p&&(p=uu(p),g=uu(g),d=ru(),hu(d,_),au(d,1/p,1/g),n*=p,o*=g),c*=n,u*=o;const y=c*u;if(!f&&y>e.image.maxCacheSize)return!1;let v=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/du(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(n/=l,o/=l,c/=l,u/=l),p&&(n/=p,o/=g);const w=m&&m.x*n,x=m&&m.y*o;if(_||1!==n||1!==o){const t=c+(w||0),e=u+(x||0);n/=t/cu(lu(t),1),o/=e/cu(lu(e),1),d||(d=ru(),_&&hu(d,_)),au(d,1/n,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,t.leafer&&t.leafer.config.smooth),E=a.getPattern(b,f||e.origin.noRepeat||"no-repeat",d,i);return i.style=E,i.patternId=r,!0}}const gu={image:function(t,e,i,s,n){let o,r;const a=Kn.get(i);return Jc&&i===Jc.paint&&Qc(s,Jc.boxBounds)?o=Jc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Jc=a.use>1?{leafPaint:o,paint:i,boxBounds:$c.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(tu(t,e,i,a,o,s),n&&(eu(t,r),iu(t,r))):a.error?n&&su(t,r,a.error):(n&&(ou(t,!0),eu(t,r)),o.loadId=a.load(()=>{ou(t,!1),t.destroyed||(tu(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),iu(t,r)),o.loadId=void 0},e=>{ou(t,!1),su(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,i,s,n){const{scaleX:o,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Vh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&Hr.isResizing(t)||Vh.running)){let{width:t,height:i}=h;t*=o*a,i*=r*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,h),!0):(!s.style||s.sync||Vh.running?pu(t,s,a):s.patternTask||(s.patternTask=Kn.patternTasker.add(()=>ce(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&pu(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:pu,recycleImage:function(t,e){const i=e["_"+t];if(p(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,Kn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],p(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:Kc,getPatternData:Zc,stretchMode:Wc,fillOrFitMode:zc,clipMode:Uc,repeatMode:Hc},{toPoint:_u}=vt,{hasTransparent:fu}=Fh,mu={},yu={};function vu(t,e,i,s){if(i){let n,o,r,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(r=t/(l-1),o=Fh.string(n,s)):(r=n.offset,o=Fh.string(n.color,s)),e.addColorStop(r,o),!a&&fu(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:wu,getDistance:xu}=ot,{get:bu,rotateOfOuter:Eu,scaleOfOuter:Su}=K,{toPoint:ku}=vt,Bu={},Tu={};function Pu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=wu(e,i);o=bu(),n?(Su(o,e,r/a*(s||1),1),Eu(o,e,t+90)):(Su(o,e,1,r/a*(s||1)),Eu(o,e,t))}return o}const{getDistance:Ru}=ot,{toPoint:Lu}=vt,Cu={},Ou={};const Au={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:r}=t;_u(s||"top",i,mu),_u(n||"bottom",i,yu);const a=e.canvas.createLinearGradient(mu.x,mu.y,yu.x,yu.y),h={type:o,style:a};return vu(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;ku(s||"center",i,Bu),ku(n||"bottom",i,Tu);const h=e.canvas.createRadialGradient(Bu.x,Bu.y,0,Bu.x,Bu.y,xu(Bu,Tu)),l={type:o,style:h};vu(l,h,t.stops,r);const d=Pu(i,Bu,Tu,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Lu(s||"center",i,Cu),Lu(n||"bottom",i,Ou);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Cu.x,Cu.y):e.canvas.createRadialGradient(Cu.x,Cu.y,0,Cu.x,Cu.y,Ru(Cu,Ou)),l={type:o,style:h};vu(l,h,t.stops,r);const d=Pu(i,Cu,Ou,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Pu},{copy:Du,move:Mu,toOffsetOutBounds:Iu}=zt,{max:Fu,abs:Wu}=Math,zu={},Uu=new ut,Hu={};function Nu(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=Wu(t.spread||0),r=Fu(r,n+o-s),a=Fu(a,n+o+i),h=Fu(h,n+o+s),l=Fu(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function Yu(t,i,s){const{shapeBounds:n}=s;let o,r;e.fullImageShadow?(Du(zu,t.bounds),Mu(zu,i.x-n.x,i.y-n.y),o=t.bounds,r=zu):(o=n,r=i),t.copyWorld(s.canvas,o,r)}const{toOffsetOutBounds:Xu}=zt,Vu={};const Gu=Nu;const ju={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=r.length-1;Iu(h,Hu,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Hu.offsetX+(r.x||0)*c*f,Hu.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Fh.string(r.color)),n=Yh.getShadowTransform(t,p,i,r,Hu,f),n&&p.setTransform(n),Yu(p,Hu,i),n&&p.resetTransform(),s=l,r.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,o,"copy"),s=o),a?p.copyWorld(a,o,o,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),ir.copyCanvasByWorld(t,e,p,s,r.blendMode),g&&_<g&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=r.length-1;Xu(h,Vu,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Vu.offsetX+(r.x||0)*c*f,Vu.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=Yh.getShadowTransform(t,p,i,r,Vu,f,!0),n&&p.setTransform(n),Yu(p,Vu,i),p.restore(),a?(p.copyWorld(p,l,o,"copy"),p.copyWorld(a,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,Fh.string(r.color),"source-in"),ir.copyCanvasByWorld(t,e,p,s,r.blendMode),g&&_<g&&p.clearWorld(s)}),p.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:Nu,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Uu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Uu}},isTransformShadow(t){},getInnerShadowSpread:Gu},{excludeRenderBounds:Ku}=dr;let Zu;function qu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Zu||(Zu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);$u(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":$u(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Ju(t){return t.getSameCanvas(!1,!0)}function $u(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(qu(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Ku(i,e)||i.__render(t,e),o=i.__.opacity,Zu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Ju(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Ju(t)),n||(n=Ju(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&qu(this,r,t,n,s,o,void 0,!1),Ku(i,e)||i.__render(n||t,e),d&&qu(this,r,t,n,s,o,d,!1)}qu(this,r,t,n,s,o,void 0,!0)};const Qu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",tp=Qu+"_#~&*+\\=|≮≯≈≠=…",ep=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 ip(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const sp=ip("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),np=ip("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),op=ip(Qu),rp=ip(tp),ap=ip("- —/~|┆·");var hp;!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"}(hp||(hp={}));const{Letter:lp,Single:dp,Before:cp,After:up,Symbol:pp,Break:gp}=hp;function _p(t){return sp[t]?lp:ap[t]?gp:np[t]?cp:op[t]?up:rp[t]?pp:ep.test(t)?dp:lp}const fp={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function mp(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:yp}=fp,{Letter:vp,Single:wp,Before:xp,After:bp,Symbol:Ep,Break:Sp}=hp;let kp,Bp,Tp,Pp,Rp,Lp,Cp,Op,Ap,Dp,Mp,Ip,Fp,Wp,zp,Up,Hp,Np=[];function Yp(t,e){Ap&&!Op&&(Op=Ap),kp.data.push({char:t,width:e}),Tp+=e}function Xp(){Pp+=Tp,kp.width=Tp,Bp.words.push(kp),kp={data:[]},Tp=0}function Vp(){Wp&&(zp.paraNumber++,Bp.paraStart=!0,Wp=!1),Ap&&(Bp.startCharSize=Op,Bp.endCharSize=Ap,Op=0),Bp.width=Pp,Up.width?yp(Bp):Hp&&Gp(),Np.push(Bp),Bp={words:[]},Pp=0}function Gp(){Pp>(zp.maxWidth||0)&&(zp.maxWidth=Pp)}const{top:jp,right:Kp,bottom:Zp,left:qp}=t.Direction4;function Jp(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 $p={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(o?(s=d[qp],o-=d[Kp]+d[qp]):i.autoSizeAlign||(s=d[qp]),r?(n=d[jp],r-=d[jp]+d[Zp]):i.autoSizeAlign||(n=d[jp]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){zp=t,Np=t.rows,Up=t.bounds,Hp=!Up.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=Up;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Wp=!0,Mp=null,Op=Cp=Ap=Tp=Pp=0,kp={data:[]},Bp={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Lp=i[s],"\n"===Lp?(Tp&&Xp(),Bp.paraEnd=!0,Vp(),Wp=!0):(Dp=_p(Lp),Dp===vp&&"none"!==r&&(Lp=mp(Lp,r,!Tp)),Cp=a.measureText(Lp).width,n&&(n<0&&(Ap=Cp),Cp+=n),Ip=Dp===wp&&(Mp===wp||Mp===vp)||Mp===wp&&Dp!==bp,Fp=!(Dp!==xp&&Dp!==wp||Mp!==Ep&&Mp!==bp),Rp=Wp&&o?h-o:h,t&&h&&Pp+Tp+Cp>Rp&&(e?(Tp&&Xp(),Pp&&Vp()):(Fp||(Fp=Dp===vp&&Mp==bp),Ip||Fp||Dp===Sp||Dp===xp||Dp===wp||Tp+Cp>Rp?(Tp&&Xp(),Pp&&Vp()):Pp&&Vp()))," "===Lp&&!0!==Wp&&Pp+Tp===0||(Dp===Sp?(" "===Lp&&Tp&&Xp(),Yp(Lp,Cp),Xp()):Ip||Fp?(Tp&&Xp(),Yp(Lp,Cp)):Yp(Lp,Cp)),Mp=Dp);Tp&&Xp(),Pp&&Vp(),Np.length>0&&(Np[Np.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{zp.paraNumber++,Pp=a.measureText(t).width,Np.push({x:o||0,text:t,width:Pp,paraStart:!0}),Hp&&Gp()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Jp(e,"x",t[qp]);break;case"right":Jp(e,"x",-t[Kp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Jp(e,"y",t[jp]);break;case"bottom":Jp(e,"y",-t[Zp])}}(d,c,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:g,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,o),c.overflow&&function(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[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],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,o),"none"!==a&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,g(o)?(i=o.type,o.color&&(t.decorationColor=Fh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(c,i),c}};const Qp={string:function(t,e){if(!t)return"#000";const i=d(e)&&e<1;if(h(t)){if(!i||!Fh.object)return t;t=Fh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function tg(t){return t?p(t)?t:[t]:[]}Object.assign(Ih,$p),Object.assign(Fh,Qp),Object.assign(Uh,Bc),Object.assign(Hh,gu),Object.assign(Nh,Au),Object.assign(Yh,ju),Object.assign(ie,{interaction:(t,e,i,s)=>new Nd(t,e,i,s),hitCanvas:(t,e)=>new uh(t,e),hitCanvasManager:()=>new Xd}),gh();class eg extends Rr{get list(){return tg(this.value)}get oldList(){return tg(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function ig(t){return(e,i)=>{const s="_"+i;eo(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),p(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?eg.BEFORE_SELECT:eg.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new eg(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}eg.BEFORE_SELECT="editor.before_select",eg.SELECT="editor.select",eg.AFTER_SELECT="editor.after_select",eg.BEFORE_HOVER="editor.before_hover",eg.HOVER="editor.hover";const{abs:sg}=Math,{copy:ng,scale:og}=K,{setListWithFn:rg}=zt,{worldBounds:ag}=dr,hg={a:1,b:0,c:0,d:1,e:0,f:0},lg={x:0,y:0,width:0,height:0};class dg extends t.UI{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?(rg(lg,e,ag),t&&this.set(t),this.set(lg),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:a}=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=sg(c.scaleX),l=sg(c.scaleY);if(ng(hg,c),hg.half=r%2,i!==l){og(hg,1/i,1/l),t.setWorld(hg,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,a*l,h*i,d*l)}else t.setWorld(hg,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/sg(c.scaleX);o&&(h(o)?Uh.stroke(o,this,t):Uh.strokes(o,this,t)),a&&(h(a)?Uh.fill(a,this,t):Uh.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}de([ig(function(t){const e=t.target;t.list=e?p(e)?e:[e]:[]})],dg.prototype,"target",void 0);class cg extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 ug={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return pg([t],i,e),i}};function pg(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&pg(s.children,e,i)}}const{findOne:gg,findByBounds:_g}=ug;class fg extends t.Group{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 dg,this.targetStroker=new dg,this.bounds=new Yt,this.selectArea=new cg,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new dh(_g(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)&&!gg(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new dh(this.editor.editBox.rect)};return gg(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):gg(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:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[eg.HOVER,this.onHover,this],[eg.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:mg,top:yg,topRight:vg,right:wg,bottomRight:xg,bottom:bg,bottomLeft:Eg,left:Sg}=t.Direction9,{toPoint:kg}=vt,{within:Bg,sign:Tg}=A,{abs:Pg}=Math,Rg={getScaleData(t,e,i,s,n,o,r,a){let h,l,c={},u=1,p=1;const{boxBounds:g,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,E=Tg(x),S=Tg(b),k=a?x:E*g.width/v,B=a?b:S*g.height/w;if(d(s))u=p=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=a?x:E,s.y*=a?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,d=(-s.x+v)/v;switch(i){case yg:p=t,h="bottom";break;case wg:u=e,h="left";break;case bg:p=r,h="top";break;case Sg:u=d,h="right";break;case mg:p=t,u=d,h="bottom-right";break;case vg:p=t,u=e,h="bottom-left";break;case xg:p=r,u=e,h="top-left";break;case Eg:p=r,u=d,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case yg:case bg:u=p;break;case Sg:case wg:p=u;break;default:l=Math.sqrt(Pg(u*p)),u=Tg(u)*l,p=Tg(p)*l}}const T=1!==u,P=1!==p;if(T&&(u/=k),P&&(p/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),p<0&&(p=1/g.height/e.scaleY)}if(kg(o||h,g,c,!0),m){const e={x:u,y:p};xd.limitScaleOf(t,c,e,n),u=e.x,p=e.y}if(T&&_){const e=g.width*t.scaleX;u=Bg(e*u,_)/e}if(P&&f){const e=g.height*t.scaleY;p=Bg(e*p,f)/e}return T&&Pg(u*y.width)<1&&(u=Tg(u)/y.width),P&&Pg(p*y.height)<1&&(p=Tg(p)/y.height),n&&u!==p&&(l=Math.min(Pg(u),Pg(p)),u=Tg(u)*l,p=Tg(p)*l),{origin:c,scaleX:u,scaleY:p,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case mg:o="bottom-right";break;case vg:o="bottom-left";break;case xg:o="top-left";break;case Eg:o="top-right";break;default:o="center"}return kg(n||o,t.boxBounds,r,!0),{origin:r,rotation:ot.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case yg:case mg:o={x:.5,y:0},n="bottom",a=1;break;case bg:case xg:o={x:.5,y:1},n="top",a=1;break;case Sg:case Eg:o={x:0,y:.5},n="right",h=1;break;case wg:case vg:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,kg(s||n,t,r,!0);const c=ot.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Sg:t=wg;break;case mg:t=vg;break;case Eg:t=xg;break;case wg:t=Sg;break;case vg:t=mg;break;case xg:t=Eg}if(i)switch(t){case yg:t=bg;break;case mg:t=Eg;break;case vg:t=xg;break;case bg:t=yg;break;case Eg:t=mg;break;case xg:t=vg}return t}},Lg={};function Cg(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return Og(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,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)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?p:o?c:u:v?p:y?c:u;h+=45*(Rg.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(A.formatRotation(h,!0)/2);const{url:x,x:b,y:E}=w,S=x+h;Lg[S]?i.cursor=Lg[S]:Lg[S]=i.cursor={url:Ag(x,h),x:b,y:E}}function Og(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Ag(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Dg extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const Mg=["top","right","bottom","left"],Ig=void 0;class Fg extends t.Group{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 h(t)||h(e)||h(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(e){super(),this.view=new t.Group,this.rect=new Dg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Dg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Dg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Dg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Dg({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o,resizeLines:r}=this,{stroke:h,strokeWidth:l,resizeLine:d,ignorePixelSnap:c}=e,u=this.getPointsStyle(),p=this.getMiddlePointsStyle();let g;this.visible=!t.locked;for(let t=0;t<8;t++)g=o[t],g.set(this.getPointStyle(t%2?p[(t-1)/2%p.length]:u[t/2%u.length])),g.rotation=(t-(t%2?1:0))/2*90,t%2&&r[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},d||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||u[0])),s.set(Object.assign({stroke:h,strokeWidth:l,editConfig:Ig},e.rect||{}));const _=a(e.rectThrough)?i:e.rectThrough;s.hittable=!_,_&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&m.stintSet(t.__world,"ignorePixelSnap",c),Og(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{editMask:c}=e,{middlePoint:u,resizeable:p,rotateable:g,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&zt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=d(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,E,S={};for(let i=0;i<8;i++)vt.toPoint(vt.directionData[i],t,S),w=a[i],v=h[i],w.set(S),v.set(S),w.visible=y&&!(!p&&!g),v.visible=y&&g&&p&&!x,i%2&&(E=l[(i-1)/2],E.set(S),E.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(E.width=e+E.height,_&&2*w.width>e&&(w.visible=!1)):(E.width=c+E.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&g&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=Mg.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=Mg.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Rg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:Ig};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return p(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return p(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}Cg(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){this.moving&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Hr.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(e){this.canDragLimitAnimate&&(e instanceof t.DragEvent||e instanceof t.MoveEvent)&&this.transformTool.onMove(e),this.resizing&&(Hr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(e){this.canGesture&&"drag"!==e.moveType&&(e.stop(),h(this.mergedConfig.moveable)&&(this.gesturing=this.moving=!0,e.type===t.MoveEvent.START?this.onTransformStart(e):this.transformTool.onMove(e)))}onScale(e){this.canGesture&&(e.stop(),h(this.mergedConfig.resizeable)&&(this.gesturing=this.resizing=!0,e.type===t.ZoomEvent.START?this.onTransformStart(e):this.transformTool.onScale(e)))}onRotate(e){this.canGesture&&(e.stop(),h(this.mergedConfig.rotateable)&&(this.gesturing=this.rotating=!0,e.type===t.RotateEvent.START?this.onTransformStart(e):this.transformTool.onRotate(e)))}onGestureStart(t){this.canGesture&&"drag"!==t.moveType&&this.onTransformStart(t)}onGestureEnd(t){this.canGesture&&"drag"!==t.moveType&&this.onTransformEnd(t)}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Cg(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(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i,this.__eventIds.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,t=>{this.enterPoint=e,Cg(this,t)}],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[[t.MoveEvent.START,t.ZoomEvent.START,t.RotateEvent.START],this.onGestureStart,this],[[t.MoveEvent.END,t.ZoomEvent.END,t.RotateEvent.END],this.onGestureEnd,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Wg={x:0,y:0,width:1e5,height:1e5};class zg extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Wg),Object.assign(this.__world,Wg)}__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 Ug='\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"/>',Hg={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${Ug}\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${Ug}\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${Ug}\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},Ng=new Yt;function Yg(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Ng.setListWithFn(i,t=>t.getBounds("box","page")),0===Ng.width&&(Ng.width=.1),0===Ng.height&&(Ng.height=.1),e.reset(Ng.get())}),s.add(e)}const Xg=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Vg=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Gg={group(e,i,s){e.sort(Vg);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(Xg);const a=new ut(i.worldTransform);return a.divideParent(o.scrollWorldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(r)),n.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(Xg),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Vg),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},jg=Kt.get("EditToolCreator");function Kg(){return t=>{qg.register(t)}}const Zg=Kg,qg={list:{},register(t){const{tag:e}=t.prototype;Jg[e]&&jg.repeat(e),Jg[e]=t},get:(t,e)=>new Jg[t](e)},{list:Jg}=qg;class $g extends eg{constructor(t,e){super(t,e)}}$g.BEFORE_OPEN="innerEditor.before_open",$g.OPEN="innerEditor.open",$g.BEFORE_CLOSE="innerEditor.before_close",$g.CLOSE="innerEditor.close";class Qg extends eg{constructor(t,e){super(t,e)}}Qg.BEFORE_GROUP="editor.before_group",Qg.GROUP="editor.group",Qg.BEFORE_UNGROUP="editor.before_ungroup",Qg.UNGROUP="editor.ungroup",Qg.BEFORE_OPEN="editor.before_open_group",Qg.OPEN="editor.open_group",Qg.BEFORE_CLOSE="editor.before_close_group",Qg.CLOSE="editor.close_group";const{updateMatrix:t_}=ir,e_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},i_="top-left";class s_ extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Or.CHANGE,e=>{if(this.checkChange&&e_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,t_(this.parent),t_(this);const a=new ut(this.__world);switch(r[i]=s,this.__layout.rotationChange(),t_(this),this.changedTransform=new ut(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(i_,o);break;case"scaleX":t.scaleOf(i_,o,1);break;case"scaleY":t.scaleOf(i_,1,o);break;case"skewX":t.skewOf(i_,o,0);break;case"skewY":t.skewOf(i_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class n_ extends eg{constructor(t,e){super(t,e)}}n_.BEFORE_MOVE="editor.before_move",n_.MOVE="editor.move";class o_ extends eg{constructor(t,e){super(t,e)}}o_.BEFORE_SCALE="editor.before_scale",o_.SCALE="editor.scale";class r_ extends eg{constructor(t,e){super(t,e)}}r_.BEFORE_ROTATE="editor.before_rotate",r_.ROTATE="editor.rotate";class a_ extends eg{constructor(t,e){super(t,e)}}a_.BEFORE_SKEW="editor.before_skew",a_.SKEW="editor.skew";class h_{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let o,{dragLimitAnimate:r}=s;const a=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,l=h(i.draggable),c=!r||a||l,u={x:e.totalX,y:e.totalY};e instanceof t.MoveEvent&&ot.move(u,i.getWorldPointByLocal(n.totalOffset,null,!0)),e.shiftKey&&(Math.abs(u.x)>Math.abs(u.y)?u.y=0:u.x=0),o=t.DragEvent.getValidMove(i,n.point,u,c),(o.x||o.y)&&(r&&!l&&a?ir.animateMove(this,o,d(r)?r:.3):this.move(o))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:o}=this.editBox;let r,{around:a,lockRatio:h,flipable:l,editSize:d}=s;e instanceof t.ZoomEvent?(a=i.getBoxPoint(e),r=e.totalScale):r=e.getInnerTotal(i);const{direction:c}=e.current;(e.shiftKey||i.lockRatio)&&(h=!0);const u=Rg.getScaleData(i,o.bounds,c,r,h,Rg.getAround(a,e.altKey),l,!n||"scale"===d),p=i.x,g=i.y;e instanceof t.DragEvent&&this.editTool&&this.editTool.onScaleWithDrag?(u.drag=e,this.scaleWithDrag(u)):this.scaleOf(u.origin,u.scaleX,u.scaleY),ot.move(o.totalOffset,i.x-p,i.y-g)}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:o,rotateAround:r,rotateGap:a,diagonalRotateKey:h}=s,{direction:l}=e.current;let d,c;if(e instanceof t.RotateEvent)c=e.rotation,d=r?vt.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=h?e.isHoldKeys(h):e.shiftKey,s=Rg.getRotateData(i,l,e,n,t?null:r||i.around||i.origin||o||"center");c=n.rotation+s.rotation-i.rotation,d=s.origin}if(c=A.float(A.getGapRotation(c,a,i.rotation),2),!c)return;const u=i.x,p=i.y;this.rotateOf(d,c),ot.move(n.totalOffset,i.x-u,i.y-p)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Rg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Rg.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(g(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new n_(n_.BEFORE_MOVE,h));const l=new n_(n_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new o_(o_.BEFORE_SCALE,t));const o=new o_(o_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(g(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new o_(o_.BEFORE_SCALE,c));const u=new o_(o_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new ut(ir.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new o_(o_.BEFORE_SCALE,r));const a=new o_(o_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new r_(r_.BEFORE_ROTATE,l));const c=new r_(r_.ROTATE,l);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(g(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new a_(a_.BEFORE_SKEW,c));const u=new a_(a_.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ir.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ut(e.worldTransform);return t(),new ut(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{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 dh,this.openedGroupList=new dh,this.simulateTarget=new s_(this),this.editBox=new Fg(this),this.editToolList={},this.selector=new fg(this),this.editMask=new zg(this),this.targetEventIds=[];let i=m.clone(Hg);t&&(i=m.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),ee.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}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?p(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>m.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&&Yg(this),this.update()}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(h(s))e=s;else if(!1===s)return}if(qg.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||qg.get(e,this);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(Qg.BEFORE_GROUP),this.target=Gg.group(this.list,this.element,t),this.emitGroupEvent(Qg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Qg.BEFORE_UNGROUP,t)),this.target=Gg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Qg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Qg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Qg.OPEN,t)}closeGroup(t){this.emitGroupEvent(Qg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Qg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ir.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 Qg(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(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(h(i))s=i;else if(!1===i)return}qg.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||qg.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent($g.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent($g.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent($g.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent($g.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new $g(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&&(Gg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Gg.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_(Xr.START,this.onRenderStart,this),i&&i.on_(Or.SCROLL,this.onChildScroll,this),t.on_(Xr.CHILD_START,this.onAppRenderStart,this),t.on_(Vr.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())}},de([(t,e)=>{eo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,o=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(o,t)}return s.config&&Object.assign(o,s.config),i&&(i.editConfig&&Object.assign(o,i.editConfig),"font-size"===o.editSize&&(o.lockRatio=!0),"resize-rotate"===i.pointType&&(o.around||(o.around="center"),a(o.lockRatio)&&(o.lockRatio=!0))),r(o.dragLimitAnimate)&&(o.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=o}})}],t.Editor.prototype,"mergeConfig",void 0),de([ig(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof dh?i:new dh(i),t.multiple&&Yg(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new eg(eg.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new eg(eg.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),de([ig(function(t,e){t.emitEvent(new eg(eg.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),t.Editor=de([No(h_,["editBox","editTool","emitEvent"])],t.Editor);class l_{static registerInnerEditor(){qg.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 t.Group,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)}}t.EditTool=class extends l_{static registerEditTool(){qg.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=de([Kg()],t.EditTool);const{left:d_,right:c_}=t.Direction9,{move:u_,copy:p_,toNumberPoints:g_}=ot;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===d_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=g_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(u_(t,o,r),s&&u_(e,-o,-r)):(s&&u_(t,-o,-r),u_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),p_(s[7],i),p_(e[7],i),p_(s[3],a),p_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===d_||t===c_,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=de([Kg()],t.LineEditTool);const{M:__,L:f_,C:m_,Q:y_,Z:v_,N:w_,D:x_,X:b_,G:E_,F:S_,O:k_,P:B_,U:T_}=Pe,P_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case __:case f_:R_(t,e,i,n,1),n+=3;break;case m_:R_(t,e,i,n,3),n+=7;break;case y_:R_(t,e,i,n,2),n+=5;break;case v_:n+=1;break;case w_:R_(t,e,i,n,2),n+=5;break;case x_:R_(t,e,i,n,2),n+=9;break;case b_:R_(t,e,i,n,2),n+=6;break;case E_:R_(t,e,i,n,2),n+=9;break;case S_:R_(t,e,i,n,2),n+=5;break;case k_:t[n]=E_,t.splice(n+4,0,t[n+3],0),R_(t,e,i,n,2),n+=9,o+=2;break;case B_:t[n]=S_,t.splice(n+4,0,t[n+3]),R_(t,e,i,n,2),n+=5,o+=1;break;case T_:R_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:R_}=P_,L_=K.get(),{topLeft:C_,top:O_,topRight:A_,right:D_,bottom:M_,left:I_}=t.Direction9;function F_(t,e,i){t.pathInputed?z_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function W_(t,e,i,s){let n=e;if(!r(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case O_:case M_:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case I_:case D_:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case C_:case A_:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=p(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}function z_(t,e,i){P_.scale(t.__.path,e,i),t.path=t.__.path}function U_(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):P_.scalePoints(s,e,i),t.points=s}function H_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)L_.a=e,L_.d=i,s[t].transform(L_,!0)}const N_=t.Leaf.prototype;N_.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))},N_.__scaleResize=function(t,e){F_(this,t,e)},N_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},N_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)W_(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),F_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){z_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?z_(this,t,e):this.points?U_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?z_(this,t,e):this.points?U_(this,t,e):F_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){H_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||F_(this,t,e),i&&H_(this,t,e)},ee.add("resize"),ee.add("editor","resize"),ie.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,ao),t.UI.addAttr("editConfig",void 0,ao),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),ao),t.UI.addAttr("editInner","PathEditor",ao),t.Group.addAttr("editInner","",ao),t.Text.addAttr("editInner","TextEditor",ao),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const Y_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},X_={top:"flex-start",middle:"center",bottom:"flex-end"},V_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function G_(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";p(e)&&(e=e[0]);if(g(e))switch(e.type){case"solid":i=Fh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Fh.string(h(t)?t:t.color);break;default:r(e.r)||(i=Fh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=Fh.string(d.color))):c=d,s.textDecoration=V_[c],s.textTransform=Y_[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=X_[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=p(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}function j_(e,i,s){K_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{ir.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function K_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&m.assign(i,e),m.assign(t.config,i,t.userConfig)}t.TextEditor=class extends l_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:g}=new ut(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||G_(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)}},t.TextEditor=de([Zg()],t.TextEditor),ee.add("text-editor","editor");const Z_=Kt.get("LeaferTypeCreator"),q_={list:{},register(t,e){J_[t]&&Z_.repeat(t),J_[t]=e},run(t,e){const i=J_[t];i&&i(e)}},{list:J_,register:$_}=q_;$_("viewport",j_),$_("custom",function(t){j_(t,null,!0)}),$_("design",function(t){j_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),$_("document",function(t){j_(t,{zoom:{min:1},move:{scroll:"limit"}})});const Q_={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ot.getCenter(e.from,i.from),n=ot.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=ot.getDistance(e.from,i.from);return{move:o,scale:ot.getDistance(e.to,i.to)/r,rotation:ot.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=tf,s=tf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),tf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?tf.getType(i.totalData,e):"none"},add(t,e){e&&(ot.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=tf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},tf=Q_,{abs:ef,max:sf}=Math,{sign:nf,within:of}=A,rf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=ef(s),r=ef(n);return o>50&&(s=sf(50,o/3)*nf(s)),r>50&&(n=sf(50,r/3)*nf(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=of(r,0,1);const e=t.deltaY?i.delta.y:i.delta.x,s=of(1-ef(a)/(4*e)*r,.5,2);n=a>0?s:1/s}return n}};let af,hf,lf,df;class cf{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(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),af=0,hf=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:af,totalY:hf}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,e.totalX=af+=e.moveX,e.totalY=hf+=e.moveY,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),lf=1,this.zoomData=Object.assign(Object.assign({},e),{scale:1,totalScale:lf}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,e.totalScale=lf*=e.scale,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),df=0,this.rotateData=Object.assign(Object.assign({},e),{rotation:0,totalRotation:df}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,e.totalRotation=df+=e.rotation,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,Object.assign(Object.assign({},i),{totalX:af,totalY:hf})),s&&e.emit(t.ZoomEvent.END,Object.assign(Object.assign({},s),{totalScale:lf})),n&&e.emit(t.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:df})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const uf=t.Leafer.prototype,pf=new Yt,gf=new dt;function _f(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function ff(t,e){return Object.assign(Object.assign({},e),{scale:t})}uf.initType=function(t){q_.run(t,this)},uf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(gf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?gf.y=0:t.includes("y")?gf.x=0:Math.abs(gf.x)>Math.abs(gf.y)?gf.y=0:gf.x=0,i&&t.includes("limit")&&(pf.set(this.__world).addPoint(this.zoomLayer),xd.getValidMove(pf,this.canvas.bounds,"inner",gf,!0),t.includes("x")?gf.y=0:t.includes("y")&&(gf.x=0))}return{x:n?0:gf.x,y:n?0:gf.y}},uf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const mf=Nd.prototype;mf.createTransformer=function(){this.transformer=new cf(this)},mf.move=function(t){this.transformer.move(t)},mf.zoom=function(t){this.transformer.zoom(t)},mf.rotate=function(t){this.transformer.rotate(t)},mf.transformEnd=function(){this.transformer.transformEnd()},mf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):rf.getScale(t,e);if(1!==o)this.zoom(ff(o,t));else{const s=e.getMove?e.getMove(t,e):rf.getMove(t,e);i.snap&&ot.round(s),this.move(_f(s,t))}},mf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Q_.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Q_.detect(n,g(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Q_.reset()}o||(n.center=Q_.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(ff(n.scale,t)),o&&this.move(_f(n.move,t))};const yf=Od.prototype,{abs:vf}=Math;function wf(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}yf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=vf(i),o=vf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;n*(e=e?d(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),ot.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},yf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},yf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},yf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=zt.maxX(r),d=zt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,ot.move(i,c,u),ot.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},yf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},ee.add("viewport"),ee.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,r=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new Yt,c={x:r.x+r.width/2,y:r.y+r.height/2};let u;const{x:f,y:m,scaleX:y,scaleY:v}=o.__;if(h(t))switch(t){case"in":u=wf(y,"in");break;case"out":u=wf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Yt(this.boxBounds)).height=0;break;case"fit-height":(t=new Yt(this.boxBounds)).width=0}else d(t)&&(u=t/y);if(u)u=this.getValidScale(u),o.scaleOfWorld(c,u,u,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=p(t);if(n||t.tag){const e=n?t:[t];l.setListWithFn(e,dr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,r);l.set(o.getWorldBounds(e))}const{width:a,height:h}=l;let d=r.x-l.x,c=r.y-l.y;return i?(d+=Math.max((r.width-a)/2,0),c+=Math.max((r.height-h)/2,0)):(u=this.getValidScale(Math.min(r.width/a,r.height/h)),d+=(r.width-a*u)/2,c+=(r.height-h*u)/2,ot.scaleOf(e,l,u),l.scaleOf(l,u),e.scaleX*=u,e.scaleY*=u),"x"===i?c=0:"y"===i&&(d=0),ot.move(e,d,c),l.move(d,c),o.set(e,s),l}return o.worldBoxBounds};class xf extends t.Group{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&&m.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Yt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.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}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Xr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Hr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}ee.add("scroll");class bf extends _l{setText(t){this._text=t,this.__htmlChanged=!0}}const Ef={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:"≥"};t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=Ef[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){h(t)?Ef[t]=e:Object.assign(Ef,t)}},de([Do(bf)],t.HTMLText.prototype,"__",void 0),de([go("")],t.HTMLText.prototype,"text",void 0),de([ao("TextEditor")],t.HTMLText.prototype,"editInner",void 0),de([Eo(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=de([Yo()],t.HTMLText),ee.add("html");class Sf extends rl{}function kf(t){return no(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,wo(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){zh.register(t,e)}},de([Do(Sf)],t.Arrow.prototype,"__",void 0),de([kf("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=de([Yo()],t.Arrow);const{M:Bf,L:Tf,C:Pf,Q:Rf,O:Lf}=Pe,{rotate:Cf,copyFrom:Of,scale:Af}=ot,Df={},Mf={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Bf:case Tf:If(t,l+1,e,i,s,n,o,r),l+=3;break;case Pf:for(h=1;h<6;h+=2)If(t,l+h,e,i,s,n,o,r);l+=7;break;case Rf:for(h=1;h<4;h+=2)If(t,l+h,e,i,s,n,o,r);l+=5;break;case Lf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){Mf.layout(t,0,0,1,1,e,i)}};function If(t,e,i,s,n,o,r,a){Of(Df,t[e],t[e+1]),r&&Cf(Df,r,a),n&&Af(Df,n,o),t[e]=i+Df.x,t[e+1]=s+Df.y}const{layout:Ff,rotate:Wf}=Mf,{getAngle:zf}=ot,Uf={x:-.5},Hf={connect:Uf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Nf={connect:Uf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Yf={connect:Uf,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]},Xf={connect:Uf,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]},Vf={offset:Uf,path:[...Yf.path],dashPath:[1,-2.5,0,2,-1,0]};Wf(Vf.path,180,{x:-1.5,y:0});const Gf={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},jf={connect:{x:.5},path:[...Gf.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Kf={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]},Zf={path:[...Kf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},qf=m.clone(Kf),Jf=m.clone(Zf);Wf(qf.path,45),Wf(Jf.path,45);const $f={angle:Hf,"angle-side":Nf,arrow:Xf,triangle:Yf,"triangle-flip":Vf,circle:jf,"circle-line":Gf,square:Zf,"square-line":Kf,diamond:Jf,"diamond-line":qf,mark:{offset:Uf,path:[1,0,-2,2,0,2]}};function Qf(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=$f[e.type]):a=e:a=$f[e];const{offset:c,connect:u,path:p,dashPath:_}=a;let f=u?u.x:0,m=c?c.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&Ff(y,0,0,h,h),m&&Ff(y,m,0),Ff(y,s.x,s.y,n,n,zf(i,s)),o.x=(f+m)*n,y}const{M:tm,L:em,C:im,Q:sm,Z:nm,N:om,D:rm,X:am,G:hm,F:lm,O:dm,P:cm,U:um}=Pe,{copy:pm,copyFrom:gm,getDistancePoint:_m}=ot,fm={},mm={},ym={},vm={},wm={},xm={list:$f,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case tm:case em:(c<2||l+6>=d)&&(gm(wm,o[l+1],o[l+2]),!c&&u&&pm(mm,wm)),l+=3;break;case im:(1===c||l+7>=d-3)&&bm(o,vm,wm,l+3),l+=7;break;case sm:(1===c||l+5>=d-3)&&bm(o,vm,wm,l+1),l+=5;break;case nm:return;case om:l+=5;break;case rm:l+=9;break;case am:l+=6;break;case hm:l+=9;break;case lm:l+=5;break;case dm:l+=7;break;case cm:l+=4;break;case um:(1===c||l+6>=d-3)&&(bm(o,vm,wm,l+1),l+6!==d&&(wm.x-=(wm.x-vm.x)/10,wm.y-=(wm.y-vm.y)/10)),l+=6}if(c++,1===c&&h!==tm)return;if(2===c&&u&&pm(ym,h===em?wm:vm),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Qf(t,e,ym,mm,s,fm,!!n);n?d.push(...i):r.push(...i),fm.x&&(_m(mm,ym,-fm.x,!0),r[1]=ym.x,r[2]=ym.y)}if(i&&"none"!==i){const e=Qf(t,i,vm,wm,s,fm,!!n);if(n?d.push(...e):r.push(...e),fm.x){let t;switch(_m(wm,vm,-fm.x,!0),h){case em:t=l-3+1;break;case im:t=l-7+5;break;case sm:t=l-5+3;break;case um:t=l-6+3}t&&Em(r,vm,t)}}}else pm(vm,wm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function bm(t,e,i,s){gm(e,t[s],t[s+1]),gm(i,t[s+2],t[s+3])}function Em(t,e,i){t[i]=e.x,t[i+1]=e.y}ee.add("arrow"),t.UI.addAttr("startArrow","none",kf),t.UI.addAttr("endArrow","none",kf),Object.assign(zh,xm),Object.assign(Uh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},de([Do(class extends sl{})],t.Flow.prototype,"__",void 0),de([co("x")],t.Flow.prototype,"flow",void 0),t.Flow=de([Yo()],t.Flow);const Sm={},km={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},Bm={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function Tm(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;bt.toPoint(i,e,n,Sm),e.x=s.__autoWidth?n.x:Sm.x,e.y=s.__autoHeight?n.y:Sm.y}const{move:Pm}=ot;function Rm(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),Pm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Lm(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const Cm={};function Om(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,a=n&&(e?!o:!r);return g(i)?(Cm.xGap=i.x||0,Cm.yGap=i.y||0):Cm.xGap=Cm.yGap=u(i),Cm.isAutoXGap=h(Cm.xGap)&&!o,Cm.isAutoYGap=h(Cm.yGap)&&!r,Cm.complex=a||"top-left"!==s||t.__hasGrow||Cm.isAutoXGap||Cm.isAutoYGap,Cm.wrap=a,Cm.complex&&(Cm.isFitXGap="fit"===Cm.xGap&&!o,Cm.isFitYGap="fit"===Cm.yGap&&!r,g(s)?(Cm.contentAlign=s.content||"top-left",Cm.rowXAlign=s.x||"from",Cm.rowYAlign=s.y||"from"):(Cm.contentAlign=s,Cm.rowXAlign=km[s],Cm.rowYAlign=Bm[s])),Cm}function Am(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Dm(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function Mm(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Im}=A;function Fm(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Wm(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Wm(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Wm(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Im(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:zm}=A;function Um(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Hm(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Hm(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Hm(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?zm(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Nm}=ot;function Ym(t,e){const i="width",{children:s,itemBox:n}=t,o=Om(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:h;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Mm(g,n),r?(g.__flowBounds=_,y||(y=Am(m,p)),a&&y.count&&y.width+_.width>x&&(y.grow?Fm(t,y,x,e):d&&Dm(y,i,x,c),Lm(u,y,i),y=Am(m,p)),f=_.width,g.__widthGrow&&(y.grow+=g.__widthGrow,f=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&Hm(g,_,b),y.width+=y.count?f+p:f,y.height=Math.max(y.height,_.height),y.count++):(Nm(g,v-_.x,w-_.y),v+=_.width+p));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:p}=o;y.count&&(y.grow?Fm(t,y,x,e):d&&Dm(y,i,x,c),a&&Lm(u,y,i)),a?(s?Dm(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Tm(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=km[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Rm(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(Tm(t,y,r),Rm(t,y,0,y.y,p,e))}}const{move:Xm}=ot;function Vm(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Xm(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Gm}=ot;function jm(t,e){const i="height",{children:s,itemBox:n}=t,o=Om(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:l;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Mm(g,n),r?(g.__flowBounds=_,y||(y=Am(m,p)),a&&y.count&&y.height+_.height>b&&(y.grow&&Um(t,y,b,e),d&&Dm(y,i,b,c),Lm(u,y,i),y=Am(m,p)),f=_.height,g.__heightGrow&&(y.grow+=g.__heightGrow,f=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&Wm(g,_,x),y.height+=y.count?f+p:f,y.width=Math.max(y.width,_.width),y.count++):(Gm(g,v-_.x,w-_.y),w+=_.height+p));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:p}=o;y.count&&(y.grow&&Um(t,y,b,e),d&&Dm(y,i,b,c),a&&Lm(u,y,i)),a?(s?Dm(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Tm(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Bm[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,p),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Vm(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Tm(t,y,r),Vm(t,y,y.x,0,l,e))}}function Km(t){return no(t,t=>({set(e){const i=d(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&fo(this)}}))}ee.add("flow","resize");const Zm=t.Box.prototype,{__updateBoxBounds:qm}=t.Group.prototype;t.UI.addAttr("flow",!1,co),t.UI.addAttr("gap",0,go),t.UI.addAttr("flowAlign","top-left",go),t.UI.addAttr("flowWrap",!1,go),t.UI.addAttr("itemBox","box",go),t.UI.addAttr("inFlow",!0,go),t.UI.addAttr("autoWidth",void 0,Km),t.UI.addAttr("autoHeight",void 0,Km),t.UI.addAttr("autoBox",void 0,go);const{copyAndSpread:Jm}=zt;Zm.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Ym(this);break;case"y":jm(this);break;case"x-reverse":Ym(this,!0);break;case"y-reverse":jm(this,!0)}t&&(this.leafer.created=!0)},Zm.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Jm(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Zm.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():qm.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Jm(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:$m,sin:Qm,pow:ty,sqrt:ey,abs:iy,ceil:sy,floor:ny,round:oy,PI:ry}=Math,ay=5*ry,hy=1.70158,ly=2.5949095,dy=7.5625,cy=2.75;function uy(t){return e=>ty(e,t)}function py(t){return e=>1-ty(1-e,t)}function gy(t){return e=>e<.5?.5*ty(2*e,t):1-.5*ty(2-2*e,t)}function _y(t){return t<1/cy?dy*t*t:t<2/cy?dy*(t-=1.5/cy)*t+.75:t<2.5/cy?dy*(t-=2.25/cy)*t+.9375:dy*(t-=2.625/cy)*t+.984375}function fy(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=my(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(iy(l)<1e-6));e++)c-=d/l;return n[r]=my(c,e,s)}}function my(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const yy={get(t){const{list:e}=yy;return h(t)?e[t||"ease"]:g(t)?e[t.name].apply(e,p(t.value)?t.value:[t.value]):e.ease},register(t,e){yy.list[t]=e},list:{linear:t=>t,ease:fy(.25,.1,.25,1),"ease-in":fy(.42,0,1,1),"ease-out":fy(0,0,.58,1),"ease-in-out":fy(.42,0,.58,1),"sine-in":t=>1-$m(t*ry*.5),"sine-out":t=>Qm(t*ry*.5),"sine-in-out":t=>.5*(1-$m(t*ry)),"quad-in":uy(2),"quad-out":py(2),"quad-in-out":gy(2),"cubic-in":uy(3),"cubic-out":py(3),"cubic-in-out":gy(3),"quart-in":uy(4),"quart-out":py(4),"quart-in-out":gy(4),"quint-in":uy(5),"quint-out":py(5),"quint-in-out":gy(5),"expo-in":t=>t?ty(2,10*t-10):0,"expo-out":t=>1===t?1:1-ty(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*ty(2,2*t*10-10):.5*(2-ty(2,10-2*t*10)),"circ-in":t=>1-ey(1-ty(t,2)),"circ-out":t=>ey(1-ty(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-ey(1-ty(2*t,2))):.5*(ey(1-ty(2-2*t,2))+1),"back-in":t=>((hy+1)*t-hy)*t*t,"back-out":t=>(t-=1)*t*((hy+1)*t+hy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((ly+1)*t-ly)*.5:.5*((t=2*t-2)*t*((ly+1)*t+ly)+2),"elastic-in":t=>0===t||1===t?t:-ty(2,10*(t-1))*Qm((t-1.1)*ay),"elastic-out":t=>0===t||1===t?t:ty(2,-10*t)*Qm((t-.1)*ay)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-ty(2,10*((t*=2)-1))*Qm((t-1.1)*ay)*.5:ty(2,10*(1-(t*=2)))*Qm((t-1.1)*ay)*.5+1,"bounce-in":t=>1-_y(1-t),"bounce-out":_y,"bounce-in-out":t=>t<.5?.5*(1-_y(1-2*t)):.5*(1+_y(2*t-1)),"cubic-bezier":fy,steps:function(t,e="floor"){return i=>("floor"===e?ny(i*t):"ceil"===e?sy(i*t):oy(i*t))/t}}};function vy(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class wy{}wy.CREATED="created",wy.PLAY="play",wy.PAUSE="pause",wy.STOP="stop",wy.SEEK="seek",wy.UPDATE="update",wy.COMPLETED="completed";t.Animate=class extends $r{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=p(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=yy.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(wy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(wy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(wy.STOP))}seek(t){this.destroyed||(g(t)&&(t=Wh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(wy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,o=!(n>1)||this.join;let a,h,l,c,u,p=0,g=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=o?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(l.swing=d(o)?o:2,u=2*l.swing-1),r&&(l.loop=u=d(r)?r:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,g+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,g+=s*u),n&&(l.easingFn=yy.get(n))}if(!l.autoDuration&&r(l.duration)&&(n>1?s>0||o?g+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}g?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*g),this.allocateTime((this.duration-p)/g)):p&&this.changeDuration(p),this.emitType(wy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:o}=this;for(let a in e)r(s[a])&&(s[a]=n[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=r(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],r(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(wy.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),jh.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(wy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},de([vy("ease")],t.Animate.prototype,"easing",void 0),de([vy(0)],t.Animate.prototype,"delay",void 0),de([vy(.2)],t.Animate.prototype,"duration",void 0),de([vy("auto")],t.Animate.prototype,"ending",void 0),de([vy(!1)],t.Animate.prototype,"reverse",void 0),de([vy(!1)],t.Animate.prototype,"swing",void 0),de([vy(!1)],t.Animate.prototype,"loop",void 0),de([vy(0)],t.Animate.prototype,"loopDelay",void 0),de([vy(1)],t.Animate.prototype,"speed",void 0),de([vy(!0)],t.Animate.prototype,"autoplay",void 0),de([vy()],t.Animate.prototype,"join",void 0),de([vy()],t.Animate.prototype,"attrs",void 0),t.Animate=de([No(la)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(wy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(wy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(wy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(wy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case wy.COMPLETED:this.completed&&this.emitType(t);break;case wy.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=de([No(la)],t.AnimateList);const xy={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},by=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Ey=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Sy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,ky=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,By=parseInt,Ty=parseFloat,{round:Py}=Math;let Ry={},Ly=0;function Cy(t){let e,i,s,n=1;switch(t.length){case 9:e=By(t.slice(1,3),16),i=By(t.slice(3,5),16),s=By(t.slice(5,7),16),n=By(t.slice(7,9),16)/255;break;case 7:e=By(t.slice(1,3),16),i=By(t.slice(3,5),16),s=By(t.slice(5,7),16);break;case 5:e=By(t[1]+t[1],16),i=By(t[2]+t[2],16),s=By(t[3]+t[3],16),n=By(t[4]+t[4],16)/255;break;case 4:e=By(t[1]+t[1],16),i=By(t[2]+t[2],16),s=By(t[3]+t[3],16);break;case 3:e=i=s=By(t[1]+t[2],16);break;case 2:e=i=s=By(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Oy=1/6,Ay=.5,Dy=2/3,My=1/3;function Iy(t,e,i){return i<0?i++:i>1&&i--,i<Oy?t+6*(e-t)*i:i<Ay?e:i<Dy?t+(e-t)*(Dy-i)*6:t}function Fy(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Iy(a,s,t+My),o=Iy(a,s,t),r=Iy(a,s,t-My)}return{r:Py(255*n),g:Py(255*o),b:Py(255*r),a:s}}ee.add("color"),Fh.object=function(t,e){let i,s=!r(e)&&e<1;if(h(t)){const e=Ry[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Cy(t);break;case"R":case"r":"("===t[4]&&Ey.test(t)?i=function(t){const e=Ey.exec(t);return{r:By(e[1]),g:By(e[2]),b:By(e[3]),a:Ty(e[4])}}(t):"("===t[3]&&by.test(t)&&(i=function(t){const e=by.exec(t);return{r:By(e[1]),g:By(e[2]),b:By(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&ky.test(t)?i=function(t){const e=ky.exec(t);return Fy(Ty(e[1]),Ty(e[2]),Ty(e[3]),Ty(e[4]))}(t):"("===t[3]&&Sy.test(t)&&(i=function(t){const e=Sy.exec(t);return Fy(Ty(e[1]),Ty(e[2]),Ty(e[3]),1)}(t))}if(!i){const e=xy[t.toLowerCase()];e&&(i=Cy("#"+e))}i&&(Ly++,Ly>1e4&&(Ry={},Ly=0),Ry[t]=Object.assign({},i))}}else g(t)&&(r(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Wy}=Math,{fourNumber:zy}=A,Uy={fill:Vy,stroke:Vy,cornerRadius:(t,e,i)=>d(t)&&d(e)?Yy(t,e,i):(t=zy(t),e=zy(e),t.map((t,s)=>Yy(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,o=Yy(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return d(t)||d(e)?A.float(Yy(t,e,i),Math.max(Ny(t),Ny(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return jh.setBetweenStyle(n,t,e,n,i,s),n},shadow:Gy,innerShadow:Gy},Hy={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?Yy(t,e,i):t},number:Yy,color:Xy,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=jh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function Ny(t){const e=String(t).split(".")[1];return e?e.length:0}function Yy(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Wy(n):n}function Xy(t,e,i){t=Fh.object(t),e=Fh.object(e);const s=Yy(t.r,e.r,i,1)+","+Yy(t.g,e.g,i,1)+","+Yy(t.b,e.b,i,1),n=Yy(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Vy(t,e,i){return h(t)&&h(e)?Xy(t,e,i):e}function Gy(t,e,i){return p(t)||p(e)?e:(e=e||{},{x:Yy((t=t||{}).x,e.x,i),y:Yy(t.y,e.y,i),blur:Yy(t.blur,e.blur,i),spread:Yy(t.spread,e.spread,i),color:Xy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ee.add("animate","color"),Gh.canAnimate=!0,Object.assign(jh.list,Uy),Object.assign(jh,Hy);const jy=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,ao),t.UI.addAttr("transition",!0,ao),t.UI.addAttr("transitionOut",void 0,ao),jy.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},jy.animate=function(e,i,s,n){if(r(e))return this.__animate;let o=p(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},jy.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},jy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(wy.COMPLETED,e)};const Ky=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Zy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:qy}=Math,{getDerivative:Jy}=ei,$y={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,p,g,_=0,f=h/2;for(let h=0;h<Ky.length;h++)l=f*(1+Ky[h]),d=f*(1-Ky[h]),c=Jy(l,t,i,n,r),u=Jy(l,e,s,o,a),p=Jy(d,t,i,n,r),g=Jy(d,e,s,o,a),_+=Zy[h]*(qy(c*c+u*u)+qy(p*p+g*g));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Jy(t,e,s,o,a),d=Jy(t,i,n,r,h);return Math.atan2(d,l)/M},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,p=t/e,g=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>g;)Qy(i,s,n,o,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,p=d*n+e*r,g=d*o+e*a,_=d*c+e*p,f=d*u+e*g,m=d*_+e*(d*p+e*(d*r+e*h)),y=d*f+e*(d*g+e*(d*a+e*l));t.push(Pe.C,c,u,_,f,m,y)}},{getDistance:Qy}=$y,{M:tv,L:ev,C:iv,Z:sv}=Pe,nv={},ov={},rv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case tv:case ev:rv.transformPoints(t,e,s,1),s+=3;break;case iv:rv.transformPoints(t,e,s,3),s+=7;break;case sv:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)nv.x=t[n],nv.y=t[n+1],K.toOuterPoint(e,nv),t[n]=nv.x,t[n+1]=nv.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case tv:case ev:i=t[a+1],s=t[a+2],e=n===ev&&a>0?ot.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case iv:i=t[a+5],s=t[a+6],e=$y.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case sv:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Wh.number(e,t.total);let o,r,a,h,l,d,c,u,p,g=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case tv:case ev:if(r=n[f+1],a=n[f+2],o=s[m],g+o>=e||!t.total)return f||(y=r,v=a),ov.x=y,ov.y=v,_.x=r,_.y=a,ot.getDistancePoint(ov,_,e-g,!0),_.rotation=ot.getAngle(ov,_),_;y=r,v=a,f+=3;break;case iv:if(r=n[f+5],a=n[f+6],o=s[m],g+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=$y.getT(e-g,o,y,v,l,d,c,u,r,a,i),ei.getPointAndSet(p,y,v,l,d,c,u,r,a,_),_.rotation=$y.getRotation(p,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case sv:f+=1;default:o=0}m++,g+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Wh.number(e,t.total);let r,a,h,l,d,c,u,p,g,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case tv:case ev:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),ov.x=v,ov.y=w,f.x=a,f.y=h,ot.getDistancePoint(ov,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case iv:if(d=n[m+1],c=n[m+2],u=n[m+3],p=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return g=$y.getT(e-_,r,v,w,d,c,u,p,a,h,i),$y.cut(o,g,v,w,d,c,u,p,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,p,a,h);break;case sv:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function av(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ee.add("motion-path"),jh.register("motion",function(t,e,i,s){return g(t)&&(t=Wh.number(t,s.getMotionTotal())),g(e)&&(e=Wh.number(e,s.getMotionTotal())),jh.number(t||0,e||0,i)}),jh.register("motionRotation",function(t,e,i){return jh.number(t,e,i)});const hv=t.UI.prototype,{updateMatrix:lv,updateAllMatrix:dv}=ir,{updateBounds:cv}=gr;function uv(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=gv(t);i.total&&(t.__.__pathForRender=rv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(dv(t),cv(t,t)):lv(t));i&&(t.leafer.created=!0)}}function pv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function gv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=rv.getMotionPathData(t.getPath(!0,!0))}function _v(t,e){return no(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Gh.setStyleName(this,e,i):Gh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function fv(t){return no(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function mv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function yv(t,e){g(e)||(e=void 0),xv(t,e,"in")}function vv(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),xv(t,e,"out"))}t.UI.addAttr("motionPath",void 0,av),t.UI.addAttr("motionPrecision",1,av),t.UI.addAttr("motion",void 0,av),t.UI.addAttr("motionRotation",!0,av),hv.getMotionPathData=function(){return gv(pv(this))},hv.getMotionPoint=function(t){const e=pv(this),i=gv(e);if(!i.total)return{};const s=rv.getDistancePoint(i,t,e.motionPrecision);K.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},hv.getMotionTotal=function(){return this.getMotionPathData().total},hv.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),uv(t))}else uv(this)};const wv={};function xv(t,e,i){const{normalStyle:s}=t;e||(e=wv),e.scale&&(A.assignScale(e,e.scale),delete e.scale),e!==wv&&Gh.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=Sv(e,t),s=t.animate();s&&Sv(i,t,s.fromStyle);return i}(t,e):void 0;Gh.canAnimate&&bv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=bv(t);if(r){const{animation:s}=r;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(r,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete r.animation}t.normalStyle=Ev(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(n){const e=Ev(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function bv(t){let e;const i={},s=mv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Gh.isState(n,t,s)&&(e=kv(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Gh.isSelected(t,s)&&(e=kv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Gh.isPlacehold(t,s)&&(e=kv(i,a)),Gh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=kv(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Gh.isFocus(t,s)&&(e=kv(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Gh.isHover(t,s)&&(e=kv(i,o));const r=i.pressStyle||t.pressStyle;r&&Gh.isPress(t,s)&&(e=kv(i,r))}return e?i:void 0}function Ev(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Gh.animateExcludes[t]||(n[t]=e[t]);return n}function Sv(t,e,i){return Ev(t,e,i,!0)}function kv(t,e){return Object.assign(t,e),!0}function Bv(t,e){const i=t[e];i&&yv(t,i),t.button&&Pv(t.children,e)}function Tv(t,e,i){i||(i=t.states[e]),yv(t,i),t.button&&Pv(t.children,null,e)}function Pv(t,e,i){if(!t)return;let s,n;for(let o=0,a=t.length;o<a;o++){if(s=t[o],e){switch(n=!0,e){case"hoverStyle":Gh.isHover(s)&&(n=!1);break;case"pressStyle":Gh.isPress(s)&&(n=!1);break;case"focusStyle":Gh.isFocus(s)&&(n=!1)}n&&Bv(s,e)}else r(i)||Tv(s,i);s.isBranch&&Pv(s.children,e,i)}}function Rv(t,e){const i=t[e];i&&vv(t,i),t.button&&Cv(t.children,e)}function Lv(t,e,i){vv(t,i),t.button&&Cv(t.children,null,e)}function Cv(t,e,i){if(!t)return;let s;for(let n=0,o=t.length;n<o;n++)s=t[n],e?Rv(s,e):r(i)||Lv(s,i),s.isBranch&&Cv(s.children,e,i)}function Ov(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=mv(e,i);o&&(s=n[t](o))}return s}function Av(t,e,i){let s=e[t];if(!s&&i){const n=mv(e,i);n&&(s=n[t])}return s}ee.add("state"),Gh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Gh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=mv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Gh.isSelected=function(t,e){return Av("selected",t,e)},Gh.isDisabled=function(t,e){return Av("disabled",t,e)},Gh.isFocus=function(t,e){return Ov("isFocus",t,e)},Gh.isHover=function(t,e){return Ov("isHover",t,e)},Gh.isPress=function(t,e){return Ov("isPress",t,e)},Gh.isPlacehold=function(t,e){return t.__.__isPlacehold},Gh.isDrag=function(t,e){return Ov("isDrag",t,e)},Gh.setStyleName=function(t,e,i){i?Tv(t,e,t[e]):Lv(t,e,t[e])},Gh.set=function(t,e){const i=t.states[e];i?Tv(t,e,i):Lv(t,e,i)},Gh.getStyle=bv,Gh.updateStyle=xv,Gh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Bv(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Rv(e,"hoverStyle");break;case t.PointerEvent.DOWN:Bv(e,"pressStyle");break;case t.PointerEvent.UP:Rv(e,"pressStyle")}};const Dv=t.UI.prototype;t.UI.addAttr("selected",!1,_v,"selectedStyle"),t.UI.addAttr("disabled",!1,_v,"disabledStyle"),t.UI.addAttr("states",{},fv),t.UI.addAttr("state","",_v),t.UI.addAttr("normalStyle",void 0,ao),t.UI.addAttr("hoverStyle",void 0,fv),t.UI.addAttr("pressStyle",void 0,fv),t.UI.addAttr("focusStyle",void 0,fv),t.UI.addAttr("selectedStyle",void 0,fv),t.UI.addAttr("disabledStyle",void 0,fv),t.UI.addAttr("placeholderStyle",void 0,fv),t.UI.addAttr("button",!1,ao),Dv.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Dv.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Bv(this,"focusStyle"):Rv(this,"focusStyle")})},Dv.updateState=function(){Gh.updateStyle(this,void 0,"in")};const Mv=t.Text.prototype,Iv="text";eo(Mv,Iv,Object.assign(Object.assign({},io(Mv,Iv)),{set(t){const e=this,i=e.text;e.__setAttr(Iv,t)&&(fo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Fv extends tl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;p(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!r(t))if(d(t))this.now=t;else if(g(t)){const e=p(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Kn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(d(o)?{width:o,height:o}:o)||(r>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Dr(Dr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),r(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},de([Do(Fv)],t.Robot.prototype,"__",void 0),de([go()],t.Robot.prototype,"robot",void 0),de([ao()],t.Robot.prototype,"actions",void 0),de([ao("")],t.Robot.prototype,"action",void 0),de([Eo(0)],t.Robot.prototype,"now",void 0),de([ao(12)],t.Robot.prototype,"FPS",void 0),de([ao(!0)],t.Robot.prototype,"loop",void 0),t.Robot=de([Yo()],t.Robot),ee.add("robot");const{Yes:Wv,NoAndSkip:zv,YesAndSkip:Uv}=t.Answer,Hv={},Nv={},Yv={};class Xv{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Hv.id=t.substring(1),t=Hv;break;case".":Nv.className=t.substring(1),t=Nv;break;default:Yv.tag=t,t=Yv}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=p(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?m.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&ir.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===Wv||o===Uv){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<zv&&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_(Lr.REMOVE,this.__onRemoveChild,this),this.target.on_(Or.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 Vv=t.UI.prototype;function Gv(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=ie.selector())}Vv.find=function(t,e){return Gv(this).getBy(t,this,!1,e)},Vv.findOne=function(t,e){return Gv(this).getBy(t,this,!0,e)},ee.add("find"),ie.finder=function(t){return new Xv(t)};const{setPoint:jv,addPoint:Kv,toBounds:Zv}=gt;const qv={syncExport(t,i,s){let n;Vh.running=!0;try{const o=Un.fileType(i),a=i.includes(".");s=Un.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===o)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===o)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let o,a,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:p}=t,{slice:g,clip:_,trim:f,screenshot:m,padding:y,onCanvas:v}=s,w=r(s.smooth)?!u||u.config.smooth:s.smooth,x=s.contextSettings||(u?u.config.contextSettings:void 0),b=c&&m&&r(s.fill)?t.fill:s.fill,E=Un.isOpaqueImage(i)||b,S=new ut;if(m)o=!0===m?c?u.canvas.bounds:t.worldRenderBounds:m;else{let e=s.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,e){case"inner":S.set(d);break;case"local":S.set(d).divide(t.localTransform),h/=t.scaleX,l/=t.scaleY;break;case"world":h=1,l=1;break;case"page":e=u||t;default:S.set(d).divide(t.getTransform(e));const i=e.worldTransform;h/=h/i.scaleX,l/=l/i.scaleY}o=t.getBounds("render",e)}const k={scaleX:1,scaleY:1};A.getScaleData(s.scale,s.size,o,k);let B=s.pixelRatio||1,{x:T,y:P,width:R,height:L}=new Yt(o).scale(k.scaleX,k.scaleY);_&&(T+=_.x,P+=_.y,R=_.width,L=_.height);const C={exporting:!0,matrix:S.scale(1/k.scaleX,1/k.scaleY).invert().translate(-T,-P).withScale(1/h*k.scaleX,1/l*k.scaleY)};let O,D=ie.canvas({width:Math.floor(R),height:Math.floor(L),pixelRatio:B,smooth:w,contextSettings:x});g&&(O=t,O.__worldOpacity=0,t=u||t,C.bounds=D.bounds),D.save();const M=p&&!r(b),I=t.get("fill");if(M&&(t.fill=""),e.render(t,D,C),M&&(t.fill=I),D.restore(),O&&O.__updateWorldOpacity(),f){a=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Kv(r,n,o):jv(r={},n,o)),a++;const h=new Yt;return r&&(Zv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(D);const t=D,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:B};D=ie.canvas(s),D.copyWorld(t,a,s),t.destroy()}if(y){const[t,e,i,s]=A.fourNumber(y),n=D,{width:o,height:r}=n;D=ie.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),D.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}E&&D.fillWorld(D.bounds,b||"#FFFFFF","destination-over"),v&&v(D);n={data:"canvas"===i?D:D.export(i,s),width:D.pixelWidth,height:D.pixelHeight,renderBounds:o,trimBounds:a};const F=u&&u.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Vh.running=!1,n},export(t,i,s){return Vh.running=!0,function(t){Jv||(Jv=new Xn);return new Promise(e=>{Jv.add(()=>ce(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>ce(this,void 0,void 0,function*(){if(!Gn.isComplete)return e.requestRender(r);const a=Vh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});t.updateLayout(),$v(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let Jv;function $v(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>$v(t))}const Qv=ke.prototype,tw=Kt.get("@leafer-in/export");return Qv.export=function(t,e){const{quality:i,blob:s}=Un.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Qv.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{tw.error(t),s(null)})})},Qv.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Qv.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{tw.error(t),s(!1)})})},ee.add("export"),Object.assign(Vh,qv),t.UI.prototype.export=function(t,e){return Vh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Vh.syncExport(this,t,e)},ee.add("filter"),Object.assign(Xh,{list:{},register(t,e){Xh.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=Xh.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Xh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),ee.add("bright"),t.UI.addAttr("bright",!1,So),t.AlignHelper=bt,t.AnimateEasing=yy,t.AnimateEvent=wy,t.AroundHelper=vt,t.ArrowData=Sf,t.AutoBounds=Vt,t.BezierHelper=ei,t.Bounds=Yt,t.BoundsEvent=Mr,t.BoundsHelper=zt,t.BoxData=sl,t.BranchHelper=gr,t.BranchRender=Ra,t.CanvasData=fl,t.CanvasManager=le,t.ChildEvent=Lr,t.ColorConvert=Fh,t.Creator=ie,t.Cursor=Yd,t.DataHelper=m,t.Debug=Kt,t.DragBoundsHelper=xd,t.Dragger=Od,t.EditBox=Fg,t.EditDataHelper=Rg,t.EditPoint=Dg,t.EditSelect=fg,t.EditSelectHelper=ug,t.EditToolCreator=qg,t.EditorEvent=eg,t.EditorGroupEvent=Qg,t.EditorHelper=Gg,t.EditorMoveEvent=n_,t.EditorRotateEvent=r_,t.EditorScaleEvent=o_,t.EditorSkewEvent=a_,t.Effect=Yh,t.EllipseData=hl,t.EllipseHelper=di,t.Event=Rr,t.EventCreator=ae,t.Eventer=$r,t.Export=Vh,t.FileHelper=Un,t.Filter=Xh,t.Finder=Xv,t.FourNumberHelper=k,t.FrameData=ol,t.GroupData=il,t.HTMLTextData=bf,t.HighBezierHelper=$y,t.HighCurveHelper=rv,t.HitCanvasManager=Xd,t.ImageData=_l,t.ImageEvent=Dr,t.ImageManager=Kn,t.IncrementId=i,t.InnerEditor=l_,t.InnerEditorEvent=$g,t.InteractionBase=Nd,t.InteractionHelper=Bd,t.Keyboard=ad,t.LayoutEvent=Yr,t.Layouter=Th,t.LeafBounds=Ba,t.LeafBoundsHelper=dr,t.LeafData=v,t.LeafDataProxy=ca,t.LeafEventer=la,t.LeafHelper=ir,t.LeafLayout=Pr,t.LeafLevelList=ch,t.LeafList=dh,t.LeafMatrix=ya,t.LeafRender=Ta,t.LeaferCanvas=uh,t.LeaferCanvasBase=ke,t.LeaferData=nl,t.LeaferEvent=Vr,t.LeaferImage=to,t.LeaferTypeCreator=q_,t.LineData=rl,t.MathHelper=A,t.Matrix=ut,t.MatrixHelper=K,t.MultiTouchHelper=Q_,t.MyDragEvent=kd,t.MyImage=ed,t.MyPointerEvent=Ed,t.NeedConvertToCanvasCommandMap=Le,t.OneRadian=M,t.PI2=I,t.PI_2=F,t.Paint=Uh,t.PaintGradient=Nh,t.PaintImage=Hh,t.PathArrow=zh,t.PathArrowModule=xm,t.PathBounds=Pn,t.PathCommandDataHelper=ms,t.PathCommandMap=Pe,t.PathConvert=Ki,t.PathCorner=Mn,t.PathCreator=Ds,t.PathData=cl,t.PathDrawer=Zs,t.PathHelper=Be,t.PathMatrixHelper=Mf,t.PathNumberCommandLengthMap=De,t.PathNumberCommandMap=Ae,t.PathScaler=P_,t.PenData=ul,t.Picker=Ch,t.Platform=e,t.Plugin=ee,t.Point=dt,t.PointHelper=ot,t.PointerButton=hd,t.PolygonData=ll,t.PropertyEvent=Or,t.RectData=al,t.RectHelper=Me,t.RectRender=El,t.RenderEvent=Xr,t.Renderer=Rh,t.ResizeEvent=Hr,t.Resource=Gn,t.RobotData=Fv,t.Run=$t,t.ScrollBar=xf,t.SelectArea=cg,t.Selector=Oh,t.StarData=dl,t.State=Gh,t.StringNumberMap=Gt,t.Stroker=dg,t.TaskItem=Yn,t.TaskProcessor=Xn,t.TextConvert=Ih,t.TextData=gl,t.TransformTool=h_,t.Transformer=cf,t.Transition=jh,t.TwoPointBoundsHelper=gt,t.UIBounds=vl,t.UICreator=ne,t.UIData=tl,t.UIEvent=ld,t.UIRender=xl,t.UnitConvert=Wh,t.WaitHelper=yr,t.WatchEvent=Nr,t.Watcher=fh,t.WheelEventHelper=rf,t.addViewport=j_,t.addViewportConfig=K_,t.affectRenderBoundsType=bo,t.affectStrokeBoundsType=vo,t.arrowType=kf,t.attr=oo,t.autoLayoutType=co,t.boundsType=go,t.canvasPatch=zn,t.canvasSizeAttrs=Se,t.createAttr=function(t){return(e,i)=>{eo(e,i,so(i,t))}},t.createDescriptor=so,t.cursorType=Ao,t.dataProcessor=Do,t.dataType=ao,t.decorateLeafAttr=no,t.defineDataProcessor=Mo,t.defineKey=eo,t.defineLeafAttr=ro,t.dimType=So,t.doBoundsType=fo,t.doStrokeType=wo,t.effectType=Ah,t.emptyData=o,t.eraserType=Co,t.extraPropertyEventMap=Ar,t.getBoundsData=z,t.getDescriptor=io,t.getMatrixData=U,t.getPointData=W,t.hitType=Oo,t.isArray=p,t.isData=_,t.isEmptyData=f,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=g,t.isString=h,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{eo(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=qr,t.maskType=Lo,t.motionPathType=av,t.naturalBoundsType=_o,t.opacityType=ko,t.path=In,t.pathInputType=mo,t.pathType=yo,t.pen=Fn,t.positionType=ho,t.registerEditTool=Kg,t.registerInnerEditor=Zg,t.registerUI=Yo,t.registerUIEvent=Xo,t.resizeType=Dh,t.rewrite=zo,t.rewriteAble=Uo,t.rotationType=po,t.scaleResize=F_,t.scaleResizeFontSize=W_,t.scaleResizeGroup=H_,t.scaleResizePath=z_,t.scaleResizePoints=U_,t.scaleType=uo,t.scrollType=lo,t.sortType=Ro,t.stateStyleType=fv,t.stateType=_v,t.strokeType=xo,t.surfaceType=Eo,t.tempBounds=Xt,t.tempMatrix=pt,t.tempPoint=ct,t.tryToNumber=u,t.useCanvas=gh,t.useModule=No,t.version="1.9.12",t.visibleType=Bo,t.zoomLayerType=Mh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function n(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:r}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function p(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return _(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&_(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=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 o in this)if("_"!==o[0]&&(t=this["_"+o],!s(t))){if("path"===o&&!this.__pathInputed)continue;e=n?n[o]:void 0,i[o]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:m,max:y}=Math,v={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||w.maxCacheSize),isSuperLarge:(t,e,i)=>w.isLarge(t,e,i,w.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,o,r,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,o){const s=e/o.width,n=i/o.height;d.setTransform(s,0,0,n,-o.x*s,-o.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:w}=v,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=x;let E,S,k;const{max:B}=Math,T=[0,0,0,0],P={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)=>R(T,t,e,i,s),toTempAB(t,e,i){k=i?a(t)?e:t:[],a(t)?(E=C(t),S=e):a(e)?(E=t,S=C(e)):(E=t,S=e),4!==E.length&&(E=L(E)),4!==S.length&&(S=L(S))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(O(t,e,i),R(k,B(E[0],S[0]),B(E[1],S[1]),B(E[2],S[2]),B(E[3],S[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(O(t,e,i),R(k,E[0]+S[0],E[1]+S[1],E[2]+S[2],E[3]+S[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,r,h,l]=4===t.length?t:L(t);return R(n,h*i,l*e,o*i,r*e)}},{set:R,get:L,setTemp:C,toTempAB:O}=P,{round:A,pow:D,max:M,floor:I,PI:F}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:P.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:D(10,e);return-0===(t=A(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(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 U=F/180,H=2*F,N=F/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function V(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:G,cos:j,acos:K,sqrt:Z}=Math,{float:q}=W,J={};function $(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:$(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:V,getWorld:$,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=j(e*=U),a=G(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=U,t.a=s+o*i,t.b=n+r*i),e&&(e*=U,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,n,o){const{e:r,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,n,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:n}=e,o=i*U,r=j(o),a=G(o);if(s||n){const e=s*U,i=n*U;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||n)&&tt.translateInner(t,-i.x,-i.y,!n)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,p,g,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=Z(n*n+o*o),c=t/d;const e=n/d;u=o>0?K(e):-K(e)}else{c=Z(r*r+a*a),d=t/c;const e=r/c;u=N-(a>0?K(-e):-K(e))}const e=q(j(u)),i=G(u);d=q(d),c=q(c),p=e?q((r/c+i)/e/U,9):0,g=e?q((o/d-i)/e/U,9):0,u=q(u/U)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=Z(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{toInnerPoint:et,toOuterPoint:it}=Q,{sin:st,cos:nt,abs:ot,sqrt:rt,atan2:at,min:ht,round:lt}=Math,dt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ct.defaultPoint);const s=nt(e*=U),n=st(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return pt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return pt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return pt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=ot(i-t),o=ot(s-e);return rt(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>ht(ut(t,e,i,s),ut(i,s,n,o)),getAngle:(t,e)=>gt(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),getRadianFrom(t,e,i,n,o,r,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=gt(t,e);return(e=s?e:{}).x=t.x+nt(n)*i,e.y=t.y+st(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:pt,getAtan2:gt}=ct;class _t{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new _t(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i){return new _t(dt.getDistancePoint(this,t,e,i))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}reset(){return dt.reset(this),this}}const ft=new _t;class mt{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return c(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,o),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new mt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const yt=new mt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){wt(t,e,i),wt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:wt}=vt;var xt,bt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.left=3]="left",t.Direction9=void 0,(bt=t.Direction9||(t.Direction9={}))[bt.topLeft=0]="topLeft",bt[bt.top=1]="top",bt[bt.topRight=2]="topRight",bt[bt.right=3]="right",bt[bt.bottomRight=4]="bottomRight",bt[bt.bottom=5]="bottom",bt[bt.bottomLeft=6]="bottomLeft",bt[bt.left=7]="left",bt[bt.center=8]="center",bt[bt["top-left"]=0]="top-left",bt[bt["top-right"]=2]="top-right",bt[bt["bottom-right"]=4]="bottom-right",bt[bt["bottom-left"]=6]="bottom-left";const Et=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];Et.forEach(t=>t.type="percent");const St={directionData:Et,tempPoint:{},get:kt,toPoint(t,e,i,s,n,o){const r=kt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),St.toPoint(t,e,i,!0),i)};function kt(e){return o(e)?Et[t.Direction9[e]]:e}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,n,o){Bt(t,i,s,n,e,o)}},{tempPointBounds:Pt,setPoint:Rt,addPoint:Lt,toBounds:Ct}=vt,{toOuterPoint:Ot}=Q,{float:At,fourNumber:Dt}=W,{floor:Mt,ceil:It}=Math;let Ft,Wt,zt,Ut;const Ht={},Nt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:o,y:r,width:a,height:h}=e;if(d(i)){const e=Dt(i);s?Vt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Yt,t),Vt.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:o,f:r}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=r+t.y*n):(i.height=t.height*-n,i.y=r+t.y*n-i.height)}else Ht.x=t.x,Ht.y=t.y,Ot(e,Ht,Nt),Rt(Pt,Nt.x,Nt.y),Ht.x=t.x+t.width,Ot(e,Ht,Nt),Lt(Pt,Nt.x,Nt.y),Ht.y=t.y+t.height,Ot(e,Ht,Nt),Lt(Pt,Nt.x,Nt.y),Ht.x=t.x,Ot(e,Ht,Nt),Lt(Pt,Nt.x,Nt.y),Ct(Pt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),o(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Yt.width=n?e.width*=s:e.width*s,Yt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Yt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Ft=t.x+t.width,Wt=t.y+t.height,zt=e.x,Ut=e.y,i||(zt+=e.width,Ut+=e.height),Ft=Ft>zt?Ft:zt,Wt=Wt>Ut?Wt:Ut,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Wt-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||jt(t,n)):Gt(t,n));o&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Pt,t.x,t.y):Lt(Pt,t.x,t.y)),Ct(Pt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){Gt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=dt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Vt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Vt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return Ft=s+o,Wt=n+r,zt=t.x+t.width,Ut=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<zt?Ft:zt,Wt=Wt<Ut?Wt:Ut,o=Ft-s,r=Wt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Vt.copy(t,Vt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Vt.set(t)}},Vt=Xt,{add:Gt,copy:jt}=Vt;class Kt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Kt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Zt=new Kt;class qt{constructor(t,e,i,s,n,o){c(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new Kt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Jt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:$t}=W;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,n=t.__nowWorld,o=$t();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(ee.enable){if(ee.filterList.length&&ee.filterList.every(t=>t!==this.name))return;if(ee.excludeList.length&&ee.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ee.enable&&this.warn(...t)}warn(...t){ee.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function te(t){return t?o(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const ee=Qt,ie=Qt.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,ie.log(s,n,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];s(i)||ne.end(i,e)}},ne=se,oe=[],re={list:{},add(t,...e){this.list[t]=!0,oe.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>oe.forEach(t=>re.has(t,!0)));const ae={editor:t=>re.need("editor")},he=Qt.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,n,o,r){de[t]||he.error("not register "+t);const a=new de[t](e);return s(i)||(a.x=i,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:de}=le,ce=Qt.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(pe[e]&&ce.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}=ue;class ge{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ae.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function _e(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function fe(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function me(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ye=[];function ve(){return(t,e)=>{ye.push(e)}}const we=[];class xe{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}_e([me("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),_e([me("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),_e([me("globalAlpha")],xe.prototype,"opacity",void 0),_e([me()],xe.prototype,"fillStyle",void 0),_e([me()],xe.prototype,"strokeStyle",void 0),_e([me("lineWidth")],xe.prototype,"strokeWidth",void 0),_e([me("lineCap")],xe.prototype,"strokeCap",void 0),_e([me("lineJoin")],xe.prototype,"strokeJoin",void 0),_e([me("lineDashOffset")],xe.prototype,"dashOffset",void 0),_e([me()],xe.prototype,"miterLimit",void 0),_e([me()],xe.prototype,"shadowBlur",void 0),_e([me()],xe.prototype,"shadowColor",void 0),_e([me()],xe.prototype,"shadowOffsetX",void 0),_e([me()],xe.prototype,"shadowOffsetY",void 0),_e([me()],xe.prototype,"filter",void 0),_e([me()],xe.prototype,"font",void 0),_e([me()],xe.prototype,"fontKerning",void 0),_e([me()],xe.prototype,"fontStretch",void 0),_e([me()],xe.prototype,"fontVariantCaps",void 0),_e([me()],xe.prototype,"textAlign",void 0),_e([me()],xe.prototype,"textBaseline",void 0),_e([me()],xe.prototype,"textRendering",void 0),_e([me()],xe.prototype,"wordSpacing",void 0),_e([me()],xe.prototype,"letterSpacing",void 0),_e([me()],xe.prototype,"direction",void 0),_e([ve()],xe.prototype,"setTransform",null),_e([ve()],xe.prototype,"resetTransform",null),_e([ve()],xe.prototype,"getTransform",null),_e([ve()],xe.prototype,"save",null),_e([ve()],xe.prototype,"restore",null),_e([ve()],xe.prototype,"translate",null),_e([ve()],xe.prototype,"scale",null),_e([ve()],xe.prototype,"rotate",null),_e([ve()],xe.prototype,"fill",null),_e([ve()],xe.prototype,"stroke",null),_e([ve()],xe.prototype,"clip",null),_e([ve()],xe.prototype,"fillRect",null),_e([ve()],xe.prototype,"strokeRect",null),_e([ve()],xe.prototype,"clearRect",null),_e([ve()],xe.prototype,"beginPath",null),_e([ve()],xe.prototype,"moveTo",null),_e([ve()],xe.prototype,"lineTo",null),_e([ve()],xe.prototype,"bezierCurveTo",null),_e([ve()],xe.prototype,"quadraticCurveTo",null),_e([ve()],xe.prototype,"closePath",null),_e([ve()],xe.prototype,"arc",null),_e([ve()],xe.prototype,"arcTo",null),_e([ve()],xe.prototype,"ellipse",null),_e([ve()],xe.prototype,"rect",null),_e([ve()],xe.prototype,"roundRect",null),_e([ve()],xe.prototype,"createConicGradient",null),_e([ve()],xe.prototype,"createLinearGradient",null),_e([ve()],xe.prototype,"createPattern",null),_e([ve()],xe.prototype,"createRadialGradient",null),_e([ve()],xe.prototype,"fillText",null),_e([ve()],xe.prototype,"measureText",null),_e([ve()],xe.prototype,"strokeText",null);const{copy:be,multiplyParent:Ee,pixelScale:Se}=Q,{round:ke}=Math,Be=new Kt,Te=new Kt,Pe={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Le extends xe{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Pe),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;g.copyAttrs(s,t,Re),Re.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Ee(t,e,n),Se(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=ke(n.e-.5)+.5,n.f=ke(n.f-.5)+.5):(n.e=ke(n.e),n.f=ke(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:n,dashPattern:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(o=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=o,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Te):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,o=!0){this.resetTransform(),this.copyWorld(t,e,i,s,o),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Be.x,Be.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return n.save(),t&&(be(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Oe),De={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ie=Object.assign(Object.assign({},Me),Oe),Fe=Ae,We={};for(let t in Fe)We[Fe[t]]=t;const ze={};for(let t in Fe)ze[Fe[t]]=De[t];const Ue={drawRoundRect(t,e,i,s,n,o){const r=W.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:He,cos:Ne,hypot:Ye,atan2:Xe,ceil:Ve,abs:Ge,PI:je,sqrt:Ke,pow:Ze}=Math,{setPoint:qe,addPoint:Je}=vt,{set:$e,toNumberPoints:Qe}=dt,{M:ti,L:ei,C:ii,Q:si,Z:ni}=Ae,oi={},ri={points(t,e,i,s){let n=Qe(e);if(t.push(ti,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],g=Ke(Ze(r-e,2)+Ze(a-o,2)),_=Ke(Ze(h-r,2)+Ze(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=o,d=r-g*h,c=a-g*l,2===i?s||t.push(si,d,c,r,a):t.push(ii,u,p,d,c,r,a),u=r+_*h,p=a+_*l);s||t.push(si,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ei,n[e],n[e+1]);s&&t.push(ni)},rect(t,e,i,s,n){Ce.creator.path=t,Ce.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){Ce.creator.path=[],Ue.drawRoundRect(Ce.creator,e,i,s,n,o),t.push(...Ce.convertToCanvasData(Ce.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,p=o-s,g=r-n;let _=Xe(u,c),f=Xe(g,p);const m=Ye(c,u),y=Ye(p,g);let v=f-_;if(v<0&&(v+=H),m<1e-12||y<1e-12||v<1e-12||Ge(v-je)<1e-12)return t&&t.push(ei,s,n),h&&(qe(h,e,i),Je(h,s,n)),d&&$e(d,e,i),void(l&&$e(l,s,n));const w=c*g-p*u<0,x=w?-1:1,b=a/Ne(v/2),E=s+b*Ne(_+v/2+N*x),S=n+b*He(_+v/2+N*x);return _-=N*x,f-=N*x,li(t,E,S,a,a,0,_/U,f/U,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>li(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*U,p=He(u),g=Ne(u);let _=r*U,f=a*U;_>je&&(_-=H),f<0&&(f+=H);let m=f-_;m<0?m+=H:m>H&&(m-=H),h&&(m-=H);const y=Ve(Ge(m/N)),v=m/y,w=He(v/4),x=8/3*w*w/He(v/2);f=_+v;let b,E,S,k,B,T,P,R,L=Ne(_),C=He(_),O=S=g*s*L-p*n*C,A=k=p*s*L+g*n*C,D=e+S,M=i+k;t&&t.push(t.length?ei:ti,D,M),l&&qe(l,D,M),c&&$e(c,D,M);for(let o=0;o<y;o++)b=Ne(f),E=He(f),S=g*s*b-p*n*E,k=p*s*b+g*n*E,B=e+O-x*(g*s*C+p*n*L),T=i+A-x*(p*s*C-g*n*L),P=e+S+x*(g*s*E+p*n*b),R=i+k+x*(p*s*E-g*n*b),t&&t.push(ii,B,T,P,R,e+S,i+k),l&&hi(e+O,i+A,B,T,P,R,e+S,i+k,l,!0),O=S,A=k,L=b,C=E,_=f,f+=v;d&&$e(d,e+S,i+k)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ii,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,p,g,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):qe(h,t,e),Je(h,r,a);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,n,o,r,a,oi),Je(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*o+g*a,l.y=c*i+u*n+p*r+g*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ai(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ri,{sin:di,cos:ci,sqrt:ui,atan2:pi}=Math,{ellipse:gi}=ri,_i={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=o*U,g=di(p),_=ci(p),f=-_*c-g*u,m=-_*u+g*c,y=s*s,w=n*n,x=m*m,b=f*f,E=y*w-y*x-w*b;let S=0;if(E<0){const t=ui(1-E/(y*w));s*=t,n*=t}else S=(r===a?-1:1)*ui(E/(y*x+w*b));const k=S*s*m/n,B=-S*n*f/s,T=pi((m-B)/n,(f-k)/s),P=pi((-m-B)/n,(-f-k)/s);let R=P-T;0===a&&R>0?R-=H:1===a&&R<0&&(R+=H);const L=e+c+_*k-g*B,C=i+u+g*k+_*B,O=R<0?1:0;d||v.ellipseToCurve?gi(t,L,C,s,n,o,T/U,P/U,O):s!==n||o?t.push(Ae.G,L,C,s,n,o,T/U,P/U,O):t.push(Ae.O,L,C,s,T/U,P/U,O)}},{M:fi,m:mi,L:yi,l:vi,H:wi,h:xi,V:bi,v:Ei,C:Si,c:ki,S:Bi,s:Ti,Q:Pi,q:Ri,T:Li,t:Ci,A:Oi,a:Ai,Z:Di,z:Mi,N:Ii,D:Fi,X:Wi,G:zi,F:Ui,O:Hi,P:Ni,U:Yi}=Ae,{rect:Xi,roundRect:Vi,arcTo:Gi,arc:ji,ellipse:Ki,quadraticCurveTo:Zi}=ri,{ellipticalArc:qi}=_i,Ji=Qt.get("PathConvert"),$i={},Qi={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=ze[s],a+=s===n?" ":We[s];for(let s=1;s<i;s++)a+=W.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?Ie:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(ts.dot&&(es(r,o),o=""),ts.dot++),"0"===o&&"."!==s&&(es(r,o),o=""),o+=s):Ae[s]?(o&&(es(r,o),o=""),ts.name=Ae[s],ts.length=De[s],ts.index=0,es(r,ts.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&es(r,o),o=s):o&&(es(r,o),o=""),n=s;return o&&es(r,o),i?Qi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case mi:t[c+1]+=a,t[c+2]+=h;case fi:a=t[c+1],h=t[c+2],p.push(fi,a,h),c+=3;break;case xi:t[c+1]+=a;case wi:a=t[c+1],p.push(yi,a,h),c+=2;break;case Ei:t[c+1]+=h;case bi:h=t[c+1],p.push(yi,a,h),c+=2;break;case vi:t[c+1]+=a,t[c+2]+=h;case yi:a=t[c+1],h=t[c+2],p.push(yi,a,h),c+=3;break;case Ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Bi;case Bi:r=o===Si||o===Bi,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Si,l,d,i,s,a,h),c+=5;break;case ki:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Si;case Si:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Si,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ci:t[c+1]+=a,t[c+2]+=h,n=Li;case Li:r=o===Pi||o===Li,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Zi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:i=t[c+1],s=t[c+2],e?Zi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ai:t[c+6]+=a,t[c+7]+=h;case Oi:qi(p,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 Mi:case Di:p.push(Di),c++;break;case Ii:a=t[c+1],h=t[c+2],e?Xi(p,a,h,t[c+3],t[c+4]):is(p,t,c,5),c+=5;break;case Fi:a=t[c+1],h=t[c+2],e?Vi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(p,t,c,9),c+=9;break;case Wi:a=t[c+1],h=t[c+2],e?Vi(p,a,h,t[c+3],t[c+4],t[c+5]):is(p,t,c,6),c+=6;break;case zi:Ki(e?p:is(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,$i),a=$i.x,h=$i.y,c+=9;break;case Ui:e?Ki(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Hi:ji(e?p:is(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$i),a=$i.x,h=$i.y,c+=7;break;case Ni:e?ji(p,t[c+1],t[c+2],t[c+3],0,360,!1):is(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Yi:Gi(e?p:is(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$i),a=$i.x,h=$i.y,c+=6;break;default:return Ji.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(fi,t.x,t.y);break;case"L":e.push(yi,t.x,t.y);break;case"C":e.push(Si,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Di)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:is}=Qi,{M:ss,L:ns,C:os,Q:rs,Z:as,N:hs,D:ls,X:ds,G:cs,F:us,O:ps,P:gs,U:_s}=Ae,{getMinDistanceFrom:fs,getRadianFrom:ms}=dt,{tan:ys,min:vs,abs:ws}=Math,xs={},bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ss,e,i)},lineTo(t,e,i){t.push(ns,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(os,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(rs,e,i,s,n)},closePath(t){t.push(as)},rect(t,e,i,s,n){t.push(hs,e,i,s,n)},roundRect(t,e,i,s,n,o){if(a(o))t.push(ds,e,i,s,n,o);else{const r=W.fourNumber(o);r?t.push(ls,e,i,s,n,...r):t.push(hs,e,i,s,n)}},ellipse(t,e,i,s,o,r,a,h,l){n(r)?t.push(us,e,i,s,o):(n(a)&&(a=0),n(h)&&(h=360),t.push(cs,e,i,s,o,r,a,h,l?1:0))},arc(t,e,i,s,o,r,a){n(o)?t.push(gs,e,i,s):(n(r)&&(r=360),t.push(ps,e,i,s,o,r,a?1:0))},arcTo(t,e,i,n,o,r,a,h){if(!s(a)){const t=fs(a,h,e,i,n,o);r=vs(r,vs(t/2,t/2*ws(ys(ms(a,h,e,i,n,o)/2))))}t.push(_s,e,i,n,o,r)},drawEllipse(t,e,i,s,o,r,a,h,l){ri.ellipse(null,e,i,s,o,n(r)?0:r,n(a)?0:a,n(h)?360:h,l,null,null,xs),t.push(ss,xs.x,xs.y),Es(t,e,i,s,o,r,a,h,l)},drawArc(t,e,i,s,o,r,a){ri.arc(null,e,i,s,n(o)?0:o,n(r)?360:r,a,null,null,xs),t.push(ss,xs.x,xs.y),Ss(t,e,i,s,o,r,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:Es,arc:Ss}=bs,{moveTo:ks,lineTo:Bs,quadraticCurveTo:Ts,bezierCurveTo:Ps,closePath:Rs,beginPath:Ls,rect:Cs,roundRect:Os,ellipse:As,arc:Ds,arcTo:Ms,drawEllipse:Is,drawArc:Fs,drawPoints:Ws}=bs;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Ce.parse(t):t:[],this}beginPath(){return Ls(this.__path),this.paint(),this}moveTo(t,e){return ks(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Ps(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ts(this.__path,t,e,i,s),this.paint(),this}closePath(){return Rs(this.__path),this.paint(),this}rect(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Os(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return As(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return Ds(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return Ms(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return Is(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Fs(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return Ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Hs,C:Ns,Q:Ys,Z:Xs,N:Vs,D:Gs,X:js,G:Ks,F:Zs,O:qs,P:Js,U:$s}=Ae,Qs=Qt.get("PathDrawer"),tn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ys:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Xs:t.closePath(),s+=1;break;case Vs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*U,e[s+6]*U,e[s+7]*U,e[s+8]),s+=9;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,H,!1),s+=5;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,H,!1),s+=4;break;case $s:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Qs.error(`command: ${i} [index:${s}]`,e)}}},{M:en,L:sn,C:nn,Q:on,Z:rn,N:an,D:hn,X:ln,G:dn,F:cn,O:un,P:pn,U:gn}=Ae,{toTwoPointBounds:_n,toTwoPointBoundsByQuadraticCurve:fn,arcTo:mn,arc:yn,ellipse:vn}=ri,{addPointBounds:wn,copy:xn,addPoint:bn,setPoint:En,addBounds:Sn,toBounds:kn}=vt,Bn=Qt.get("PathBounds");let Tn,Pn,Rn;const Ln={},Cn={},On={},An={toBounds(t,e){An.toTwoPointBounds(t,Cn),kn(Cn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return En(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===rn||r===nn||r===on?En(e,h,l):En(e,t[a+1],t[a+2])),r){case en:case sn:h=t[a+1],l=t[a+2],bn(e,h,l),a+=3;break;case nn:n=t[a+5],o=t[a+6],_n(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Ln),wn(e,Ln),h=n,l=o,a+=7;break;case on:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],fn(h,l,i,s,n,o,Ln),wn(e,Ln),h=n,l=o,a+=5;break;case rn:a+=1;break;case an:h=t[a+1],l=t[a+2],Sn(e,h,l,t[a+3],t[a+4]),a+=5;break;case hn:case ln:h=t[a+1],l=t[a+2],Sn(e,h,l,t[a+3],t[a+4]),a+=r===hn?9:6;break;case dn:vn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Ln,On),0===a?xn(e,Ln):wn(e,Ln),h=On.x,l=On.y,a+=9;break;case cn:h=t[a+1],l=t[a+2],Pn=t[a+3],Rn=t[a+4],Sn(e,h-Pn,l-Rn,2*Pn,2*Rn),h+=Pn,a+=5;break;case un:yn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ln,On),0===a?xn(e,Ln):wn(e,Ln),h=On.x,l=On.y,a+=7;break;case pn:h=t[a+1],l=t[a+2],Tn=t[a+3],Sn(e,h-Tn,l-Tn,2*Tn,2*Tn),h+=Tn,a+=4;break;case gn:mn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ln,On),0===a?xn(e,Ln):wn(e,Ln),h=On.x,l=On.y,a+=6;break;default:return void Bn.error(`command: ${r} [index:${a}]`,t)}}},{M:Dn,L:Mn,Z:In}=Ae,{getCenterX:Fn,getCenterY:Wn}=dt,{arcTo:zn}=bs,Un={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case Dn:l=p=t[r+1],d=g=t[r+2],r+=3,t[r]===Mn?(c=t[r+1],u=t[r+2],f.push(Dn,Fn(l,c),Wn(d,u))):f.push(Dn,l,d);break;case Mn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Mn:zn(f,a,h,t[r+1],t[r+2],e,p,g);break;case In:zn(f,a,h,l,d,e,p,g);break;default:f.push(Mn,a,h)}p=a,g=h;break;case In:n!==In&&(zn(f,l,d,c,u,e,p,g),f.push(In)),r+=1;break;default:o=ze[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==In&&(f[1]=l,f[2]=d),f}};function Hn(t){return new zs(t)}const Nn=Hn();Ce.creator=Hn(),Ce.parse=Qi.parse,Ce.convertToCanvasData=Qi.toCanvasData;const{drawRoundRect:Yn}=Ue;function Xn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Yn(this,t,e,i,s,n)})}(t)}const Vn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Gn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Gn=Vn;Gn.alphaPixelTypes.forEach(t=>Gn.upperCaseTypeMap[t]=t.toUpperCase());const jn=Qt.get("TaskProcessor");class Kn{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return fe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){jn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e,i){let n,o,r,h;const l=new Kn(t);return l.parent=this,a(e)?h=e:e&&(o=e.parallel,n=e.start,r=e.time,h=e.delay,i||(i=e.canUse)),r&&(l.time=r),!1===o&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const qn=Qt.get("Resource"),Jn={tasker:new Zn,map:{},get isComplete(){return $n.tasker.isComplete},set(t,e){$n.map[t]&&qn.repeat(t),$n.map[t]=e},get:t=>$n.map[t],remove(t){const e=$n.map[t];e&&(e.destroy&&e.destroy(),delete $n.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),$n.set(t,e),e},destroy(){$n.map={}}},$n=Jn,Qn={maxRecycled:10,recycledList:[],patternTasker:new Zn,get(t){let e=Jn.get(t.url);return e||Jn.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||to.recycledList.push(t)})},clearRecycled(){const t=to.recycledList;t.length>to.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Jn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Vn.alphaPixelTypes.some(e=>to.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:"+Vn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Vn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){to.recycledList=[]}},to=Qn,{IMAGE:eo,create:io}=x;class so{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=io(eo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Qn.isFormat("svg",t)&&(this.isSVG=!0),Qn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Jn.tasker.add(()=>fe(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,s(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,o,r){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=v.image.resize(this.view,t,e,n,o,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function no(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function oo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ro(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ao(t,e){return(i,s)=>lo(i,s,t,e&&e(s))}function ho(t){return t}function lo(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};no(t,e,Object.assign(n,s||{})),Wo(t,e,i)}function co(t){return ao(t)}function uo(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function po(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function go(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),vo(this))}}))}function _o(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function fo(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mo(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&vo(this)}}))}function yo(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(vo(this),this.__.__removeNaturalSize())}}))}function vo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function wo(t){return ao(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),vo(this)}}))}const xo=mo;function bo(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i)&&(Eo(this),e&&(this.__.__useStroke=!0))}}))}function Eo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&vo(t)}const So=bo;function ko(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Bo(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function To(t){return ao(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 Po(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Lo(this)}}))}function Ro(t){return ao(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Co(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Co(this,t,e,i),this.mask&&Lo(this)}}))}function Lo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Co(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||vo(t))}function Oo(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ao(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Do(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Mo(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Io(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Fo(t){return(e,i)=>{no(e,"__DataProcessor",{get:()=>t})}}function Wo(t,e,i){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ro(e,i);if(s(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(c(i)){const t=p(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=n;for(;!l&&d;)l=oo(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),no(n,e,a)}const zo=new Qt("rewrite"),Uo=[],Ho=["destroy","constructor"];function No(t){return(e,i)=>{Uo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Yo(){return t=>{Xo()}}function Xo(t){Uo.length&&(Uo.forEach(e=>{t&&zo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Uo.length=0)}function Vo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ho.includes(s)||e&&e.includes(s)))if(t.prototype){oo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Go(){return t=>{le.register(t)}}function jo(){return t=>{ue.register(t)}}setTimeout(()=>Xo(!0));const{copy:Ko,toInnerPoint:Zo,toOuterPoint:qo,scaleOfOuter:Jo,rotateOfOuter:$o,skewOfOuter:Qo,multiplyParent:tr,divideParent:er,getLayout:ir}=Q,sr={},{round:nr}=Math,or={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),hr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)ar(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++)lr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&lr(t),t.__updateChange()},updateAllChange(t){if(cr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)dr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,n,o){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const o=c(e)?Object.assign({},e):{x:e,y:i};s?qo(t.localTransform,o,o,!0):t.parent&&Zo(t.parent.scrollWorldTransform,o,o,!0),rr.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=nr(e),i=nr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){rr.zoomOfLocal(t,ur(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(a(s)||(s&&(o=s),s=i),Ko(sr,r),Jo(sr,e,i,s),rr.hasHighPosition(t))rr.setTransform(t,sr,n,o);else{const e=t.x+sr.e-r.e,a=t.y+sr.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){rr.rotateOfLocal(t,ur(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Ko(sr,n),$o(sr,e,i),rr.hasHighPosition(t)?rr.setTransform(t,sr,!1,s):t.set({x:t.x+sr.e-n.e,y:t.y+sr.f-n.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){rr.skewOfLocal(t,ur(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Ko(sr,t.__localMatrix),Qo(sr,e,i,s),rr.setTransform(t,sr,n,o)},transformWorld(t,e,i,s){Ko(sr,t.worldTransform),tr(sr,e),t.parent&&er(sr,t.parent.scrollWorldTransform),rr.setTransform(t,sr,i,s)},transform(t,e,i,s){Ko(sr,t.localTransform),tr(sr,e),rr.setTransform(t,sr,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&rr.getInnerOrigin(t,n.origin),r=ir(e,o,n.around&&rr.getInnerOrigin(t,n.around));if(rr.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=rr.getInnerOrigin(t,n.origin);dt.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Jo(i,rr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(rr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Ko(sr,t.worldTransform),er(sr,e.scrollWorldTransform),i?sr:Object.assign({},sr)),drop(t,e,i,s){t.setTransform(rr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||rr.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(()=>rr.animateMove(t,e,i))}}},rr=or,{updateAllMatrix:ar,updateMatrix:hr,updateAllWorldOpacity:lr,updateAllChange:dr,updateChange:cr}=rr;function ur(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const pr={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>_r(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_r(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_r(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 gr;function _r(t,e){return e||(gr=0),t.__.mask&&(gr=1),gr<0?null:(gr&&(gr=-1),!0)}const{updateBounds:fr}=or,mr={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),yr(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++)vr(e[t],e)},updateBounds(t,e){const i=[t];vr(t,i),wr(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++)fr(s[t]);e&&e===i||fr(i)}}},{pushAllChildBranch:yr,pushAllBranchStack:vr,updateBoundsByBranchStack:wr}=mr,xr={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:br,updateBounds:Er}=or,{toOuterOf:Sr,getPoints:kr,copy:Br}=Xt,Tr="_localContentBounds",Pr="_worldContentBounds",Rr="_worldBoxBounds",Lr="_worldStrokeBounds";class Cr{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 Sr(this.contentBounds,this.leaf.__localMatrix,this[Tr]||(this[Tr]={})),this[Tr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Sr(this.contentBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}get worldBoxBounds(){return Sr(this.boxBounds,this.leaf.__world,this[Rr]||(this[Rr]={})),this[Rr]}get worldStrokeBounds(){return Sr(this.strokeBounds,this.leaf.__world,this[Lr]||(this[Lr]={})),this[Lr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Er(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,v.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return Q.defaultMatrix;case"page":t=e.zoomLayer;default:return br(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=br(s,e,!0)}if(r||(r=Q.getLayout(o)),Br(r,a),dt.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,n=kr(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return s(o)||n.forEach(t=>i.innerToWorld(t,null,!1,o)),n}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Or{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 Ar extends Or{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Ar.ADD="child.add",Ar.REMOVE="child.remove",Ar.CREATED="created",Ar.MOUNTED="mounted",Ar.UNMOUNTED="unmounted",Ar.DESTROY="destroy";const Dr="property.scroll";class Mr extends Or{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Mr.CHANGE="property.change",Mr.LEAFER_CHANGE="property.leafer_change",Mr.SCROLL=Dr;const Ir={scrollX:Dr,scrollY:Dr};class Fr extends Or{constructor(t,e){super(t),Object.assign(this,e)}}Fr.LOAD="image.load",Fr.LOADED="image.loaded",Fr.ERROR="image.error";class Wr extends Or{static checkHas(t,e,i){"on"===i?e===Nr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(zr)||t.hasEvent(Ur)||t.hasEvent(Hr),t.__hasWorldEvent=t.hasEvent(Nr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(zr,t),"inner"===e&&t.emit(Ur,t)),t.emit(Hr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Nr,this)}}Wr.RESIZE="bounds.resize",Wr.INNER="bounds.inner",Wr.LOCAL="bounds.local",Wr.WORLD="bounds.world";const{RESIZE:zr,INNER:Ur,LOCAL:Hr,WORLD:Nr}=Wr,Yr={};[zr,Ur,Hr,Nr].forEach(t=>Yr[t]=1);class Xr extends Or{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(Xr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Xr.RESIZE="resize";class Vr extends Or{constructor(t,e){super(t),this.data=e}}Vr.REQUEST="watch.request",Vr.DATA="watch.data";class Gr extends Or{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Gr.REQUEST="layout.request",Gr.START="layout.start",Gr.BEFORE="layout.before",Gr.LAYOUT="layout",Gr.AFTER="layout.after",Gr.AGAIN="layout.again",Gr.END="layout.end";class jr extends Or{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}jr.REQUEST="render.request",jr.CHILD_START="render.child_start",jr.CHILD_END="render.child_end",jr.START="render.start",jr.BEFORE="render.before",jr.RENDER="render",jr.AFTER="render.after",jr.AGAIN="render.again",jr.END="render.end",jr.NEXT="render.next";class Kr extends Or{}Kr.START="leafer.start",Kr.BEFORE_READY="leafer.before_ready",Kr.READY="leafer.ready",Kr.AFTER_READY="leafer.after_ready",Kr.VIEW_READY="leafer.view_ready",Kr.VIEW_COMPLETED="leafer.view_completed",Kr.STOP="leafer.stop",Kr.RESTART="leafer.restart",Kr.END="leafer.end",Kr.UPDATE_MODE="leafer.update_mode",Kr.TRANSFORM="leafer.transform",Kr.MOVE="leafer.move",Kr.SCALE="leafer.scale",Kr.ROTATE="leafer.rotate",Kr.SKEW="leafer.skew";const{MOVE:Zr,SCALE:qr,ROTATE:Jr,SKEW:$r}=Kr,Qr={x:Zr,y:Zr,scaleX:qr,scaleY:qr,rotation:Jr,skewX:$r,skewY:$r},ta={};class ea{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=ia(this,s,!0),h=o(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):a[t]=[l],Yr[t]&&Wr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ia(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Yr[t]&&Wr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ue.has(t)&&(e=ue.get(t,{type:t,target:this,current:this}));const s=ia(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:n}=this,o=i&&i[t],r=n&&n[t];return!!(s(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ia(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ta)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ta)}}const{on:sa,on_:na,off:oa,off_:ra,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroy:ca}=ea.prototype,ua={on:sa,on_:na,off:oa,off_:ra,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroyEventer:ca},pa=Qt.get("setAttr"),ga={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||r(e)||s(e)||(pa.warn(this.innerName,t,e),e=void 0),c(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Mr(Mr.LEAFER_CHANGE,this,t,n,e));const i=Qr[t];i&&(this.emitEvent(new Kr(i,this)),this.emitEvent(new Kr(Kr.TRANSFORM,this)))}this.emitPropertyEvent(Mr.CHANGE,t,n,e);const i=Ir[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 Mr(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:_a,multiplyParent:fa,translateInner:ma,defaultWorld:ya}=Q,{toPoint:va,tempPoint:wa}=St,xa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;fa(this.__local||e,t?t.__scrollWorld||t.__world:ya,i,!!e.affectScaleOrRotation,n),s&&ma(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)&&(_a(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)&&(va(i.around||i.origin,t.boxBounds,wa),ma(e,-wa.x,-wa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ba,updateAllMatrix:Ea}=or,{updateBounds:Sa}=mr,{toOuterOf:ka,copyAndSpread:Ba,copy:Ta}=Xt,{toBounds:Pa}=An,Ra={__updateWorldBounds(){const{__layout:t,__world:e}=this;ka(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Wr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Wr.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(),ka(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ka(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ka(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Pa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ea(this),Sa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ea(this),Sa(this,this))):ba(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ta(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,i)}},La={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),or.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ca}=pr,Oa={__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++)Ca(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++)Ca(i[s],e)||i[s].__clip(t,e)}}},Aa={},{LEAF:Da,create:Ma}=x,{stintSet:Ia}=g,{toInnerPoint:Fa,toOuterPoint:Wa,multiplyParent:za}=Q,{toOuterOf:Ua}=Xt,{copy:Ha,move:Na}=dt,{moveLocal:Ya,zoomOfLocal:Xa,rotateOfLocal:Va,skewOfLocal:Ga,moveWorld:ja,zoomOfWorld:Ka,rotateOfWorld:Za,skewOfWorld:qa,transform:Ja,transformWorld:$a,setTransform:Qa,getFlipTransform:th,getLocalOrigin:eh,getRelativeWorld:ih,drop:sh}=or;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Cr}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=Ma(Da),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ar.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(Ar.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ar.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(Ar.MOUNTED)):this.__emitLifeEvent(Ar.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 za(i,t.matrix,e,void 0,i),Ua(this.__layout.renderBounds,e,e),Ia(e,"half",i.half),Ia(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}=Qn.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),Aa.scaleX=i,Aa.scaleY=s,Aa}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?ih(this,e):this.worldTransform,n=i?t:{};return Ua(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ha(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ha(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Fa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Wa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Na(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Na(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Qa(this,t,e,i)}transform(t,e,i){Ja(this,t,e,i)}move(t,e,i){Ya(this,t,e,i)}moveInner(t,e,i){ja(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Xa(this,eh(this,t),e,i,s,n)}rotateOf(t,e,i){Va(this,eh(this,t),e,i)}skewOf(t,e,i,s,n){Ga(this,eh(this,t),e,i,s,n)}transformWorld(t,e,i){$a(this,t,e,i)}moveWorld(t,e,i){ja(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Ka(this,t,e,i,s,n)}rotateOfWorld(t,e){Za(this,t,e)}skewOfWorld(t,e,i,s,n){qa(this,t,e,i,s,n)}flip(t,e){Ja(this,th(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){sh(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):Wo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ar(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ar.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Vo(ga),Vo(xa),Vo(Ra),Vo(ua),Vo(La)],t.Leaf);const{setListWithFn:nh}=Xt,{sort:oh}=mr,{localBoxBounds:rh,localStrokeBounds:ah,localRenderBounds:hh,maskLocalBoxBounds:lh,maskLocalStrokeBounds:dh,maskLocalRenderBounds:ch}=pr,uh=new Qt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){nh(e||this.__layout.boxBounds,this.children,this.__hasMask?lh:rh)}__updateStrokeBounds(t){nh(t||this.__layout.strokeBounds,this.children,this.__hasMask?dh:ah)}__updateRenderBounds(t){nh(t||this.__layout.renderBounds,this.children,this.__hasMask?ch:hh)}__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(oh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return uh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=le.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Ar.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ar.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(Ar.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ar.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Ar(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Vo(Oa)],t.Branch);class ph{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let n=0,o=e.length;n<o;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new ph;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 gh{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}}class _h extends Le{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}}Xn(OffscreenCanvasRenderingContext2D.prototype),Xn(Path2D.prototype);const{mineType:fh}=Vn;function mh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:fh(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:fh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new _h(t,e),image:t=>new so(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},no(v,"devicePixelRatio",{get:()=>1});const{userAgent:yh}=navigator;yh.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),yh.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):yh.indexOf("Mac")>-1?v.os="Mac":yh.indexOf("Linux")>-1&&(v.os="Linux");class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ph;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 ph,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(jr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Ar.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 Vr(Vr.DATA,{updatedList:this.updatedList})),this.__updatedList=new ph,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Mr.CHANGE,this.__onAttrChange,this],[[Ar.ADD,Ar.REMOVE],this.__onChildEvent,this],[Vr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:xh,updateChange:bh}=or,{pushAllChildBranch:Eh,pushAllParent:Sh}=mr;const{worldBounds:kh}=pr;class Bh{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new ph(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,kh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,kh),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:Th,updateAllChange:Ph}=or,Rh=Qt.get("Layouter");class Lh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new gh,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(Gr.START),this.layoutOnce(),t.emitEvent(new Gr(Gr.END,this.layoutedBlocks,this.times))}catch(t){Rh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rh.warn("layouting"):this.times>3?Rh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Vr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=se.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Gr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Gr(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?(wh(t,!0),e.add(t),t.isBranch&&Eh(t,e),Sh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sh(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||xh(s[t])}xh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Gr(o,a,this.times)),i.emitEvent(new Gr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,se.end(e)}fullLayout(){const t=se.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Gr,o=this.getBlocks(new ph(e));e.emitEvent(new Gr(i,o,this.times)),Lh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Gr(s,o,this.times)),e.emitEvent(new Gr(n,o,this.times)),this.addBlocks(o),se.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?mr.updateBounds(t):or.updateBounds(t),Ph(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(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_([[Gr.REQUEST,this.layout,this],[Gr.AGAIN,this.layoutAgain,this],[Vr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ch=Qt.get("Renderer");class Oh{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.__requestRender()}requestLayout(){this.target.emit(Gr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(jr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(jr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(jr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Ch.log(e.innerName,"---\x3e");try{this.emitRender(jr.START),this.renderOnce(t),this.emitRender(jr.END,this.totalBounds),Qn.clearRecycled()}catch(t){this.rendering=!1,Ch.error(t)}Ch.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ch.warn("rendering");if(this.times>3)return Ch.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(jr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(jr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(jr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(jr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=se.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Kt(s);i.save(),s.spread(Oh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),se.end(e)}fullRender(){const t=se.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),se.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),v.render(this.target,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ch.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new jr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[jr.REQUEST,this.update,this],[Gr.END,this.__onLayoutEnd,this],[jr.AGAIN,this.renderAgain,this],[Xr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Oh.clipSpread=10;const{hitRadiusPoint:Ah}=Xt;class Dh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ph(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new ph;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||or.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&or.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=>or.worldHittable(t))}getPath(t){const e=new ph,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 ph;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 ph,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Ah(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Mh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Dh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.backgrounder&&s&&s.updateLayout(),n.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ih(t){return ao(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Fh(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const i="_"+e;no(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ae,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Lh(t,e),renderer:(t,e,i)=>new Oh(t,e,i),selector:(t,e)=>new Mh(t,e)}),v.layout=Lh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new ph,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const zh={},Uh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Hh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Nh={},Yh={},Xh={},Vh={},Gh={},jh={apply(){re.need("filter")}},Kh={},Zh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},qh={list:{},register(t,e){qh.list[t]=e},get:t=>qh.list[t]},{parse:Jh,objectToCanvasData:$h}=Qi,{stintSet:Qh}=g,{hasTransparent:tl}=Uh,el={},il=Qt.get("UIData");class sl 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,il.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,il.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(Qh(this,"__isTransparentFill",tl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(Qh(this,"__isTransparentStroke",tl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?Jh(t):$h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){nl(this,"shadow",t)}setInnerShadow(t){nl(this,"innerShadow",t)}setFilter(t){nl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yh.compute("fill",this.__leaf),e&&Yh.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=el)):(this.__isStrokes=!0,this._stroke||(this._stroke=el))}__removePaint(t,e){e&&this.__removeInput(t),Xh.recycleImage(t,this),"fill"===t?(Qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Qh(this,"__isAlphaPixelStroke",void 0),Qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function nl(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 ol extends sl{}class rl extends ol{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 al extends ol{__getInputData(t,e){const i=super.__getInputData(t,e);return Re.forEach(t=>delete i[t]),i}}class hl extends rl{}class ll extends sl{get __usePathBox(){return this.points||this.__pathInputed}}class dl extends sl{get __boxStroke(){return!this.__pathInputed}}class cl extends sl{get __boxStroke(){return!this.__pathInputed}}class ul extends ll{}class pl extends sl{}class gl extends sl{get __pathInputed(){return 2}}class _l extends ol{}const fl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ml extends sl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=fl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=le.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class yl extends dl{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 vl extends dl{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:wl,add:xl}=P,bl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=wl(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Gh.getShadowRenderSpread(this,e)),s&&(t=wl(t,s)),o&&(t=xl(t,jh.getSpread(o))),r&&(t=xl(t,r)),a&&(t=xl(t,a));let l=t;return i&&(l=wl(l,Gh.getInnerShadowSpread(this,i))),n&&(l=wl(l,n)),this.__layout.renderShapeSpread=l,h?wl(h.__updateRenderSpread(),t):t}},{stintSet:El}=g,Sl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);El(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),El(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;El(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),El(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){kl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Yh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Gh.shadow(this,t,h),a&&(s.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),n&&(s.__isFills?Yh.fills(n,this,t,e):Yh.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),c&&jh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Uh.string(e.color))}n&&(s.__isFills?Yh.fills(n,this,t,e):Yh.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Yh.strokes(o,this,t,e):Yh.stroke(o,this,t,e))}}else s.__pathInputed?kl(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?Yh.fills(s,this,t,e):Yh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Yh.strokes(n,this,t,e):Yh.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 kl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Yh.stroke(n,t,e,i),s&&Yh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&Yh.stroke(n,t,e,i)}const Bl={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Tl,Pl;t.UI=Tl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Nn.set(this.path=t||[]),t||this.__drawPathByBox(Nn),Nn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Nn.set(i=[]),this.__drawPathByBox(Nn)),t?Qi.toCanvasData(i,!0):i}getPathString(t,e,i){return Qi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Kh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Un.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Nh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?tn.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,a(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Yh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Tl.one(e)}static one(t,e,i,s,n){return le.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Go()(this)}static registerData(t){Fo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([Fo(sl)],t.UI.prototype,"__",void 0),_e([Wh()],t.UI.prototype,"zoomLayer",void 0),_e([co("")],t.UI.prototype,"id",void 0),_e([co("")],t.UI.prototype,"name",void 0),_e([co("")],t.UI.prototype,"className",void 0),_e([Bo("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Po(1)],t.UI.prototype,"opacity",void 0),_e([Ro(!0)],t.UI.prototype,"visible",void 0),_e([Bo(!1)],t.UI.prototype,"locked",void 0),_e([To(!1)],t.UI.prototype,"dim",void 0),_e([To(!1)],t.UI.prototype,"dimskip",void 0),_e([Oo(0)],t.UI.prototype,"zIndex",void 0),_e([Ao(!1)],t.UI.prototype,"mask",void 0),_e([Do(!1)],t.UI.prototype,"eraser",void 0),_e([uo(0,!0)],t.UI.prototype,"x",void 0),_e([uo(0,!0)],t.UI.prototype,"y",void 0),_e([mo(100,!0)],t.UI.prototype,"width",void 0),_e([mo(100,!0)],t.UI.prototype,"height",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_o(1,!0)],t.UI.prototype,"scaleY",void 0),_e([fo(0,!0)],t.UI.prototype,"rotation",void 0),_e([fo(0,!0)],t.UI.prototype,"skewX",void 0),_e([fo(0,!0)],t.UI.prototype,"skewY",void 0),_e([uo(0,!0)],t.UI.prototype,"offsetX",void 0),_e([uo(0,!0)],t.UI.prototype,"offsetY",void 0),_e([po(0,!0)],t.UI.prototype,"scrollX",void 0),_e([po(0,!0)],t.UI.prototype,"scrollY",void 0),_e([go()],t.UI.prototype,"origin",void 0),_e([go()],t.UI.prototype,"around",void 0),_e([co(!1)],t.UI.prototype,"lazy",void 0),_e([yo(1)],t.UI.prototype,"pixelRatio",void 0),_e([ko(0)],t.UI.prototype,"renderSpread",void 0),_e([wo()],t.UI.prototype,"path",void 0),_e([xo()],t.UI.prototype,"windingRule",void 0),_e([xo(!0)],t.UI.prototype,"closed",void 0),_e([mo(0)],t.UI.prototype,"padding",void 0),_e([mo(!1)],t.UI.prototype,"lockRatio",void 0),_e([mo()],t.UI.prototype,"widthRange",void 0),_e([mo()],t.UI.prototype,"heightRange",void 0),_e([co(!1)],t.UI.prototype,"draggable",void 0),_e([co()],t.UI.prototype,"dragBounds",void 0),_e([co("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([co(!1)],t.UI.prototype,"editable",void 0),_e([Mo(!0)],t.UI.prototype,"hittable",void 0),_e([Mo("path")],t.UI.prototype,"hitFill",void 0),_e([So("path")],t.UI.prototype,"hitStroke",void 0),_e([Mo(!1)],t.UI.prototype,"hitBox",void 0),_e([Mo(!0)],t.UI.prototype,"hitChildren",void 0),_e([Mo(!0)],t.UI.prototype,"hitSelf",void 0),_e([Mo()],t.UI.prototype,"hitRadius",void 0),_e([Io("")],t.UI.prototype,"cursor",void 0),_e([Bo()],t.UI.prototype,"fill",void 0),_e([So(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([So("inside")],t.UI.prototype,"strokeAlign",void 0),_e([So(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([So(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([So("none")],t.UI.prototype,"strokeCap",void 0),_e([So("miter")],t.UI.prototype,"strokeJoin",void 0),_e([So()],t.UI.prototype,"dashPattern",void 0),_e([So(0)],t.UI.prototype,"dashOffset",void 0),_e([So(10)],t.UI.prototype,"miterLimit",void 0),_e([xo(0)],t.UI.prototype,"cornerRadius",void 0),_e([xo()],t.UI.prototype,"cornerSmoothing",void 0),_e([Ih()],t.UI.prototype,"shadow",void 0),_e([Ih()],t.UI.prototype,"innerShadow",void 0),_e([Ih()],t.UI.prototype,"blur",void 0),_e([Ih()],t.UI.prototype,"backgroundBlur",void 0),_e([Ih()],t.UI.prototype,"grayscale",void 0),_e([Ih()],t.UI.prototype,"filter",void 0),_e([Bo()],t.UI.prototype,"placeholderColor",void 0),_e([co(100)],t.UI.prototype,"placeholderDelay",void 0),_e([co({})],t.UI.prototype,"data",void 0),_e([No(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Tl=_e([Vo(bl),Vo(Sl),Yo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},_e([Fo(ol)],t.Group.prototype,"__",void 0),_e([mo(0)],t.Group.prototype,"width",void 0),_e([mo(0)],t.Group.prototype,"height",void 0),t.Group=_e([Vo(t.Branch),Go()],t.Group);const Rl=Qt.get("Leafer");t.Leafer=Pl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Jn.isComplete}get layoutLocked(){return!this.layouter.running}get 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),Pl.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=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,n,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new ge,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),xr.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(Kr.RESTART):this.emitLeafer(Kr.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(Kr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Re);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=g.copyAttrs({},this.canvas,Re);e.resize(t),this.updateLazyBounds(),this.__onResize(new Xr(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Re),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Re.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(Kr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Re.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,Re);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(Kr.BEFORE_READY),this.emitLeafer(Kr.READY),this.emitLeafer(Kr.AFTER_READY),xr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Kr.VIEW_READY),xr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){xr.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(Kr.VIEW_COMPLETED),xr.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Kr(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[Kr.START,()=>se.end(t)],[Gr.START,this.updateLazyBounds,this],[jr.START,this.__onCreated,this],[jr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Vr.DATA,this.__onWatchData,this],[Gr.END,this.__onLayoutEnd,this],[jr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Pl.list.remove(this);try{this.stop(),this.emitLeafer(Kr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Qn.clearRecycled()},100)}catch(t){Rl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ph,_e([Fo(al)],t.Leafer.prototype,"__",void 0),_e([mo()],t.Leafer.prototype,"pixelRatio",void 0),_e([co("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Pl=_e([Go()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([Fo(dl)],t.Rect.prototype,"__",void 0),t.Rect=_e([Vo(Bl),Yo(),Go()],t.Rect);const{add:Ll,includes:Cl,scroll:Ol}=Xt,Al=t.Rect.prototype,Dl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(Ll(a,o),Ol(a,i)),this.__updateRectRenderBounds(),t=!Cl(o,a),t&&"show"===r&&Ll(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))}},_e([Fo(rl)],t.Box.prototype,"__",void 0),_e([mo(100)],t.Box.prototype,"width",void 0),_e([mo(100)],t.Box.prototype,"height",void 0),_e([co(!1)],t.Box.prototype,"resizeChildren",void 0),_e([ko("show")],t.Box.prototype,"overflow",void 0),_e([No(Al.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([No(Al.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([No(Al.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([No(Al.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([No(Al.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([No(Al.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([No(Al.__render)],t.Box.prototype,"__renderRect",null),_e([No(Dl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([Yo(),Go()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([Fo(hl)],t.Frame.prototype,"__",void 0),_e([Bo("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([ko("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Go()],t.Frame);const{moveTo:Ml,closePath:Il,ellipse:Fl}=bs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,o=t/2,r=e/2,a=this.__.path=[];i?(s||n?(i<1&&Fl(a,o,r,o*i,r*i,0,s,n,!1),Fl(a,o,r,o,r,0,n,s,!0),i<1&&Il(a)):(i<1&&(Fl(a,o,r,o*i,r*i),Ml(a,t,r)),Fl(a,o,r,o,r,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Ml(a,o,r),Fl(a,o,r,o,r,0,s,n,!1),Il(a)):Fl(a,o,r,o,r)}},_e([Fo(cl)],t.Ellipse.prototype,"__",void 0),_e([xo(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([xo(0)],t.Ellipse.prototype,"startAngle",void 0),_e([xo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Go()],t.Ellipse);const{sin:Wl,cos:zl,PI:Ul}=Math,{moveTo:Hl,lineTo:Nl,closePath:Yl,drawPoints:Xl}=bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Xl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Hl(e,o,0);for(let t=1;t<n;t++)Nl(e,o+o*Wl(2*t*Ul/n),r-r*zl(2*t*Ul/n));Yl(e)}}},_e([Fo(ul)],t.Polygon.prototype,"__",void 0),_e([xo(3)],t.Polygon.prototype,"sides",void 0),_e([xo()],t.Polygon.prototype,"points",void 0),_e([xo(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([Yo(),Go()],t.Polygon);const{sin:Vl,cos:Gl,PI:jl}=Math,{moveTo:Kl,lineTo:Zl,closePath:ql}=bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Kl(r,n,0);for(let t=1;t<2*i;t++)Zl(r,n+(t%2==0?n:n*s)*Vl(t*jl/i),o-(t%2==0?o:o*s)*Gl(t*jl/i));ql(r)}},_e([Fo(pl)],t.Star.prototype,"__",void 0),_e([xo(5)],t.Star.prototype,"corners",void 0),_e([xo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Go()],t.Star);const{moveTo:Jl,lineTo:$l,drawPoints:Ql}=bs,{rotate:td,getAngle:ed,getDistance:id,defaultPoint:sd}=dt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&td(i,e),i}set toPoint(t){this.width=id(sd,t),this.rotation=ed(sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ql(e,t.points,t.curve,t.closed):(Jl(e,0,0),$l(e,this.width,0))}},_e([Fo(ll)],t.Line.prototype,"__",void 0),_e([bo("center")],t.Line.prototype,"strokeAlign",void 0),_e([mo(0)],t.Line.prototype,"height",void 0),_e([xo()],t.Line.prototype,"points",void 0),_e([xo(0)],t.Line.prototype,"curve",void 0),_e([xo(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Go()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},_e([Fo(yl)],t.Image.prototype,"__",void 0),_e([mo("")],t.Image.prototype,"url",void 0),t.Image=_e([Go()],t.Image);const nd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new so({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Fr(Fr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),o=new mt;e&&o.translate(e.x,e.y),i&&(a(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([Fo(vl)],t.Canvas.prototype,"__",void 0),_e([Fh(100)],t.Canvas.prototype,"width",void 0),_e([Fh(100)],t.Canvas.prototype,"height",void 0),_e([Fh(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Fh(!0)],t.Canvas.prototype,"smooth",void 0),_e([co(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Fh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Go()],t.Canvas);const{copyAndSpread:od,includes:rd,spread:ad,setList:hd}=Xt,{stintSet:ld}=g;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Hh.number(e,n),t.__letterSpacing=Hh.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,ld(t,"__padding",l&&W.fourNumber(l)),ld(t,"__clipText","show"!==h&&!t.__autoSize),ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=zh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ad(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!rd(h,a)),this.isOverflow?(hd(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;od(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([Fo(ml)],t.Text.prototype,"__",void 0),_e([mo(0)],t.Text.prototype,"width",void 0),_e([mo(0)],t.Text.prototype,"height",void 0),_e([Bo()],t.Text.prototype,"boxStyle",void 0),_e([co(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([Bo("#000000")],t.Text.prototype,"fill",void 0),_e([bo("outside")],t.Text.prototype,"strokeAlign",void 0),_e([Mo("all")],t.Text.prototype,"hitFill",void 0),_e([mo("")],t.Text.prototype,"text",void 0),_e([mo("")],t.Text.prototype,"placeholder",void 0),_e([mo("caption")],t.Text.prototype,"fontFamily",void 0),_e([mo(12)],t.Text.prototype,"fontSize",void 0),_e([mo("normal")],t.Text.prototype,"fontWeight",void 0),_e([mo(!1)],t.Text.prototype,"italic",void 0),_e([mo("none")],t.Text.prototype,"textCase",void 0),_e([mo("none")],t.Text.prototype,"textDecoration",void 0),_e([mo(0)],t.Text.prototype,"letterSpacing",void 0),_e([mo({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([mo(0)],t.Text.prototype,"paraIndent",void 0),_e([mo(0)],t.Text.prototype,"paraSpacing",void 0),_e([mo("x")],t.Text.prototype,"writingMode",void 0),_e([mo("left")],t.Text.prototype,"textAlign",void 0),_e([mo("top")],t.Text.prototype,"verticalAlign",void 0),_e([mo(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([mo("normal")],t.Text.prototype,"textWrap",void 0),_e([mo("show")],t.Text.prototype,"textOverflow",void 0),_e([Bo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Go()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([Fo(gl)],t.Path.prototype,"__",void 0),_e([bo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Go()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([Fo(_l)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{no(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Vo(zs,["set","path","paint"]),Go()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ae.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),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,Re),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Gr.END,this.__onReady,this],[jr.START,this.__onCreated,this],[jr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(jr.END,this.__onChildRenderEnd,this))}},t.App=_e([Go()],t.App);const dd={},cd={isHoldSpaceKey:()=>cd.isHold("Space"),isHold:t=>dd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){dd[t]||(dd[t]=!0)},setUpCode(t){dd[t]=!1}},ud={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 pd extends Or{get spaceKey(){return cd.isHoldSpaceKey()}get left(){return ud.left(this)}get right(){return ud.right(this)}get middle(){return ud.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return cd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ue.changeName(t,e)}}const{min:gd,max:_d,abs:fd}=Math,{float:md,sign:yd}=W,{minX:vd,maxX:wd,minY:xd,maxY:bd}=Xt,Ed=new Kt,Sd=new Kt,kd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Bd.getValidMove(t.__localBoxBounds,Bd.getDragBounds(t),s,e,!0),Bd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&Bd.getValidScaleOf(t.__localBoxBounds,Bd.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Bd.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),Bd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=md(s.x),s.y=md(s.y),s},getValidScaleOf(t,e,i,s,n,o,a){a||(n=Object.assign({},n)),Sd.set(e),Ed.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,p,g,_,f=1,m=1;return Bd.isInnerMode(t,e,i,"width")?(n.x<0&&Ed.scaleOf(s,f=1/n.x,1),g=md(Ed.minX-Sd.minX),_=md(Sd.maxX-Ed.maxX),u=h&&g>0?1+g/(h*Ed.width):1,p=l&&_>0?1+_/(l*Ed.width):1,f*=_d(u,p)):(n.x<0&&((md(vd(t)-vd(e))<=0||md(wd(e)-wd(t))<=0)&&Ed.scaleOf(s,f=1/n.x,1),Ed.unsign()),g=md(Sd.minX-Ed.minX),_=md(Ed.maxX-Sd.maxX),u=h&&g>0?1-g/(h*Ed.width):1,p=l&&_>0?1-_/(l*Ed.width):1,f*=gd(u,p)),Bd.isInnerMode(t,e,i,"height")?(n.y<0&&Ed.scaleOf(s,1,m=1/n.y),g=md(Ed.minY-Sd.minY),_=md(Sd.maxY-Ed.maxY),u=d&&g>0?1+g/(d*Ed.height):1,p=c&&_>0?1+_/(c*Ed.height):1,m*=_d(u,p),o&&(u=_d(fd(f),fd(m)),f=yd(f)*u,m=yd(m)*u)):(n.y<0&&((md(xd(t)-xd(e))<=0||md(bd(e)-bd(t))<=0)&&Ed.scaleOf(s,1,m=1/n.y),Ed.unsign()),g=md(Sd.minY-Ed.minY),_=md(Ed.maxY-Sd.maxY),u=d&&g>0?1-g/(d*Ed.height):1,p=c&&_>0?1-_/(c*Ed.height):1,m*=gd(u,p)),n.x*=r(f)?f:1,n.y*=r(m)?m:1,n}},Bd=kd;t.PointerEvent=class extends pd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([jo()],t.PointerEvent);const Td=t.PointerEvent,Pd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ph?t:new ph(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return dt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),kd.axisMove(t,n),n}static limitMove(t,e){kd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Pd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Pd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Pd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){Pd.x=t?this.totalX:this.moveX,Pd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([jo()],t.DragEvent);const Rd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([jo()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([jo()],t.MoveEvent),t.TouchEvent=class extends pd{},t.TouchEvent=_e([jo()],t.TouchEvent);const Ld=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([jo()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([jo()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([jo()],t.ZoomEvent),t.KeyEvent=class extends pd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([jo()],t.KeyEvent);const Cd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Od.getSwipeDirection(dt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new ph,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>or.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Od=Cd,Ad=new ph,{getDragEventData:Dd,getDropEventData:Md,getSwipeEventData:Id}=Cd;class Fd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Dd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||Ad;return this.dragging&&(n?e?Ad:new ph(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&ud.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],or.draggable(e)){this.draggableList=new ph(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=Dd(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;n.forEach(i=>{if(i.draggable){const n=o(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},l||n);h&&!n&&e?or.animateMove(i,d,a(h)?h:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=Dd(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(dt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Id(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Md(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Wd=Qt.get("emit");const zd=["move","zoom","rotate","key"];function Ud(t,e,i,s,n){if(zd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Nd(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&Hd(o,e,i,s,n)}}function Hd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nd(t,n)&&(Zh.updateEventStyle&&!s&&Zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ue.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Nd(t,e){return e&&e.has(t)}const Yd={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:Xd,pathCanDrag:Vd,pathHasOutside:Gd}=Cd;class jd{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&&ud.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ud.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&cd.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(Yd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ph(t),this.createTransformer(),this.dragger=new Fd(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(ud.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),ud.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=ud.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&ud.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=dt.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;ud.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,cd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,cd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ph),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Xd(e.path,t));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;v.backgrounder||t.origin||o&&o.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Gd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Vd(t.path))&&!Gd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&dt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Xd(e.path,t.PointerEvent.LONG_TAP)||Xd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Xr.RESIZE,this.__onResize,this)],t.once(Kr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],Hd(n,t,e,!0,s))return;n.isApp&&Ud(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Ud(n,t,e,!1,s),Hd(n,t,e,!1,s))return}catch(t){Wd.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 Kd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Kd.custom={};class Zd extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ph,this.pixelList=new ph}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())};const{toInnerRadiusPointOf:qd,copy:Jd,setRadius:$d}=dt,{hitRadiusPoint:Qd,hitPoint:tc}=Xt,ec={},ic={},sc=t.Leaf.prototype;sc.hit=function(t,e=0){this.updateLayout(),Jd(ic,t),$d(ic,e);const i=this.__world;return!!(e?Qd(i,ic):tc(i,ic))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},ic),e,{target:this}):this.__hitWorld(ic))},sc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Jd(ec,t),$d(t=ec,e.hitRadius)),qd(t,i,ec),e.hitBox||n){if(Xt.hitRadiusPoint(s.boxBounds,ec))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ec)},sc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},sc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},sc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},sc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const nc=new mt,oc=t.UI.prototype;oc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=v.image.hitCanvasSize,r=o.hitScale=Zt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Zt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),Qn.patternLocked=!0,this.__renderShape(o,{matrix:nc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),Qn.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},oc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const rc=t.UI.prototype,ac=t.Rect.prototype,hc=t.Box.prototype;ac.__updateHitCanvas=hc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?rc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ac.__hitFill=hc.__hitFill=function(t){return this.__hitCanvas?rc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.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 lc=Le.prototype;function dc(t,e,i){t.__.__font?Yh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function cc(t,e,i,s,n){const o=i.__;c(t)?Yh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Yh.strokeArrow(t,i,s,n)}function uc(t,e,i,s,n){const o=i.__;c(t)?Yh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),Yh.drawTextStroke(i,s,n))}function pc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,uc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",Yh.fillText(i,o,n),o.blendMode="normal",or.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}lc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},lc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},lc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Zt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:gc,copyAndSpread:_c,toOuterOf:fc,getOuterOf:mc,getByMove:yc,move:vc,getIntersectData:wc}=Xt,xc={};let bc;const{stintSet:Ec}=g,{hasTransparent:Sc}=Uh;function kc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:r}=i.__layout;switch(e.type){case"image":n=Xh.image(i,t,e,r,!bc||!bc[e.url]);break;case"linear":n=Vh.linearGradient(e,r);break;case"radial":n=Vh.radialGradient(e,r);break;case"angular":n=Vh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;n={type:o,style:Uh.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:Uh.string(e)})}if(n){if(o(n.style)&&Sc(n.style)&&(n.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}e.editing&&(n.editing=e.editing),e.blendMode&&(n.blendMode=e.blendMode)}return n}const Bc={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];d(a)||(a=[a]),bc=Xh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=kc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(Ec(i,"__isAlphaPixelFill",n),Ec(i,"__isTransparentFill",o)):(Ec(i,"__isAlphaPixelStroke",n),Ec(i,"__isTransparentStroke",o),Ec(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i,s){i.fillStyle=t,dc(e,i,s)},fills:function(t,e,i,s){let n;for(let o=0,r=t.length;o<r;o++){if(n=t[o],n.image){if(Xh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){!o&&n.image.isPlacehold&&e.drawImagePlaceholder(n.image,i,s);continue}}if(i.fillStyle=n.style,n.transform||n.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),dc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),dc(e,i,s),i.restoreBlendMode()):dc(e,i,s)}},fillPathOrText:dc,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)Yh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":cc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),cc(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)cc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),cc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),or.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Yh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":uc(t,1,e,i,s);break;case"inside":pc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?uc(t,2,e,i,s):pc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!Xh.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.blendMode?(n.saveBlendMode(r.blendMode),i?Yh.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?Yh.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;fc(r.strokeSpread?(_c(xc,r.boxBounds,r.strokeSpread),xc):r.boxBounds,o,a);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=o;else{let s;if(v.fullImageShadow)s=a;else{const t=r.renderShapeSpread?gc(n,P.swapAndScale(r.renderShapeSpread,g,_)):n;s=wc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),g*=f,_*=m),u=mc(a,c),h=yc(u,-c.e,-c.f),l=mc(o,c),vc(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:g,scaleY:_}}};let Tc,Pc=new Kt;const{isSame:Rc}=Xt;function Lc(t,e,i,s,n,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Xh.createData(n,s,i,o),!0}function Cc(t,e){Dc(t,Fr.LOAD,e)}function Oc(t,e){Dc(t,Fr.LOADED,e)}function Ac(t,e,i){e.error=i,t.forceUpdate("surface"),Dc(t,Fr.ERROR,e)}function Dc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Fr(e,i))}function Mc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ic,translate:Fc}=Q,Wc=new Kt,zc={},Uc={};function Hc(t,e,i,s){const n=o(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Nc={},Yc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Xc,set:Vc,rotateOfOuter:Gc,translate:jc,scaleOfOuter:Kc,multiplyParent:Zc,scale:qc,rotate:Jc,skew:$c}=Q;function Qc(t,e,i,s,n,o,r,a){r&&Jc(t,r),a&&$c(t,a.x,a.y),n&&qc(t,n,o),jc(t,e.x+i,e.y+s)}const{get:tu,scale:eu,copy:iu}=Q,{getFloorScale:su}=W,{abs:nu}=Math;const ou={image:function(t,e,i,s,n){let o,r;const a=Qn.get(i);return Tc&&i===Tc.paint&&Rc(s,Tc.boxBounds)?o=Tc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Tc=a.use>1?{leafPaint:o,paint:i,boxBounds:Pc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Lc(t,e,i,a,o,s),n&&(Cc(t,r),Oc(t,r))):a.error?n&&Ac(t,r,a.error):(n&&(Mc(t,!0),Cc(t,r)),o.loadId=a.load(()=>{Mc(t,!1),t.destroyed||(Lc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Oc(t,r)),o.loadId=void 0},e=>{Mc(t,!1),Ac(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,n){const{scaleX:o,scaleY:r}=Xh.getImageRenderScaleData(t,i,s,n),{image:a,data:h}=t,{exporting:l}=n;return!(!h||t.patternId===o+"-"+r&&!l)&&(e&&(h.repeat?e=!1:t.changeful||"miniapp"===v.name&&Xr.isResizing(i)||l||(e=v.image.isLarge(a,o,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Xh.drawImage(t,o,r,i,s,n),!0):(!t.style||t.sync||l?Xh.createPattern(t,i,s,n):Xh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a,blendMode:h}=t,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let p,{width:g,height:_}=a;d&&!d.onlyScale||(p=u.path||u.cornerRadius)||l||h?(n.save(),p&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,g,_),n.restore()):(r.scaleX&&(g*=r.scaleX,_*=r.scaleY),n.drawImage(c,0,0,g,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,Qn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],d(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Qn.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Xh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=Xh.getImageRenderScaleData(t,e,i,s),r=n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!v.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Xh.getPatternFixScale(t,n,o);let d,c,u,{width:p,height:g}=i;l&&(n*=l,o*=l),p*=n,g*=o,h&&(c=h.x*n/nu(s.scaleX||1),u=h.y*o/nu(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=su(p+(c||0)),o*=su(g+(u||0)),d=tu(),a&&iu(d,a),eu(d,1/n,1/o));const _=i.getCanvas(p,g,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=v.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){const{changeful:n,sync:o,scaleFixed:r}=i;n&&(t.changeful=n),o&&(t.sync=o),r&&(t.scaleFixed=r),t.data=Xh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Wc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:p,skew:g,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:a},x="center"!==h&&(p||0)%180==90;let b,E;switch(Xt.set(Uc,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,zc),b=zc.scaleX,E=zc.scaleY),(h||m||f)&&(b&&Xt.scale(Uc,b,E,!0),h&&Tt.toPoint(h,Uc,e,Uc,!0,!0))):v&&!p||(b=E=Xt.getFitScale(e,Uc,"fit"!==a),Xt.put(e,i,h,b,!1,Uc),Xt.scale(Uc,b,E,!0)),l&&dt.move(Uc,l),a){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,Xh.stretchMode(w,e,b,E));break;case"normal":case"clip":if(Uc.x||Uc.y||b||_||p||g){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Xh.clipMode(w,e,Uc.x,Uc.y,b,E,p,g,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||p||g)&&Xh.repeatMode(w,e,s,n,Uc.x,Uc.y,b,E,p,g,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;c(t)?(o=t.x,r=t.y):o=r=t;return{x:Hc(o,i,n.width,e&&e.x),y:Hc(r,s,n.height,e&&e.y)}}(m,i&&f,Uc.width,Uc.height,e));break;default:b&&Xh.fillOrFitMode(w,e,Uc.x,Uc.y,b,E,p)}return w.transform||(e.x||e.y)&&Fc(w.transform=Ic(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=Xc(),{x:o,y:r}=e;o||r?jc(n,o,r):n.onlyScale=!0,qc(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=Xc();jc(a,e.x+i,e.y+s),qc(a,n,o),r&&Gc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const d=Xc();Qc(d,e,i,s,n,o,r,a),h&&(r||a?(Vc(Yc),Kc(Yc,e,h,l),Zc(d,Yc)):Kc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=Xc();if(c)Qc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Gc(u,{x:i/2,y:s/2},h);else switch(Jc(u,h),h){case 90:jc(u,s,0);break;case 180:jc(u,i,s);break;case 270:jc(u,0,i)}Nc.x=e.x+n,Nc.y=e.y+o,jc(u,Nc.x,Nc.y),r&&Kc(u,Nc,r,a)}t.transform=u}},{toPoint:ru}=St,{hasTransparent:au}=Uh,hu={},lu={};function du(t,e,i,s){if(i){let n,r,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],o(n)?(a=t/(l-1),r=Uh.string(n,s)):(a=n.offset,r=Uh.string(n.color,s)),e.addColorStop(a,r),!h&&au(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:cu,getDistance:uu}=dt,{get:pu,rotateOfOuter:gu,scaleOfOuter:_u}=Q,{toPoint:fu}=St,mu={},yu={};function vu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=cu(e,i);o=pu(),n?(_u(o,e,r/a*(s||1),1),gu(o,e,t+90)):(_u(o,e,1,r/a*(s||1)),gu(o,e,t))}return o}const{getDistance:wu}=dt,{toPoint:xu}=St,bu={},Eu={};const Su={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;ru(i||"top",e,hu),ru(s||"bottom",e,lu);const r=v.canvas.createLinearGradient(hu.x,hu.y,lu.x,lu.y),a={type:n,style:r};return du(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;fu(i||"center",e,mu),fu(s||"bottom",e,yu);const a=v.canvas.createRadialGradient(mu.x,mu.y,0,mu.x,mu.y,uu(mu,yu)),h={type:n,style:a};du(h,a,t.stops,o);const l=vu(e,mu,yu,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;xu(i||"center",e,bu),xu(s||"bottom",e,Eu);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,bu.x,bu.y):v.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,wu(bu,Eu)),h={type:n,style:a};du(h,a,t.stops,o);const l=vu(e,bu,Eu,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:vu},{copy:ku,move:Bu,toOffsetOutBounds:Tu}=Xt,{max:Pu,abs:Ru}=Math,Lu={},Cu=new mt,Ou={};function Au(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=Ru(t.spread||0),r=Pu(r,n+o-s),a=Pu(a,n+o+i),h=Pu(h,n+o+s),l=Pu(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function Du(t,e,i){const{shapeBounds:s}=i;let n,o;v.fullImageShadow?(ku(Lu,t.bounds),Bu(Lu,e.x-s.x,e.y-s.y),n=t.bounds,o=Lu):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:Mu}=Xt,Iu={};const Fu=Au;const Wu={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=r.length-1;Tu(h,Ou,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Ou.offsetX+(r.x||0)*c*f,Ou.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Uh.string(r.color)),n=Gh.getShadowTransform(t,p,i,r,Ou,f),n&&p.setTransform(n),Du(p,Ou,i),n&&p.resetTransform(),s=l,r.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,o,"copy"),s=o),a?p.copyWorld(a,o,o,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),or.copyCanvasByWorld(t,e,p,s,r.blendMode),g&&_<g&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=r.length-1;Mu(h,Iu,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Iu.offsetX+(r.x||0)*c*f,Iu.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=Gh.getShadowTransform(t,p,i,r,Iu,f,!0),n&&p.setTransform(n),Du(p,Iu,i),p.restore(),a?(p.copyWorld(p,l,o,"copy"),p.copyWorld(a,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,Uh.string(r.color),"source-in"),or.copyCanvasByWorld(t,e,p,s,r.blendMode),g&&_<g&&p.clearWorld(s)}),p.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:Au,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Cu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Cu}},isTransformShadow(t){},getInnerShadowSpread:Fu},{excludeRenderBounds:zu}=pr;let Uu;function Hu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Uu||(Uu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);Yu(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Yu(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Nu(t){return t.getSameCanvas(!1,!0)}function Yu(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(Hu(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||zu(i,e)||i.__render(t,e),o=i.__.opacity,Uu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Nu(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Nu(t)),n||(n=Nu(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&Hu(this,r,t,n,s,o,void 0,!1),zu(i,e)||i.__render(n||t,e),d&&Hu(this,r,t,n,s,o,d,!1)}Hu(this,r,t,n,s,o,void 0,!0)};const Xu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Vu=Xu+"_#~&*+\\=|≮≯≈≠=…",Gu=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 ju(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ku=ju("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Zu=ju("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),qu=ju(Xu),Ju=ju(Vu),$u=ju("- —/~|┆·");var Qu;!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"}(Qu||(Qu={}));const{Letter:tp,Single:ep,Before:ip,After:sp,Symbol:np,Break:op}=Qu;function rp(t){return Ku[t]?tp:$u[t]?op:Zu[t]?ip:qu[t]?sp:Ju[t]?np:Gu.test(t)?ep:tp}const ap={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function hp(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:lp}=ap,{Letter:dp,Single:cp,Before:up,After:pp,Symbol:gp,Break:_p}=Qu;let fp,mp,yp,vp,wp,xp,bp,Ep,Sp,kp,Bp,Tp,Pp,Rp,Lp,Cp,Op,Ap=[];function Dp(t,e){Sp&&!Ep&&(Ep=Sp),fp.data.push({char:t,width:e}),yp+=e}function Mp(){vp+=yp,fp.width=yp,mp.words.push(fp),fp={data:[]},yp=0}function Ip(){Rp&&(Lp.paraNumber++,mp.paraStart=!0,Rp=!1),Sp&&(mp.startCharSize=Ep,mp.endCharSize=Sp,Ep=0),mp.width=vp,Cp.width?lp(mp):Op&&Fp(),Ap.push(mp),mp={words:[]},vp=0}function Fp(){vp>(Lp.maxWidth||0)&&(Lp.maxWidth=vp)}const{top:Wp,right:zp,bottom:Up,left:Hp}=t.Direction4;function Np(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 Yp={getDrawData:function(t,e){o(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[Hp],n-=a[zp]+a[Hp],!n&&(n=.01)):e.autoSizeAlign||(i=a[Hp]),r?(s=a[Wp],r-=a[Wp]+a[Up],!r&&(r=.01)):e.autoSizeAlign||(s=a[Wp]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){Lp=t,Ap=t.rows,Cp=t.bounds,Op=!Cp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=v,{width:a}=Cp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Rp=!0,Bp=null,Ep=bp=Sp=yp=vp=0,fp={data:[]},mp={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)xp=e[i],"\n"===xp?(yp&&Mp(),mp.paraEnd=!0,Ip(),Rp=!0):(kp=rp(xp),kp===dp&&"none"!==o&&(xp=hp(xp,o,!yp)),bp=r.measureText(xp).width,s&&(s<0&&(Sp=bp),bp+=s),Tp=kp===cp&&(Bp===cp||Bp===dp)||Bp===cp&&kp!==pp,Pp=!(kp!==up&&kp!==cp||Bp!==gp&&Bp!==pp),wp=Rp&&n?a-n:a,t&&a&&vp+yp+bp>wp&&(h?(yp&&Mp(),vp&&Ip()):(Pp||(Pp=kp===dp&&Bp==pp),Tp||Pp||kp===_p||kp===up||kp===cp||yp+bp>wp?(yp&&Mp(),vp&&Ip()):vp&&Ip()))," "===xp&&!0!==Rp&&vp+yp===0||(kp===_p?(" "===xp&&yp&&Mp(),Dp(xp,bp),Mp()):Tp||Pp?(yp&&Mp(),Dp(xp,bp)):Dp(xp,bp)),Bp=kp);yp&&Mp(),vp&&Ip(),Ap.length>0&&(Ap[Ap.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Lp.paraNumber++,vp=r.measureText(t).width,Ap.push({x:n||0,text:t,width:vp,paraStart:!0}),Op&&Fp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Np(e,"x",t[Hp]);break;case"right":Np(e,"x",-t[zp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Np(e,"y",t[Wp]);break;case"bottom":Np(e,"y",-t[Up])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:g,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,g,_,f,m,y,v;s.forEach(t=>{t.words&&(g=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-g,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(t.x+=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===_?(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&&p),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:o}=t;let{textOverflow:r}=e;if(n.splice(o),r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?v.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?n:[n[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,c(o)?(i=o.type,o.color&&(t.decorationColor=Uh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(h,e),h}};const Xp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(o(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const r=t.r+","+t.g+","+t.b;return 1===n?"rgb("+r+")":"rgba("+r+","+n+")"}};function Vp(t){return t?d(t)?t:[t]:[]}Object.assign(zh,Yp),Object.assign(Uh,Xp),Object.assign(Yh,Bc),Object.assign(Xh,ou),Object.assign(Vh,Su),Object.assign(Gh,Wu),Object.assign(ae,{interaction:(t,e,i,s)=>new jd(t,e,i,s),hitCanvas:(t,e)=>new _h(t,e),hitCanvasManager:()=>new Zd}),mh();class Gp extends Or{get list(){return Vp(this.value)}get oldList(){return Vp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function jp(t){return(e,i)=>{const s="_"+i;no(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?Gp.BEFORE_SELECT:Gp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Gp(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Gp.BEFORE_SELECT="editor.before_select",Gp.SELECT="editor.select",Gp.AFTER_SELECT="editor.after_select",Gp.BEFORE_HOVER="editor.before_hover",Gp.HOVER="editor.hover";const{abs:Kp}=Math,{copy:Zp,scale:qp}=Q,{setListWithFn:Jp}=Xt,{worldBounds:$p}=pr,Qp={a:1,b:0,c:0,d:1,e:0,f:0},tg={x:0,y:0,width:0,height:0};class eg extends t.UI{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?(Jp(tg,e,$p),t&&this.set(t),this.set(tg),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Kp(c.scaleX),l=Kp(c.scaleY);if(Zp(Qp,c),Qp.half=a%2,i!==l){qp(Qp,1/i,1/l),t.setWorld(Qp,e.matrix),t.beginPath(),n.strokeWidth=a;const{x:o,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,r*l,h*i,d*l)}else t.setWorld(Qp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Kp(c.scaleX);r&&(o(r)?Yh.stroke(r,this,t,e):Yh.strokes(r,this,t,e)),h&&(o(h)?Yh.fill(h,this,t,e):Yh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}_e([jp(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],eg.prototype,"target",void 0);class ig extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 sg={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return ng([t],i,e),i}};function ng(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&ng(s.children,e,i)}}const{findOne:og,findByBounds:rg}=sg;class ag extends t.Group{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 eg,this.targetStroker=new eg,this.bounds=new Kt,this.selectArea=new ig,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:o,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:n,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new ph(rg(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)&&!og(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new ph(this.editor.editBox.rect)};return og(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):og(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:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[Gp.HOVER,this.onHover,this],[Gp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.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:lg,topRight:dg,right:cg,bottomRight:ug,bottom:pg,bottomLeft:gg,left:_g}=t.Direction9,{toPoint:fg}=St,{within:mg,sign:yg}=W,{abs:vg}=Math,wg={getScaleData(t,e,i,s,n,o,r,h){let l,d,c={},u=1,p=1;const{boxBounds:g,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,E=yg(x),S=yg(b),k=h?x:E*g.width/v,B=h?b:S*g.height/w;if(a(s))u=p=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=h?x:E,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case lg:p=t,l="bottom";break;case cg:u=e,l="left";break;case pg:p=r,l="top";break;case _g:u=a,l="right";break;case hg:p=t,u=a,l="bottom-right";break;case dg:p=t,u=e,l="bottom-left";break;case ug:p=r,u=e,l="top-left";break;case gg:p=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case lg:case pg:u=p;break;case _g:case cg:p=u;break;default:d=Math.sqrt(vg(u*p)),u=yg(u)*d,p=yg(p)*d}}const T=1!==u,P=1!==p;if(T&&(u/=k),P&&(p/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),p<0&&(p=1/g.height/e.scaleY)}if(fg(o||l,g,c,!0),m){const e={x:u,y:p};kd.limitScaleOf(t,c,e,n),u=e.x,p=e.y}if(T&&_){const e=g.width*t.scaleX;u=mg(e*u,_)/e}if(P&&f){const e=g.height*t.scaleY;p=mg(e*p,f)/e}return T&&vg(u*y.width)<1&&(u=yg(u)/y.width),P&&vg(p*y.height)<1&&(p=yg(p)/y.height),n&&u!==p&&(d=Math.min(vg(u),vg(p)),u=yg(u)*d,p=yg(p)*d),isFinite(u)||(u=1),isFinite(p)||(p=1),{origin:c,scaleX:u,scaleY:p,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case hg:o="bottom-right";break;case dg:o="bottom-left";break;case ug:o="top-left";break;case gg:o="top-right";break;default:o="center"}return fg(n||o,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case lg:case hg:o={x:.5,y:0},n="bottom",a=1;break;case pg:case ug:o={x:.5,y:1},n="top",a=1;break;case _g:case gg:o={x:0,y:.5},n="right",h=1;break;case cg:case dg:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,fg(s||n,t,r,!0);const c=dt.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case _g:t=cg;break;case hg:t=dg;break;case gg:t=ug;break;case cg:t=_g;break;case dg:t=hg;break;case ug:t=gg}if(i)switch(t){case lg:t=pg;break;case hg:t=gg;break;case dg:t=ug;break;case pg:t=lg;break;case gg:t=hg;break;case ug:t=dg}return t}},xg={};function bg(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return Eg(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,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)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?p:o?c:u:v?p:y?c:u;h+=45*(wg.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(W.formatRotation(h,!0)/2);const{url:x,x:b,y:E}=w,S=x+h;xg[S]?i.cursor=xg[S]:xg[S]=i.cursor={url:Sg(x,h),x:b,y:E}}function Eg(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Sg(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class kg extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const Bg=["top","right","bottom","left"],Tg=void 0;class Pg extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return o(t)||o(e)||o(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(e){super(),this.view=new t.Group,this.rect=new kg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new kg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new kg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new kg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new kg({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),p=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=r[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},p[(t-1)/2%p.length]||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:Tg},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),Eg(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:p,rotateable:g,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Xt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=a(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,E,S={};for(let i=0;i<8;i++)St.toPoint(St.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!p&&!g),v.visible=y&&g&&p&&!x,i%2&&(E=d[(i-1)/2],E.set(S),E.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(E.width=e+E.height,_&&2*w.width>e&&(w.visible=!1)):(E.width=c+E.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&g&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=Bg.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=Bg.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?wg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:Tg};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return d(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return d(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return d(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:o,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(o&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}bg(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&&(Xr.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(e){this.canDragLimitAnimate&&(e instanceof t.DragEvent||e instanceof t.MoveEvent)&&this.transformTool.onMove(e),this.resizing&&(Xr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(e){if(this.canGesture&&"drag"!==e.moveType&&(e.stop(),o(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,e.type){case t.MoveEvent.START:this.onTransformStart(e);break;case t.MoveEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onMove(e)}}onScale(e){if(this.canGesture&&(e.stop(),o(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onScale(e)}}onRotate(e){if(this.canGesture&&(e.stop(),o(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onRotate(e)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){bg(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(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i,this.__eventIds.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,t=>{this.enterPoint=e,bg(this,t)}],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[[t.MoveEvent.START,t.MoveEvent.BEFORE_MOVE,t.MoveEvent.END],this.onMove,this,!0],[[t.ZoomEvent.START,t.ZoomEvent.BEFORE_ZOOM,t.ZoomEvent.END],this.onScale,this,!0],[[t.RotateEvent.START,t.RotateEvent.BEFORE_ROTATE,t.RotateEvent.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Rg={x:0,y:0,width:1e5,height:1e5};class Lg extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Rg),Object.assign(this.__world,Rg)}__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 Cg='\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"/>',Og={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${Cg}\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${Cg}\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${Cg}\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},Ag=new Kt;function Dg(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Ag.setListWithFn(i,t=>t.getBounds("box","page")),0===Ag.width&&(Ag.width=.1),0===Ag.height&&(Ag.height=.1),e.reset(Ag.get())}),s.add(e)}const Mg=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Ig=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Fg={group(e,i,s){e.sort(Ig);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(Mg);const a=new mt(i.worldTransform);return a.divideParent(o.scrollWorldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(r)),n.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(Mg),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Ig),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Wg=Qt.get("EditToolCreator");function zg(){return t=>{Hg.register(t)}}const Ug=zg,Hg={list:{},register(t){const{tag:e}=t.prototype;Ng[e]&&Wg.repeat(e),Ng[e]=t},get:(t,e)=>new Ng[t](e)},{list:Ng}=Hg;class Yg extends Gp{constructor(t,e){super(t,e)}}Yg.BEFORE_OPEN="innerEditor.before_open",Yg.OPEN="innerEditor.open",Yg.BEFORE_CLOSE="innerEditor.before_close",Yg.CLOSE="innerEditor.close";class Xg extends Gp{constructor(t,e){super(t,e)}}Xg.BEFORE_GROUP="editor.before_group",Xg.GROUP="editor.group",Xg.BEFORE_UNGROUP="editor.before_ungroup",Xg.UNGROUP="editor.ungroup",Xg.BEFORE_OPEN="editor.before_open_group",Xg.OPEN="editor.open_group",Xg.BEFORE_CLOSE="editor.before_close_group",Xg.CLOSE="editor.close_group";const{updateMatrix:Vg}=or,Gg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},jg="top-left";class Kg extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Mr.CHANGE,e=>{if(this.checkChange&&Gg[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,Vg(this.parent),Vg(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Vg(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(jg,o);break;case"scaleX":t.scaleOf(jg,o,1);break;case"scaleY":t.scaleOf(jg,1,o);break;case"skewX":t.skewOf(jg,o,0);break;case"skewY":t.skewOf(jg,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Zg extends Gp{constructor(t,e){super(t,e)}}Zg.BEFORE_MOVE="editor.before_move",Zg.MOVE="editor.move";class qg extends Gp{constructor(t,e){super(t,e)}}qg.BEFORE_SCALE="editor.before_scale",qg.SCALE="editor.scale";class Jg extends Gp{constructor(t,e){super(t,e)}}Jg.BEFORE_ROTATE="editor.before_rotate",Jg.ROTATE="editor.rotate";class $g extends Gp{constructor(t,e){super(t,e)}}$g.BEFORE_SKEW="editor.before_skew",$g.SKEW="editor.skew";class Qg{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let r,{dragLimitAnimate:h}=s;const l=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,d=o(i.draggable),c=!h||l||d,u={x:e.totalX,y:e.totalY};e instanceof t.MoveEvent&&dt.move(u,i.getWorldPointByLocal(n.totalOffset,null,!0)),e.shiftKey&&(Math.abs(u.x)>Math.abs(u.y)?u.y=0:u.x=0),r=t.DragEvent.getValidMove(i,n.point,u,c),(r.x||r.y)&&(h&&!d&&l?or.animateMove(this,r,a(h)?h:.3):this.move(r))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:o}=this.editBox;let r,{around:a,lockRatio:h,flipable:l,editSize:d}=s;e instanceof t.ZoomEvent?(a=i.getBoxPoint(e),r=e.totalScale):r=e.getInnerTotal(i);const{direction:c}=e.current;(e.shiftKey||i.lockRatio)&&(h=!0);const u=wg.getScaleData(i,o.bounds,c,r,h,wg.getAround(a,e.altKey),l,!n||"scale"===d),p=i.x,g=i.y;e instanceof t.DragEvent&&this.editTool&&this.editTool.onScaleWithDrag?(u.drag=e,this.scaleWithDrag(u)):this.scaleOf(u.origin,u.scaleX,u.scaleY),dt.move(o.totalOffset,i.x-p,i.y-g)}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:o,rotateAround:r,rotateGap:a,diagonalRotateKey:h}=s,{direction:l}=e.current;let d,c;if(e instanceof t.RotateEvent)c=e.rotation,d=r?St.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=h?e.isHoldKeys(h):e.shiftKey,s=wg.getRotateData(i,l,e,n,t?null:r||i.around||i.origin||o||"center");c=n.rotation+s.rotation-i.rotation,d=s.origin}if(c=W.float(W.getGapRotation(c,a,i.rotation),2),!c)return;const u=i.x,p=i.y;this.rotateOf(d,c),dt.move(n.totalOffset,i.x-u,i.y-p)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=wg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),wg.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(c(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new Zg(Zg.BEFORE_MOVE,h));const l=new Zg(Zg.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new qg(qg.BEFORE_SCALE,t));const o=new qg(qg.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(c(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new qg(qg.BEFORE_SCALE,u));const p=new qg(qg.SCALE,u);this.doScale(p),this.emitEvent(p)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new mt(or.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new qg(qg.BEFORE_SCALE,r));const a=new qg(qg.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(a(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Jg(Jg.BEFORE_ROTATE,d));const c=new Jg(Jg.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(c(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new $g($g.BEFORE_SKEW,u));const p=new $g($g.SKEW,u);this.doSkew(p),this.emitEvent(p)}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(or.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{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 ph,this.openedGroupList=new ph,this.simulateTarget=new Kg(this),this.editBox=new Pg(this),this.editToolList={},this.selector=new ag(this),this.editMask=new Lg(this),this.targetEventIds=[];let i=g.clone(Og);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),re.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}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&&Dg(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||Hg.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(o(s))e=s;else if(!1===s)return}if(Hg.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(Xg.BEFORE_GROUP),this.target=Fg.group(this.list,this.element,t),this.emitGroupEvent(Xg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xg.BEFORE_UNGROUP,t)),this.target=Fg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Xg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Xg.OPEN,t)}closeGroup(t){this.emitGroupEvent(Xg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Xg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!or.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 Xg(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||Hg.get(t,this)}openInnerEditor(t,e,i){let s;if(o(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(o(i))s=i;else if(!1===i)return}Hg.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Yg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Yg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Yg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Yg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Yg(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&&(Fg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Fg.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(jr.START,this.onRenderStart,this),i&&i.on_(Mr.SCROLL,this.onChildScroll,this),t.on_(jr.CHILD_START,this.onAppRenderStart,this),t.on_(Kr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},_e([(t,e)=>{no(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:o,app:r}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return o.config&&Object.assign(a,o.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),n(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],t.Editor.prototype,"mergeConfig",void 0),_e([jp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof ph?i:new ph(i),t.multiple&&Dg(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Gp(Gp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Gp(Gp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),_e([jp(function(t,e){t.emitEvent(new Gp(Gp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),t.Editor=_e([Vo(Qg,["editBox","editTool","emitEvent"])],t.Editor);class t_{static registerInnerEditor(){Hg.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 t.Group,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)}}t.EditTool=class extends t_{static registerEditTool(){Hg.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=_e([zg()],t.EditTool);const{left:e_,right:i_}=t.Direction9,{move:s_,copy:n_,toNumberPoints:o_}=dt;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===e_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=o_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(s_(t,o,r),s&&s_(e,-o,-r)):(s&&s_(t,-o,-r),s_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),n_(s[7],i),n_(e[7],i),n_(s[3],a),n_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===e_||t===i_,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=_e([zg()],t.LineEditTool);const{M:r_,L:a_,C:h_,Q:l_,Z:d_,N:c_,D:u_,X:p_,G:g_,F:__,O:f_,P:m_,U:y_}=Ae,v_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case r_:case a_:w_(t,e,i,n,1),n+=3;break;case h_:w_(t,e,i,n,3),n+=7;break;case l_:w_(t,e,i,n,2),n+=5;break;case d_:n+=1;break;case c_:w_(t,e,i,n,2),n+=5;break;case u_:w_(t,e,i,n,2),n+=9;break;case p_:w_(t,e,i,n,2),n+=6;break;case g_:w_(t,e,i,n,2),n+=9;break;case __:w_(t,e,i,n,2),n+=5;break;case f_:t[n]=g_,t.splice(n+4,0,t[n+3],0),w_(t,e,i,n,2),n+=9,o+=2;break;case m_:t[n]=__,t.splice(n+4,0,t[n+3]),w_(t,e,i,n,2),n+=5,o+=1;break;case y_:w_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:w_}=v_,x_=Q.get(),{topLeft:b_,top:E_,topRight:S_,right:k_,bottom:B_,left:T_}=t.Direction9;function P_(t,e,i){t.pathInputed?L_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function R_(t,e,i,n){let o=e;if(!s(n)){const s=t.__layout;let{width:r,height:a}=s.boxBounds;switch(r*=i-e,a*=e-i,n){case E_:case B_:o=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case T_:case k_:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case b_:case S_:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=d(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function L_(t,e,i){v_.scale(t.__.path,e,i),t.path=t.__.path}function C_(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):v_.scalePoints(s,e,i),t.points=s}function O_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)x_.a=e,x_.d=i,s[t].transform(x_,!0)}const A_=t.Leaf.prototype;A_.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))},A_.__scaleResize=function(t,e){P_(this,t,e)},A_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},A_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)R_(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),P_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){L_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?L_(this,t,e):this.points?C_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?L_(this,t,e):this.points?C_(this,t,e):P_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){O_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||P_(this,t,e),i&&O_(this,t,e)},re.add("resize"),re.add("editor","resize"),ae.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,co),t.UI.addAttr("editConfig",void 0,co),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),co),t.UI.addAttr("editInner","PathEditor",co),t.Group.addAttr("editInner","",co),t.Text.addAttr("editInner","TextEditor",co),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const D_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},M_={top:"flex-start",middle:"center",bottom:"flex-end"},I_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function F_(t,e,i){const{style:n}=t,{fill:r,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let p;n.fontFamily=e.fontFamily,n.fontSize=e.fontSize*i+"px",function(t,e){let i="black";d(e)&&(e=e[0]);if(c(e))switch(e.type){case"solid":i=Uh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Uh.string(o(t)?t:t.color);break;default:s(e.r)||(i=Uh.string(e))}else i=e;t.color=i}(n,r),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,c(u)?(p=u.type,u.color&&(n.textDecorationColor=Uh.string(u.color))):p=u,n.textDecoration=I_[p],n.textTransform=D_[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=M_[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}function W_(e,i,s){z_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{or.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function z_(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)}t.TextEditor=class extends t_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:g}=new mt(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||F_(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)}},t.TextEditor=_e([Ug()],t.TextEditor),re.add("text-editor","editor");const U_=Qt.get("LeaferTypeCreator"),H_={list:{},register(t,e){N_[t]&&U_.repeat(t),N_[t]=e},run(t,e){const i=N_[t];i&&i(e)}},{list:N_,register:Y_}=H_;Y_("viewport",W_),Y_("custom",function(t){W_(t,null,!0)}),Y_("design",function(t){W_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Y_("document",function(t){W_(t,{zoom:{min:1},move:{scroll:"limit"}})});const X_={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),n=dt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=dt.getDistance(e.from,i.from);return{move:o,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=V_,s=V_.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),V_.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)?V_.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=V_;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},V_=X_,{abs:G_,max:j_}=Math,{sign:K_,within:Z_}=W,q_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=G_(s),r=G_(n);return o>50&&(s=j_(50,o/3)*K_(s)),r>50&&(n=j_(50,r/3)*K_(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(v.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=Z_(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Z_(1-G_(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let J_,$_,Q_,tf;class ef{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(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),J_=0,$_=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:J_,totalY:$_}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,e.totalX=J_+=e.moveX,e.totalY=$_+=e.moveY,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),Q_=1,this.zoomData=Object.assign(Object.assign({},e),{scale:1,totalScale:Q_}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,e.totalScale=Q_*=e.scale,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),tf=0,this.rotateData=Object.assign(Object.assign({},e),{rotation:0,totalRotation:tf}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,e.totalRotation=tf+=e.rotation,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,Object.assign(Object.assign({},i),{totalX:J_,totalY:$_})),s&&e.emit(t.ZoomEvent.END,Object.assign(Object.assign({},s),{totalScale:Q_})),n&&e.emit(t.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:tf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const sf=t.Leafer.prototype,nf=new Kt,of=new _t;function rf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function af(t,e){return Object.assign(Object.assign({},e),{scale:t})}sf.initType=function(t){H_.run(t,this)},sf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(of.set(t,e),s){const t=!0===s?"":s;t.includes("x")?of.y=0:t.includes("y")?of.x=0:Math.abs(of.x)>Math.abs(of.y)?of.y=0:of.x=0,i&&t.includes("limit")&&(nf.set(this.__world).addPoint(this.zoomLayer),kd.getValidMove(nf,this.canvas.bounds,"inner",of,!0),t.includes("x")?of.y=0:t.includes("y")&&(of.x=0))}return{x:n?0:of.x,y:n?0:of.y}},sf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const hf=jd.prototype;hf.createTransformer=function(){this.transformer=new ef(this)},hf.move=function(t){this.transformer.move(t)},hf.zoom=function(t){this.transformer.zoom(t)},hf.rotate=function(t){this.transformer.rotate(t)},hf.transformEnd=function(){this.transformer.transformEnd()},hf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):q_.getScale(t,e);if(1!==o)this.zoom(af(o,t));else{const s=e.getMove?e.getMove(t,e):q_.getMove(t,e);i.snap&&dt.round(s),this.move(rf(s,t))}},hf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=X_.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(X_.detect(n,c(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}X_.reset()}o||(n.center=X_.state.center)}else o=r=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(af(n.scale,t)),o&&this.move(rf(n.move,t))};const lf=Fd.prototype,{abs:df}=Math;function cf(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}lf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=df(i),o=df(s),r=e?1:.1,h=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(h){const r="touch"===t.pointerType?3:1,l=70;n*(e=e?a(h)?h:.95:r)>l?e=l/n:o*e>l&&(e=l/o),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},lf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},lf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},lf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Xt.maxX(r),d=Xt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},lf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},re.add("viewport"),re.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let r;this.killAnimate(),u(e)?(r=e.padding,i=e.scroll,s=e.transition):r=e;const{zoomLayer:h}=this,l=this.canvas.bounds.clone().shrink(n(r)?30:r),p=new Kt,g={x:l.x+l.width/2,y:l.y+l.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(o(t))switch(t){case"in":_=cf(y,"in");break;case"out":_=cf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Kt(this.boxBounds)).height=0;break;case"fit-height":(t=new Kt(this.boxBounds)).width=0}else a(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(g,_,_,!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];p.setListWithFn(e,pr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,l);p.set(h.getWorldBounds(e))}const{width:o,height:r}=p;let a=l.x-p.x,c=l.y-p.y;return i?(a+=Math.max((l.width-o)/2,0),c+=Math.max((l.height-r)/2,0)):(_=this.getValidScale(Math.min(l.width/o,l.height/r)),a+=(l.width-o*_)/2,c+=(l.height-r*_)/2,dt.scaleOf(e,p,_),p.scaleOf(p,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(a=0),dt.move(e,a,c),p.move(a,c),h.set(e,s),p}return h.worldBoxBounds};class uf extends t.Group{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(e){let i;o(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Kt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.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}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(jr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Xr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class pf extends yl{setText(t){this._text=t,this.__htmlChanged=!0}}const gf={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:"≥"};t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const o=t.indexOf(";",n+1);if(o>n+1&&(e=t.slice(n+1,o),i=gf[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){o(t)?gf[t]=e:Object.assign(gf,t)}},_e([Fo(pf)],t.HTMLText.prototype,"__",void 0),_e([mo("")],t.HTMLText.prototype,"text",void 0),_e([co("TextEditor")],t.HTMLText.prototype,"editInner",void 0),_e([Bo(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=_e([Go()],t.HTMLText),re.add("html");class _f extends ll{}function ff(t){return ao(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Eo(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Nh.register(t,e)}},_e([Fo(_f)],t.Arrow.prototype,"__",void 0),_e([ff("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=_e([Go()],t.Arrow);const{M:mf,L:yf,C:vf,Q:wf,O:xf}=Ae,{rotate:bf,copyFrom:Ef,scale:Sf}=dt,kf={},Bf={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case mf:case yf:Tf(t,l+1,e,i,s,n,o,r),l+=3;break;case vf:for(h=1;h<6;h+=2)Tf(t,l+h,e,i,s,n,o,r);l+=7;break;case wf:for(h=1;h<4;h+=2)Tf(t,l+h,e,i,s,n,o,r);l+=5;break;case xf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){Bf.layout(t,0,0,1,1,e,i)}};function Tf(t,e,i,s,n,o,r,a){Ef(kf,t[e],t[e+1]),r&&bf(kf,r,a),n&&Sf(kf,n,o),t[e]=i+kf.x,t[e+1]=s+kf.y}const{layout:Pf,rotate:Rf}=Bf,{getAngle:Lf}=dt,Cf={x:-.5},Of={connect:Cf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Af={connect:Cf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Df={connect:Cf,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]},Mf={connect:Cf,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]},If={offset:Cf,path:[...Df.path],dashPath:[1,-2.5,0,2,-1,0]};Rf(If.path,180,{x:-1.5,y:0});const Ff={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Wf={connect:{x:.5},path:[...Ff.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},zf={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]},Uf={path:[...zf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Hf=g.clone(zf),Nf=g.clone(Uf);Rf(Hf.path,45),Rf(Nf.path,45);const Yf={angle:Of,"angle-side":Af,arrow:Mf,triangle:Df,"triangle-flip":If,circle:Wf,"circle-line":Ff,square:Uf,"square-line":zf,diamond:Nf,"diamond-line":Hf,mark:{offset:Cf,path:[1,0,-2,2,0,2]}};function Xf(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Yf[e.type]):a=e:a=Yf[e];const{offset:u,connect:p,path:g,dashPath:_}=a;let f=p?p.x:0,m=u?u.x:0;const y=[...g];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&Pf(y,0,0,h,h),m&&Pf(y,m,0),Pf(y,s.x,s.y,n,n,Lf(i,s)),o.x=(f+m)*n,y}const{M:Vf,L:Gf,C:jf,Q:Kf,Z:Zf,N:qf,D:Jf,X:$f,G:Qf,F:tm,O:em,P:im,U:sm}=Ae,{copy:nm,copyFrom:om,getDistancePoint:rm}=dt,am={},hm={},lm={},dm={},cm={},um={list:Yf,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case Vf:case Gf:(c<2||l+6>=d)&&(om(cm,o[l+1],o[l+2]),!c&&u&&nm(hm,cm)),l+=3;break;case jf:(1===c||l+7>=d-3)&&pm(o,dm,cm,l+3),l+=7;break;case Kf:(1===c||l+5>=d-3)&&pm(o,dm,cm,l+1),l+=5;break;case Zf:return;case qf:l+=5;break;case Jf:l+=9;break;case $f:l+=6;break;case Qf:l+=9;break;case tm:l+=5;break;case em:l+=7;break;case im:l+=4;break;case sm:(1===c||l+6>=d-3)&&(pm(o,dm,cm,l+1),l+6!==d&&(cm.x-=(cm.x-dm.x)/10,cm.y-=(cm.y-dm.y)/10)),l+=6}if(c++,1===c&&h!==Vf)return;if(2===c&&u&&nm(lm,h===Gf?cm:dm),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Xf(t,e,lm,hm,s,am,!!n);n?d.push(...i):r.push(...i),am.x&&(rm(hm,lm,-am.x,!0),r[1]=lm.x,r[2]=lm.y)}if(i&&"none"!==i){const e=Xf(t,i,dm,cm,s,am,!!n);if(n?d.push(...e):r.push(...e),am.x){let t;switch(rm(cm,dm,-am.x,!0),h){case Gf:t=l-3+1;break;case jf:t=l-7+5;break;case Kf:t=l-5+3;break;case sm:t=l-6+3}t&&gm(r,dm,t)}}}else nm(dm,cm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function pm(t,e,i,s){om(e,t[s],t[s+1]),om(i,t[s+2],t[s+3])}function gm(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),t.UI.addAttr("startArrow","none",ff),t.UI.addAttr("endArrow","none",ff),Object.assign(Nh,um),Object.assign(Yh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},_e([Fo(class extends rl{})],t.Flow.prototype,"__",void 0),_e([go("x")],t.Flow.prototype,"flow",void 0),t.Flow=_e([Go()],t.Flow);const _m={},fm={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},mm={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function ym(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Tt.toPoint(i,e,n,_m),e.x=s.__autoWidth?n.x:_m.x,e.y=s.__autoHeight?n.y:_m.y}const{move:vm}=dt;function wm(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),vm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function xm(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const bm={};function Em(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:r,__autoHeight:a}=t.__,h=n&&(e?!r:!a);return c(i)?(bm.xGap=i.x||0,bm.yGap=i.y||0):bm.xGap=bm.yGap=l(i),bm.isAutoXGap=o(bm.xGap)&&!r,bm.isAutoYGap=o(bm.yGap)&&!a,bm.complex=h||"top-left"!==s||t.__hasGrow||bm.isAutoXGap||bm.isAutoYGap,bm.wrap=h,bm.complex&&(bm.isFitXGap="fit"===bm.xGap&&!r,bm.isFitYGap="fit"===bm.yGap&&!a,c(s)?(bm.contentAlign=s.content||"top-left",bm.rowXAlign=s.x||"from",bm.rowYAlign=s.y||"from"):(bm.contentAlign=s,bm.rowXAlign=fm[s],bm.rowYAlign=mm[s])),bm}function Sm(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function km(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function Bm(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Tm}=W;function Pm(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Rm(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Rm(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Rm(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Tm(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:Lm}=W;function Cm(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Om(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Om(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Om(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?Lm(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Am}=dt;function Dm(t,e){const i="width",{children:s,itemBox:n}=t,o=Em(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:h;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Bm(g,n),r?(g.__flowBounds=_,y||(y=Sm(m,p)),a&&y.count&&y.width+_.width>x&&(y.grow?Pm(t,y,x,e):d&&km(y,i,x,c),xm(u,y,i),y=Sm(m,p)),f=_.width,g.__widthGrow&&(y.grow+=g.__widthGrow,f=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&Om(g,_,b),y.width+=y.count?f+p:f,y.height=Math.max(y.height,_.height),y.count++):(Am(g,v-_.x,w-_.y),v+=_.width+p));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:p}=o;y.count&&(y.grow?Pm(t,y,x,e):d&&km(y,i,x,c),a&&xm(u,y,i)),a?(s?km(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){ym(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=fm[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],wm(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(ym(t,y,r),wm(t,y,0,y.y,p,e))}}const{move:Mm}=dt;function Im(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Mm(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Fm}=dt;function Wm(t,e){const i="height",{children:s,itemBox:n}=t,o=Em(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:l;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Bm(g,n),r?(g.__flowBounds=_,y||(y=Sm(m,p)),a&&y.count&&y.height+_.height>b&&(y.grow&&Cm(t,y,b,e),d&&km(y,i,b,c),xm(u,y,i),y=Sm(m,p)),f=_.height,g.__heightGrow&&(y.grow+=g.__heightGrow,f=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&Rm(g,_,x),y.height+=y.count?f+p:f,y.width=Math.max(y.width,_.width),y.count++):(Fm(g,v-_.x,w-_.y),w+=_.height+p));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:p}=o;y.count&&(y.grow&&Cm(t,y,b,e),d&&km(y,i,b,c),a&&xm(u,y,i)),a?(s?km(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){ym(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=mm[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,p),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Im(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(ym(t,y,r),Im(t,y,y.x,0,l,e))}}function zm(t){return ao(t,t=>({set(e){const i=a(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&vo(this)}}))}re.add("flow","resize");const Um=t.Box.prototype,{__updateBoxBounds:Hm}=t.Group.prototype;t.UI.addAttr("flow",!1,go),t.UI.addAttr("gap",0,mo),t.UI.addAttr("flowAlign","top-left",mo),t.UI.addAttr("flowWrap",!1,mo),t.UI.addAttr("itemBox","box",mo),t.UI.addAttr("inFlow",!0,mo),t.UI.addAttr("autoWidth",void 0,zm),t.UI.addAttr("autoHeight",void 0,zm),t.UI.addAttr("autoBox",void 0,mo);const{copyAndSpread:Nm}=Xt;Um.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Dm(this);break;case"y":Wm(this);break;case"x-reverse":Dm(this,!0);break;case"y-reverse":Wm(this,!0)}t&&(this.leafer.created=!0)},Um.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Nm(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Um.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Hm.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Nm(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Ym,sin:Xm,pow:Vm,sqrt:Gm,abs:jm,ceil:Km,floor:Zm,round:qm,PI:Jm}=Math,$m=5*Jm,Qm=1.70158,ty=2.5949095,ey=7.5625,iy=2.75;function sy(t){return e=>Vm(e,t)}function ny(t){return e=>1-Vm(1-e,t)}function oy(t){return e=>e<.5?.5*Vm(2*e,t):1-.5*Vm(2-2*e,t)}function ry(t){return t<1/iy?ey*t*t:t<2/iy?ey*(t-=1.5/iy)*t+.75:t<2.5/iy?ey*(t-=2.25/iy)*t+.9375:ey*(t-=2.625/iy)*t+.984375}function ay(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=hy(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(jm(l)<1e-6));e++)c-=d/l;return n[r]=hy(c,e,s)}}function hy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const ly={get(t){const{list:e}=ly;return o(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){ly.list[t]=e},list:{linear:t=>t,ease:ay(.25,.1,.25,1),"ease-in":ay(.42,0,1,1),"ease-out":ay(0,0,.58,1),"ease-in-out":ay(.42,0,.58,1),"sine-in":t=>1-Ym(t*Jm*.5),"sine-out":t=>Xm(t*Jm*.5),"sine-in-out":t=>.5*(1-Ym(t*Jm)),"quad-in":sy(2),"quad-out":ny(2),"quad-in-out":oy(2),"cubic-in":sy(3),"cubic-out":ny(3),"cubic-in-out":oy(3),"quart-in":sy(4),"quart-out":ny(4),"quart-in-out":oy(4),"quint-in":sy(5),"quint-out":ny(5),"quint-in-out":oy(5),"expo-in":t=>t?Vm(2,10*t-10):0,"expo-out":t=>1===t?1:1-Vm(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Vm(2,2*t*10-10):.5*(2-Vm(2,10-2*t*10)),"circ-in":t=>1-Gm(1-Vm(t,2)),"circ-out":t=>Gm(1-Vm(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Gm(1-Vm(2*t,2))):.5*(Gm(1-Vm(2-2*t,2))+1),"back-in":t=>((Qm+1)*t-Qm)*t*t,"back-out":t=>(t-=1)*t*((Qm+1)*t+Qm)+1,"back-in-out":t=>t<.5?(t*=2)*t*((ty+1)*t-ty)*.5:.5*((t=2*t-2)*t*((ty+1)*t+ty)+2),"elastic-in":t=>0===t||1===t?t:-Vm(2,10*(t-1))*Xm((t-1.1)*$m),"elastic-out":t=>0===t||1===t?t:Vm(2,-10*t)*Xm((t-.1)*$m)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Vm(2,10*((t*=2)-1))*Xm((t-1.1)*$m)*.5:Vm(2,10*(1-(t*=2)))*Xm((t-1.1)*$m)*.5+1,"bounce-in":t=>1-ry(1-t),"bounce-out":ry,"bounce-in-out":t=>t<.5?.5*(1-ry(1-2*t)):.5*(1+ry(2*t-1)),"cubic-bezier":ay,steps:function(t,e="floor"){return i=>("floor"===e?Zm(i*t):"ceil"===e?Km(i*t):qm(i*t))/t}}};function dy(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class cy{}cy.CREATED="created",cy.PLAY="play",cy.PAUSE="pause",cy.STOP="stop",cy.SEEK="seek",cy.UPDATE="update",cy.COMPLETED="completed";t.Animate=class extends ea{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&a(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=ly.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(cy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(cy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(cy.STOP))}seek(t){this.destroyed||(c(t)&&(t=Hh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(cy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:n}=this,{length:o}=i,r=!(o>1)||this.join;let h,l,d,c,u,p=0,g=0;o>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<o;n++){if(l=i[n],c=l.style||l,h||(h=r?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=l;o&&(d.swing=a(o)?o:2,u=2*d.swing-1),r&&(d.loop=u=a(r)?r:2),t?(d.duration=t,p+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,g+=e*u),i?(d.delay=i,p+=i*u):s&&(d.autoDelay=s,g+=s*u),n&&(d.easingFn=ly.get(n))}if(!d.autoDuration&&s(d.duration)&&(o>1?n>0||r?g+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}g?((this.duration<=p||!n||!n.duration)&&this.changeDuration(p+.2*g),this.allocateTime((this.duration-p)/g)):p&&this.changeDuration(p),this.emitType(cy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:n,toStyle:o,target:r}=this;for(let a in e)s(n[a])&&(n[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=s(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:n}=i;for(let o=0;o<n;o++)e=i[o],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),v.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(cy.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),qh.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(cy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return a(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},_e([dy("ease")],t.Animate.prototype,"easing",void 0),_e([dy(0)],t.Animate.prototype,"delay",void 0),_e([dy(.2)],t.Animate.prototype,"duration",void 0),_e([dy("auto")],t.Animate.prototype,"ending",void 0),_e([dy(!1)],t.Animate.prototype,"reverse",void 0),_e([dy(!1)],t.Animate.prototype,"swing",void 0),_e([dy(!1)],t.Animate.prototype,"loop",void 0),_e([dy(0)],t.Animate.prototype,"loopDelay",void 0),_e([dy(1)],t.Animate.prototype,"speed",void 0),_e([dy(!0)],t.Animate.prototype,"autoplay",void 0),_e([dy()],t.Animate.prototype,"join",void 0),_e([dy()],t.Animate.prototype,"attrs",void 0),t.Animate=_e([Vo(ua)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(cy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(cy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(cy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(cy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case cy.COMPLETED:this.completed&&this.emitType(t);break;case cy.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=_e([Vo(ua)],t.AnimateList);const uy={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},py=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,gy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,_y=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,fy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,my=parseInt,yy=parseFloat,{round:vy}=Math;let wy={},xy=0;function by(t){let e,i,s,n=1;switch(t.length){case 9:e=my(t.slice(1,3),16),i=my(t.slice(3,5),16),s=my(t.slice(5,7),16),n=my(t.slice(7,9),16)/255;break;case 7:e=my(t.slice(1,3),16),i=my(t.slice(3,5),16),s=my(t.slice(5,7),16);break;case 5:e=my(t[1]+t[1],16),i=my(t[2]+t[2],16),s=my(t[3]+t[3],16),n=my(t[4]+t[4],16)/255;break;case 4:e=my(t[1]+t[1],16),i=my(t[2]+t[2],16),s=my(t[3]+t[3],16);break;case 3:e=i=s=my(t[1]+t[2],16);break;case 2:e=i=s=my(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Ey=1/6,Sy=.5,ky=2/3,By=1/3;function Ty(t,e,i){return i<0?i++:i>1&&i--,i<Ey?t+6*(e-t)*i:i<Sy?e:i<ky?t+(e-t)*(ky-i)*6:t}function Py(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Ty(a,s,t+By),o=Ty(a,s,t),r=Ty(a,s,t-By)}return{r:vy(255*n),g:vy(255*o),b:vy(255*r),a:s}}re.add("color"),Uh.object=function(t,e){let i,n=!s(e)&&e<1;if(o(t)){const e=wy[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=by(t);break;case"R":case"r":"("===t[4]&&gy.test(t)?i=function(t){const e=gy.exec(t);return{r:my(e[1]),g:my(e[2]),b:my(e[3]),a:yy(e[4])}}(t):"("===t[3]&&py.test(t)&&(i=function(t){const e=py.exec(t);return{r:my(e[1]),g:my(e[2]),b:my(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&fy.test(t)?i=function(t){const e=fy.exec(t);return Py(yy(e[1]),yy(e[2]),yy(e[3]),yy(e[4]))}(t):"("===t[3]&&_y.test(t)&&(i=function(t){const e=_y.exec(t);return Py(yy(e[1]),yy(e[2]),yy(e[3]),1)}(t))}if(!i){const e=uy[t.toLowerCase()];e&&(i=by("#"+e))}i&&(xy++,xy>1e4&&(wy={},xy=0),wy[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),n&&(i.a*=e),i};const{round:Ry}=Math,{fourNumber:Ly}=W,Cy={fill:Iy,stroke:Iy,cornerRadius:(t,e,i)=>a(t)&&a(e)?Dy(t,e,i):(t=Ly(t),e=Ly(e),t.map((t,s)=>Dy(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,n=e.length,o=Dy(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return a(t)||a(e)?W.float(Dy(t,e,i),Math.max(Ay(t),Ay(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return qh.setBetweenStyle(n,t,e,n,i,s),n},shadow:Fy,innerShadow:Fy},Oy={value:function(t,e,i){const s=a(t),n=a(e);return s&&n?t+(e-t)*i:n||s?Dy(t,e,i):t},number:Dy,color:My,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=qh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function Ay(t){const e=String(t).split(".")[1];return e?e.length:0}function Dy(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Ry(n):n}function My(t,e,i){t=Uh.object(t),e=Uh.object(e);const s=Dy(t.r,e.r,i,1)+","+Dy(t.g,e.g,i,1)+","+Dy(t.b,e.b,i,1),n=Dy(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Iy(t,e,i){return o(t)&&o(e)?My(t,e,i):e}function Fy(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:Dy((t=t||{}).x,e.x,i),y:Dy(t.y,e.y,i),blur:Dy(t.blur,e.blur,i),spread:Dy(t.spread,e.spread,i),color:My(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}re.add("animate","color"),Zh.canAnimate=!0,Object.assign(qh.list,Cy),Object.assign(qh,Oy);const Wy=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,co),t.UI.addAttr("transition",!0,co),t.UI.addAttr("transitionOut",void 0,co),Wy.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Wy.animate=function(e,i,n,o){if(s(e))return this.__animate;let r=d(e)&&!i&&n?new t.AnimateList(this,e,o):new t.Animate(this,e,i,o);this.killAnimate(n,r.toStyle);const a=this.__animate;return a&&(r instanceof t.AnimateList?r.list.unshift(a):r=new t.AnimateList(this,[a,r])),this.__animate=r},Wy.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Wy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(cy.COMPLETED,e)};const zy=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Uy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Hy}=Math,{getDerivative:Ny}=ri,Yy={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,p,g,_=0,f=h/2;for(let h=0;h<zy.length;h++)l=f*(1+zy[h]),d=f*(1-zy[h]),c=Ny(l,t,i,n,r),u=Ny(l,e,s,o,a),p=Ny(d,t,i,n,r),g=Ny(d,e,s,o,a),_+=Uy[h]*(Hy(c*c+u*u)+Hy(p*p+g*g));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Ny(t,e,s,o,a),d=Ny(t,i,n,r,h);return Math.atan2(d,l)/U},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,p=t/e,g=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>g;)Xy(i,s,n,o,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,p=d*n+e*r,g=d*o+e*a,_=d*c+e*p,f=d*u+e*g,m=d*_+e*(d*p+e*(d*r+e*h)),y=d*f+e*(d*g+e*(d*a+e*l));t.push(Ae.C,c,u,_,f,m,y)}},{getDistance:Xy}=Yy,{M:Vy,L:Gy,C:jy,Z:Ky}=Ae,Zy={},qy={},Jy={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Vy:case Gy:Jy.transformPoints(t,e,s,1),s+=3;break;case jy:Jy.transformPoints(t,e,s,3),s+=7;break;case Ky:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Zy.x=t[n],Zy.y=t[n+1],Q.toOuterPoint(e,Zy),t[n]=Zy.x,t[n+1]=Zy.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Vy:case Gy:i=t[a+1],s=t[a+2],e=n===Gy&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case jy:i=t[a+5],s=t[a+6],e=Yy.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Ky:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Hh.number(e,t.total);let o,r,a,h,l,d,c,u,p,g=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Vy:case Gy:if(r=n[f+1],a=n[f+2],o=s[m],g+o>=e||!t.total)return f||(y=r,v=a),qy.x=y,qy.y=v,_.x=r,_.y=a,dt.getDistancePoint(qy,_,e-g,!0),_.rotation=dt.getAngle(qy,_),_;y=r,v=a,f+=3;break;case jy:if(r=n[f+5],a=n[f+6],o=s[m],g+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Yy.getT(e-g,o,y,v,l,d,c,u,r,a,i),ri.getPointAndSet(p,y,v,l,d,c,u,r,a,_),_.rotation=Yy.getRotation(p,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Ky:f+=1;default:o=0}m++,g+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Hh.number(e,t.total);let r,a,h,l,d,c,u,p,g,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case Vy:case Gy:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),qy.x=v,qy.y=w,f.x=a,f.y=h,dt.getDistancePoint(qy,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case jy:if(d=n[m+1],c=n[m+2],u=n[m+3],p=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return g=Yy.getT(e-_,r,v,w,d,c,u,p,a,h,i),Yy.cut(o,g,v,w,d,c,u,p,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,p,a,h);break;case Ky:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function $y(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}re.add("motion-path"),qh.register("motion",function(t,e,i,s){return c(t)&&(t=Hh.number(t,s.getMotionTotal())),c(e)&&(e=Hh.number(e,s.getMotionTotal())),qh.number(t||0,e||0,i)}),qh.register("motionRotation",function(t,e,i){return qh.number(t,e,i)});const Qy=t.UI.prototype,{updateMatrix:tv,updateAllMatrix:ev}=or,{updateBounds:iv}=mr;function sv(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=ov(t);i.total&&(t.__.__pathForRender=Jy.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(ev(t),iv(t,t)):tv(t));i&&(t.leafer.created=!0)}}function nv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function ov(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Jy.getMotionPathData(t.getPath(!0,!0))}function rv(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Zh.setStyleName(this,e,i):Zh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function av(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function hv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function lv(t,e){c(e)||(e=void 0),uv(t,e,"in")}function dv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),uv(t,e,"out"))}t.UI.addAttr("motionPath",void 0,$y),t.UI.addAttr("motionPrecision",1,$y),t.UI.addAttr("motion",void 0,$y),t.UI.addAttr("motionRotation",!0,$y),Qy.getMotionPathData=function(){return ov(nv(this))},Qy.getMotionPoint=function(t){const e=nv(this),i=ov(e);if(!i.total)return{};const s=Jy.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:a(n)&&(s.rotation+=n),s},Qy.getMotionTotal=function(){return this.getMotionPathData().total},Qy.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),sv(t))}else sv(this)};const cv={};function uv(t,e,i){const{normalStyle:s}=t;e||(e=cv),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==cv&&Zh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const r=o?function(t,e){const i=_v(e,t),s=t.animate();s&&_v(i,t,s.fromStyle);return i}(t,e):void 0;Zh.canAnimate&&pv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=pv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=gv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=gv(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function pv(t){let e;const i={},s=hv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Zh.isState(n,t,s)&&(e=fv(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Zh.isSelected(t,s)&&(e=fv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Zh.isPlacehold(t,s)&&(e=fv(i,a)),Zh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=fv(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Zh.isFocus(t,s)&&(e=fv(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Zh.isHover(t,s)&&(e=fv(i,o));const r=i.pressStyle||t.pressStyle;r&&Zh.isPress(t,s)&&(e=fv(i,r))}return e?i:void 0}function gv(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Zh.animateExcludes[t]||(n[t]=e[t]);return n}function _v(t,e,i){return gv(t,e,i,!0)}function fv(t,e){return Object.assign(t,e),!0}function mv(t,e){const i=t[e];i&&lv(t,i),t.button&&vv(t.children,e)}function yv(t,e,i){i||(i=t.states[e]),lv(t,i),t.button&&vv(t.children,null,e)}function vv(t,e,i){if(!t)return;let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],e){switch(o=!0,e){case"hoverStyle":Zh.isHover(n)&&(o=!1);break;case"pressStyle":Zh.isPress(n)&&(o=!1);break;case"focusStyle":Zh.isFocus(n)&&(o=!1)}o&&mv(n,e)}else s(i)||yv(n,i);n.isBranch&&vv(n.children,e,i)}}function wv(t,e){const i=t[e];i&&dv(t,i),t.button&&bv(t.children,e)}function xv(t,e,i){dv(t,i),t.button&&bv(t.children,null,e)}function bv(t,e,i){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?wv(n,e):s(i)||xv(n,i),n.isBranch&&bv(n.children,e,i)}function Ev(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=hv(e,i);o&&(s=n[t](o))}return s}function Sv(t,e,i){let s=e[t];if(!s&&i){const n=hv(e,i);n&&(s=n[t])}return s}re.add("state"),Zh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Zh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=hv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Zh.isSelected=function(t,e){return Sv("selected",t,e)},Zh.isDisabled=function(t,e){return Sv("disabled",t,e)},Zh.isFocus=function(t,e){return Ev("isFocus",t,e)},Zh.isHover=function(t,e){return Ev("isHover",t,e)},Zh.isPress=function(t,e){return Ev("isPress",t,e)},Zh.isPlacehold=function(t,e){return t.__.__isPlacehold},Zh.isDrag=function(t,e){return Ev("isDrag",t,e)},Zh.setStyleName=function(t,e,i){i?yv(t,e,t[e]):xv(t,e,t[e])},Zh.set=function(t,e){const i=t.states[e];i?yv(t,e,i):xv(t,e,i)},Zh.getStyle=pv,Zh.updateStyle=uv,Zh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:mv(e,"hoverStyle");break;case t.PointerEvent.LEAVE:wv(e,"hoverStyle");break;case t.PointerEvent.DOWN:mv(e,"pressStyle");break;case t.PointerEvent.UP:wv(e,"pressStyle")}};const kv=t.UI.prototype;t.UI.addAttr("selected",!1,rv,"selectedStyle"),t.UI.addAttr("disabled",!1,rv,"disabledStyle"),t.UI.addAttr("states",{},av),t.UI.addAttr("state","",rv),t.UI.addAttr("normalStyle",void 0,co),t.UI.addAttr("hoverStyle",void 0,av),t.UI.addAttr("pressStyle",void 0,av),t.UI.addAttr("focusStyle",void 0,av),t.UI.addAttr("selectedStyle",void 0,av),t.UI.addAttr("disabledStyle",void 0,av),t.UI.addAttr("placeholderStyle",void 0,av),t.UI.addAttr("button",!1,co),kv.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},kv.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?mv(this,"focusStyle"):wv(this,"focusStyle")})},kv.updateState=function(){Zh.updateStyle(this,void 0,"in")};const Bv=t.Text.prototype,Tv="text";no(Bv,Tv,Object.assign(Object.assign({},oo(Bv,Tv)),{set(t){const e=this,i=e.text;e.__setAttr(Tv,t)&&(vo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Pv extends sl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Qn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:h,height:l}=o&&(a(o)?{width:o,height:o}:o)||(r>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Fr(Fr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:n,__action:o}=this;o&&(o.FPS&&(i=o.FPS),s(o.loop)||(n=o.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!n)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},_e([Fo(Pv)],t.Robot.prototype,"__",void 0),_e([mo()],t.Robot.prototype,"robot",void 0),_e([co()],t.Robot.prototype,"actions",void 0),_e([co("")],t.Robot.prototype,"action",void 0),_e([Bo(0)],t.Robot.prototype,"now",void 0),_e([co(12)],t.Robot.prototype,"FPS",void 0),_e([co(!0)],t.Robot.prototype,"loop",void 0),t.Robot=_e([Go()],t.Robot),re.add("robot");const{Yes:Rv,NoAndSkip:Lv,YesAndSkip:Cv}=t.Answer,Ov={},Av={},Dv={};class Mv{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,n){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":Ov.id=t.substring(1),t=Ov;break;case".":Av.className=t.substring(1),t=Av;break;default:Dv.tag=t,t=Dv}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&&or.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===Rv||o===Cv){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Lv&&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_(Ar.REMOVE,this.__onRemoveChild,this),this.target.on_(Mr.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 Iv=t.UI.prototype;function Fv(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}Iv.find=function(t,e){return Fv(this).getBy(t,this,!1,e)},Iv.findOne=function(t,e){return Fv(this).getBy(t,this,!0,e)},re.add("find"),ae.finder=function(t){return new Mv(t)};const{setPoint:Wv,addPoint:zv,toBounds:Uv}=vt;const Hv={syncExport(t,e,i){let n;Kh.running=!0;try{const o=Vn.fileType(e),r=e.includes(".");i=Vn.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===o)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),n={data:!!r||t.toJSON(i.json)};else if("svg"===o)r&&h(a(t.toSVG(),"svg"),e),n={data:!!r||t.toSVG()};else{let o,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:g,trim:_,screenshot:f,padding:m,onCanvas:y}=i,w=s(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,E=Vn.isOpaqueImage(e)||b,S=new mt;if(f)o=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}o=t.getBounds("render",e)}const k={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,o,k);let B=i.pixelRatio||1,{x:T,y:P,width:R,height:L}=new Kt(o).scale(k.scaleX,k.scaleY);g&&(T+=g.x,P+=g.y,R=g.width,L=g.height);const C={exporting:!0,matrix:S.scale(1/k.scaleX,1/k.scaleY).invert().translate(-T,-P).withScale(1/a*k.scaleX,1/h*k.scaleY)};let O,A=ae.canvas({width:Math.floor(R),height:Math.floor(L),pixelRatio:B,smooth:w,contextSettings:x});p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=A.bounds),A.save();const D=u&&!s(b),M=t.get("fill");if(D&&(t.fill=""),v.render(t,A,C),D&&(t.fill=M),A.restore(),O&&O.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?zv(r,n,o):Wv(r={},n,o)),a++;const h=new Kt;return r&&(Uv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=ae.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=W.fourNumber(m),n=A,{width:o,height:r}=n;A=ae.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}E&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),y&&y(A);n={data:"canvas"===e?A:A.export(e,i),width:A.pixelWidth,height:A.pixelHeight,renderBounds:o,trimBounds:r};const I=c&&c.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Kh.running=!1,n},export(t,e,i){return Kh.running=!0,function(t){Nv||(Nv=new Zn);return new Promise(e=>{Nv.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>fe(this,void 0,void 0,function*(){if(!Jn.isComplete)return v.requestRender(o);const r=Kh.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Yv(t);const{leafer:r}=t;r?r.waitViewCompleted(o):o()}))}};let Nv;function Yv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Yv(t))}const Xv=Le.prototype,Vv=Qt.get("@leafer-in/export");return Xv.export=function(t,e){const{quality:i,blob:s}=Vn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Xv.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Vv.error(t),i(null)})})},Xv.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Xv.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Vv.error(t),i(!1)})})},re.add("export"),Object.assign(Kh,Hv),t.UI.prototype.export=function(t,e){return Kh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Kh.syncExport(this,t,e)},re.add("filter"),Object.assign(jh,{list:{},register(t,e){jh.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=jh.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=jh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),re.add("bright"),t.UI.addAttr("bright",!1,To),t.AlignHelper=Tt,t.AnimateEasing=ly,t.AnimateEvent=cy,t.AroundHelper=St,t.ArrowData=_f,t.AutoBounds=qt,t.BezierHelper=ri,t.Bounds=Kt,t.BoundsEvent=Wr,t.BoundsHelper=Xt,t.BoxData=rl,t.BranchHelper=mr,t.BranchRender=Oa,t.CanvasData=vl,t.CanvasManager=ge,t.ChildEvent=Ar,t.ColorConvert=Uh,t.Creator=ae,t.Cursor=Kd,t.DataHelper=g,t.Debug=Qt,t.DragBoundsHelper=kd,t.Dragger=Fd,t.EditBox=Pg,t.EditDataHelper=wg,t.EditPoint=kg,t.EditSelect=ag,t.EditSelectHelper=sg,t.EditToolCreator=Hg,t.EditorEvent=Gp,t.EditorGroupEvent=Xg,t.EditorHelper=Fg,t.EditorMoveEvent=Zg,t.EditorRotateEvent=Jg,t.EditorScaleEvent=qg,t.EditorSkewEvent=$g,t.Effect=Gh,t.EllipseData=cl,t.EllipseHelper=_i,t.Event=Or,t.EventCreator=ue,t.Eventer=ea,t.Export=Kh,t.FileHelper=Vn,t.Filter=jh,t.Finder=Mv,t.FourNumberHelper=P,t.FrameData=hl,t.GroupData=ol,t.HTMLTextData=pf,t.HighBezierHelper=Yy,t.HighCurveHelper=Jy,t.HitCanvasManager=Zd,t.ImageData=yl,t.ImageEvent=Fr,t.ImageManager=Qn,t.IncrementId=x,t.InnerEditor=t_,t.InnerEditorEvent=Yg,t.InteractionBase=jd,t.InteractionHelper=Cd,t.Keyboard=cd,t.LayoutEvent=Gr,t.Layouter=Lh,t.LeafBounds=Ra,t.LeafBoundsHelper=pr,t.LeafData=f,t.LeafDataProxy=ga,t.LeafEventer=ua,t.LeafHelper=or,t.LeafLayout=Cr,t.LeafLevelList=gh,t.LeafList=ph,t.LeafMatrix=xa,t.LeafRender=La,t.LeaferCanvas=_h,t.LeaferCanvasBase=Le,t.LeaferData=al,t.LeaferEvent=Kr,t.LeaferImage=so,t.LeaferTypeCreator=H_,t.LineData=ll,t.MathHelper=W,t.Matrix=mt,t.MatrixHelper=Q,t.MultiTouchHelper=X_,t.MyDragEvent=Rd,t.MyImage=nd,t.MyPointerEvent=Td,t.MyTouchEvent=Ld,t.NeedConvertToCanvasCommandMap=Me,t.OneRadian=U,t.PI2=H,t.PI_2=N,t.Paint=Yh,t.PaintGradient=Vh,t.PaintImage=Xh,t.PathArrow=Nh,t.PathArrowModule=um,t.PathBounds=An,t.PathCommandDataHelper=bs,t.PathCommandMap=Ae,t.PathConvert=Qi,t.PathCorner=Un,t.PathCreator=zs,t.PathData=gl,t.PathDrawer=tn,t.PathHelper=Ce,t.PathMatrixHelper=Bf,t.PathNumberCommandLengthMap=ze,t.PathNumberCommandMap=We,t.PathScaler=v_,t.PenData=_l,t.Picker=Dh,t.Platform=v,t.Plugin=re,t.Point=_t,t.PointHelper=dt,t.PointerButton=ud,t.PolygonData=ul,t.PropertyEvent=Mr,t.RectData=dl,t.RectHelper=Ue,t.RectRender=Bl,t.RenderEvent=jr,t.Renderer=Oh,t.ResizeEvent=Xr,t.Resource=Jn,t.RobotData=Pv,t.Run=se,t.ScrollBar=uf,t.SelectArea=ig,t.Selector=Mh,t.StarData=pl,t.State=Zh,t.StringNumberMap=Jt,t.Stroker=eg,t.TaskItem=Kn,t.TaskProcessor=Zn,t.TextConvert=zh,t.TextData=ml,t.TransformTool=Qg,t.Transformer=ef,t.Transition=qh,t.TwoPointBoundsHelper=vt,t.UIBounds=bl,t.UICreator=le,t.UIData=sl,t.UIEvent=pd,t.UIRender=Sl,t.UnitConvert=Hh,t.WaitHelper=xr,t.WatchEvent=Vr,t.Watcher=vh,t.WheelEventHelper=q_,t.addViewport=W_,t.addViewportConfig=z_,t.affectRenderBoundsType=ko,t.affectStrokeBoundsType=bo,t.arrowType=ff,t.attr=ho,t.autoLayoutType=go,t.boundsType=mo,t.canvasPatch=Xn,t.canvasSizeAttrs=Re,t.createAttr=function(t){return(e,i)=>{no(e,i,ro(i,t))}},t.createDescriptor=ro,t.cursorType=Io,t.dataProcessor=Fo,t.dataType=co,t.decorateLeafAttr=ao,t.defineDataProcessor=Wo,t.defineKey=no,t.defineLeafAttr=lo,t.dimType=To,t.doBoundsType=vo,t.doStrokeType=Eo,t.effectType=Ih,t.emptyData=i,t.eraserType=Do,t.extraPropertyEventMap=Ir,t.getBoundsData=X,t.getDescriptor=oo,t.getMatrixData=V,t.getPointData=Y,t.hitType=Mo,t.isArray=d,t.isData=u,t.isEmptyData=p,t.isFinite=r,t.isNull=n,t.isNumber=a,t.isObject=c,t.isString=o,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{no(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Qr,t.maskType=Ao,t.motionPathType=$y,t.naturalBoundsType=yo,t.opacityType=Po,t.path=Hn,t.pathInputType=wo,t.pathType=xo,t.pen=Nn,t.positionType=uo,t.registerEditTool=zg,t.registerInnerEditor=Ug,t.registerUI=Go,t.registerUIEvent=jo,t.resizeType=Fh,t.rewrite=No,t.rewriteAble=Yo,t.rotationType=fo,t.scaleResize=P_,t.scaleResizeFontSize=R_,t.scaleResizeGroup=O_,t.scaleResizePath=L_,t.scaleResizePoints=C_,t.scaleType=_o,t.scrollType=po,t.sortType=Oo,t.stateStyleType=av,t.stateType=rv,t.strokeType=So,t.surfaceType=Bo,t.tempBounds=Zt,t.tempMatrix=yt,t.tempPoint=ft,t.tryToNumber=l,t.useCanvas=mh,t.useModule=Vo,t.version="1.10.0",t.visibleType=Ro,t.zoomLayerType=Wh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=worker.min.js.map
|