@leafer/worker 1.10.0 → 1.11.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 +104 -79
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +105 -80
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(t||(t={}));const e={};function i(t){return void 0===t}function s(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function r(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;function h(t){return"string"==typeof t&&a.test(t)?+t:t}const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return p(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&p(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=g;class _{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(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let n in this)"_"!==n[0]&&(s=e?e[n]:void 0,t[n]=i(s)?this[n]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(l(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:n}=this;s.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!i(t))){if("path"===o&&!this.__pathInputed)continue;e=n?n[o]:void 0,s[o]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:n,e:o,f:r}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:n,e:o,f:r}}return s}__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:f,max:m}=Math,y={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||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.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=y.origin.createCanvas(m(f(e+(s||0)),1),m(f(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:v}=y,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=w;let b,k,S;const{max:E}=Math,B=[0,0,0,0],T={zero:[...B],tempFour:B,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(B,t,e,i,s),toTempAB(t,e,i){S=i?r(t)?e:t:[],r(t)?(b=O(t),k=e):r(e)?(b=t,k=O(e)):(b=t,k=e),4!==b.length&&(b=C(b)),4!==k.length&&(k=C(k))},get(t,e){let s;if(!r(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,i)=>r(t)&&r(e)?E(t,e):(L(t,e,i),R(S,E(b[0],k[0]),E(b[1],k[1]),E(b[2],k[2]),E(b[3],k[3]))),add:(t,e,i)=>r(t)&&r(e)?t+e:(L(t,e,i),R(S,b[0]+k[0],b[1]+k[1],b[2]+k[2],b[3]+k[3])),swapAndScale(t,e,i,s){if(r(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,a,h,l]=4===t.length?t:C(t);return R(n,h*i,l*e,o*i,a*e)}},{set:R,get:C,setTemp:O,toTempAB:L}=T,{round:P,pow:A,max:D,floor:M,PI:F}=Math,I={within:(t,e,s)=>(d(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const s=i(e)?1e12:A(10,e);return-0===(t=P(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(r(e)?e:e.width||0)/i.width,n=(r(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&I.assignScale(s,t);return s},assignScale(t,e){r(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(M(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const z=F/180,Y=2*F,N=F/2;function X(){return{x:0,y:0}}function H(){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:j,cos:U,acos:G,sqrt:q}=Math,{float:K}=I,Z={};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 $={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:V,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){Q.toInnerPoint(t,e,Z),Q.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=U(e*=z),a=j(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){Q.toInnerPoint(t,e,Z),Q.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=z,t.a=s+o*i,t.b=n+r*i),e&&(e*=z,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,Z),Q.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d: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,s,n,o){const{e:r,f:a}=t;if(s||(s=t),i(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:i,b:n,c:r,d:a}=t;s.a=i*e.a+n*e.c,s.b=i*e.b+n*e.d,s.c=r*e.a+a*e.c,s.d=r*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=r*e.a+a*e.c+e.e,s.f=r*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e: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,s,n,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(i(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:n}=e,o=i*z,r=U(o),a=j(o);if(s||n){const e=s*z,i=n*z;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,(s=s||n)&&Q.translateInner(t,-s.x,-s.y,!n)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=q(n*n+o*o),c=t/d;const e=n/d;u=o>0?G(e):-G(e)}else{c=q(r*r+a*a),d=t/c;const e=r/c;u=N-(a>0?G(-e):-G(e))}const e=K(U(u)),i=j(u);d=K(d),c=K(c),g=e?K((r/c+i)/e/z,9):0,p=e?K((o/d-i)/e/z,9):0,u=K(u/z)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=q(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{toInnerPoint:tt,toOuterPoint:et}=$,{sin:it,cos:st,abs:nt,sqrt:ot,atan2:rt,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=z),n=it(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}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),o=nt(s-e);return ot(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>at(ct(t,e,i,s),ct(i,s,n,o)),getAngle:(t,e)=>gt(t,e)/z,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/z),getRadianFrom(t,e,s,n,o,r,a,h){i(a)&&(a=s,h=n);const l=t-s,d=e-n,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(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+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:gt}=dt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new pt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i){return new pt(lt.getDistancePoint(this,t,e,i))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}reset(){return lt.reset(this),this}}const _t=new pt;class ft{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return d(t)?$.copy(this,t):$.set(this,t,e,i,s,n,o),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new ft(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const mt=new ft,yt={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){vt(t,e,i),vt(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:vt}=yt;var wt,xt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(xt||(xt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const kt={directionData:bt,tempPoint:{},get:St,toPoint(t,e,i,s,n,o){const r=St(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={}),kt.toPoint(t,e,i,!0),i)};function St(t){return n(t)?bt[xt[t]]:t}const{toPoint:Et}=kt,Bt={toPoint(t,e,i,s,n,o){Et(t,i,s,n,e,o)}},{tempPointBounds:Tt,setPoint:Rt,addPoint:Ct,toBounds:Ot}=yt,{toOuterPoint:Lt}=$,{float:Pt,fourNumber:At}=I,{floor:Dt,ceil:Mt}=Math;let Ft,It,Wt,zt;const Yt={},Nt={},Xt={},Ht={tempBounds:Xt,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(l(i)){const e=At(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?Ut(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||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Xt,t),Vt.toOuterOf(Xt,e),Xt),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 Yt.x=t.x,Yt.y=t.y,Lt(e,Yt,Nt),Rt(Tt,Nt.x,Nt.y),Yt.x=t.x+t.width,Lt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Yt.y=t.y+t.height,Lt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Yt.x=t.x,Lt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Ot(Tt,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 ft(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,o=!0,r){r||(r=e),n(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Xt.width=o?e.width*=s:e.width*s,Xt.height=o?e.height*=s:e.height*s,Bt.toPoint(i,Xt,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=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(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){Ft=t.x+t.width,It=t.y+t.height,Wt=e.x,zt=e.y,i||(Wt+=e.width,zt+=e.height),Ft=Ft>Wt?Ft:Wt,It=It>zt?It:zt,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=It-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||Ut(t,n)):jt(t,n));o&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Tt,t.x,t.y):Ct(Tt,t.x,t.y)),Ot(Tt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=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,It=n+r,Wt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<Wt?Ft:Wt,It=It<zt?It:zt,o=Ft-s,r=It-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=Ht,{add:jt,copy:Ut}=Vt;class Gt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Ht.copy(this,t):Ht.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 Gt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const qt=new Gt;class Kt{constructor(t,e,i,s,n,o){d(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 Gt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Zt={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}=I;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Qt(t)}static set exclude(t){this.excludeList=Qt(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"===$t.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(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 Qt(t){return t?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const te=$t,ee=$t.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,n,"ms")},endOfName(t,e){const s=se.nameToIdMap[t];i(s)||se.end(s,e)}},se=ie,ne=[],oe={list:{},add(t,...e){this.list[t]=!0,ne.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ne.forEach(t=>oe.has(t,!0)));const re={editor:t=>oe.need("editor")},ae=$t.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&ae.repeat(e),le[e]=t},get(t,e,s,n,o,r){le[t]||ae.error("not register "+t);const a=new le[t](e);return i(s)||(a.x=s,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:le}=he,de=$t.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;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=re.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function pe(t,e,i,s){var 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 _e(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 fe(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 me=[];function ye(){return(t,e)=>{me.push(e)}}const ve=[];let we=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;me.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){d(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}};pe([fe("imageSmoothingEnabled")],we.prototype,"smooth",void 0),pe([fe("imageSmoothingQuality")],we.prototype,"smoothLevel",void 0),pe([fe("globalAlpha")],we.prototype,"opacity",void 0),pe([fe()],we.prototype,"fillStyle",void 0),pe([fe()],we.prototype,"strokeStyle",void 0),pe([fe("lineWidth")],we.prototype,"strokeWidth",void 0),pe([fe("lineCap")],we.prototype,"strokeCap",void 0),pe([fe("lineJoin")],we.prototype,"strokeJoin",void 0),pe([fe("lineDashOffset")],we.prototype,"dashOffset",void 0),pe([fe()],we.prototype,"miterLimit",void 0),pe([fe()],we.prototype,"shadowBlur",void 0),pe([fe()],we.prototype,"shadowColor",void 0),pe([fe()],we.prototype,"shadowOffsetX",void 0),pe([fe()],we.prototype,"shadowOffsetY",void 0),pe([fe()],we.prototype,"filter",void 0),pe([fe()],we.prototype,"font",void 0),pe([fe()],we.prototype,"fontKerning",void 0),pe([fe()],we.prototype,"fontStretch",void 0),pe([fe()],we.prototype,"fontVariantCaps",void 0),pe([fe()],we.prototype,"textAlign",void 0),pe([fe()],we.prototype,"textBaseline",void 0),pe([fe()],we.prototype,"textRendering",void 0),pe([fe()],we.prototype,"wordSpacing",void 0),pe([fe()],we.prototype,"letterSpacing",void 0),pe([fe()],we.prototype,"direction",void 0),pe([ye()],we.prototype,"setTransform",null),pe([ye()],we.prototype,"resetTransform",null),pe([ye()],we.prototype,"getTransform",null),pe([ye()],we.prototype,"save",null),pe([ye()],we.prototype,"restore",null),pe([ye()],we.prototype,"translate",null),pe([ye()],we.prototype,"scale",null),pe([ye()],we.prototype,"rotate",null),pe([ye()],we.prototype,"fill",null),pe([ye()],we.prototype,"stroke",null),pe([ye()],we.prototype,"clip",null),pe([ye()],we.prototype,"fillRect",null),pe([ye()],we.prototype,"strokeRect",null),pe([ye()],we.prototype,"clearRect",null),pe([ye()],we.prototype,"beginPath",null),pe([ye()],we.prototype,"moveTo",null),pe([ye()],we.prototype,"lineTo",null),pe([ye()],we.prototype,"bezierCurveTo",null),pe([ye()],we.prototype,"quadraticCurveTo",null),pe([ye()],we.prototype,"closePath",null),pe([ye()],we.prototype,"arc",null),pe([ye()],we.prototype,"arcTo",null),pe([ye()],we.prototype,"ellipse",null),pe([ye()],we.prototype,"rect",null),pe([ye()],we.prototype,"roundRect",null),pe([ye()],we.prototype,"createConicGradient",null),pe([ye()],we.prototype,"createLinearGradient",null),pe([ye()],we.prototype,"createPattern",null),pe([ye()],we.prototype,"createRadialGradient",null),pe([ye()],we.prototype,"fillText",null),pe([ye()],we.prototype,"measureText",null),pe([ye()],we.prototype,"strokeText",null);const{copy:xe,multiplyParent:be,pixelScale:ke}=$,{round:Se}=Math,Ee=new Gt,Be=new Gt,Te={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Ce extends we{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=Te),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||y.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 Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&be(t,e,n),ke(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Se(n.e-.5)+.5,n.f=Se(n.f-.5)+.5):(n.e=Se(n.e),n.f=Se(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:s,strokeJoin:n,dashPattern:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),i(e.dashPattern)||(o=e.dashPattern),i(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,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=Be):i=Ee,this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.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,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.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(Ee.x,Ee.y,Ee.width,Ee.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,Ee.x,Ee.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(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ee.x,Ee.y,Ee.width,Ee.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ee.x,Ee.y,Ee.width,Ee.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ee,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):re.canvas(Object.assign({},i));return n.save(),t&&(xe(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 Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={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},Le),Ae={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},De={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},Me=Object.assign(Object.assign({},De),Le),Fe=Pe,Ie={};for(let t in Fe)Ie[Fe[t]]=t;const We={};for(let t in Fe)We[Fe[t]]=Ae[t];const ze={drawRoundRect(t,e,i,s,n,o){const r=I.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:Ye,cos:Ne,hypot:Xe,atan2:He,ceil:Ve,abs:je,PI:Ue,sqrt:Ge,pow:qe}=Math,{setPoint:Ke,addPoint:Ze}=yt,{set:Je,toNumberPoints:$e}=lt,{M:Qe,L:ti,C:ei,Q:ii,Z:si}=Pe,ni={},oi={points(t,e,i,s){let n=$e(e);if(t.push(Qe,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=Ge(qe(r-e,2)+qe(a-o,2)),_=Ge(qe(h-r,2)+qe(l-a,2)),(p||_)&&(f=p+_,p=y*p/f,_=y*_/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(ii,d,c,r,a):t.push(ei,u,g,d,c,r,a),u=r+_*h,g=a+_*l);s||t.push(ii,u,g,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ti,n[e],n[e+1]);s&&t.push(si)},rect(t,e,i,s,n){Oe.creator.path=t,Oe.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){Oe.creator.path=[],ze.drawRoundRect(Oe.creator,e,i,s,n,o),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=He(u,c),f=He(p,g);const m=Xe(c,u),y=Xe(g,p);let v=f-_;if(v<0&&(v+=Y),m<1e-12||y<1e-12||v<1e-12||je(v-Ue)<1e-12)return t&&t.push(ti,s,n),h&&(Ke(h,e,i),Ze(h,s,n)),d&&Je(d,e,i),void(l&&Je(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Ne(v/2),k=s+b*Ne(_+v/2+N*x),S=n+b*Ye(_+v/2+N*x);return _-=N*x,f-=N*x,hi(t,k,S,a,a,0,_/z,f/z,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>hi(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*z,g=Ye(u),p=Ne(u);let _=r*z,f=a*z;_>Ue&&(_-=Y),f<0&&(f+=Y);let m=f-_;m<0?m+=Y:m>Y&&(m-=Y),h&&(m-=Y);const y=Ve(je(m/N)),v=m/y,w=Ye(v/4),x=8/3*w*w/Ye(v/2);f=_+v;let b,k,S,E,B,T,R,C,O=Ne(_),L=Ye(_),P=S=p*s*O-g*n*L,A=E=g*s*O+p*n*L,D=e+S,M=i+E;t&&t.push(t.length?ti:Qe,D,M),l&&Ke(l,D,M),c&&Je(c,D,M);for(let o=0;o<y;o++)b=Ne(f),k=Ye(f),S=p*s*b-g*n*k,E=g*s*b+p*n*k,B=e+P-x*(p*s*L+g*n*O),T=i+A-x*(g*s*L-p*n*O),R=e+S+x*(p*s*k+g*n*b),C=i+E+x*(g*s*k-p*n*b),t&&t.push(ei,B,T,R,C,e+S,i+E),l&&ai(e+P,i+A,B,T,R,C,e+S,i+E,l,!0),P=S,A=E,O=b,L=k,_=f,f+=v;d&&Je(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ei,(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){ai(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Ze(h,t,e):Ke(h,t,e),Ze(h,r,a);for(let l=0,c=d.length;l<c;l++)ri(d[l],t,e,i,s,n,o,r,a,ni),Ze(h,ni.x,ni.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ri(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:ri,toTwoPointBounds:ai,ellipse:hi}=oi,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:gi}=oi,pi={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*z,p=li(g),_=di(g),f=-_*c-p*u,m=-_*u+p*c,v=s*s,w=n*n,x=m*m,b=f*f,k=v*w-v*x-w*b;let S=0;if(k<0){const t=ci(1-k/(v*w));s*=t,n*=t}else S=(r===a?-1:1)*ci(k/(v*x+w*b));const E=S*s*m/n,B=-S*n*f/s,T=ui((m-B)/n,(f-E)/s),R=ui((-m-B)/n,(-f-E)/s);let C=R-T;0===a&&C>0?C-=Y:1===a&&C<0&&(C+=Y);const O=e+c+_*E-p*B,L=i+u+p*E+_*B,P=C<0?1:0;d||y.ellipseToCurve?gi(t,O,L,s,n,o,T/z,R/z,P):s!==n||o?t.push(Pe.G,O,L,s,n,o,T/z,R/z,P):t.push(Pe.O,O,L,s,T/z,R/z,P)}},{M:_i,m:fi,L:mi,l:yi,H:vi,h:wi,V:xi,v:bi,C:ki,c:Si,S:Ei,s:Bi,Q:Ti,q:Ri,T:Ci,t:Oi,A:Li,a:Pi,Z:Ai,z:Di,N:Mi,D:Fi,X:Ii,G:Wi,F:zi,O:Yi,P:Ni,U:Xi}=Pe,{rect:Hi,roundRect:Vi,arcTo:ji,arc:Ui,ellipse:Gi,quadraticCurveTo:qi}=oi,{ellipticalArc:Ki}=pi,Zi=$t.get("PathConvert"),Ji={},$i={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=We[s],a+=s===n?" ":Ie[s];for(let s=1;s<i;s++)a+=I.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?Me:De;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(Qi.dot&&(ts(r,o),o=""),Qi.dot++),"0"===o&&"."!==s&&(ts(r,o),o=""),o+=s):Pe[s]?(o&&(ts(r,o),o=""),Qi.name=Pe[s],Qi.length=Ae[s],Qi.index=0,ts(r,Qi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&ts(r,o),o=s):o&&(ts(r,o),o=""),n=s;return o&&ts(r,o),i?$i.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(n=t[c],n){case fi:t[c+1]+=a,t[c+2]+=h;case _i:a=t[c+1],h=t[c+2],g.push(_i,a,h),c+=3;break;case wi:t[c+1]+=a;case vi:a=t[c+1],g.push(mi,a,h),c+=2;break;case bi:t[c+1]+=h;case xi:h=t[c+1],g.push(mi,a,h),c+=2;break;case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],g.push(mi,a,h),c+=3;break;case Bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ei;case Ei:r=o===ki||o===Ei,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(ki,l,d,i,s,a,h),c+=5;break;case Si: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=ki;case ki:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(ki,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Oi:t[c+1]+=a,t[c+2]+=h,n=Ci;case Ci:r=o===Ti||o===Ci,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ti,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=Ti;case Ti:i=t[c+1],s=t[c+2],e?qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ti,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 Li:Ki(g,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Di:case Ai:g.push(Ai),c++;break;case Mi:a=t[c+1],h=t[c+2],e?Hi(g,a,h,t[c+3],t[c+4]):es(g,t,c,5),c+=5;break;case Fi:a=t[c+1],h=t[c+2],e?Vi(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):es(g,t,c,9),c+=9;break;case Ii:a=t[c+1],h=t[c+2],e?Vi(g,a,h,t[c+3],t[c+4],t[c+5]):es(g,t,c,6),c+=6;break;case Wi:Gi(e?g:es(g,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ji),a=Ji.x,h=Ji.y,c+=9;break;case zi:e?Gi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):es(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Yi:Ui(e?g:es(g,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 Ni:e?Ui(g,t[c+1],t[c+2],t[c+3],0,360,!1):es(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Xi:ji(e?g:es(g,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 Zi.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(_i,t.x,t.y);break;case"L":e.push(mi,t.x,t.y);break;case"C":e.push(ki,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ai)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Qi.index===Qi.length&&(Qi.index=1,t.push(Qi.name)),t.push(Number(e)),Qi.index++,Qi.dot=0}},{current:Qi,pushData:ts,copyData:es}=$i,{M:is,L:ss,C:ns,Q:os,Z:rs,N:as,D:hs,X:ls,G:ds,F:cs,O:us,P:gs,U:ps}=Pe,{getMinDistanceFrom:_s,getRadianFrom:fs}=lt,{tan:ms,min:ys,abs:vs}=Math,ws={},xs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(is,e,i)},lineTo(t,e,i){t.push(ss,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(ns,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(os,e,i,s,n)},closePath(t){t.push(rs)},rect(t,e,i,s,n){t.push(as,e,i,s,n)},roundRect(t,e,i,s,n,o){if(r(o))t.push(ls,e,i,s,n,o);else{const r=I.fourNumber(o);r?t.push(hs,e,i,s,n,...r):t.push(as,e,i,s,n)}},ellipse(t,e,i,n,o,r,a,h,l){s(r)?t.push(cs,e,i,n,o):(s(a)&&(a=0),s(h)&&(h=360),t.push(ds,e,i,n,o,r,a,h,l?1:0))},arc(t,e,i,n,o,r,a){s(o)?t.push(gs,e,i,n):(s(r)&&(r=360),t.push(us,e,i,n,o,r,a?1:0))},arcTo(t,e,s,n,o,r,a,h){if(!i(a)){const t=_s(a,h,e,s,n,o);r=ys(r,ys(t/2,t/2*vs(ms(fs(a,h,e,s,n,o)/2))))}t.push(ps,e,s,n,o,r)},drawEllipse(t,e,i,n,o,r,a,h,l){oi.ellipse(null,e,i,n,o,s(r)?0:r,s(a)?0:a,s(h)?360:h,l,null,null,ws),t.push(is,ws.x,ws.y),bs(t,e,i,n,o,r,a,h,l)},drawArc(t,e,i,n,o,r,a){oi.arc(null,e,i,n,s(o)?0:o,s(r)?360:r,a,null,null,ws),t.push(is,ws.x,ws.y),ks(t,e,i,n,o,r,a)},drawPoints(t,e,i,s){oi.points(t,e,i,s)}},{ellipse:bs,arc:ks}=xs,{moveTo:Ss,lineTo:Es,quadraticCurveTo:Bs,bezierCurveTo:Ts,closePath:Rs,beginPath:Cs,rect:Os,roundRect:Ls,ellipse:Ps,arc:As,arcTo:Ds,drawEllipse:Ms,drawArc:Fs,drawPoints:Is}=xs;class Ws{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Oe.parse(t):t:[],this}beginPath(){return Cs(this.__path),this.paint(),this}moveTo(t,e){return Ss(this.__path,t,e),this.paint(),this}lineTo(t,e){return Es(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return Ts(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 Rs(this.__path),this.paint(),this}rect(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ls(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 As(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return Ds(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return Ms(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 Is(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:zs,L:Ys,C:Ns,Q:Xs,Z:Hs,N:Vs,D:js,X:Us,G:Gs,F:qs,O:Ks,P:Zs,U:Js}=Pe,$s=$t.get("PathDrawer"),Qs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case zs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ys: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 Xs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs: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 js: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 Us:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Gs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*z,e[s+6]*z,e[s+7]*z,e[s+8]),s+=9;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,Y,!1),s+=5;break;case Ks:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*z,e[s+5]*z,e[s+6]),s+=7;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],0,Y,!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 $s.error(`command: ${i} [index:${s}]`,e)}}},{M:tn,L:en,C:sn,Q:nn,Z:on,N:rn,D:an,X:hn,G:ln,F:dn,O:cn,P:un,U:gn}=Pe,{toTwoPointBounds:pn,toTwoPointBoundsByQuadraticCurve:_n,arcTo:fn,arc:mn,ellipse:yn}=oi,{addPointBounds:vn,copy:wn,addPoint:xn,setPoint:bn,addBounds:kn,toBounds:Sn}=yt,En=$t.get("PathBounds");let Bn,Tn,Rn;const Cn={},On={},Ln={},Pn={toBounds(t,e){Pn.toTwoPointBounds(t,On),Sn(On,e)},toTwoPointBounds(t,e){if(!t||!t.length)return bn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===on||r===sn||r===nn?bn(e,h,l):bn(e,t[a+1],t[a+2])),r){case tn:case en:h=t[a+1],l=t[a+2],xn(e,h,l),a+=3;break;case sn:n=t[a+5],o=t[a+6],pn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,Cn),vn(e,Cn),h=n,l=o,a+=7;break;case nn:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],_n(h,l,i,s,n,o,Cn),vn(e,Cn),h=n,l=o,a+=5;break;case on:a+=1;break;case rn:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=5;break;case an:case hn:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=r===an?9:6;break;case ln:yn(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],Cn,Ln),0===a?wn(e,Cn):vn(e,Cn),h=Ln.x,l=Ln.y,a+=9;break;case dn:h=t[a+1],l=t[a+2],Tn=t[a+3],Rn=t[a+4],kn(e,h-Tn,l-Rn,2*Tn,2*Rn),h+=Tn,a+=5;break;case cn:mn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Cn,Ln),0===a?wn(e,Cn):vn(e,Cn),h=Ln.x,l=Ln.y,a+=7;break;case un:h=t[a+1],l=t[a+2],Bn=t[a+3],kn(e,h-Bn,l-Bn,2*Bn,2*Bn),h+=Bn,a+=4;break;case gn:fn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Cn,Ln),0===a?wn(e,Cn):vn(e,Cn),h=Ln.x,l=Ln.y,a+=6;break;default:return void En.error(`command: ${r} [index:${a}]`,t)}}},{M:An,L:Dn,Z:Mn}=Pe,{getCenterX:Fn,getCenterY:In}=lt,{arcTo:Wn}=xs,zn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,p=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case An:l=g=t[r+1],d=p=t[r+2],r+=3,t[r]===Dn?(c=t[r+1],u=t[r+2],f.push(An,Fn(l,c),In(d,u))):f.push(An,l,d);break;case Dn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Dn:Wn(f,a,h,t[r+1],t[r+2],e,g,p);break;case Mn:Wn(f,a,h,l,d,e,g,p);break;default:f.push(Dn,a,h)}g=a,p=h;break;case Mn:n!==Mn&&(Wn(f,l,d,c,u,e,g,p),f.push(Mn)),r+=1;break;default:o=We[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==Mn&&(f[1]=l,f[2]=d),f}};function Yn(t){return new Ws(t)}const Nn=Yn();Oe.creator=Yn(),Oe.parse=$i.parse,Oe.convertToCanvasData=$i.toCanvasData;const{drawRoundRect:Xn}=ze;function Hn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Xn(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=jn.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{}}}},jn=Vn;jn.alphaPixelTypes.forEach(t=>jn.upperCaseTypeMap[t]=t.toUpperCase());const Un=$t.get("TaskProcessor");class Gn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return _e(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){Un.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class qn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&g.assign(this.config,t),this.empty()}add(t,e,s){let n,o,a,h;const l=new Gn(t);return l.parent=this,r(e)?h=e:e&&(o=e.parallel,n=e.start,a=e.time,h=e.delay,s||(s=e.canUse)),a&&(l.time=a),!1===o&&(l.parallel=!1),s&&(l.canUse=s),i(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 Kn=$t.get("Resource"),Zn={tasker:new qn,map:{},get isComplete(){return Jn.tasker.isComplete},set(t,e){Jn.map[t]&&Kn.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 n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=re.image(s)),Jn.set(t,e),e},destroy(){Jn.map={}}},Jn=Zn,$n={maxRecycled:10,recycledList:[],patternTasker:new qn,get(t){let e=Zn.get(t.url);return e||Zn.set(t.url,e=re.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Qn.recycledList.push(t)})},clearRecycled(){const t=Qn.recycledList;t.length>Qn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Zn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Vn.alphaPixelTypes.some(e=>Qn.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(){Qn.recycledList=[]}},Qn=$n,{IMAGE:to,create:eo}=w;class io{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=eo(to),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}$n.isFormat("svg",t)&&(this.isSVG=!0),$n.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Zn.tasker.add(()=>_e(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,i(t)?y.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=y.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=y.canvas.createPattern(t,e);return y.image.setPatternTransform(n,i,s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function so(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function no(t,e){return Object.getOwnPropertyDescriptor(t,e)}function oo(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ro(t,e){return(i,s)=>ho(i,s,t,e&&e(s))}function ao(t){return t}function ho(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};so(t,e,Object.assign(n,s||{})),Wo(t,e,i)}function lo(t){return ro(t)}function co(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function uo(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function go(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yo(this))}}))}function po(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function _o(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function fo(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i,e)&&yo(this)}}))}function mo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(yo(this),this.__.__removeNaturalSize())}}))}function yo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function vo(t){return ro(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),yo(this)}}))}const wo=fo;function xo(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i)&&(bo(this),e&&(this.__.__useStroke=!0))}}))}function bo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yo(t)}const ko=xo;function So(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Bo(t){return ro(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 To(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Co(this)}}))}function Ro(t){return ro(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Oo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Oo(this,t,e,i),this.mask&&Co(this)}}))}function Co(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Oo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||yo(t))}function Lo(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Po(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ao(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Do(t){return ro(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Mo(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Fo(t){return(e,i)=>{so(e,"__DataProcessor",{get:()=>t})}}function Io(t){return(e,i)=>{so(e,"__LayoutProcessor",{get:()=>t})}}function Wo(t,e,s){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=oo(e,s);if(i(s))a.get=function(){return this[o]};else if("function"==typeof s)a.get=function(){const t=this[o];return null==t?s(this.__leaf):t};else if(d(s)){const t=u(s);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:g.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,c=n;for(;!l&&c;)l=no(c,e),c=c.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),so(n,e,a)}const zo=new $t("rewrite"),Yo=[],No=["destroy","constructor"];function Xo(t){return(e,i)=>{Yo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Ho(){return t=>{Vo()}}function Vo(t){Yo.length&&(Yo.forEach(e=>{t&&zo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Yo.length=0)}function jo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(No.includes(s)||e&&e.includes(s)))if(t.prototype){no(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Uo(){return t=>{he.register(t)}}function Go(){return t=>{ce.register(t)}}setTimeout(()=>Vo(!0));const{copy:qo,toInnerPoint:Ko,toOuterPoint:Zo,scaleOfOuter:Jo,rotateOfOuter:$o,skewOfOuter:Qo,multiplyParent:tr,divideParent:er,getLayout:ir}=$,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||y.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=d(e)?Object.assign({},e):{x:e,y:i};s?Zo(t.localTransform,o,o,!0):t.parent&&Ko(t.parent.scrollWorldTransform,o,o,!0),rr.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){d(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 a=t.__localMatrix;if(r(s)||(s&&(o=s),s=i),qo(sr,a),Jo(sr,e,i,s),rr.hasHighPosition(t))rr.setTransform(t,sr,n,o);else{const e=t.x+sr.e-a.e,r=t.y+sr.f-a.f;o&&!n?t.animate({x:e,y:r,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=r,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;qo(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:I.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){qo(sr,t.__localMatrix),Qo(sr,e,i,s),rr.setTransform(t,sr,n,o)},transformWorld(t,e,i,s){qo(sr,t.worldTransform),tr(sr,e),t.parent&&er(sr,t.parent.scrollWorldTransform),rr.setTransform(t,sr,i,s)},transform(t,e,i,s){qo(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){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=rr.getInnerOrigin(t,n.origin);lt.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)=>lt.tempToOuterOf(rr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return kt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(qo(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),y.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?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const gr={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 pr;function _r(t,e){return e||(pr=0),t.__.mask&&(pr=1),pr<0?null:(pr&&(pr=-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:s}=e;if(s)for(;t.parent&&i(s[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:kr}=or,{toOuterOf:Sr,getPoints:Er,copy:Br}=Ht,Tr="_localContentBounds",Rr="_worldContentBounds",Cr="_worldBoxBounds",Or="_worldStrokeBounds";class Lr{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[Rr]||(this[Rr]={})),this[Rr]}get worldBoxBounds(){return Sr(this.boxBounds,this.leaf.__world,this[Cr]||(this[Cr]={})),this[Cr]}get worldStrokeBounds(){return Sr(this.strokeBounds,this.leaf.__world,this[Or]||(this[Or]={})),this[Or]}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 kr(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,y.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return br(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=br(s,e,!0)}if(r||(r=$.getLayout(o)),Br(r,a),lt.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:s}=this,n=Er(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return i(o)||n.forEach(t=>s.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 Pr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Ar extends Pr{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 Pr{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 Fr={scrollX:Dr,scrollY:Dr};class Ir extends Pr{constructor(t,e){super(t),Object.assign(this,e)}}Ir.LOAD="image.load",Ir.LOADED="image.loaded",Ir.ERROR="image.error";class Wr extends Pr{static checkHas(t,e,i){"on"===i?e===Xr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(zr)||t.hasEvent(Yr)||t.hasEvent(Nr),t.__hasWorldEvent=t.hasEvent(Xr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(zr,t),"inner"===e&&t.emit(Yr,t)),t.emit(Nr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Xr,this)}}Wr.RESIZE="bounds.resize",Wr.INNER="bounds.inner",Wr.LOCAL="bounds.local",Wr.WORLD="bounds.world";const{RESIZE:zr,INNER:Yr,LOCAL:Nr,WORLD:Xr}=Wr,Hr={};[zr,Yr,Nr,Xr].forEach(t=>Hr[t]=1);class Vr extends Pr{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){d(t)?(super(Vr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}Vr.RESIZE="resize";class jr extends Pr{constructor(t,e){super(t),this.data=e}}jr.REQUEST="watch.request",jr.DATA="watch.data";class Ur extends Pr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ur.REQUEST="layout.request",Ur.START="layout.start",Ur.BEFORE="layout.before",Ur.LAYOUT="layout",Ur.AFTER="layout.after",Ur.AGAIN="layout.again",Ur.END="layout.end";class Gr extends Pr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Gr.REQUEST="render.request",Gr.CHILD_START="render.child_start",Gr.CHILD_END="render.child_end",Gr.START="render.start",Gr.BEFORE="render.before",Gr.RENDER="render",Gr.AFTER="render.after",Gr.AGAIN="render.again",Gr.END="render.end",Gr.NEXT="render.next";class qr extends Pr{}qr.START="leafer.start",qr.BEFORE_READY="leafer.before_ready",qr.READY="leafer.ready",qr.AFTER_READY="leafer.after_ready",qr.VIEW_READY="leafer.view_ready",qr.VIEW_COMPLETED="leafer.view_completed",qr.STOP="leafer.stop",qr.RESTART="leafer.restart",qr.END="leafer.end",qr.UPDATE_MODE="leafer.update_mode",qr.TRANSFORM="leafer.transform",qr.MOVE="leafer.move",qr.SCALE="leafer.scale",qr.ROTATE="leafer.rotate",qr.SKEW="leafer.skew";const{MOVE:Kr,SCALE:Zr,ROTATE:Jr,SKEW:$r}=qr,Qr={x:Kr,y:Kr,scaleX:Zr,scaleY:Zr,rotation:Jr,skewX:$r,skewY:$r},ta={};class ea{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,r;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const a=ia(this,s,!0),h=n(t)?t.split(" "):t,d=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(d):a[t]=[d],Hr[t]&&Wr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(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],Hr[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):l(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=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(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 l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.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:s,__captureMap:n}=this,o=s&&s[t],r=n&&n[t];return!!(i(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},ga=$t.get("setAttr"),pa={__setAttr(t,e,s){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!s||o(e)||i(e)||(ga.warn(this.innerName,t,e),e=void 0),d(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 qr(i,this)),this.emitEvent(new qr(qr.TRANSFORM,this)))}this.emitPropertyEvent(Mr.CHANGE,t,n,e);const i=Fr[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 s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:_a,multiplyParent:fa,translateInner:ma,defaultWorld:ya}=$,{toPoint:va,tempPoint:wa}=kt,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:ka}=or,{updateBounds:Sa}=mr,{toOuterOf:Ea,copyAndSpread:Ba,copy:Ta}=Ht,{toBounds:Ra}=Pn,Ca={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ea(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(),Ea(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ea(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ea(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ra(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(),ka(this),Sa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ka(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;r(i)&&i<=0?Ta(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,i)}},Oa={__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);$t.showBounds&&$t.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:La}=gr,Pa={__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++)La(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++)La(i[s],e)||i[s].__clip(t,e)}}},Aa={},{LEAF:Da,create:Ma}=w,{stintSet:Fa}=g,{toInnerPoint:Ia,toOuterPoint:Wa,multiplyParent:za}=$,{toOuterOf:Ya}=Ht,{copy:Na,move:Xa}=lt,{moveLocal:Ha,zoomOfLocal:Va,rotateOfLocal:ja,skewOfLocal:Ua,moveWorld:Ga,zoomOfWorld:qa,rotateOfWorld:Ka,skewOfWorld:Za,transform:Ja,transformWorld:$a,setTransform:Qa,getFlipTransform:th,getLocalOrigin:eh,getRelativeWorld:ih,drop:sh}=or;let nh=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 _}get __LayoutProcessor(){return Lr}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){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(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),Ya(this.__layout.renderBounds,e,e),Fa(e,"half",i.half),Fa(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}=$n.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 Ya(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Na(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Na(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ia(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 Xa(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 Xa(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){Ha(this,t,e,i)}moveInner(t,e,i){Ga(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Va(this,eh(this,t),e,i,s,n)}rotateOf(t,e,i){ja(this,eh(this,t),e,i)}skewOf(t,e,i,s,n){Ua(this,eh(this,t),e,i,s,n)}transformWorld(t,e,i){$a(this,t,e,i)}moveWorld(t,e,i){Ga(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){qa(this,t,e,i,s,n)}rotateOfWorld(t,e){Ka(this,t,e)}skewOfWorld(t,e,i,s,n){Za(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 oe.need("path")}getMotionPoint(t){return oe.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=fo),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)}};nh=pe([jo(pa),jo(xa),jo(Ca),jo(ua),jo(Oa)],nh);const{setListWithFn:oh}=Ht,{sort:rh}=mr,{localBoxBounds:ah,localStrokeBounds:hh,localRenderBounds:lh,maskLocalBoxBounds:dh,maskLocalStrokeBounds:ch,maskLocalRenderBounds:uh}=gr,gh=new $t("Branch");let ph=class extends nh{__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){oh(e||this.__layout.boxBounds,this.children,this.__hasMask?dh:ah)}__updateStrokeBounds(t){oh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ch:hh)}__updateRenderBounds(t){oh(t||this.__layout.renderBounds,this.children,this.__hasMask?uh:lh)}__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(rh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return gh.warn("add self or destroyed");const s=i(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),s||e++});t=he.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?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)):i(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)}};ph=pe([jo(Pa)],ph);class _h{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,n=i.length;t<n;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let n=0,o=e.length;n<o;n++)i(s)?e[n].innerId===t.innerId&&(s=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;i(s)||e.splice(s,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 _h;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 fh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const mh="1.10.0";class yh extends Ce{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=y.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}}Hn(OffscreenCanvasRenderingContext2D.prototype),Hn(Path2D.prototype);const{mineType:vh}=Vn;function wh(t,e){y.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:vh(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:vh(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",y.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()})},y.canvas=re.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(re,{canvas:(t,e)=>new yh(t,e),image:t=>new io(t)}),y.name="web",y.isWorker=!0,y.backgrounder=!0,y.requestRender=function(t){requestAnimationFrame(t)},so(y,"devicePixelRatio",{get:()=>1});const{userAgent:xh}=navigator;xh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),xh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):xh.indexOf("Mac")>-1?y.os="Mac":xh.indexOf("Linux")>-1&&(y.os="Linux");class bh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new _h;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 _h,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(Gr.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 jr(jr.DATA,{updatedList:this.updatedList})),this.__updatedList=new _h,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],[jr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:kh,updateBounds:Sh,updateChange:Eh}=or,{pushAllChildBranch:Bh,pushAllParent:Th}=mr;const{worldBounds:Rh}=gr;class Ch{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new _h(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Rh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Rh),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:Oh,updateAllChange:Lh}=or,Ph=$t.get("Layouter");class Ah{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new fh,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(Ur.START),this.layoutOnce(),t.emitEvent(new Ur(Ur.END,this.layoutedBlocks,this.times))}catch(t){Ph.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ph.warn("layouting"):this.times>3?Ph.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(jr.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=ie.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Ur,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Ur(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?(kh(t,!0),e.add(t),t.isBranch&&Bh(t,e),Th(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Th(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||Sh(s[t])}Sh(i)}})}(this.__levelList),function(t){t.list.forEach(Eh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Ur(o,a,this.times)),i.emitEvent(new Ur(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Ur,o=this.getBlocks(new _h(e));e.emitEvent(new Ur(i,o,this.times)),Ah.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Ur(s,o,this.times)),e.emitEvent(new Ur(n,o,this.times)),this.addBlocks(o),ie.end(t)}static fullLayout(t){Oh(t,!0),t.isBranch?mr.updateBounds(t):or.updateBounds(t),Lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ch([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ch(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_([[Ur.REQUEST,this.layout,this],[Ur.AGAIN,this.layoutAgain,this],[jr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Dh=$t.get("Renderer");class Mh{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(Ur.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Gr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Gr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Gr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Dh.log(e.innerName,"---\x3e");try{this.emitRender(Gr.START),this.renderOnce(t),this.emitRender(Gr.END,this.totalBounds),$n.clearRecycled()}catch(t){this.rendering=!1,Dh.error(t)}Dh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Dh.warn("rendering");if(this.times>3)return Dh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Gr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Gr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Gr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Gr.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=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Gt(s);i.save(),s.spread(Mh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.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),$t.showRepaint&&$t.drawRepaint(i,t),y.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 Gt;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 y.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()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(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 Gt(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||Dh.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 Gr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Gr.REQUEST,this.update,this],[Ur.END,this.__onLayoutEnd,this],[Gr.AGAIN,this.renderAgain,this],[Vr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Mh.clipSpread=10;const{hitRadiusPoint:Fh}=Ht;class Ih{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 _h(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 _h;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 _h,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 _h;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 _h,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||Fh(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 Wh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Ih(this.target=t,this),this.finder=re.finder&&re.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return y.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):oe.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function zh(t){return ro(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Yh(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Nh(){return(t,e)=>{const i="_"+e;so(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Xh(t){return(e,i)=>{so(e,i,oo(i,t))}}Object.assign(re,{watcher:(t,e)=>new bh(t,e),layouter:(t,e)=>new Ah(t,e),renderer:(t,e,i)=>new Mh(t,e,i),selector:(t,e)=>new Wh(t,e)}),y.layout=Ah.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new _h,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Hh={},Vh={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}},jh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Uh={},Gh={},qh={},Kh={},Zh={},Jh={apply(){oe.need("filter")}},$h={},Qh={setStyleName:()=>oe.need("state"),set:()=>oe.need("state")},tl={list:{},register(t,e){tl.list[t]=e},get:t=>tl.list[t]},{parse:el,objectToCanvasData:il}=$i,{stintSet:sl}=g,{hasTransparent:nl}=Vh,ol={},rl=$t.get("UIData");class al extends _{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,rl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,rl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(sl(this,"__isTransparentFill",nl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(sl(this,"__isTransparentStroke",nl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?el(t):il(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){hl(this,"shadow",t)}setInnerShadow(t){hl(this,"innerShadow",t)}setFilter(t){hl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Gh.compute("fill",this.__leaf),e&&Gh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){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(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ol)):(this.__isStrokes=!0,this._stroke||(this._stroke=ol))}__removePaint(t,e){e&&this.__removeInput(t),qh.recycleImage(t,this),"fill"===t?(sl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(sl(this,"__isAlphaPixelStroke",void 0),sl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function hl(t,e,i){t.__setInput(e,i),l(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 ll extends al{}class dl extends ll{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 cl extends ll{__getInputData(t,e){const i=super.__getInputData(t,e);return Re.forEach(t=>delete i[t]),i}}class ul extends dl{}class gl extends al{get __usePathBox(){return this.points||this.__pathInputed}}class pl extends al{get __boxStroke(){return!this.__pathInputed}}class _l extends al{get __boxStroke(){return!this.__pathInputed}}class fl extends gl{}class ml extends al{}class yl extends al{get __pathInputed(){return 2}}class vl extends ll{}const wl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class xl extends al{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=wl[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=he.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 bl extends pl{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 kl extends pl{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:Sl,add:El}=T,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=Sl(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=Zh.getShadowRenderSpread(this,e)),s&&(t=Sl(t,s)),o&&(t=El(t,Jh.getSpread(o))),r&&(t=El(t,r)),a&&(t=El(t,a));let l=t;return i&&(l=Sl(l,Zh.getInnerShadowSpread(this,i))),n&&(l=Sl(l,n)),this.__layout.renderShapeSpread=l,h?Sl(h.__updateRenderSpread(),t):t}},{stintSet:Tl}=g,Rl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Tl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Tl(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;Tl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Zh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Cl(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=Gh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Zh.shadow(this,t,h),a&&(s.__isStrokes?Gh.strokes(o,this,t,e):Gh.stroke(o,this,t,e)),n&&(s.__isFills?Gh.fills(n,this,t,e):Gh.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&Zh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Gh.strokes(o,this,t,e):Gh.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?Gh.strokes(o,this,t,e):Gh.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,Vh.string(e.color))}n&&(s.__isFills?Gh.fills(n,this,t,e):Gh.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Gh.strokes(o,this,t,e):Gh.stroke(o,this,t,e))}}else s.__pathInputed?Cl(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?Gh.fills(s,this,t,e):Gh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Gh.strokes(n,this,t,e):Gh.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 Cl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Gh.stroke(n,t,e,i),s&&Gh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&Gh.stroke(n,t,e,i)}const Ol={__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 Ll;let Pl=Ll=class extends nh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Nn.set(this.path=t||[]),t||this.__drawPathByBox(Nn),Nn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return oe.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return oe.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?$i.toCanvasData(i,!0):i}getPathString(t,e,i){return $i.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||$h.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?zn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Uh.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?Qs.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,r(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Gh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),oe.need("animate")}killAnimate(t,e){}export(t,e){return oe.need("export")}syncExport(t,e){return oe.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Ll.one(e)}static one(t,e,i,s,n){return he.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Uo()(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()}};pe([Fo(al)],Pl.prototype,"__",void 0),pe([Nh()],Pl.prototype,"zoomLayer",void 0),pe([lo("")],Pl.prototype,"id",void 0),pe([lo("")],Pl.prototype,"name",void 0),pe([lo("")],Pl.prototype,"className",void 0),pe([Eo("pass-through")],Pl.prototype,"blendMode",void 0),pe([To(1)],Pl.prototype,"opacity",void 0),pe([Ro(!0)],Pl.prototype,"visible",void 0),pe([Eo(!1)],Pl.prototype,"locked",void 0),pe([Bo(!1)],Pl.prototype,"dim",void 0),pe([Bo(!1)],Pl.prototype,"dimskip",void 0),pe([Lo(0)],Pl.prototype,"zIndex",void 0),pe([Po(!1)],Pl.prototype,"mask",void 0),pe([Ao(!1)],Pl.prototype,"eraser",void 0),pe([co(0,!0)],Pl.prototype,"x",void 0),pe([co(0,!0)],Pl.prototype,"y",void 0),pe([fo(100,!0)],Pl.prototype,"width",void 0),pe([fo(100,!0)],Pl.prototype,"height",void 0),pe([po(1,!0)],Pl.prototype,"scaleX",void 0),pe([po(1,!0)],Pl.prototype,"scaleY",void 0),pe([_o(0,!0)],Pl.prototype,"rotation",void 0),pe([_o(0,!0)],Pl.prototype,"skewX",void 0),pe([_o(0,!0)],Pl.prototype,"skewY",void 0),pe([co(0,!0)],Pl.prototype,"offsetX",void 0),pe([co(0,!0)],Pl.prototype,"offsetY",void 0),pe([uo(0,!0)],Pl.prototype,"scrollX",void 0),pe([uo(0,!0)],Pl.prototype,"scrollY",void 0),pe([go()],Pl.prototype,"origin",void 0),pe([go()],Pl.prototype,"around",void 0),pe([lo(!1)],Pl.prototype,"lazy",void 0),pe([mo(1)],Pl.prototype,"pixelRatio",void 0),pe([So(0)],Pl.prototype,"renderSpread",void 0),pe([vo()],Pl.prototype,"path",void 0),pe([wo()],Pl.prototype,"windingRule",void 0),pe([wo(!0)],Pl.prototype,"closed",void 0),pe([fo(0)],Pl.prototype,"padding",void 0),pe([fo(!1)],Pl.prototype,"lockRatio",void 0),pe([fo()],Pl.prototype,"widthRange",void 0),pe([fo()],Pl.prototype,"heightRange",void 0),pe([lo(!1)],Pl.prototype,"draggable",void 0),pe([lo()],Pl.prototype,"dragBounds",void 0),pe([lo("auto")],Pl.prototype,"dragBoundsType",void 0),pe([lo(!1)],Pl.prototype,"editable",void 0),pe([Do(!0)],Pl.prototype,"hittable",void 0),pe([Do("path")],Pl.prototype,"hitFill",void 0),pe([ko("path")],Pl.prototype,"hitStroke",void 0),pe([Do(!1)],Pl.prototype,"hitBox",void 0),pe([Do(!0)],Pl.prototype,"hitChildren",void 0),pe([Do(!0)],Pl.prototype,"hitSelf",void 0),pe([Do()],Pl.prototype,"hitRadius",void 0),pe([Mo("")],Pl.prototype,"cursor",void 0),pe([Eo()],Pl.prototype,"fill",void 0),pe([ko(void 0,!0)],Pl.prototype,"stroke",void 0),pe([ko("inside")],Pl.prototype,"strokeAlign",void 0),pe([ko(1,!0)],Pl.prototype,"strokeWidth",void 0),pe([ko(!1)],Pl.prototype,"strokeWidthFixed",void 0),pe([ko("none")],Pl.prototype,"strokeCap",void 0),pe([ko("miter")],Pl.prototype,"strokeJoin",void 0),pe([ko()],Pl.prototype,"dashPattern",void 0),pe([ko(0)],Pl.prototype,"dashOffset",void 0),pe([ko(10)],Pl.prototype,"miterLimit",void 0),pe([wo(0)],Pl.prototype,"cornerRadius",void 0),pe([wo()],Pl.prototype,"cornerSmoothing",void 0),pe([zh()],Pl.prototype,"shadow",void 0),pe([zh()],Pl.prototype,"innerShadow",void 0),pe([zh()],Pl.prototype,"blur",void 0),pe([zh()],Pl.prototype,"backgroundBlur",void 0),pe([zh()],Pl.prototype,"grayscale",void 0),pe([zh()],Pl.prototype,"filter",void 0),pe([Eo()],Pl.prototype,"placeholderColor",void 0),pe([lo(100)],Pl.prototype,"placeholderDelay",void 0),pe([lo({})],Pl.prototype,"data",void 0),pe([Xo(nh.prototype.reset)],Pl.prototype,"reset",null),Pl=Ll=pe([jo(Bl),jo(Rl),Ho()],Pl);let Al=class extends Pl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Dl;pe([Fo(ll)],Al.prototype,"__",void 0),pe([fo(0)],Al.prototype,"width",void 0),pe([fo(0)],Al.prototype,"height",void 0),Al=pe([jo(ph),Uo()],Al);const Ml=$t.get("Leafer");let Fl=Dl=class extends Al{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Zn.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),Dl.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=re.canvas(s);this.__controllers.push(this.renderer=re.renderer(this,n,s),this.watcher=re.watcher(this,s),this.layouter=re.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=re.selector(this),this.interaction=re.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.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(qr.RESTART):this.emitLeafer(qr.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(qr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=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 Gt(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 Vr(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 Kt(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(qr.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(qr.BEFORE_READY),this.emitLeafer(qr.READY),this.emitLeafer(qr.AFTER_READY),xr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(qr.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(qr.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 oe.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new qr(t,this))}__listenEvents(){const t=ie.start("FirstCreate "+this.innerName);this.once([[qr.START,()=>ie.end(t)],[Ur.START,this.updateLazyBounds,this],[Gr.START,this.__onCreated,this],[Gr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[jr.DATA,this.__onWatchData,this],[Ur.END,this.__onLayoutEnd,this],[Gr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Dl.list.remove(this);try{this.stop(),this.emitLeafer(qr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{$n.clearRecycled()},100)}catch(t){Ml.error(t)}}};t?e():setTimeout(e)}};Fl.list=new _h,pe([Fo(cl)],Fl.prototype,"__",void 0),pe([fo()],Fl.prototype,"pixelRatio",void 0),pe([lo("normal")],Fl.prototype,"mode",void 0),Fl=Dl=pe([Uo()],Fl);let Il=class extends Pl{get __tag(){return"Rect"}};pe([Fo(pl)],Il.prototype,"__",void 0),Il=pe([jo(Ol),Ho(),Uo()],Il);const{add:Wl,includes:zl,scroll:Yl}=Ht,Nl=Il.prototype,Xl=Al.prototype;let Hl=class extends Al{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"))&&(Wl(a,o),Yl(a,i)),this.__updateRectRenderBounds(),t=!zl(o,a),t&&"show"===r&&Wl(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))}};pe([Fo(dl)],Hl.prototype,"__",void 0),pe([fo(100)],Hl.prototype,"width",void 0),pe([fo(100)],Hl.prototype,"height",void 0),pe([lo(!1)],Hl.prototype,"resizeChildren",void 0),pe([So("show")],Hl.prototype,"overflow",void 0),pe([Xo(Nl.__updateStrokeSpread)],Hl.prototype,"__updateStrokeSpread",null),pe([Xo(Nl.__updateRenderSpread)],Hl.prototype,"__updateRectRenderSpread",null),pe([Xo(Nl.__updateBoxBounds)],Hl.prototype,"__updateRectBoxBounds",null),pe([Xo(Nl.__updateStrokeBounds)],Hl.prototype,"__updateStrokeBounds",null),pe([Xo(Nl.__updateRenderBounds)],Hl.prototype,"__updateRectRenderBounds",null),pe([Xo(Nl.__updateChange)],Hl.prototype,"__updateRectChange",null),pe([Xo(Nl.__render)],Hl.prototype,"__renderRect",null),pe([Xo(Xl.__render)],Hl.prototype,"__renderGroup",null),Hl=pe([Ho(),Uo()],Hl);let Vl=class extends Hl{get __tag(){return"Frame"}get isFrame(){return!0}};pe([Fo(ul)],Vl.prototype,"__",void 0),pe([Eo("#FFFFFF")],Vl.prototype,"fill",void 0),pe([So("hide")],Vl.prototype,"overflow",void 0),Vl=pe([Uo()],Vl);const{moveTo:jl,closePath:Ul,ellipse:Gl}=xs;let ql=class extends Pl{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&&Gl(a,o,r,o*i,r*i,0,s,n,!1),Gl(a,o,r,o,r,0,n,s,!0),i<1&&Ul(a)):(i<1&&(Gl(a,o,r,o*i,r*i),jl(a,t,r)),Gl(a,o,r,o,r,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(jl(a,o,r),Gl(a,o,r,o,r,0,s,n,!1),Ul(a)):Gl(a,o,r,o,r)}};pe([Fo(_l)],ql.prototype,"__",void 0),pe([wo(0)],ql.prototype,"innerRadius",void 0),pe([wo(0)],ql.prototype,"startAngle",void 0),pe([wo(0)],ql.prototype,"endAngle",void 0),ql=pe([Uo()],ql);const{sin:Kl,cos:Zl,PI:Jl}=Math,{moveTo:$l,lineTo:Ql,closePath:td,drawPoints:ed}=xs;let id=class extends Pl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ed(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;$l(e,o,0);for(let t=1;t<n;t++)Ql(e,o+o*Kl(2*t*Jl/n),r-r*Zl(2*t*Jl/n));td(e)}}};pe([Fo(fl)],id.prototype,"__",void 0),pe([wo(3)],id.prototype,"sides",void 0),pe([wo()],id.prototype,"points",void 0),pe([wo(0)],id.prototype,"curve",void 0),id=pe([Ho(),Uo()],id);const{sin:sd,cos:nd,PI:od}=Math,{moveTo:rd,lineTo:ad,closePath:hd}=xs;let ld=class extends Pl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];rd(r,n,0);for(let t=1;t<2*i;t++)ad(r,n+(t%2==0?n:n*s)*sd(t*od/i),o-(t%2==0?o:o*s)*nd(t*od/i));hd(r)}};pe([Fo(ml)],ld.prototype,"__",void 0),pe([wo(5)],ld.prototype,"corners",void 0),pe([wo(.382)],ld.prototype,"innerRadius",void 0),ld=pe([Uo()],ld);const{moveTo:dd,lineTo:cd,drawPoints:ud}=xs,{rotate:gd,getAngle:pd,getDistance:_d,defaultPoint:fd}=lt;let md=class extends Pl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&gd(i,e),i}set toPoint(t){this.width=_d(fd,t),this.rotation=pd(fd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ud(e,t.points,t.curve,t.closed):(dd(e,0,0),cd(e,this.width,0))}};pe([Fo(gl)],md.prototype,"__",void 0),pe([xo("center")],md.prototype,"strokeAlign",void 0),pe([fo(0)],md.prototype,"height",void 0),pe([wo()],md.prototype,"points",void 0),pe([wo(0)],md.prototype,"curve",void 0),pe([wo(!1)],md.prototype,"closed",void 0),md=pe([Uo()],md);let yd=class extends Il{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}};pe([Fo(bl)],yd.prototype,"__",void 0),pe([fo("")],yd.prototype,"url",void 0),yd=pe([Uo()],yd);const vd=yd;let wd=class extends Il{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new io({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ir(Ir.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),o=new ft;e&&o.translate(e.x,e.y),i&&(r(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()}};pe([Fo(kl)],wd.prototype,"__",void 0),pe([Yh(100)],wd.prototype,"width",void 0),pe([Yh(100)],wd.prototype,"height",void 0),pe([Yh(1)],wd.prototype,"pixelRatio",void 0),pe([Yh(!0)],wd.prototype,"smooth",void 0),pe([lo(!1)],wd.prototype,"safeResize",void 0),pe([Yh()],wd.prototype,"contextSettings",void 0),wd=pe([Uo()],wd);const{copyAndSpread:xd,includes:bd,spread:kd,setList:Sd}=Ht,{stintSet:Ed}=g;let Bd=class extends Pl{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=jh.number(e,n),t.__letterSpacing=jh.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"}`,Ed(t,"__padding",l&&I.fourNumber(l)),Ed(t,"__clipText","show"!==h&&!t.__autoSize),Ed(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Hh.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&&kd(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",!bd(h,a)),this.isOverflow?(Sd(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;xd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};pe([Fo(xl)],Bd.prototype,"__",void 0),pe([fo(0)],Bd.prototype,"width",void 0),pe([fo(0)],Bd.prototype,"height",void 0),pe([Eo()],Bd.prototype,"boxStyle",void 0),pe([lo(!1)],Bd.prototype,"resizeFontSize",void 0),pe([Eo("#000000")],Bd.prototype,"fill",void 0),pe([xo("outside")],Bd.prototype,"strokeAlign",void 0),pe([Do("all")],Bd.prototype,"hitFill",void 0),pe([fo("")],Bd.prototype,"text",void 0),pe([fo("")],Bd.prototype,"placeholder",void 0),pe([fo("caption")],Bd.prototype,"fontFamily",void 0),pe([fo(12)],Bd.prototype,"fontSize",void 0),pe([fo("normal")],Bd.prototype,"fontWeight",void 0),pe([fo(!1)],Bd.prototype,"italic",void 0),pe([fo("none")],Bd.prototype,"textCase",void 0),pe([fo("none")],Bd.prototype,"textDecoration",void 0),pe([fo(0)],Bd.prototype,"letterSpacing",void 0),pe([fo({type:"percent",value:1.5})],Bd.prototype,"lineHeight",void 0),pe([fo(0)],Bd.prototype,"paraIndent",void 0),pe([fo(0)],Bd.prototype,"paraSpacing",void 0),pe([fo("x")],Bd.prototype,"writingMode",void 0),pe([fo("left")],Bd.prototype,"textAlign",void 0),pe([fo("top")],Bd.prototype,"verticalAlign",void 0),pe([fo(!0)],Bd.prototype,"autoSizeAlign",void 0),pe([fo("normal")],Bd.prototype,"textWrap",void 0),pe([fo("show")],Bd.prototype,"textOverflow",void 0),pe([Eo(!1)],Bd.prototype,"textEditing",void 0),Bd=pe([Uo()],Bd);let Td=class extends Pl{get __tag(){return"Path"}};pe([Fo(yl)],Td.prototype,"__",void 0),pe([xo("center")],Td.prototype,"strokeAlign",void 0),Td=pe([Uo()],Td);let Rd=class extends Al{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Td(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};pe([Fo(vl)],Rd.prototype,"__",void 0),pe([(t,e)=>{so(t,e,{get(){return this.__path}})}],Rd.prototype,"path",void 0),Rd=pe([jo(Ws,["set","path","paint"]),Uo()],Rd);let Cd=class extends Fl{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&&re.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Fl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),i(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([[Ur.END,this.__onReady,this],[Gr.START,this.__onCreated,this],[Gr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Gr.END,this.__onChildRenderEnd,this))}};Cd=pe([Uo()],Cd);const Od={},Ld={isHoldSpaceKey:()=>Ld.isHold("Space"),isHold:t=>Od[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Od[t]||(Od[t]=!0)},setUpCode(t){Od[t]=!1}},Pd={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 Ad extends Pr{get spaceKey(){return Ld.isHoldSpaceKey()}get left(){return Pd.left(this)}get right(){return Pd.right(this)}get middle(){return Pd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ld.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){ce.changeName(t,e)}}const{min:Dd,max:Md,abs:Fd}=Math,{float:Id,sign:Wd}=I,{minX:zd,maxX:Yd,minY:Nd,maxY:Xd}=Ht,Hd=new Gt,Vd=new Gt,jd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Ud.getValidMove(t.__localBoxBounds,Ud.getDragBounds(t),s,e,!0),Ud.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&Ud.getValidScaleOf(t.__localBoxBounds,Ud.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)),Ud.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),Ud.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=Id(s.x),s.y=Id(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),Vd.set(e),Hd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,g,p,_,f=1,m=1;return Ud.isInnerMode(t,e,i,"width")?(n.x<0&&Hd.scaleOf(s,f=1/n.x,1),p=Id(Hd.minX-Vd.minX),_=Id(Vd.maxX-Hd.maxX),u=h&&p>0?1+p/(h*Hd.width):1,g=l&&_>0?1+_/(l*Hd.width):1,f*=Md(u,g)):(n.x<0&&((Id(zd(t)-zd(e))<=0||Id(Yd(e)-Yd(t))<=0)&&Hd.scaleOf(s,f=1/n.x,1),Hd.unsign()),p=Id(Vd.minX-Hd.minX),_=Id(Hd.maxX-Vd.maxX),u=h&&p>0?1-p/(h*Hd.width):1,g=l&&_>0?1-_/(l*Hd.width):1,f*=Dd(u,g)),Ud.isInnerMode(t,e,i,"height")?(n.y<0&&Hd.scaleOf(s,1,m=1/n.y),p=Id(Hd.minY-Vd.minY),_=Id(Vd.maxY-Hd.maxY),u=d&&p>0?1+p/(d*Hd.height):1,g=c&&_>0?1+_/(c*Hd.height):1,m*=Md(u,g),r&&(u=Md(Fd(f),Fd(m)),f=Wd(f)*u,m=Wd(m)*u)):(n.y<0&&((Id(Nd(t)-Nd(e))<=0||Id(Xd(e)-Xd(t))<=0)&&Hd.scaleOf(s,1,m=1/n.y),Hd.unsign()),p=Id(Vd.minY-Hd.minY),_=Id(Hd.maxY-Vd.maxY),u=d&&p>0?1-p/(d*Hd.height):1,g=c&&_>0?1-_/(c*Hd.height):1,m*=Dd(u,g)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},Ud=jd;let Gd=class extends Ad{};Gd.POINTER="pointer",Gd.BEFORE_DOWN="pointer.before_down",Gd.BEFORE_MOVE="pointer.before_move",Gd.BEFORE_UP="pointer.before_up",Gd.DOWN="pointer.down",Gd.MOVE="pointer.move",Gd.UP="pointer.up",Gd.OVER="pointer.over",Gd.OUT="pointer.out",Gd.ENTER="pointer.enter",Gd.LEAVE="pointer.leave",Gd.TAP="tap",Gd.DOUBLE_TAP="double_tap",Gd.CLICK="click",Gd.DOUBLE_CLICK="double_click",Gd.LONG_PRESS="long_press",Gd.LONG_TAP="long_tap",Gd.MENU="pointer.menu",Gd.MENU_TAP="pointer.menu_tap",Gd=pe([Go()],Gd);const qd=Gd,Kd={};let Zd=class extends Gd{static setList(t){this.list=t instanceof _h?t:new _h(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),jd.axisMove(t,n),n}static limitMove(t,e){jd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Kd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Kd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Kd,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){Kd.x=t?this.totalX:this.moveX,Kd.y=t?this.totalY:this.moveY}};Zd.BEFORE_DRAG="drag.before_drag",Zd.START="drag.start",Zd.DRAG="drag",Zd.END="drag.end",Zd.OVER="drag.over",Zd.OUT="drag.out",Zd.ENTER="drag.enter",Zd.LEAVE="drag.leave",Zd=pe([Go()],Zd);const Jd=Zd;let $d=class extends Gd{static setList(t){Zd.setList(t)}static setData(t){Zd.setData(t)}};$d.DROP="drop",$d=pe([Go()],$d);let Qd=class extends Zd{};Qd.BEFORE_MOVE="move.before_move",Qd.START="move.start",Qd.MOVE="move",Qd.END="move.end",Qd=pe([Go()],Qd);let tc=class extends Ad{};tc=pe([Go()],tc);const ec=tc;let ic=class extends Gd{};ic.BEFORE_ROTATE="rotate.before_rotate",ic.START="rotate.start",ic.ROTATE="rotate",ic.END="rotate.end",ic=pe([Go()],ic);let sc=class extends Zd{};sc.SWIPE="swipe",sc.LEFT="swipe.left",sc.RIGHT="swipe.right",sc.UP="swipe.up",sc.DOWN="swipe.down",sc=pe([Go()],sc);let nc=class extends Gd{};nc.BEFORE_ZOOM="zoom.before_zoom",nc.START="zoom.start",nc.ZOOM="zoom",nc.END="zoom.end",nc=pe([Go()],nc);let oc=class extends Ad{};oc.BEFORE_DOWN="key.before_down",oc.BEFORE_UP="key.before_up",oc.DOWN="key.down",oc.HOLD="key.hold",oc.UP="key.up",oc=pe([Go()],oc);const rc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?sc.UP:t>45&&t<135?sc.DOWN:t<=45&&t>=-45?sc.RIGHT:sc.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:ac.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:i(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 _h,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>or.draggable(t)||!t.isLeafer&&t.hasEvent(Zd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},ac=rc,hc=new _h,{getDragEventData:lc,getDropEventData:dc,getSwipeEventData:cc}=rc;class uc{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=lc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Zd.list||this.draggableList||hc;return this.dragging&&(s?t?hc:new _h(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Qd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Pd.left(t),this.dragging&&(this.interaction.emit(Zd.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 _h(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=lc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit(Qd.BEFORE_MOVE,this.dragData),e.emit(Qd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Zd.BEFORE_DRAG,this.dragData),e.emit(Zd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:a}=e.p,h=!a||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=Zd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},h||s);a&&!s&&t?or.animateMove(e,l,r(a)?a:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Zd.OUT,t,i),e.emit(Zd.OVER,t,s)):e.emit(Zd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Zd.LEAVE,t,i,s),e.emit(Zd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=lc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Qd.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Zd.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=cc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=dc(t,e,Zd.data);s.path=i,this.interaction.emit($d.DROP,s),this.interaction.emit(Zd.LEAVE,t,i)}dragReset(){Zd.list=Zd.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 gc=$t.get("emit");const pc=["move","zoom","rotate","key"];function _c(t,e,i,s,n){if(pc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!mc(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&&fc(o,e,i,s,n)}}function fc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!mc(t,n)&&(Qh.updateEventStyle&&!s&&Qh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ce.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function mc(t,e){return e&&e.has(t)}const yc={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:vc,pathCanDrag:wc,pathHasOutside:xc}=rc;class bc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Pd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Pd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ld.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(yc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new _h(t),this.createTransformer(),this.dragger=new uc(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Pd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Gd.BEFORE_DOWN,t),this.emit(Gd.DOWN,t),Pd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Pd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Pd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Gd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Gd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Pd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Gd.BEFORE_UP,t),this.emit(Gd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Gd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Gd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(oc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ld.setDownCode(e),this.emit(oc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(oc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(oc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ld.setUpCode(e),this.emit(oc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new _h),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Gd.OUT,t,i),this.emit(Gd.OVER,t,e)):this.emit(Gd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(Gd.LEAVE,t,i,e),this.emit(Gd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Gd.LEAVE,t),this.dragger.dragging&&this.emit($d.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[Gd.DOUBLE_TAP,Gd.DOUBLE_CLICK].some(e=>vc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;y.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&&!xc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!wc(t.path))&&!xc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Gd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&<.round(s),s}emitTap(t){this.emit(Gd.TAP,t),this.emit(Gd.CLICK,t)}emitDoubleTap(t){this.emit(Gd.DOUBLE_TAP,t),this.emit(Gd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(Gd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Gd.LONG_TAP,t),(vc(t.path,Gd.LONG_TAP)||vc(t.path,Gd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(r(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Vr.RESIZE,this.__onResize,this)],t.once(qr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let 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],fc(n,t,e,!0,s))return;n.isApp&&_c(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&_c(n,t,e,!1,s),fc(n,t,e,!1,s))return}catch(t){gc.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 kc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}kc.custom={};class Sc extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new _h,this.pixelList=new _h}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),re.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),re.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()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())};const{toInnerRadiusPointOf:Ec,copy:Bc,setRadius:Tc}=lt,{hitRadiusPoint:Rc,hitPoint:Cc}=Ht,Oc={},Lc={},Pc=nh.prototype;Pc.hit=function(t,e=0){this.updateLayout(),Bc(Lc,t),Tc(Lc,e);const i=this.__world;return!!(e?Rc(i,Lc):Cc(i,Lc))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},Lc),e,{target:this}):this.__hitWorld(Lc))},Pc.__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&&(Bc(Oc,t),Tc(t=Oc,e.hitRadius)),Ec(t,i,Oc),e.hitBox||n){if(Ht.hitRadiusPoint(s.boxBounds,Oc))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Oc)},Pc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Pc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Pc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Pc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Ac=new ft,Dc=Pl.prototype;Dc.__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=y.image.hitCanvasSize,r=o.hitScale=qt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=qt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),$n.patternLocked=!0,this.__renderShape(o,{matrix:Ac.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),$n.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},Dc.__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 Mc=Pl.prototype,Fc=Il.prototype,Ic=Hl.prototype;Fc.__updateHitCanvas=Ic.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Mc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Fc.__hitFill=Ic.__hitFill=function(t){return this.__hitCanvas?Mc.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},Bd.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))},Al.prototype.pick=function(t,i){return i||(i=e),this.updateLayout(),y.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Wc=Ce.prototype;function zc(t,e,i){t.__.__font?Gh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Yc(t,e,i,s,n){const o=i.__;d(t)?Gh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Gh.strokeArrow(t,i,s,n)}function Nc(t,e,i,s,n){const o=i.__;d(t)?Gh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),Gh.drawTextStroke(i,s,n))}function Xc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Nc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",Gh.fillText(i,o,n),o.blendMode="normal",or.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}Wc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Wc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Wc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),qt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Hc,copyAndSpread:Vc,toOuterOf:jc,getOuterOf:Uc,getByMove:Gc,move:qc,getIntersectData:Kc}=Ht,Zc={};let Jc;const{stintSet:$c}=g,{hasTransparent:Qc}=Vh;function tu(t,e,s){if(!d(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:r}=s.__layout;switch(e.type){case"image":o=qh.image(s,t,e,r,!Jc||!Jc[e.url]);break;case"linear":o=Kh.linearGradient(e,r);break;case"radial":o=Kh.radialGradient(e,r);break;case"angular":o=Kh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;o={type:n,style:Vh.string(a,h)};break;default:i(e.r)||(o={type:"solid",style:Vh.string(e)})}if(o){if(n(o.style)&&Qc(o.style)&&(o.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}e.editing&&(o.editing=e.editing),e.blendMode&&(o.blendMode=e.blendMode)}return o}const eu={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];l(a)||(a=[a]),Jc=qh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=tu(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?($c(i,"__isAlphaPixelFill",n),$c(i,"__isTransparentFill",o)):($c(i,"__isAlphaPixelStroke",n),$c(i,"__isTransparentStroke",o),$c(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i,s){i.fillStyle=t,zc(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(qh.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),zc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),zc(e,i,s),i.restoreBlendMode()):zc(e,i,s)}},fillPathOrText:zc,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)Gh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Yc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Yc(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)Yc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Yc(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){Gh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Nc(t,1,e,i,s);break;case"inside":Xc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Nc(t,2,e,i,s):Xc(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||!qh.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?Gh.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?Gh.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;jc(r.strokeSpread?(Vc(Zc,r.boxBounds,r.strokeSpread),Zc):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(y.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Hc(n,T.swapAndScale(r.renderShapeSpread,p,_)):n;s=Kc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=Uc(a,c),h=Gc(u,-c.e,-c.f),l=Uc(o,c),qc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let iu,su=new Gt;const{isSame:nu}=Ht;function ou(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||qh.createData(n,s,i,o),!0}function ru(t,e){lu(t,Ir.LOAD,e)}function au(t,e){lu(t,Ir.LOADED,e)}function hu(t,e,i){e.error=i,t.forceUpdate("surface"),lu(t,Ir.ERROR,e)}function lu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ir(e,i))}function du(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:cu,translate:uu}=$,gu=new Gt,pu={},_u={};function fu(t,e,i,s){const o=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let mu={},yu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:vu,set:wu,rotateOfOuter:xu,translate:bu,scaleOfOuter:ku,multiplyParent:Su,scale:Eu,rotate:Bu,skew:Tu}=$;function Ru(t,e,i,s,n,o,r,a){r&&Bu(t,r),a&&Tu(t,a.x,a.y),n&&Eu(t,n,o),bu(t,e.x+i,e.y+s)}const{get:Cu,scale:Ou,copy:Lu}=$,{getFloorScale:Pu}=I,{abs:Au}=Math;const Du={image:function(t,e,i,s,n){let o,r;const a=$n.get(i);return iu&&i===iu.paint&&nu(s,iu.boxBounds)?o=iu.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),iu=a.use>1?{leafPaint:o,paint:i,boxBounds:su.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(ou(t,e,i,a,o,s),n&&(ru(t,r),au(t,r))):a.error?n&&hu(t,r,a.error):(n&&(du(t,!0),ru(t,r)),o.loadId=a.load(()=>{du(t,!1),t.destroyed||(ou(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),au(t,r)),o.loadId=void 0},e=>{du(t,!1),hu(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}=qh.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"===y.name&&Vr.isResizing(i)||l||(e=y.image.isLarge(a,o,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),qh.drawImage(t,o,r,i,s,n),!0):(!t.style||t.sync||l?qh.createPattern(t,i,s,n):qh.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 g,{width:p,height:_}=a;d&&!d.onlyScale||(g=u.path||u.cornerRadius)||l||h?(n.save(),g&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,_),n.restore()):(r.scaleX&&(p*=r.scaleX,_*=r.scaleY),n.drawImage(c,0,0,p,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.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(l(i)){let s,n,o,r,a;for(let h=0,d=i.length;h<d;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,$n.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],l(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=$n.patternTasker.add(()=>_e(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&qh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=qh.getImageRenderScaleData(t,e,i,s),r=n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!y.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=qh.getPatternFixScale(t,n,o);let d,c,u,{width:g,height:p}=i;l&&(n*=l,o*=l),g*=n,p*=o,h&&(c=h.x*n/Au(s.scaleX||1),u=h.y*o/Au(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=Pu(g+(c||0)),o*=Pu(p+(u||0)),d=Cu(),a&&Lu(d,a),Ou(d,1/n,1/o));const _=i.getCanvas(g,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=y.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=qh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=gu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:o}=i,{opacity:r,mode:a,align:h,offset:l,scale:c,size:u,rotation:g,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Ht.set(_u,0,0,x?o:s,x?s:o),a&&"cover"!==a&&"fit"!==a?((c||u)&&(I.getScaleData(c,u,i,pu),b=pu.scaleX,k=pu.scaleY),(h||m||f)&&(b&&Ht.scale(_u,b,k,!0),h&&Bt.toPoint(h,_u,e,_u,!0,!0))):v&&!g||(b=k=Ht.getFitScale(e,_u,"fit"!==a),Ht.put(e,i,h,b,!1,_u),Ht.scale(_u,b,k,!0)),l&<.move(_u,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/o,qh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(_u.x||_u.y||b||_||g||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),qh.clipMode(w,e,_u.x,_u.y,b,k,g,p,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||p)&&qh.repeatMode(w,e,s,o,_u.x,_u.y,b,k,g,p,h,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;d(t)?(o=t.x,r=t.y):o=r=t;return{x:fu(o,i,n.width,e&&e.x),y:fu(r,s,n.height,e&&e.y)}}(m,i&&f,_u.width,_u.height,e));break;default:b&&qh.fillOrFitMode(w,e,_u.x,_u.y,b,k,g)}return w.transform||(e.x||e.y)&&uu(w.transform=cu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=vu(),{x:o,y:r}=e;o||r?bu(n,o,r):n.onlyScale=!0,Eu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=vu();bu(a,e.x+i,e.y+s),Eu(a,n,o),r&&xu(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=vu();Ru(d,e,i,s,n,o,r,a),h&&(r||a?(wu(yu),ku(yu,e,h,l),Su(d,yu)):ku(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=vu();if(c)Ru(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)xu(u,{x:i/2,y:s/2},h);else switch(Bu(u,h),h){case 90:bu(u,s,0);break;case 180:bu(u,i,s);break;case 270:bu(u,0,i)}mu.x=e.x+n,mu.y=e.y+o,bu(u,mu.x,mu.y),r&&ku(u,mu,r,a)}t.transform=u}},{toPoint:Mu}=kt,{hasTransparent:Fu}=Vh,Iu={},Wu={};function zu(t,e,i,s){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],n(o)?(a=t/(l-1),r=Vh.string(o,s)):(a=o.offset,r=Vh.string(o.color,s)),e.addColorStop(a,r),!h&&Fu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Yu,getDistance:Nu}=lt,{get:Xu,rotateOfOuter:Hu,scaleOfOuter:Vu}=$,{toPoint:ju}=kt,Uu={},Gu={};function qu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Yu(e,i);o=Xu(),n?(Vu(o,e,r/a*(s||1),1),Hu(o,e,t+90)):(Vu(o,e,1,r/a*(s||1)),Hu(o,e,t))}return o}const{getDistance:Ku}=lt,{toPoint:Zu}=kt,Ju={},$u={};const Qu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Mu(i||"top",e,Iu),Mu(s||"bottom",e,Wu);const r=y.canvas.createLinearGradient(Iu.x,Iu.y,Wu.x,Wu.y),a={type:n,style:r};return zu(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;ju(i||"center",e,Uu),ju(s||"bottom",e,Gu);const a=y.canvas.createRadialGradient(Uu.x,Uu.y,0,Uu.x,Uu.y,Nu(Uu,Gu)),h={type:n,style:a};zu(h,a,t.stops,o);const l=qu(e,Uu,Gu,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;Zu(i||"center",e,Ju),Zu(s||"bottom",e,$u);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,Ju.x,Ju.y):y.canvas.createRadialGradient(Ju.x,Ju.y,0,Ju.x,Ju.y,Ku(Ju,$u)),h={type:n,style:a};zu(h,a,t.stops,o);const l=qu(e,Ju,$u,r||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:qu},{copy:tg,move:eg,toOffsetOutBounds:ig}=Ht,{max:sg,abs:ng}=Math,og={},rg=new ft,ag={};function hg(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=ng(t.spread||0),r=sg(r,n+o-s),a=sg(a,n+o+i),h=sg(h,n+o+s),l=sg(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function lg(t,e,i){const{shapeBounds:s}=i;let n,o;y.fullImageShadow?(tg(og,t.bounds),eg(og,e.x-s.x,e.y-s.y),n=t.bounds,o=og):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:dg}=Ht,cg={};const ug=hg;const gg={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;ig(h,ag,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(ag.offsetX+(r.x||0)*c*f,ag.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Vh.string(r.color)),n=Zh.getShadowTransform(t,g,i,r,ag,f),n&&g.setTransform(n),lg(g,ag,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),or.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;dg(h,cg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(cg.offsetX+(r.x||0)*c*f,cg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=Zh.getShadowTransform(t,g,i,r,cg,f,!0),n&&g.setTransform(n),lg(g,cg,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Vh.string(r.color),"source-in"),or.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:hg,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 rg.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),rg}},isTransformShadow(t){},getInnerShadowSpread:ug},{excludeRenderBounds:pg}=gr;let _g;function fg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":_g||(_g=!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);yg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":yg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function mg(t){return t.getSameCanvas(!1,!0)}function yg(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)}Al.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&&(fg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||pg(i,e)||i.__render(t,e),o=i.__.opacity,_g=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=mg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=mg(t)),n||(n=mg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&fg(this,r,t,n,s,o,void 0,!1),pg(i,e)||i.__render(n||t,e),d&&fg(this,r,t,n,s,o,d,!1)}fg(this,r,t,n,s,o,void 0,!0)};const vg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",wg=vg+"_#~&*+\\=|≮≯≈≠=…",xg=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function bg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const kg=bg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Sg=bg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Eg=bg(vg),Bg=bg(wg),Tg=bg("- —/~|┆·");var Rg;!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"}(Rg||(Rg={}));const{Letter:Cg,Single:Og,Before:Lg,After:Pg,Symbol:Ag,Break:Dg}=Rg;function Mg(t){return kg[t]?Cg:Tg[t]?Dg:Sg[t]?Lg:Eg[t]?Pg:Bg[t]?Ag:xg.test(t)?Og:Cg}const Fg={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 Ig(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:Wg}=Fg,{Letter:zg,Single:Yg,Before:Ng,After:Xg,Symbol:Hg,Break:Vg}=Rg;let jg,Ug,Gg,qg,Kg,Zg,Jg,$g,Qg,tp,ep,ip,sp,np,op,rp,ap,hp=[];function lp(t,e){Qg&&!$g&&($g=Qg),jg.data.push({char:t,width:e}),Gg+=e}function dp(){qg+=Gg,jg.width=Gg,Ug.words.push(jg),jg={data:[]},Gg=0}function cp(){np&&(op.paraNumber++,Ug.paraStart=!0,np=!1),Qg&&(Ug.startCharSize=$g,Ug.endCharSize=Qg,$g=0),Ug.width=qg,rp.width?Wg(Ug):ap&&up(),hp.push(Ug),Ug={words:[]},qg=0}function up(){qg>(op.maxWidth||0)&&(op.maxWidth=qg)}const{top:gp,right:pp,bottom:_p,left:fp}=wt;function mp(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){n(t)||(t=String(t));let i=0,s=0,o=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(i=a[fp],o-=a[pp]+a[fp],!o&&(o=.01)):e.autoSizeAlign||(i=a[fp]),r?(s=a[gp],r-=a[gp]+a[_p],!r&&(r=.01)):e.autoSizeAlign||(s=a[gp]));const h={bounds:{x:i,y:s,width:o,height:r},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){op=t,hp=t.rows,rp=t.bounds,ap=!rp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=y,{width:a}=rp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;np=!0,ep=null,$g=Jg=Qg=Gg=qg=0,jg={data:[]},Ug={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)Zg=e[i],"\n"===Zg?(Gg&&dp(),Ug.paraEnd=!0,cp(),np=!0):(tp=Mg(Zg),tp===zg&&"none"!==o&&(Zg=Ig(Zg,o,!Gg)),Jg=r.measureText(Zg).width,s&&(s<0&&(Qg=Jg),Jg+=s),ip=tp===Yg&&(ep===Yg||ep===zg)||ep===Yg&&tp!==Xg,sp=!(tp!==Ng&&tp!==Yg||ep!==Hg&&ep!==Xg),Kg=np&&n?a-n:a,t&&a&&qg+Gg+Jg>Kg&&(h?(Gg&&dp(),qg&&cp()):(sp||(sp=tp===zg&&ep==Xg),ip||sp||tp===Vg||tp===Ng||tp===Yg||Gg+Jg>Kg?(Gg&&dp(),qg&&cp()):qg&&cp()))," "===Zg&&!0!==np&&qg+Gg===0||(tp===Vg?(" "===Zg&&Gg&&dp(),lp(Zg,Jg),dp()):ip||sp?(Gg&&dp(),lp(Zg,Jg)):lp(Zg,Jg)),ep=tp);Gg&&dp(),qg&&cp(),hp.length>0&&(hp[hp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{op.paraNumber++,qg=r.measureText(t).width,hp.push({x:n||0,text:t,width:qg,paraStart:!0}),ap&&up()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":mp(e,"x",t[fp]);break;case"right":mp(e,"x",-t[pp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":mp(e,"y",t[gp]);break;case"bottom":mp(e,"y",-t[_p])}}(a,h,e,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:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,o),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?y.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,o),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,d(o)?(i=o.type,o.color&&(t.decorationColor=Vh.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 vp={string:function(t,e){if(!t)return"#000";const s=r(e)&&e<1;if(n(t)){if(!s||!Vh.object)return t;t=Vh.object(t)}let o=i(t.a)?1:t.a;s&&(o*=e);const a=t.r+","+t.g+","+t.b;return 1===o?"rgb("+a+")":"rgba("+a+","+o+")"}};function wp(t){return t?l(t)?t:[t]:[]}Object.assign(Hh,yp),Object.assign(Vh,vp),Object.assign(Gh,eu),Object.assign(qh,Du),Object.assign(Kh,Qu),Object.assign(Zh,gg),Object.assign(re,{interaction:(t,e,i,s)=>new bc(t,e,i,s),hitCanvas:(t,e)=>new yh(t,e),hitCanvasManager:()=>new Sc}),wh();class xp extends Pr{get list(){return wp(this.value)}get oldList(){return wp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function bp(t){return(e,i)=>{const s="_"+i;so(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(d(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),l(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?xp.BEFORE_SELECT:xp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new xp(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}xp.BEFORE_SELECT="editor.before_select",xp.SELECT="editor.select",xp.AFTER_SELECT="editor.after_select",xp.BEFORE_HOVER="editor.before_hover",xp.HOVER="editor.hover";const{abs:kp}=Math,{copy:Sp,scale:Ep}=$,{setListWithFn:Bp}=Ht,{worldBounds:Tp}=gr,Rp={a:1,b:0,c:0,d:1,e:0,f:0},Cp={x:0,y:0,width:0,height:0};class Op extends Pl{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?(Bp(Cp,e,Tp),t&&this.set(t),this.set(Cp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:r,strokeWidth:a,fill:h}=o,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=kp(c.scaleX),l=kp(c.scaleY);if(Sp(Rp,c),Rp.half=a%2,i!==l){Ep(Rp,1/i,1/l),t.setWorld(Rp,e.matrix),t.beginPath(),o.strokeWidth=a;const{x:n,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,r*l,h*i,d*l)}else t.setWorld(Rp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=a/kp(c.scaleX);r&&(n(r)?Gh.stroke(r,this,t,e):Gh.strokes(r,this,t,e)),h&&(n(h)?Gh.fill(h,this,t,e):Gh.fills(h,this,t,e))}}o.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}pe([bp(function(t){const e=t.target;t.list=e?l(e)?e:[e]:[]})],Op.prototype,"target",void 0);class Lp extends Al{constructor(t){super(t),this.strokeArea=new Il({strokeAlign:"center"}),this.fillArea=new Il,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 Pp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Ap([t],i,e),i}};function Ap(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&&Ap(s.children,e,i)}}const{findOne:Dp,findByBounds:Mp}=Pp;class Fp extends Al{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 Op,this.targetStroker=new Op,this.bounds=new Gt,this.selectArea=new Lp,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 _h(Mp(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)&&!Dp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new _h(this.editor.editBox.rect)};return Dp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Dp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[xp.HOVER,this.onHover,this],[xp.SELECT,this.onSelect,this]]),e.on_([[Gd.MOVE,this.onPointerMove,this],[Gd.BEFORE_DOWN,this.onBeforeDown,this],[Gd.TAP,this.onTap,this],[Zd.START,this.onDragStart,this,!0],[Zd.DRAG,this.onDrag,this],[Zd.END,this.onDragEnd,this],[Qd.MOVE,this.onAutoMove,this],[[nc.ZOOM,Qd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Ip,top:Wp,topRight:zp,right:Yp,bottomRight:Np,bottom:Xp,bottomLeft:Hp,left:Vp}=xt,{toPoint:jp}=kt,{within:Up,sign:Gp}=I,{abs:qp}=Math,Kp={getScaleData(t,e,i,s,n,o,a,h){let l,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Gp(x),S=Gp(b),E=h?x:k*p.width/v,B=h?b:S*p.height/w;if(r(s))u=g=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case Wp:g=t,l="bottom";break;case Yp:u=e,l="left";break;case Xp:g=r,l="top";break;case Vp:u=a,l="right";break;case Ip:g=t,u=a,l="bottom-right";break;case zp:g=t,u=e,l="bottom-left";break;case Np:g=r,u=e,l="top-left";break;case Hp:g=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case Wp:case Xp:u=g;break;case Vp:case Yp:g=u;break;default:d=Math.sqrt(qp(u*g)),u=Gp(u)*d,g=Gp(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!a){const{worldTransform:e}=t;u<0&&(u=1/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(jp(o||l,p,c,!0),m){const e={x:u,y:g};jd.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=Up(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=Up(e*g,f)/e}return T&&qp(u*y.width)<1&&(u=Gp(u)/y.width),R&&qp(g*y.height)<1&&(g=Gp(g)/y.height),n&&u!==g&&(d=Math.min(qp(u),qp(g)),u=Gp(u)*d,g=Gp(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case Ip:o="bottom-right";break;case zp:o="bottom-left";break;case Np:o="top-left";break;case Hp:o="top-right";break;default:o="center"}return jp(n||o,t.boxBounds,r,!0),{origin:r,rotation:lt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Wp:case Ip:o={x:.5,y:0},n="bottom",a=1;break;case Xp:case Np:o={x:.5,y:1},n="top",a=1;break;case Vp:case Hp:o={x:0,y:.5},n="right",h=1;break;case Yp:case zp: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,jp(s||n,t,r,!0);const c=lt.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 Vp:t=Yp;break;case Ip:t=zp;break;case Hp:t=Np;break;case Yp:t=Vp;break;case zp:t=Ip;break;case Np:t=Hp}if(i)switch(t){case Wp:t=Xp;break;case Ip:t=Hp;break;case zp:t=Np;break;case Xp:t=Wp;break;case Hp:t=Ip;break;case Np:t=zp}return t}},Zp={};function Jp(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 $p(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*(Kp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(I.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;Zp[S]?i.cursor=Zp[S]:Zp[S]=i.cursor={url:Qp(x,h),x:b,y:k}}function $p(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Qp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class t_ extends Hl{constructor(t){super(t),this.useFastShadow=!0}}const e_=["top","right","bottom","left"],i_=void 0;class s_ extends Al{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return n(t)||n(e)||n(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Al,this.rect=new t_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new t_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Al({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new t_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new t_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new t_({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:n,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])),n.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:i_},e.rect||{}));const f=s(e.rectThrough)?i:e.rectThrough;n.hittable=!f,f&&(t.syncEventer=n,this.app.interaction.bottomList=[{target:n,proxy:t}]),i&&g.stintSet(t.__world,"ignorePixelSnap",d),$p(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:a,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:p,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Ht.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=r(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)kt.toPoint(kt.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!p),v.visible=y&&p&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,_&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),a.visible=y&&a.children.length>0||0,a.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=e_.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=e_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Kp.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:i_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return l(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return l(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return l(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)}Jp(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&&(Vr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof Zd||t instanceof Qd)&&this.transformTool.onMove(t),this.resizing&&(Vr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),n(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case Qd.START:this.onTransformStart(t);break;case Qd.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case nc.START:this.onTransformStart(t);break;case nc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case nc.START:this.onTransformStart(t);break;case nc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Jp(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Bd)||t.find(t=>t instanceof Bd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Zd.START,this.onDragStart,this],[Zd.DRAG,this.onDrag,this],[Zd.END,this.onDragEnd,this],[Gd.ENTER,e=>{this.enterPoint=t,Jp(this,e)}],[Gd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[Gd.DOUBLE_TAP,this.onDoubleTap,this],[Gd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[oc.HOLD,oc.UP],this.onKey,this],[oc.DOWN,this.onArrow,this],[[Qd.START,Qd.BEFORE_MOVE,Qd.END],this.onMove,this,!0],[[nc.START,nc.BEFORE_ZOOM,nc.END],this.onScale,this,!0],[[ic.START,ic.BEFORE_ROTATE,ic.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const n_={x:0,y:0,width:1e5,height:1e5};class o_ extends Pl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,n_),Object.assign(this.__world,n_)}__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 r_='\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"/>',a_={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${r_}\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${r_}\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${r_}\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},h_=new Gt;function l_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{h_.setListWithFn(i,t=>t.getBounds("box","page")),0===h_.width&&(h_.width=.1),0===h_.height&&(h_.height=.1),e.reset(h_.get())}),s.add(e)}const d_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),c_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),u_={group(t,e,i){t.sort(c_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Al(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(d_);const r=new ft(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(d_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(c_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},g_=$t.get("EditToolCreator");function p_(){return t=>{f_.register(t)}}const __=p_,f_={list:{},register(t){const{tag:e}=t.prototype;m_[e]&&g_.repeat(e),m_[e]=t},get:(t,e)=>new m_[t](e)},{list:m_}=f_;class y_ extends xp{constructor(t,e){super(t,e)}}y_.BEFORE_OPEN="innerEditor.before_open",y_.OPEN="innerEditor.open",y_.BEFORE_CLOSE="innerEditor.before_close",y_.CLOSE="innerEditor.close";class v_ extends xp{constructor(t,e){super(t,e)}}v_.BEFORE_GROUP="editor.before_group",v_.GROUP="editor.group",v_.BEFORE_UNGROUP="editor.before_ungroup",v_.UNGROUP="editor.ungroup",v_.BEFORE_OPEN="editor.before_open_group",v_.OPEN="editor.open_group",v_.BEFORE_CLOSE="editor.before_close_group",v_.CLOSE="editor.close_group";const{updateMatrix:w_}=or,x_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},b_="top-left";class k_ extends Il{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&&x_[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,w_(this.parent),w_(this);const a=new ft(this.__world);switch(r[i]=s,this.__layout.rotationChange(),w_(this),this.changedTransform=new ft(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(b_,o);break;case"scaleX":t.scaleOf(b_,o,1);break;case"scaleY":t.scaleOf(b_,1,o);break;case"skewX":t.skewOf(b_,o,0);break;case"skewY":t.skewOf(b_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class S_ extends xp{constructor(t,e){super(t,e)}}S_.BEFORE_MOVE="editor.before_move",S_.MOVE="editor.move";class E_ extends xp{constructor(t,e){super(t,e)}}E_.BEFORE_SCALE="editor.before_scale",E_.SCALE="editor.scale";class B_ extends xp{constructor(t,e){super(t,e)}}B_.BEFORE_ROTATE="editor.before_rotate",B_.ROTATE="editor.rotate";class T_ extends xp{constructor(t,e){super(t,e)}}T_.BEFORE_SKEW="editor.before_skew",T_.SKEW="editor.skew";class R_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:a}=i;const h=t.type===Qd.END||t.type===Zd.END,l=n(e.draggable),d=!a||h||l,c={x:t.totalX,y:t.totalY};t instanceof Qd&<.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),o=Zd.getValidMove(e,s.point,c,d),(o.x||o.y)&&(a&&!l&&h?or.animateMove(this,o,r(a)?a:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof nc?(r=e.getBoxPoint(t),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=Kp.getScaleData(e,n.bounds,d,o,a,Kp.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof Zd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),lt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof ic)d=t.rotation,l=o?kt.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=Kp.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=I.float(I.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),lt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Kp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Kp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;d(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(d(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 S_(S_.BEFORE_MOVE,h));const l=new S_(S_.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 E_(E_.BEFORE_SCALE,t));const o=new E_(E_.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(d(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:c};this.emitEvent(new E_(E_.BEFORE_SCALE,u));const g=new E_(E_.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new ft(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 E_(E_.BEFORE_SCALE,r));const a=new E_(E_.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:a}=s;if(a){const s=a({target:i,origin:t,rotation:e});if(r(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 B_(B_.BEFORE_ROTATE,d));const c=new B_(B_.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(d(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:c};this.emitEvent(new T_(T_.BEFORE_SKEW,u));const g=new T_(T_.SKEW,u);this.doSkew(g),this.emitEvent(g)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(or.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ft(e.worldTransform);return t(),new ft(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let C_=class extends Al{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 _h,this.openedGroupList=new _h,this.simulateTarget=new k_(this),this.editBox=new s_(this),this.editToolList={},this.selector=new Fp(this),this.editMask=new o_(this),this.targetEventIds=[];let i=g.clone(a_);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),oe.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?l(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&&l_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||f_.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(n(s))e=s;else if(!1===s)return}if(f_.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(v_.BEFORE_GROUP),this.target=u_.group(this.list,this.element,t),this.emitGroupEvent(v_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(v_.BEFORE_UNGROUP,t)),this.target=u_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(v_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(v_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(v_.OPEN,t)}closeGroup(t){this.emitGroupEvent(v_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(v_.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 v_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||f_.get(t,this)}openInnerEditor(t,e,i){let s;if(n(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(n(i))s=i;else if(!1===i)return}f_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(y_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(y_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(y_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(y_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new y_(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&&(u_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(u_.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_(Gr.START,this.onRenderStart,this),i&&i.on_(Mr.SCROLL,this.onChildScroll,this),t.on_(Gr.CHILD_START,this.onAppRenderStart,this),t.on_(qr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};pe([(t,e)=>{so(t,e,{get(){const{config:t,element:e,dragPoint:n,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),n&&(n.editConfig&&Object.assign(a,n.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===n.pointType&&(a.around||(a.around="center"),s(a.lockRatio)&&(a.lockRatio=!0))),i(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],C_.prototype,"mergeConfig",void 0),pe([bp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof _h?i:new _h(i),t.multiple&&l_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new xp(xp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new xp(xp.AFTER_SELECT,s))})],C_.prototype,"target",void 0),pe([bp(function(t,e){t.emitEvent(new xp(xp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],C_.prototype,"hoverTarget",void 0),C_=pe([jo(R_,["editBox","editTool","emitEvent"])],C_);class O_{static registerInnerEditor(){f_.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 Al,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let L_=class extends O_{static registerEditTool(){f_.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()}};L_=pe([p_()],L_);const{left:P_,right:A_}=xt,{move:D_,copy:M_,toNumberPoints:F_}=lt;let I_=class extends L_{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===P_;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=F_(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?(D_(t,o,r),s&&D_(e,-o,-r)):(s&&D_(t,-o,-r),D_(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),M_(s[7],i),M_(e[7],i),M_(s[3],a),M_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===P_||t===A_,s[t].visible=a,e[t].visible=!r&&a}};I_=pe([p_()],I_);const{M:W_,L:z_,C:Y_,Q:N_,Z:X_,N:H_,D:V_,X:j_,G:U_,F:G_,O:q_,P:K_,U:Z_}=Pe,J_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case W_:case z_:$_(t,e,i,n,1),n+=3;break;case Y_:$_(t,e,i,n,3),n+=7;break;case N_:$_(t,e,i,n,2),n+=5;break;case X_:n+=1;break;case H_:$_(t,e,i,n,2),n+=5;break;case V_:$_(t,e,i,n,2),n+=9;break;case j_:$_(t,e,i,n,2),n+=6;break;case U_:$_(t,e,i,n,2),n+=9;break;case G_:$_(t,e,i,n,2),n+=5;break;case q_:t[n]=U_,t.splice(n+4,0,t[n+3],0),$_(t,e,i,n,2),n+=9,o+=2;break;case K_:t[n]=G_,t.splice(n+4,0,t[n+3]),$_(t,e,i,n,2),n+=5,o+=1;break;case Z_:$_(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:$_}=J_,Q_=$.get(),{topLeft:tf,top:ef,topRight:sf,right:nf,bottom:of,left:rf}=xt;function af(t,e,i){t.pathInputed?lf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function hf(t,e,s,n){let o=e;if(!i(n)){const i=t.__layout;let{width:r,height:a}=i.boxBounds;switch(r*=s-e,a*=e-s,n){case ef:case of:o=s,i.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case rf:case nf:i.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case tf:case sf:i.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=l(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function lf(t,e,i){J_.scale(t.__.path,e,i),t.path=t.__.path}function df(t,e,i){const{points:s}=t;d(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):J_.scalePoints(s,e,i),t.points=s}function cf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Q_.a=e,Q_.d=i,s[t].transform(Q_,!0)}const uf=nh.prototype;uf.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))},uf.__scaleResize=function(t,e){af(this,t,e)},uf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},uf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Bd.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)hf(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),af(this,t,e)}},Td.prototype.__scaleResize=function(t,e){lf(this,t,e)},md.prototype.__scaleResize=function(t,e){this.pathInputed?lf(this,t,e):this.points?df(this,t,e):this.width*=t},id.prototype.__scaleResize=function(t,e){this.pathInputed?lf(this,t,e):this.points?df(this,t,e):af(this,t,e)},Al.prototype.__scaleResize=function(t,e){cf(this,t,e)},Hl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||af(this,t,e),i&&cf(this,t,e)},oe.add("resize"),oe.add("editor","resize"),re.editor=function(t,e){const i=new C_(t);return e&&e.sky.add(e.editor=i),i},Hl.addAttr("textBox",!1,lo),Pl.addAttr("editConfig",void 0,lo),Pl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),lo),Pl.addAttr("editInner","PathEditor",lo),Al.addAttr("editInner","",lo),Bd.addAttr("editInner","TextEditor",lo),Pl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Pl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Pl.setEditInner=function(t){this.changeAttr("editInner",t)};const gf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},pf={top:"flex-start",middle:"center",bottom:"flex-end"},_f={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function ff(t,e,s){const{style:o}=t,{fill:r,padding:a,textWrap:h,textOverflow:c,textDecoration:u}=e;let g;o.fontFamily=e.fontFamily,o.fontSize=e.fontSize*s+"px",function(t,e){let s="black";l(e)&&(e=e[0]);if(d(e))switch(e.type){case"solid":s=Vh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];s=Vh.string(n(t)?t:t.color);break;default:i(e.r)||(s=Vh.string(e))}else s=e;t.color=s}(o,r),o.fontStyle=e.italic?"italic":"normal",o.fontWeight=e.fontWeight,d(u)?(g=u.type,u.color&&(o.textDecorationColor=Vh.string(u.color))):g=u,o.textDecoration=_f[g],o.textTransform=gf[e.textCase],o.textAlign="both"===e.textAlign?"justify":e.textAlign,o.display="flex",o.flexDirection="column",o.justifyContent=pf[e.verticalAlign],o.lineHeight=(e.__.__lineHeight||0)*s+"px",o.letterSpacing=(e.__.__letterSpacing||0)*s+"px",o.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",o.wordBreak="break"===h?"break-all":"normal",o.textIndent=(e.paraIndent||0)*s+"px",o.padding=l(a)?a.map(t=>t*s+"px").join(" "):(a||0)*s+"px",o.textOverflow="show"===c?"":"hide"===c?"clip":c}let mf=class extends O_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Bd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div"),{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(Gd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];a.setStartAfter(t),a.setEndAfter(t),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new ft(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||ff(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function yf(t,e,i){vf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Qd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(Qd.END,e=>{or.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(nc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function vf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&g.assign(i,e),g.assign(t.config,i,t.userConfig)}mf=pe([__()],mf),oe.add("text-editor","editor");const wf=$t.get("LeaferTypeCreator"),xf={list:{},register(t,e){bf[t]&&wf.repeat(t),bf[t]=e},run(t,e){const i=bf[t];i&&i(e)}},{list:bf,register:kf}=xf;kf("viewport",yf),kf("custom",function(t){yf(t,null,!0)}),kf("design",function(t){yf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),kf("document",function(t){yf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Sf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),n=lt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=lt.getDistance(e.from,i.from);return{move:o,scale:lt.getDistance(e.to,i.to)/r,rotation:lt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Ef,s=Ef.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Ef.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Ef.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Ef;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Ef=Sf,{abs:Bf,max:Tf}=Math,{sign:Rf,within:Cf}=I,Of={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Bf(s),r=Bf(n);return o>50&&(s=Tf(50,o/3)*Rf(s)),r>50&&(n=Tf(50,r/3)*Rf(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&&(y.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=Cf(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Cf(1-Bf(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Lf,Pf,Af,Df;class Mf{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Lf=0,Pf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Lf,totalY:Pf}),e.emit(Qd.START,this.moveData)),t.path=this.moveData.path,t.totalX=Lf+=t.moveX,t.totalY=Pf+=t.moveY,e.emit(Qd.BEFORE_MOVE,t),e.emit(Qd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Af=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Af}),e.emit(nc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Af*=t.scale,e.emit(nc.BEFORE_ZOOM,t),e.emit(nc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Df=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Df}),e.emit(ic.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Df+=t.rotation,e.emit(ic.BEFORE_ROTATE,t),e.emit(ic.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Qd.END,Object.assign(Object.assign({},e),{totalX:Lf,totalY:Pf})),i&&t.emit(nc.END,Object.assign(Object.assign({},i),{totalScale:Af})),s&&t.emit(ic.END,Object.assign(Object.assign({},s),{totalRotation:Df})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Ff=Fl.prototype,If=new Gt,Wf=new pt;function zf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Yf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Ff.initType=function(t){xf.run(t,this)},Ff.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(Wf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Wf.y=0:t.includes("y")?Wf.x=0:Math.abs(Wf.x)>Math.abs(Wf.y)?Wf.y=0:Wf.x=0,i&&t.includes("limit")&&(If.set(this.__world).addPoint(this.zoomLayer),jd.getValidMove(If,this.canvas.bounds,"inner",Wf,!0),t.includes("x")?Wf.y=0:t.includes("y")&&(Wf.x=0))}return{x:n?0:Wf.x,y:n?0:Wf.y}},Ff.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 Nf=bc.prototype;Nf.createTransformer=function(){this.transformer=new Mf(this)},Nf.move=function(t){this.transformer.move(t)},Nf.zoom=function(t){this.transformer.zoom(t)},Nf.rotate=function(t){this.transformer.rotate(t)},Nf.transformEnd=function(){this.transformer.transformEnd()},Nf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Of.getScale(t,e);if(1!==o)this.zoom(Yf(o,t));else{const s=e.getMove?e.getMove(t,e):Of.getMove(t,e);i.snap&<.round(s),this.move(zf(s,t))}},Nf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Sf.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Sf.detect(n,d(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Sf.reset()}o||(n.center=Sf.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(Yf(n.scale,t)),o&&this.move(zf(n.move,t))};const Xf=uc.prototype,{abs:Hf}=Math;function Vf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Xf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=Hf(i),o=Hf(s),a=e?1:.1,h=this.canAnimate&&this.moving&&(n>a||o>a)&&this.interaction.m.dragAnimate;if(h){const a="touch"===t.pointerType?3:1,l=70;n*(e=e?r(h)?h:.95:a)>l?e=l/n:o*e>l&&(e=l/o),t=Object.assign({},t),lt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Xf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Xf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Xf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Ht.maxX(r),d=Ht.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,lt.move(i,c,u),lt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},Xf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},oe.add("viewport"),oe.add("view"),Fl.prototype.zoom=function(t,e,i,o){let a;this.killAnimate(),c(e)?(a=e.padding,i=e.scroll,o=e.transition):a=e;const{zoomLayer:h}=this,u=this.canvas.bounds.clone().shrink(s(a)?30:a),g=new Gt,p={x:u.x+u.width/2,y:u.y+u.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(n(t))switch(t){case"in":_=Vf(y,"in");break;case"out":_=Vf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Gt(this.boxBounds)).height=0;break;case"fit-height":(t=new Gt(this.boxBounds)).width=0}else r(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(p,_,_,!1,o);else if(d(t)){const e={x:f,y:m,scaleX:y,scaleY:v},s=l(t);if(s||t.tag){const e=s?t:[t];g.setListWithFn(e,gr.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,u);g.set(h.getWorldBounds(e))}const{width:n,height:r}=g;let a=u.x-g.x,d=u.y-g.y;return i?(a+=Math.max((u.width-n)/2,0),d+=Math.max((u.height-r)/2,0)):(_=this.getValidScale(Math.min(u.width/n,u.height/r)),a+=(u.width-n*_)/2,d+=(u.height-r*_)/2,lt.scaleOf(e,g,_),g.scaleOf(g,_),e.scaleX*=_,e.scaleY*=_),"x"===i?d=0:"y"===i&&(a=0),lt.move(e,a,d),g.move(a,d),h.set(e,o),g}return h.worldBoxBounds};class jf extends Al{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&g.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;n(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Hl,this.scrollYBar=new Hl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Gt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Zd.DRAG,this.onDrag,this),e.on_(Zd.DRAG,this.onDrag,this),t.on_(Zd.END,this.onDragEnd,this),e.on_(Zd.END,this.onDragEnd,this),this.target.on_(Gr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Vr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}oe.add("scroll");class Uf extends bl{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:"≥"};let qf=class extends yd{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){n(t)?Gf[t]=e:Object.assign(Gf,t)}};pe([Fo(Uf)],qf.prototype,"__",void 0),pe([fo("")],qf.prototype,"text",void 0),pe([lo("TextEditor")],qf.prototype,"editInner",void 0),pe([Eo(!1)],qf.prototype,"textEditing",void 0),qf=pe([Uo()],qf),oe.add("html");class Kf extends gl{}function Zf(t){return ro(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,bo(this)}}}))}let Jf=class extends md{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Uh.register(t,e)}};pe([Fo(Kf)],Jf.prototype,"__",void 0),pe([Zf("angle")],Jf.prototype,"endArrow",void 0),Jf=pe([Uo()],Jf);const{M:$f,L:Qf,C:tm,Q:em,O:im}=Pe,{rotate:sm,copyFrom:nm,scale:om}=lt,rm={},am={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 $f:case Qf:hm(t,l+1,e,i,s,n,o,r),l+=3;break;case tm:for(h=1;h<6;h+=2)hm(t,l+h,e,i,s,n,o,r);l+=7;break;case em:for(h=1;h<4;h+=2)hm(t,l+h,e,i,s,n,o,r);l+=5;break;case im: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){am.layout(t,0,0,1,1,e,i)}};function hm(t,e,i,s,n,o,r,a){nm(rm,t[e],t[e+1]),r&&sm(rm,r,a),n&&om(rm,n,o),t[e]=i+rm.x,t[e+1]=s+rm.y}const{layout:lm,rotate:dm}=am,{getAngle:cm}=lt,um={x:-.5},gm={connect:um,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},pm={connect:um,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},_m={connect:um,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},fm={connect:um,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},mm={offset:um,path:[..._m.path],dashPath:[1,-2.5,0,2,-1,0]};dm(mm.path,180,{x:-1.5,y:0});const ym={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},vm={connect:{x:.5},path:[...ym.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},wm={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},xm={path:[...wm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},bm=g.clone(wm),km=g.clone(xm);dm(bm.path,45),dm(km.path,45);const Sm={angle:gm,"angle-side":pm,arrow:fm,triangle:_m,"triangle-flip":mm,circle:vm,"circle-line":ym,square:xm,"square-line":wm,diamond:km,"diamond-line":bm,mark:{offset:um,path:[1,0,-2,2,0,2]}};function Em(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:c}=t.__;d(e)?e.type?(h=e.scale,a=Sm[e.type]):a=e:a=Sm[e];const{offset:u,connect:g,path:p,dashPath:_}=a;let f=g?g.x:0,m=u?u.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===c&&u.roundJoin?m+=u.roundJoin:"bevel"===c&&u.bevelJoin&&(m+=u.bevelJoin)),h&&lm(y,0,0,h,h),m&&lm(y,m,0),lm(y,s.x,s.y,n,n,cm(i,s)),o.x=(f+m)*n,y}const{M:Bm,L:Tm,C:Rm,Q:Cm,Z:Om,N:Lm,D:Pm,X:Am,G:Dm,F:Mm,O:Fm,P:Im,U:Wm}=Pe,{copy:zm,copyFrom:Ym,getDistancePoint:Nm}=lt,Xm={},Hm={},Vm={},jm={},Um={},Gm={list:Sm,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 Bm:case Tm:(c<2||l+6>=d)&&(Ym(Um,o[l+1],o[l+2]),!c&&u&&zm(Hm,Um)),l+=3;break;case Rm:(1===c||l+7>=d-3)&&qm(o,jm,Um,l+3),l+=7;break;case Cm:(1===c||l+5>=d-3)&&qm(o,jm,Um,l+1),l+=5;break;case Om:return;case Lm:l+=5;break;case Pm:l+=9;break;case Am:l+=6;break;case Dm:l+=9;break;case Mm:l+=5;break;case Fm:l+=7;break;case Im:l+=4;break;case Wm:(1===c||l+6>=d-3)&&(qm(o,jm,Um,l+1),l+6!==d&&(Um.x-=(Um.x-jm.x)/10,Um.y-=(Um.y-jm.y)/10)),l+=6}if(c++,1===c&&h!==Bm)return;if(2===c&&u&&zm(Vm,h===Tm?Um:jm),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Em(t,e,Vm,Hm,s,Xm,!!n);n?d.push(...i):r.push(...i),Xm.x&&(Nm(Hm,Vm,-Xm.x,!0),r[1]=Vm.x,r[2]=Vm.y)}if(i&&"none"!==i){const e=Em(t,i,jm,Um,s,Xm,!!n);if(n?d.push(...e):r.push(...e),Xm.x){let t;switch(Nm(Um,jm,-Xm.x,!0),h){case Tm:t=l-3+1;break;case Rm:t=l-7+5;break;case Cm:t=l-5+3;break;case Wm:t=l-6+3}t&&Km(r,jm,t)}}}else zm(jm,Um)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function qm(t,e,i,s){Ym(e,t[s],t[s+1]),Ym(i,t[s+2],t[s+3])}function Km(t,e,i){t[i]=e.x,t[i+1]=e.y}oe.add("arrow"),Pl.addAttr("startArrow","none",Zf),Pl.addAttr("endArrow","none",Zf),Object.assign(Uh,Gm),Object.assign(Gh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Zm=class extends Hl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};pe([Fo(class extends dl{})],Zm.prototype,"__",void 0),pe([go("x")],Zm.prototype,"flow",void 0),Zm=pe([Uo()],Zm);const Jm={},$m={"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"},Qm={"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 ty(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Bt.toPoint(i,e,n,Jm),e.x=s.__autoWidth?n.x:Jm.x,e.y=s.__autoHeight?n.y:Jm.y}const{move:ey}=lt;function iy(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)),ey(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function sy(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 ny={};function oy(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:r,__autoHeight:a}=t.__,l=o&&(e?!r:!a);return d(i)?(ny.xGap=i.x||0,ny.yGap=i.y||0):ny.xGap=ny.yGap=h(i),ny.isAutoXGap=n(ny.xGap)&&!r,ny.isAutoYGap=n(ny.yGap)&&!a,ny.complex=l||"top-left"!==s||t.__hasGrow||ny.isAutoXGap||ny.isAutoYGap,ny.wrap=l,ny.complex&&(ny.isFitXGap="fit"===ny.xGap&&!r,ny.isFitYGap="fit"===ny.yGap&&!a,d(s)?(ny.contentAlign=s.content||"top-left",ny.rowXAlign=s.x||"from",ny.rowYAlign=s.y||"from"):(ny.contentAlign=s,ny.rowXAlign=$m[s],ny.rowYAlign=Qm[s])),ny}function ry(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function ay(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 hy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:ly}=I;function dy(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=cy(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=cy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function cy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?ly(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:uy}=I;function gy(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=py(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=py(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function py(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?uy(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:_y}=lt;function fy(t,e){const i="width",{children:s,itemBox:n}=t,o=oy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=hy(p,n),r?(p.__flowBounds=_,y||(y=ry(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?dy(t,y,x,e):d&&ay(y,i,x,c),sy(u,y,i),y=ry(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&py(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(_y(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?dy(t,y,x,e):d&&ay(y,i,x,c),a&&sy(u,y,i)),a?(s?ay(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){ty(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=$m[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],iy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(ty(t,y,r),iy(t,y,0,y.y,g,e))}}const{move:my}=lt;function yy(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)),my(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:vy}=lt;function wy(t,e){const i="height",{children:s,itemBox:n}=t,o=oy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=hy(p,n),r?(p.__flowBounds=_,y||(y=ry(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&gy(t,y,b,e),d&&ay(y,i,b,c),sy(u,y,i),y=ry(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&cy(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(vy(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&gy(t,y,b,e),d&&ay(y,i,b,c),a&&sy(u,y,i)),a?(s?ay(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){ty(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Qm[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],yy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(ty(t,y,r),yy(t,y,y.x,0,l,e))}}function xy(t){return ro(t,t=>({set(e){const i=r(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)&&yo(this)}}))}oe.add("flow","resize");const by=Hl.prototype,{__updateBoxBounds:ky}=Al.prototype;Pl.addAttr("flow",!1,go),Pl.addAttr("gap",0,fo),Pl.addAttr("flowAlign","top-left",fo),Pl.addAttr("flowWrap",!1,fo),Pl.addAttr("itemBox","box",fo),Pl.addAttr("inFlow",!0,fo),Pl.addAttr("autoWidth",void 0,xy),Pl.addAttr("autoHeight",void 0,xy),Pl.addAttr("autoBox",void 0,fo);const{copyAndSpread:Sy}=Ht;by.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:fy(this);break;case"y":wy(this);break;case"x-reverse":fy(this,!0);break;case"y-reverse":wy(this,!0)}t&&(this.leafer.created=!0)},by.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Sy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},by.__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():ky.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&&Sy(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:Ey,sin:By,pow:Ty,sqrt:Ry,abs:Cy,ceil:Oy,floor:Ly,round:Py,PI:Ay}=Math,Dy=5*Ay,My=1.70158,Fy=2.5949095,Iy=7.5625,Wy=2.75;function zy(t){return e=>Ty(e,t)}function Yy(t){return e=>1-Ty(1-e,t)}function Ny(t){return e=>e<.5?.5*Ty(2*e,t):1-.5*Ty(2-2*e,t)}function Xy(t){return t<1/Wy?Iy*t*t:t<2/Wy?Iy*(t-=1.5/Wy)*t+.75:t<2.5/Wy?Iy*(t-=2.25/Wy)*t+.9375:Iy*(t-=2.625/Wy)*t+.984375}function Hy(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=Vy(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Cy(l)<1e-6));e++)c-=d/l;return n[r]=Vy(c,e,s)}}function Vy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const jy={get(t){const{list:e}=jy;return n(t)?e[t||"ease"]:d(t)?e[t.name].apply(e,l(t.value)?t.value:[t.value]):e.ease},register(t,e){jy.list[t]=e},list:{linear:t=>t,ease:Hy(.25,.1,.25,1),"ease-in":Hy(.42,0,1,1),"ease-out":Hy(0,0,.58,1),"ease-in-out":Hy(.42,0,.58,1),"sine-in":t=>1-Ey(t*Ay*.5),"sine-out":t=>By(t*Ay*.5),"sine-in-out":t=>.5*(1-Ey(t*Ay)),"quad-in":zy(2),"quad-out":Yy(2),"quad-in-out":Ny(2),"cubic-in":zy(3),"cubic-out":Yy(3),"cubic-in-out":Ny(3),"quart-in":zy(4),"quart-out":Yy(4),"quart-in-out":Ny(4),"quint-in":zy(5),"quint-out":Yy(5),"quint-in-out":Ny(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-Ry(1-Ty(t,2)),"circ-out":t=>Ry(1-Ty(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Ry(1-Ty(2*t,2))):.5*(Ry(1-Ty(2-2*t,2))+1),"back-in":t=>((My+1)*t-My)*t*t,"back-out":t=>(t-=1)*t*((My+1)*t+My)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Fy+1)*t-Fy)*.5:.5*((t=2*t-2)*t*((Fy+1)*t+Fy)+2),"elastic-in":t=>0===t||1===t?t:-Ty(2,10*(t-1))*By((t-1.1)*Dy),"elastic-out":t=>0===t||1===t?t:Ty(2,-10*t)*By((t-.1)*Dy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Ty(2,10*((t*=2)-1))*By((t-1.1)*Dy)*.5:Ty(2,10*(1-(t*=2)))*By((t-1.1)*Dy)*.5+1,"bounce-in":t=>1-Xy(1-t),"bounce-out":Xy,"bounce-in-out":t=>t<.5?.5*(1-Xy(1-2*t)):.5*(1+Xy(2*t-1)),"cubic-bezier":Hy,steps:function(t,e="floor"){return i=>("floor"===e?Ly(i*t):"ceil"===e?Oy(i*t):Py(i*t))/t}}};function Uy(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 Gy{}Gy.CREATED="created",Gy.PLAY="play",Gy.PAUSE="pause",Gy.STOP="stop",Gy.SEEK="seek",Gy.UPDATE="update",Gy.COMPLETED="completed";let qy=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&&r(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=l(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=jy.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(Gy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Gy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Gy.STOP))}seek(t){this.destroyed||(d(t)&&(t=jh.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(Gy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:s,config:n}=this,{length:o}=s,a=!(o>1)||this.join;let h,l,d,c,u,g=0,p=0;o>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<o;n++){if(l=s[n],c=l.style||l,h||(h=a?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:a}=l;o&&(d.swing=r(o)?o:2,u=2*d.swing-1),a&&(d.loop=u=r(a)?a:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=jy.get(n))}if(!d.autoDuration&&i(d.duration)&&(o>1?n>0||a?p+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=g||!n||!n.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(Gy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,s){const{fromStyle:n,toStyle:o,target:r}=this;for(let a in e)i(n[a])&&(n[a]=o[a]=e===s?s[a]:r[a]),t.beforeStyle[a]=i(s[a])?o[a]:s[a],o[a]=e[a]}allocateTime(t){let e,{frames:s}=this,{length:n}=s;for(let o=0;o<n;o++)e=s[o],i(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(),y.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(Gy.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={}),tl.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(Gy.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 r(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};pe([Uy("ease")],qy.prototype,"easing",void 0),pe([Uy(0)],qy.prototype,"delay",void 0),pe([Uy(.2)],qy.prototype,"duration",void 0),pe([Uy("auto")],qy.prototype,"ending",void 0),pe([Uy(!1)],qy.prototype,"reverse",void 0),pe([Uy(!1)],qy.prototype,"swing",void 0),pe([Uy(!1)],qy.prototype,"loop",void 0),pe([Uy(0)],qy.prototype,"loopDelay",void 0),pe([Uy(1)],qy.prototype,"speed",void 0),pe([Uy(!0)],qy.prototype,"autoplay",void 0),pe([Uy()],qy.prototype,"join",void 0),pe([Uy()],qy.prototype,"attrs",void 0),qy=pe([jo(ua)],qy);let Ky=class extends qy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new qy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Gy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Gy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Gy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Gy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Gy.COMPLETED:this.completed&&this.emitType(t);break;case Gy.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)}};Ky=pe([jo(ua)],Ky);const Zy={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"},Jy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,$y=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Qy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,tv=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,ev=parseInt,iv=parseFloat,{round:sv}=Math;let nv={},ov=0;function rv(t){let e,i,s,n=1;switch(t.length){case 9:e=ev(t.slice(1,3),16),i=ev(t.slice(3,5),16),s=ev(t.slice(5,7),16),n=ev(t.slice(7,9),16)/255;break;case 7:e=ev(t.slice(1,3),16),i=ev(t.slice(3,5),16),s=ev(t.slice(5,7),16);break;case 5:e=ev(t[1]+t[1],16),i=ev(t[2]+t[2],16),s=ev(t[3]+t[3],16),n=ev(t[4]+t[4],16)/255;break;case 4:e=ev(t[1]+t[1],16),i=ev(t[2]+t[2],16),s=ev(t[3]+t[3],16);break;case 3:e=i=s=ev(t[1]+t[2],16);break;case 2:e=i=s=ev(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const av=1/6,hv=.5,lv=2/3,dv=1/3;function cv(t,e,i){return i<0?i++:i>1&&i--,i<av?t+6*(e-t)*i:i<hv?e:i<lv?t+(e-t)*(lv-i)*6:t}function uv(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=cv(a,s,t+dv),o=cv(a,s,t),r=cv(a,s,t-dv)}return{r:sv(255*n),g:sv(255*o),b:sv(255*r),a:s}}oe.add("color"),Vh.object=function(t,e){let s,o=!i(e)&&e<1;if(n(t)){const e=nv[t];if(e)s=Object.assign({},e);else{switch(t[0]){case"#":s=rv(t);break;case"R":case"r":"("===t[4]&&$y.test(t)?s=function(t){const e=$y.exec(t);return{r:ev(e[1]),g:ev(e[2]),b:ev(e[3]),a:iv(e[4])}}(t):"("===t[3]&&Jy.test(t)&&(s=function(t){const e=Jy.exec(t);return{r:ev(e[1]),g:ev(e[2]),b:ev(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&tv.test(t)?s=function(t){const e=tv.exec(t);return uv(iv(e[1]),iv(e[2]),iv(e[3]),iv(e[4]))}(t):"("===t[3]&&Qy.test(t)&&(s=function(t){const e=Qy.exec(t);return uv(iv(e[1]),iv(e[2]),iv(e[3]),1)}(t))}if(!s){const e=Zy[t.toLowerCase()];e&&(s=rv("#"+e))}s&&(ov++,ov>1e4&&(nv={},ov=0),nv[t]=Object.assign({},s))}}else d(t)&&(i(t.a)&&(t.a=1),o&&(t=Object.assign({},t)),s=t);return s||(s={r:255,g:255,b:255,a:1}),o&&(s.a*=e),s};const{round:gv}=Math,{fourNumber:pv}=I,_v={fill:wv,stroke:wv,cornerRadius:(t,e,i)=>r(t)&&r(e)?yv(t,e,i):(t=pv(t),e=pv(e),t.map((t,s)=>yv(t,e[s],i))),text(t,e,i){if(n(t)&&n(e)){const s=t.length,n=e.length,o=yv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return r(t)||r(e)?I.float(yv(t,e,i),Math.max(mv(t),mv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return tl.setBetweenStyle(n,t,e,n,i,s),n},shadow:xv,innerShadow:xv},fv={value:function(t,e,i){const s=r(t),n=r(e);return s&&n?t+(e-t)*i:n||s?yv(t,e,i):t},number:yv,color:vv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=tl;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 mv(t){const e=String(t).split(".")[1];return e?e.length:0}function yv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?gv(n):n}function vv(t,e,i){t=Vh.object(t),e=Vh.object(e);const s=yv(t.r,e.r,i,1)+","+yv(t.g,e.g,i,1)+","+yv(t.b,e.b,i,1),n=yv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function wv(t,e,i){return n(t)&&n(e)?vv(t,e,i):e}function xv(t,e,i){return l(t)||l(e)?e:(e=e||{},{x:yv((t=t||{}).x,e.x,i),y:yv(t.y,e.y,i),blur:yv(t.blur,e.blur,i),spread:yv(t.spread,e.spread,i),color:vv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}oe.add("animate","color"),Qh.canAnimate=!0,Object.assign(tl.list,_v),Object.assign(tl,fv);const bv=Pl.prototype;Pl.addAttr("animation",void 0,function(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Pl.addAttr("animationOut",void 0,lo),Pl.addAttr("transition",!0,lo),Pl.addAttr("transitionOut",void 0,lo),bv.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))},bv.animate=function(t,e,s,n){if(i(t))return this.__animate;let o=l(t)&&!e&&s?new Ky(this,t,n):new qy(this,t,e,n);this.killAnimate(s,o.toStyle);const r=this.__animate;return r&&(o instanceof Ky?o.list.unshift(r):o=new Ky(this,[r,o])),this.__animate=o},bv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Ky&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},bv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Gy.COMPLETED,e)};const kv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Sv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Ev}=Math,{getDerivative:Bv}=oi,Tv={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<kv.length;h++)l=f*(1+kv[h]),d=f*(1-kv[h]),c=Bv(l,t,i,n,r),u=Bv(l,e,s,o,a),g=Bv(d,t,i,n,r),p=Bv(d,e,s,o,a),_+=Sv[h]*(Ev(c*c+u*u)+Ev(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Bv(t,e,s,o,a),d=Bv(t,i,n,r,h);return Math.atan2(d,l)/z},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)Rv(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Pe.C,c,u,_,f,m,y)}},{getDistance:Rv}=Tv,{M:Cv,L:Ov,C:Lv,Z:Pv}=Pe,Av={},Dv={},Mv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Cv:case Ov:Mv.transformPoints(t,e,s,1),s+=3;break;case Lv:Mv.transformPoints(t,e,s,3),s+=7;break;case Pv:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Av.x=t[n],Av.y=t[n+1],$.toOuterPoint(e,Av),t[n]=Av.x,t[n+1]=Av.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 Cv:case Ov:i=t[a+1],s=t[a+2],e=n===Ov&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Lv:i=t[a+5],s=t[a+6],e=Tv.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 Pv: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=jh.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Cv:case Ov:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),Dv.x=y,Dv.y=v,_.x=r,_.y=a,lt.getDistancePoint(Dv,_,e-p,!0),_.rotation=lt.getAngle(Dv,_),_;y=r,v=a,f+=3;break;case Lv:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Tv.getT(e-p,o,y,v,l,d,c,u,r,a,i),oi.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=Tv.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Pv:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=jh.number(e,t.total);let r,a,h,l,d,c,u,g,p,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case Cv:case Ov:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),Dv.x=v,Dv.y=w,f.x=a,f.y=h,lt.getDistancePoint(Dv,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case Lv:if(d=n[m+1],c=n[m+2],u=n[m+3],g=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return p=Tv.getT(e-_,r,v,w,d,c,u,g,a,h,i),Tv.cut(o,p,v,w,d,c,u,g,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,g,a,h);break;case Pv:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function Fv(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!s(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}oe.add("motion-path"),tl.register("motion",function(t,e,i,s){return d(t)&&(t=jh.number(t,s.getMotionTotal())),d(e)&&(e=jh.number(e,s.getMotionTotal())),tl.number(t||0,e||0,i)}),tl.register("motionRotation",function(t,e,i){return tl.number(t,e,i)});const Iv=Pl.prototype,{updateMatrix:Wv,updateAllMatrix:zv}=or,{updateBounds:Yv}=mr;function Nv(t){const{motion:e,leaferIsCreated:i}=t;if(!s(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Hv(t);i.total&&(t.__.__pathForRender=Mv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(zv(t),Yv(t,t)):Wv(t));i&&(t.leafer.created=!0)}}function Xv(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 Hv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Mv.getMotionPathData(t.getPath(!0,!0))}function Vv(t,e){return ro(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Qh.setStyleName(this,e,i):Qh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function jv(t){return ro(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Uv(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 Gv(t,e){d(e)||(e=void 0),Zv(t,e,"in")}function qv(t,e){const{normalStyle:i}=t;d(e)||(e=void 0),i&&(e||(e=i),Zv(t,e,"out"))}Pl.addAttr("motionPath",void 0,Fv),Pl.addAttr("motionPrecision",1,Fv),Pl.addAttr("motion",void 0,Fv),Pl.addAttr("motionRotation",!0,Fv),Iv.getMotionPathData=function(){return Hv(Xv(this))},Iv.getMotionPoint=function(t){const e=Xv(this),i=Hv(e);if(!i.total)return{};const s=Mv.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:r(n)&&(s.rotation+=n),s},Iv.getMotionTotal=function(){return this.getMotionPathData().total},Iv.__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],s(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Nv(t))}else Nv(this)};const Kv={};function Zv(t,e,i){const{normalStyle:n}=t;e||(e=Kv),e.scale&&(I.assignScale(e,e.scale),delete e.scale),e!==Kv&&Qh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let n="in"===t?"transition":"transitionOut";"out"===t&&s(i[n])&&s(e[n])&&(n="transition");return s(e[n])?i[n]:e[n]}(i,e,t);const r=o?function(t,e){const i=Qv(e,t),s=t.animate();s&&Qv(i,t,s.fromStyle);return i}(t,e):void 0;Qh.canAnimate&&Jv(t)&&t.killAnimate("transition"),n&&t.set(n,"temp");const a=Jv(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=$v(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=$v(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function Jv(t){let e;const i={},s=Uv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Qh.isState(n,t,s)&&(e=tw(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Qh.isSelected(t,s)&&(e=tw(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Qh.isPlacehold(t,s)&&(e=tw(i,a)),Qh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=tw(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Qh.isFocus(t,s)&&(e=tw(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Qh.isHover(t,s)&&(e=tw(i,o));const r=i.pressStyle||t.pressStyle;r&&Qh.isPress(t,s)&&(e=tw(i,r))}return e?i:void 0}function $v(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Qh.animateExcludes[t]||(n[t]=e[t]);return n}function Qv(t,e,i){return $v(t,e,i,!0)}function tw(t,e){return Object.assign(t,e),!0}function ew(t,e){const i=t[e];i&&Gv(t,i),t.button&&sw(t.children,e)}function iw(t,e,i){i||(i=t.states[e]),Gv(t,i),t.button&&sw(t.children,null,e)}function sw(t,e,s){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":Qh.isHover(n)&&(o=!1);break;case"pressStyle":Qh.isPress(n)&&(o=!1);break;case"focusStyle":Qh.isFocus(n)&&(o=!1)}o&&ew(n,e)}else i(s)||iw(n,s);n.isBranch&&sw(n.children,e,s)}}function nw(t,e){const i=t[e];i&&qv(t,i),t.button&&rw(t.children,e)}function ow(t,e,i){qv(t,i),t.button&&rw(t.children,null,e)}function rw(t,e,s){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?nw(n,e):i(s)||ow(n,s),n.isBranch&&rw(n.children,e,s)}function aw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Uv(e,i);o&&(s=n[t](o))}return s}function hw(t,e,i){let s=e[t];if(!s&&i){const n=Uv(e,i);n&&(s=n[t])}return s}oe.add("state"),Qh.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},Qh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Uv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Qh.isSelected=function(t,e){return hw("selected",t,e)},Qh.isDisabled=function(t,e){return hw("disabled",t,e)},Qh.isFocus=function(t,e){return aw("isFocus",t,e)},Qh.isHover=function(t,e){return aw("isHover",t,e)},Qh.isPress=function(t,e){return aw("isPress",t,e)},Qh.isPlacehold=function(t,e){return t.__.__isPlacehold},Qh.isDrag=function(t,e){return aw("isDrag",t,e)},Qh.setStyleName=function(t,e,i){i?iw(t,e,t[e]):ow(t,e,t[e])},Qh.set=function(t,e){const i=t.states[e];i?iw(t,e,i):ow(t,e,i)},Qh.getStyle=Jv,Qh.updateStyle=Zv,Qh.updateEventStyle=function(t,e){switch(e){case Gd.ENTER:ew(t,"hoverStyle");break;case Gd.LEAVE:nw(t,"hoverStyle");break;case Gd.DOWN:ew(t,"pressStyle");break;case Gd.UP:nw(t,"pressStyle")}};const lw=Pl.prototype;Pl.addAttr("selected",!1,Vv,"selectedStyle"),Pl.addAttr("disabled",!1,Vv,"disabledStyle"),Pl.addAttr("states",{},jv),Pl.addAttr("state","",Vv),Pl.addAttr("normalStyle",void 0,lo),Pl.addAttr("hoverStyle",void 0,jv),Pl.addAttr("pressStyle",void 0,jv),Pl.addAttr("focusStyle",void 0,jv),Pl.addAttr("selectedStyle",void 0,jv),Pl.addAttr("disabledStyle",void 0,jv),Pl.addAttr("placeholderStyle",void 0,jv),Pl.addAttr("button",!1,lo),lw.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))},lw.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?ew(this,"focusStyle"):nw(this,"focusStyle")})},lw.updateState=function(){Qh.updateStyle(this,void 0,"in")};const dw=Bd.prototype,cw="text";so(dw,cw,Object.assign(Object.assign({},no(dw,cw)),{set(t){const e=this,i=e.text;e.__setAttr(cw,t)&&(yo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class uw extends al{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let gw=class extends Pl{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;l(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),!i(t))if(r(t))this.now=t;else if(d(t)){const e=l(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=$n.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:a}=e,{width:h,height:l}=o&&(r(o)?{width:o,height:o}:o)||(a>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 Ir(Ir.LOADED,{image:t}))}__runAction(t,e){let{FPS:s,loop:n,__action:o}=this;o&&(o.FPS&&(s=o.FPS),i(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/s)}__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()}};pe([Fo(uw)],gw.prototype,"__",void 0),pe([fo()],gw.prototype,"robot",void 0),pe([lo()],gw.prototype,"actions",void 0),pe([lo("")],gw.prototype,"action",void 0),pe([Eo(0)],gw.prototype,"now",void 0),pe([lo(12)],gw.prototype,"FPS",void 0),pe([lo(!0)],gw.prototype,"loop",void 0),gw=pe([Uo()],gw),oe.add("robot");const{Yes:pw,NoAndSkip:_w,YesAndSkip:fw}=t,mw={},yw={},vw={};class ww{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,s,n){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return s?o:o?[o]:[];case"string":switch(t[0]){case"#":mw.id=t.substring(1),t=mw;break;case".":yw.className=t.substring(1),t=yw;break;default:vw.tag=t,t=vw}case"object":if(i(t.id)){if(t.tag){const{tag:i}=t,n=l(i);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,s,n?g.toMap(i):i)}return this.getByMethod(this.methods.className,e,s,t.className)}{const i=this.getById(t.id,e);return s?i:i?[i]:[]}case"function":return this.getByMethod(t,e,s,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===pw||o===fw){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<_w&&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 xw=Pl.prototype;function bw(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())}xw.find=function(t,e){return bw(this).getBy(t,this,!1,e)},xw.findOne=function(t,e){return bw(this).getBy(t,this,!0,e)},oe.add("find"),re.finder=function(t){return new ww(t)};const{setPoint:kw,addPoint:Sw,toBounds:Ew}=yt;const Bw={syncExport(t,e,s){let n;$h.running=!0;try{const o=Vn.fileType(e),r=e.includes(".");s=Vn.getExportOptions(s);const{toURL:a}=y,{download:h}=y.origin;if("json"===o)r&&h(a(JSON.stringify(t.toJSON(s.json)),"text"),e),n={data:!!r||t.toJSON(s.json)};else if("svg"===o)r&&h(a(t.toSVG(),"svg"),e),n={data:!!r||t.toSVG()};else{let o,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:v}=s,w=i(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&i(s.fill)?t.fill:s.fill,k=Vn.isOpaqueImage(e)||b,S=new ft;if(f)o=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}o=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};I.getScaleData(s.scale,s.size,o,E);let B=s.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Gt(o).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const L={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let P,A=re.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(P=t,P.__worldOpacity=0,t=c||t,L.bounds=A.bounds),A.save();const D=u&&!i(b),M=t.get("fill");if(D&&(t.fill=""),y.render(t,A,L),D&&(t.fill=M),A.restore(),P&&P.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Sw(r,n,o):kw(r={},n,o)),a++;const h=new Gt;return r&&(Ew(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=re.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=I.fourNumber(m),n=A,{width:o,height:r}=n;A=re.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),v&&v(A);n={data:"canvas"===e?A:A.export(e,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:o,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return $h.running=!1,n},export(t,e,i){return $h.running=!0,function(t){Tw||(Tw=new qn);return new Promise(e=>{Tw.add(()=>_e(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>_e(this,void 0,void 0,function*(){if(!Zn.isComplete)return y.requestRender(o);const r=$h.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Rw(t);const{leafer:r}=t;r?r.waitViewCompleted(o):o()}))}};let Tw;function Rw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Rw(t))}const Cw=Ce.prototype,Ow=$t.get("@leafer-in/export");Cw.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)},Cw.toBlob=function(t,e){return new Promise(i=>{y.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Ow.error(t),i(null)})})},Cw.toDataURL=function(t,e){return y.origin.canvasToDataURL(this.view,t,e)},Cw.saveAs=function(t,e){return new Promise(i=>{y.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Ow.error(t),i(!1)})})},oe.add("export"),Object.assign($h,Bw),Pl.prototype.export=function(t,e){return $h.export(this,t,e)},Pl.prototype.syncExport=function(t,e){return $h.syncExport(this,t,e)},oe.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}}),oe.add("bright"),Pl.addAttr("bright",!1,Bo);export{Bt as AlignHelper,qy as Animate,jy as AnimateEasing,Gy as AnimateEvent,Ky as AnimateList,t as Answer,Cd as App,kt as AroundHelper,Jf as Arrow,Kf as ArrowData,Kt as AutoBounds,oi as BezierHelper,Gt as Bounds,Wr as BoundsEvent,Ht as BoundsHelper,Hl as Box,dl as BoxData,ph as Branch,mr as BranchHelper,Pa as BranchRender,wd as Canvas,kl as CanvasData,ge as CanvasManager,Ar as ChildEvent,Vh as ColorConvert,re as Creator,kc as Cursor,g as DataHelper,$t as Debug,wt as Direction4,xt as Direction9,jd as DragBoundsHelper,Zd as DragEvent,uc as Dragger,$d as DropEvent,s_ as EditBox,Kp as EditDataHelper,t_ as EditPoint,Fp as EditSelect,Pp as EditSelectHelper,L_ as EditTool,f_ as EditToolCreator,C_ as Editor,xp as EditorEvent,v_ as EditorGroupEvent,u_ as EditorHelper,S_ as EditorMoveEvent,B_ as EditorRotateEvent,E_ as EditorScaleEvent,T_ as EditorSkewEvent,Zh as Effect,ql as Ellipse,_l as EllipseData,pi as EllipseHelper,Pr as Event,ce as EventCreator,ea as Eventer,$h as Export,Vn as FileHelper,Jh as Filter,ww as Finder,Zm as Flow,T as FourNumberHelper,Vl as Frame,ul as FrameData,Al as Group,ll as GroupData,qf as HTMLText,Uf as HTMLTextData,Tv as HighBezierHelper,Mv as HighCurveHelper,Sc as HitCanvasManager,yd as Image,bl as ImageData,Ir as ImageEvent,$n as ImageManager,w as IncrementId,O_ as InnerEditor,y_ as InnerEditorEvent,bc as InteractionBase,rc as InteractionHelper,oc as KeyEvent,Ld as Keyboard,Ur as LayoutEvent,Ah as Layouter,nh as Leaf,Ca as LeafBounds,gr as LeafBoundsHelper,_ as LeafData,pa as LeafDataProxy,ua as LeafEventer,or as LeafHelper,Lr as LeafLayout,fh as LeafLevelList,_h as LeafList,xa as LeafMatrix,Oa as LeafRender,Fl as Leafer,yh as LeaferCanvas,Ce as LeaferCanvasBase,cl as LeaferData,qr as LeaferEvent,io as LeaferImage,xf as LeaferTypeCreator,md as Line,gl as LineData,I_ as LineEditTool,I as MathHelper,ft as Matrix,$ as MatrixHelper,Qd as MoveEvent,Sf as MultiTouchHelper,Jd as MyDragEvent,vd as MyImage,qd as MyPointerEvent,ec as MyTouchEvent,De as NeedConvertToCanvasCommandMap,z as OneRadian,Y as PI2,N as PI_2,Gh as Paint,Kh as PaintGradient,qh as PaintImage,Td as Path,Uh as PathArrow,Gm as PathArrowModule,Pn as PathBounds,xs as PathCommandDataHelper,Pe as PathCommandMap,$i as PathConvert,zn as PathCorner,Ws as PathCreator,yl as PathData,Qs as PathDrawer,Oe as PathHelper,am as PathMatrixHelper,We as PathNumberCommandLengthMap,Ie as PathNumberCommandMap,J_ as PathScaler,Rd as Pen,vl as PenData,Ih as Picker,y as Platform,oe as Plugin,pt as Point,lt as PointHelper,Pd as PointerButton,Gd as PointerEvent,id as Polygon,fl as PolygonData,Mr as PropertyEvent,Il as Rect,pl as RectData,ze as RectHelper,Ol as RectRender,Gr as RenderEvent,Mh as Renderer,Vr as ResizeEvent,Zn as Resource,gw as Robot,uw as RobotData,ic as RotateEvent,ie as Run,jf as ScrollBar,Lp as SelectArea,Wh as Selector,ld as Star,ml as StarData,Qh as State,Zt as StringNumberMap,Op as Stroker,sc as SwipeEvent,Gn as TaskItem,qn as TaskProcessor,Bd as Text,Hh as TextConvert,xl as TextData,mf as TextEditor,tc as TouchEvent,R_ as TransformTool,Mf as Transformer,tl as Transition,yt as TwoPointBoundsHelper,Pl as UI,Bl as UIBounds,he as UICreator,al as UIData,Ad as UIEvent,Rl as UIRender,jh as UnitConvert,xr as WaitHelper,jr as WatchEvent,bh as Watcher,Of as WheelEventHelper,nc as ZoomEvent,yf as addViewport,vf as addViewportConfig,So as affectRenderBoundsType,xo as affectStrokeBoundsType,Zf as arrowType,ao as attr,go as autoLayoutType,fo as boundsType,Hn as canvasPatch,Re as canvasSizeAttrs,Xh as createAttr,oo as createDescriptor,Mo as cursorType,Fo as dataProcessor,lo as dataType,ro as decorateLeafAttr,Wo as defineDataProcessor,so as defineKey,ho as defineLeafAttr,Bo as dimType,yo as doBoundsType,bo as doStrokeType,zh as effectType,e as emptyData,Ao as eraserType,Fr as extraPropertyEventMap,H as getBoundsData,no as getDescriptor,V as getMatrixData,X as getPointData,Do as hitType,l as isArray,c as isData,u as isEmptyData,o as isFinite,s as isNull,r as isNumber,d as isObject,n as isString,i as isUndefined,Io as layoutProcessor,Qr as leaferTransformAttrMap,Po as maskType,Fv as motionPathType,mo as naturalBoundsType,To as opacityType,Yn as path,vo as pathInputType,wo as pathType,Nn as pen,co as positionType,p_ as registerEditTool,__ as registerInnerEditor,Uo as registerUI,Go as registerUIEvent,Yh as resizeType,Xo as rewrite,Ho as rewriteAble,_o as rotationType,af as scaleResize,hf as scaleResizeFontSize,cf as scaleResizeGroup,lf as scaleResizePath,df as scaleResizePoints,po as scaleType,uo as scrollType,Lo as sortType,jv as stateStyleType,Vv as stateType,ko as strokeType,Eo as surfaceType,qt as tempBounds,mt as tempMatrix,_t as tempPoint,h as tryToNumber,wh as useCanvas,jo as useModule,mh as version,Ro as visibleType,Nh as zoomLayerType};
|
|
1
|
+
var t;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(t||(t={}));const e={};function i(t){return void 0===t}function s(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:o}=Number;function r(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;function h(t){return"string"==typeof t&&a.test(t)?+t:t}const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return p(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&p(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=g;class _{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(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let n in this)"_"!==n[0]&&(s=e?e[n]:void 0,t[n]=i(s)?this[n]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(l(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:n}=this;s.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!i(t))){if("path"===o&&!this.__pathInputed)continue;e=n?n[o]:void 0,s[o]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:n,e:o,f:r}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:n,e:o,f:r}}return s}__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:f,max:m}=Math,y={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||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.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=y.origin.createCanvas(m(f(e+(s||0)),1),m(f(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:v}=y,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=w;let b,k,S;const{max:E}=Math,B=[0,0,0,0],T={zero:[...B],tempFour:B,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(B,t,e,i,s),toTempAB(t,e,i){S=i?r(t)?e:t:[],r(t)?(b=O(t),k=e):r(e)?(b=t,k=O(e)):(b=t,k=e),4!==b.length&&(b=C(b)),4!==k.length&&(k=C(k))},get(t,e){let s;if(!r(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,i)=>r(t)&&r(e)?E(t,e):(P(t,e,i),R(S,E(b[0],k[0]),E(b[1],k[1]),E(b[2],k[2]),E(b[3],k[3]))),add:(t,e,i)=>r(t)&&r(e)?t+e:(P(t,e,i),R(S,b[0]+k[0],b[1]+k[1],b[2]+k[2],b[3]+k[3])),swapAndScale(t,e,i,s){if(r(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[o,a,h,l]=4===t.length?t:C(t);return R(n,h*i,l*e,o*i,a*e)}},{set:R,get:C,setTemp:O,toTempAB:P}=T,{round:L,pow:A,max:D,floor:M,PI:F}=Math,I={within:(t,e,s)=>(d(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const s=i(e)?1e12:A(10,e);return-0===(t=L(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(r(e)?e:e.width||0)/i.width,n=(r(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&I.assignScale(s,t);return s},assignScale(t,e){r(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(M(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const z=F/180,Y=2*F,N=F/2;function X(){return{x:0,y:0}}function H(){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:j,cos:U,acos:G,sqrt:q}=Math,{float:K}=I,Z={};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 $={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:V,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){Q.toInnerPoint(t,e,Z),Q.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=U(e*=z),a=j(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){Q.toInnerPoint(t,e,Z),Q.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=z,t.a=s+o*i,t.b=n+r*i),e&&(e*=z,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,Z),Q.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d: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,s,n,o){const{e:r,f:a}=t;if(s||(s=t),i(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:i,b:n,c:r,d:a}=t;s.a=i*e.a+n*e.c,s.b=i*e.b+n*e.d,s.c=r*e.a+a*e.c,s.d=r*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=r*e.a+a*e.c+e.e,s.f=r*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e: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,s,n,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(i(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:n}=e,o=i*z,r=U(o),a=j(o);if(s||n){const e=s*z,i=n*z;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,(s=s||n)&&Q.translateInner(t,-s.x,-s.y,!n)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=q(n*n+o*o),c=t/d;const e=n/d;u=o>0?G(e):-G(e)}else{c=q(r*r+a*a),d=t/c;const e=r/c;u=N-(a>0?G(-e):-G(e))}const e=K(U(u)),i=j(u);d=K(d),c=K(c),g=e?K((r/c+i)/e/z,9):0,p=e?K((o/d-i)/e/z,9):0,u=K(u/z)}else d=n,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=q(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{toInnerPoint:tt,toOuterPoint:et}=$,{sin:it,cos:st,abs:nt,sqrt:ot,atan2:rt,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=z),n=it(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}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),o=nt(s-e);return ot(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>at(ct(t,e,i,s),ct(i,s,n,o)),getAngle:(t,e)=>gt(t,e)/z,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/z),getRadianFrom(t,e,s,n,o,r,a,h){i(a)&&(a=s,h=n);const l=t-s,d=e-n,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const o=gt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(o)*i,e.y=t.y+it(o)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:gt}=dt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new pt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const _t=new pt;class ft{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return d(t)?$.copy(this,t):$.set(this,t,e,i,s,n,o),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new ft(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const mt=new ft,yt={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){vt(t,e,i),vt(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:vt}=yt;var wt,xt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(xt||(xt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const kt={directionData:bt,tempPoint:{},get:St,toPoint(t,e,i,s,n,o){const r=St(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={}),kt.toPoint(t,e,i,!0),i)};function St(t){return n(t)?bt[xt[t]]:t}const{toPoint:Et}=kt,Bt={toPoint(t,e,i,s,n,o){Et(t,i,s,n,e,o)}},{tempPointBounds:Tt,setPoint:Rt,addPoint:Ct,toBounds:Ot}=yt,{toOuterPoint:Pt}=$,{float:Lt,fourNumber:At}=I,{floor:Dt,ceil:Mt}=Math;let Ft,It,Wt,zt;const Yt={},Nt={},Xt={},Ht={tempBounds:Xt,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(l(i)){const e=At(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?Ut(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||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Xt,t),Vt.toOuterOf(Xt,e),Xt),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 Yt.x=t.x,Yt.y=t.y,Pt(e,Yt,Nt),Rt(Tt,Nt.x,Nt.y),Yt.x=t.x+t.width,Pt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Yt.y=t.y+t.height,Pt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Yt.x=t.x,Pt(e,Yt,Nt),Ct(Tt,Nt.x,Nt.y),Ot(Tt,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 ft(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,o=!0,r){r||(r=e),n(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Xt.width=o?e.width*=s:e.width*s,Xt.height=o?e.height*=s:e.height*s,Bt.toPoint(i,Xt,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=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){Ft=t.x+t.width,It=t.y+t.height,Wt=e.x,zt=e.y,i||(Wt+=e.width,zt+=e.height),Ft=Ft>Wt?Ft:Wt,It=It>zt?It:zt,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=It-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||Ut(t,n)):jt(t,n));o&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Tt,t.x,t.y):Ct(Tt,t.x,t.y)),Ot(Tt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=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,It=n+r,Wt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<Wt?Ft:Wt,It=It<zt?It:zt,o=Ft-s,r=It-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=Ht,{add:jt,copy:Ut}=Vt;class Gt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Ht.copy(this,t):Ht.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 Gt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const qt=new Gt;class Kt{constructor(t,e,i,s,n,o){d(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 Gt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Zt={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}=I;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Qt(t)}static set exclude(t){this.excludeList=Qt(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"===$t.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(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 Qt(t){return t?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const te=$t,ee=$t.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,n,"ms")},endOfName(t,e){const s=se.nameToIdMap[t];i(s)||se.end(s,e)}},se=ie,ne=[],oe={list:{},add(t,...e){this.list[t]=!0,ne.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ne.forEach(t=>oe.has(t,!0)));const re={editor:t=>oe.need("editor")},ae=$t.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&ae.repeat(e),le[e]=t},get(t,e,s,n,o,r){le[t]||ae.error("not register "+t);const a=new le[t](e);return i(s)||(a.x=s,n&&(a.y=n),o&&(a.width=o),r&&(a.height=r)),a}},{list:le}=he,de=$t.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;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=re.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function pe(t,e,i,s){var 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 _e(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 fe(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 me=[];function ye(){return(t,e)=>{me.push(e)}}const ve=[];let we=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;me.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){d(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}};pe([fe("imageSmoothingEnabled")],we.prototype,"smooth",void 0),pe([fe("imageSmoothingQuality")],we.prototype,"smoothLevel",void 0),pe([fe("globalAlpha")],we.prototype,"opacity",void 0),pe([fe()],we.prototype,"fillStyle",void 0),pe([fe()],we.prototype,"strokeStyle",void 0),pe([fe("lineWidth")],we.prototype,"strokeWidth",void 0),pe([fe("lineCap")],we.prototype,"strokeCap",void 0),pe([fe("lineJoin")],we.prototype,"strokeJoin",void 0),pe([fe("lineDashOffset")],we.prototype,"dashOffset",void 0),pe([fe()],we.prototype,"miterLimit",void 0),pe([fe()],we.prototype,"shadowBlur",void 0),pe([fe()],we.prototype,"shadowColor",void 0),pe([fe()],we.prototype,"shadowOffsetX",void 0),pe([fe()],we.prototype,"shadowOffsetY",void 0),pe([fe()],we.prototype,"filter",void 0),pe([fe()],we.prototype,"font",void 0),pe([fe()],we.prototype,"fontKerning",void 0),pe([fe()],we.prototype,"fontStretch",void 0),pe([fe()],we.prototype,"fontVariantCaps",void 0),pe([fe()],we.prototype,"textAlign",void 0),pe([fe()],we.prototype,"textBaseline",void 0),pe([fe()],we.prototype,"textRendering",void 0),pe([fe()],we.prototype,"wordSpacing",void 0),pe([fe()],we.prototype,"letterSpacing",void 0),pe([fe()],we.prototype,"direction",void 0),pe([ye()],we.prototype,"setTransform",null),pe([ye()],we.prototype,"resetTransform",null),pe([ye()],we.prototype,"getTransform",null),pe([ye()],we.prototype,"save",null),pe([ye()],we.prototype,"restore",null),pe([ye()],we.prototype,"translate",null),pe([ye()],we.prototype,"scale",null),pe([ye()],we.prototype,"rotate",null),pe([ye()],we.prototype,"fill",null),pe([ye()],we.prototype,"stroke",null),pe([ye()],we.prototype,"clip",null),pe([ye()],we.prototype,"fillRect",null),pe([ye()],we.prototype,"strokeRect",null),pe([ye()],we.prototype,"clearRect",null),pe([ye()],we.prototype,"beginPath",null),pe([ye()],we.prototype,"moveTo",null),pe([ye()],we.prototype,"lineTo",null),pe([ye()],we.prototype,"bezierCurveTo",null),pe([ye()],we.prototype,"quadraticCurveTo",null),pe([ye()],we.prototype,"closePath",null),pe([ye()],we.prototype,"arc",null),pe([ye()],we.prototype,"arcTo",null),pe([ye()],we.prototype,"ellipse",null),pe([ye()],we.prototype,"rect",null),pe([ye()],we.prototype,"roundRect",null),pe([ye()],we.prototype,"createConicGradient",null),pe([ye()],we.prototype,"createLinearGradient",null),pe([ye()],we.prototype,"createPattern",null),pe([ye()],we.prototype,"createRadialGradient",null),pe([ye()],we.prototype,"fillText",null),pe([ye()],we.prototype,"measureText",null),pe([ye()],we.prototype,"strokeText",null);const{copy:xe,multiplyParent:be,pixelScale:ke}=$,{round:Se}=Math,Ee=new Gt,Be=new Gt,Te={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Ce extends we{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=Te),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||y.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 Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&be(t,e,n),ke(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Se(n.e-.5)+.5,n.f=Se(n.f-.5)+.5):(n.e=Se(n.e),n.f=Se(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:s,strokeJoin:n,dashPattern:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),i(e.dashPattern)||(o=e.dashPattern),i(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,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=Be):i=Ee,this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.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,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.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(Ee.x,Ee.y,Ee.width,Ee.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,Ee.x,Ee.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(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ee.x,Ee.y,Ee.width,Ee.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ee.x,Ee.y,Ee.width,Ee.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ee,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):re.canvas(Object.assign({},i));return n.save(),t&&(xe(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 Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Pe),Ae={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},De={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},Me=Object.assign(Object.assign({},De),Pe),Fe=Le,Ie={};for(let t in Fe)Ie[Fe[t]]=t;const We={};for(let t in Fe)We[Fe[t]]=Ae[t];const ze={drawRoundRect(t,e,i,s,n,o){const r=I.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:Ye,cos:Ne,hypot:Xe,atan2:He,ceil:Ve,abs:je,PI:Ue,sqrt:Ge,pow:qe}=Math,{setPoint:Ke,addPoint:Ze}=yt,{set:Je,toNumberPoints:$e}=lt,{M:Qe,L:ti,C:ei,Q:ii,Z:si}=Le,ni={},oi={points(t,e,i,s){let n=$e(e);if(t.push(Qe,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,g,p,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=Ge(qe(r-e,2)+qe(a-o,2)),_=Ge(qe(h-r,2)+qe(l-a,2)),(p||_)&&(f=p+_,p=y*p/f,_=y*_/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(ii,d,c,r,a):t.push(ei,u,g,d,c,r,a),u=r+_*h,g=a+_*l);s||t.push(ii,u,g,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ti,n[e],n[e+1]);s&&t.push(si)},rect(t,e,i,s,n){Oe.creator.path=t,Oe.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){Oe.creator.path=[],ze.drawRoundRect(Oe.creator,e,i,s,n,o),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,g=o-s,p=r-n;let _=He(u,c),f=He(p,g);const m=Xe(c,u),y=Xe(g,p);let v=f-_;if(v<0&&(v+=Y),m<1e-12||y<1e-12||v<1e-12||je(v-Ue)<1e-12)return t&&t.push(ti,s,n),h&&(Ke(h,e,i),Ze(h,s,n)),d&&Je(d,e,i),void(l&&Je(l,s,n));const w=c*p-g*u<0,x=w?-1:1,b=a/Ne(v/2),k=s+b*Ne(_+v/2+N*x),S=n+b*Ye(_+v/2+N*x);return _-=N*x,f-=N*x,hi(t,k,S,a,a,0,_/z,f/z,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>hi(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*z,g=Ye(u),p=Ne(u);let _=r*z,f=a*z;_>Ue&&(_-=Y),f<0&&(f+=Y);let m=f-_;m<0?m+=Y:m>Y&&(m-=Y),h&&(m-=Y);const y=Ve(je(m/N)),v=m/y,w=Ye(v/4),x=8/3*w*w/Ye(v/2);f=_+v;let b,k,S,E,B,T,R,C,O=Ne(_),P=Ye(_),L=S=p*s*O-g*n*P,A=E=g*s*O+p*n*P,D=e+S,M=i+E;t&&t.push(t.length?ti:Qe,D,M),l&&Ke(l,D,M),c&&Je(c,D,M);for(let o=0;o<y;o++)b=Ne(f),k=Ye(f),S=p*s*b-g*n*k,E=g*s*b+p*n*k,B=e+L-x*(p*s*P+g*n*O),T=i+A-x*(g*s*P-p*n*O),R=e+S+x*(p*s*k+g*n*b),C=i+E+x*(g*s*k-p*n*b),t&&t.push(ei,B,T,R,C,e+S,i+E),l&&ai(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,_=f,f+=v;d&&Je(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ei,(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){ai(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Ze(h,t,e):Ke(h,t,e),Ze(h,r,a);for(let l=0,c=d.length;l<c;l++)ri(d[l],t,e,i,s,n,o,r,a,ni),Ze(h,ni.x,ni.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*o+p*a,l.y=c*i+u*n+g*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return ri(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:ri,toTwoPointBounds:ai,ellipse:hi}=oi,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:gi}=oi,pi={ellipticalArc(t,e,i,s,n,o,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=o*z,p=li(g),_=di(g),f=-_*c-p*u,m=-_*u+p*c,v=s*s,w=n*n,x=m*m,b=f*f,k=v*w-v*x-w*b;let S=0;if(k<0){const t=ci(1-k/(v*w));s*=t,n*=t}else S=(r===a?-1:1)*ci(k/(v*x+w*b));const E=S*s*m/n,B=-S*n*f/s,T=ui((m-B)/n,(f-E)/s),R=ui((-m-B)/n,(-f-E)/s);let C=R-T;0===a&&C>0?C-=Y:1===a&&C<0&&(C+=Y);const O=e+c+_*E-p*B,P=i+u+p*E+_*B,L=C<0?1:0;d||y.ellipseToCurve?gi(t,O,P,s,n,o,T/z,R/z,L):s!==n||o?t.push(Le.G,O,P,s,n,o,T/z,R/z,L):t.push(Le.O,O,P,s,T/z,R/z,L)}},_i={toCommand:t=>[],toNode:t=>[]},{M:fi,m:mi,L:yi,l:vi,H:wi,h:xi,V:bi,v:ki,C:Si,c:Ei,S:Bi,s:Ti,Q:Ri,q:Ci,T:Oi,t:Pi,A:Li,a:Ai,Z:Di,z:Mi,N:Fi,D:Ii,X:Wi,G:zi,F:Yi,O:Ni,P:Xi,U:Hi}=Le,{rect:Vi,roundRect:ji,arcTo:Ui,arc:Gi,ellipse:qi,quadraticCurveTo:Ki}=oi,{ellipticalArc:Zi}=pi,Ji=$t.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=We[s],a+=s===n?" ":Ie[s];for(let s=1;s<i;s++)a+=I.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?Me:De;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(ts.dot&&(es(r,o),o=""),ts.dot++),"0"===o&&"."!==s&&(es(r,o),o=""),o+=s):Le[s]?(o&&(es(r,o),o=""),ts.name=Le[s],ts.length=Ae[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 g=[];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],g.push(fi,a,h),c+=3;break;case xi:t[c+1]+=a;case wi:a=t[c+1],g.push(yi,a,h),c+=2;break;case ki:t[c+1]+=h;case bi:h=t[c+1],g.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],g.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],g.push(Si,l,d,i,s,a,h),c+=5;break;case Ei: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],g.push(Si,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Pi:t[c+1]+=a,t[c+2]+=h,n=Oi;case Oi:r=o===Ri||o===Oi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Ki(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ri,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ri;case Ri:i=t[c+1],s=t[c+2],e?Ki(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ri,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 Li:Zi(g,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Mi:case Di:g.push(Di),c++;break;case Fi:a=t[c+1],h=t[c+2],e?Vi(g,a,h,t[c+3],t[c+4]):is(g,t,c,5),c+=5;break;case Ii:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(g,t,c,9),c+=9;break;case Wi:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4],t[c+5]):is(g,t,c,6),c+=6;break;case zi:qi(e?g:is(g,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,$i),a=$i.x,h=$i.y,c+=9;break;case Yi:e?qi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ni:Gi(e?g:is(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$i),a=$i.x,h=$i.y,c+=7;break;case Xi:e?Gi(g,t[c+1],t[c+2],t[c+3],0,360,!1):is(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Hi:Ui(e?g:is(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$i),a=$i.x,h=$i.y,c+=6;break;default:return Ji.error(`command: ${n} [index:${c}]`,t),g}o=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return _i.toCommand(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(Ri,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:gs,P:ps,U:_s}=Le,{getMinDistanceFrom:fs,getRadianFrom:ms}=lt,{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(r(o))t.push(ds,e,i,s,n,o);else{const r=I.fourNumber(o);r?t.push(ls,e,i,s,n,...r):t.push(hs,e,i,s,n)}},ellipse(t,e,i,n,o,r,a,h,l){s(r)?t.push(us,e,i,n,o):(s(a)&&(a=0),s(h)&&(h=360),t.push(cs,e,i,n,o,r,a,h,l?1:0))},arc(t,e,i,n,o,r,a){s(o)?t.push(ps,e,i,n):(s(r)&&(r=360),t.push(gs,e,i,n,o,r,a?1:0))},arcTo(t,e,s,n,o,r,a,h){if(!i(a)){const t=fs(a,h,e,s,n,o);r=vs(r,vs(t/2,t/2*ws(ys(ms(a,h,e,s,n,o)/2))))}t.push(_s,e,s,n,o,r)},drawEllipse(t,e,i,n,o,r,a,h,l){oi.ellipse(null,e,i,n,o,s(r)?0:r,s(a)?0:a,s(h)?360:h,l,null,null,xs),t.push(ss,xs.x,xs.y),ks(t,e,i,n,o,r,a,h,l)},drawArc(t,e,i,n,o,r,a){oi.arc(null,e,i,n,s(o)?0:o,s(r)?360:r,a,null,null,xs),t.push(ss,xs.x,xs.y),Ss(t,e,i,n,o,r,a)},drawPoints(t,e,i,s){oi.points(t,e,i,s)}},{ellipse:ks,arc:Ss}=bs,{moveTo:Es,lineTo:Bs,quadraticCurveTo:Ts,bezierCurveTo:Rs,closePath:Cs,beginPath:Os,rect:Ps,roundRect:Ls,ellipse:As,arc:Ds,arcTo:Ms,drawEllipse:Fs,drawArc:Is,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?n(t)?Oe.parse(t):t:[],this}beginPath(){return Os(this.__path),this.paint(),this}moveTo(t,e){return Es(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 Rs(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 Cs(this.__path),this.paint(),this}rect(t,e,i,s){return Ps(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ls(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 Fs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return Is(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:Ys,L:Ns,C:Xs,Q:Hs,Z:Vs,N:js,D:Us,X:Gs,G:qs,F:Ks,O:Zs,P:Js,U:$s}=Le,Qs=$t.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 Ys:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Hs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Vs:t.closePath(),s+=1;break;case js:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Us: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 Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*z,e[s+6]*z,e[s+7]*z,e[s+8]),s+=9;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,Y,!1),s+=5;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*z,e[s+5]*z,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,Y,!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:gn,U:pn}=Le,{toTwoPointBounds:_n,toTwoPointBoundsByQuadraticCurve:fn,arcTo:mn,arc:yn,ellipse:vn}=oi,{addPointBounds:wn,copy:xn,addPoint:bn,setPoint:kn,addBounds:Sn,toBounds:En}=yt,Bn=$t.get("PathBounds");let Tn,Rn,Cn;const On={},Pn={},Ln={},An={toBounds(t,e){An.toTwoPointBounds(t,Pn),En(Pn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return kn(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?kn(e,h,l):kn(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,On),wn(e,On),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,On),wn(e,On),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],On,Ln),0===a?xn(e,On):wn(e,On),h=Ln.x,l=Ln.y,a+=9;break;case cn:h=t[a+1],l=t[a+2],Rn=t[a+3],Cn=t[a+4],Sn(e,h-Rn,l-Cn,2*Rn,2*Cn),h+=Rn,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],On,Ln),0===a?xn(e,On):wn(e,On),h=Ln.x,l=Ln.y,a+=7;break;case gn: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 pn:mn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],On,Ln),0===a?xn(e,On):wn(e,On),h=Ln.x,l=Ln.y,a+=6;break;default:return void Bn.error(`command: ${r} [index:${a}]`,t)}}},{M:Dn,L:Mn,Z:Fn}=Le,{getCenterX:In,getCenterY:Wn}=lt,{arcTo:zn}=bs,Yn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,p=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case Dn:l=g=t[r+1],d=p=t[r+2],r+=3,t[r]===Mn?(c=t[r+1],u=t[r+2],f.push(Dn,In(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,g,p);break;case Fn:zn(f,a,h,l,d,e,g,p);break;default:f.push(Mn,a,h)}g=a,p=h;break;case Fn:n!==Fn&&(zn(f,l,d,c,u,e,g,p),f.push(Fn)),r+=1;break;default:o=We[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==Fn&&(f[1]=l,f[2]=d),f}};function Nn(t){return new zs(t)}const Xn=Nn();Oe.creator=Nn(),Oe.parse=Qi.parse,Oe.convertToCanvasData=Qi.toCanvasData;const{drawRoundRect:Hn}=ze;function Vn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Hn(this,t,e,i,s,n)})}(t)}const jn={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=Un.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{}}}},Un=jn;Un.alphaPixelTypes.forEach(t=>Un.upperCaseTypeMap[t]=t.toUpperCase());const Gn=$t.get("TaskProcessor");class qn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return _e(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){Gn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Kn{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,s){let n,o,a,h;const l=new qn(t);return l.parent=this,r(e)?h=e:e&&(o=e.parallel,n=e.start,a=e.time,h=e.delay,s||(s=e.canUse)),a&&(l.time=a),!1===o&&(l.parallel=!1),s&&(l.canUse=s),i(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 Zn=$t.get("Resource"),Jn={tasker:new Kn,map:{},get isComplete(){return $n.tasker.isComplete},set(t,e){$n.map[t]&&Zn.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 n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=re.image(s)),$n.set(t,e),e},destroy(){$n.map={}}},$n=Jn,Qn={maxRecycled:10,recycledList:[],patternTasker:new Kn,get(t){let e=Jn.get(t.url);return e||Jn.set(t.url,e=re.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=>jn.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:"+jn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+jn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){to.recycledList=[]}},to=Qn,{IMAGE:eo,create:io}=w;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(()=>_e(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,i(t)?y.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=y.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=y.canvas.createPattern(t,e);return y.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||{})),zo(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 go(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function po(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)&&(ko(this),e&&(this.__.__useStroke=!0))}}))}function ko(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&vo(t)}const So=bo;function Eo(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 Ro(t){return ao(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Oo(this)}}))}function Co(t){return ao(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&&Oo(this)}}))}function Oo(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||vo(t))}function Lo(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"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Fo(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Io(t){return(e,i)=>{no(e,"__DataProcessor",{get:()=>t})}}function Wo(t){return(e,i)=>{no(e,"__LayoutProcessor",{get:()=>t})}}function zo(t,e,s){const n=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ro(e,s);if(i(s))a.get=function(){return this[o]};else if("function"==typeof s)a.get=function(){const t=this[o];return null==t?s(this.__leaf):t};else if(d(s)){const t=u(s);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:g.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[o];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,c=n;for(;!l&&c;)l=oo(c,e),c=c.__proto__;l&&l.set&&(a.set=l.set),n[r]&&(a.set=n[r],delete n[r]),no(n,e,a)}const Yo=new $t("rewrite"),No=[],Xo=["destroy","constructor"];function Ho(t){return(e,i)=>{No.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Vo(){return t=>{jo()}}function jo(t){No.length&&(No.forEach(e=>{t&&Yo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),No.length=0)}function Uo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Xo.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=>{he.register(t)}}function qo(){return t=>{ce.register(t)}}setTimeout(()=>jo(!0));const{copy:Ko,toInnerPoint:Zo,toOuterPoint:Jo,scaleOfOuter:$o,rotateOfOuter:Qo,skewOfOuter:tr,multiplyParent:er,divideParent:ir,getLayout:sr}=$,nr={},{round:or}=Math,rr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),lr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)hr(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++)dr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&dr(t),t.__updateChange()},updateAllChange(t){if(ur(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)cr(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||y.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=d(e)?Object.assign({},e):{x:e,y:i};s?Jo(t.localTransform,o,o,!0):t.parent&&Zo(t.parent.scrollWorldTransform,o,o,!0),ar.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=or(e),i=or(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){ar.zoomOfLocal(t,gr(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const a=t.__localMatrix;if(r(s)||(s&&(o=s),s=i),Ko(nr,a),$o(nr,e,i,s),ar.hasHighPosition(t))ar.setTransform(t,nr,n,o);else{const e=t.x+nr.e-a.e,r=t.y+nr.f-a.f;o&&!n?t.animate({x:e,y:r,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=r,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){ar.rotateOfLocal(t,gr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Ko(nr,n),Qo(nr,e,i),ar.hasHighPosition(t)?ar.setTransform(t,nr,!1,s):t.set({x:t.x+nr.e-n.e,y:t.y+nr.f-n.f,rotation:I.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){ar.skewOfLocal(t,gr(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Ko(nr,t.__localMatrix),tr(nr,e,i,s),ar.setTransform(t,nr,n,o)},transformWorld(t,e,i,s){Ko(nr,t.worldTransform),er(nr,e),t.parent&&ir(nr,t.parent.scrollWorldTransform),ar.setTransform(t,nr,i,s)},transform(t,e,i,s){Ko(nr,t.localTransform),er(nr,e),ar.setTransform(t,nr,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&ar.getInnerOrigin(t,n.origin),r=sr(e,o,n.around&&ar.getInnerOrigin(t,n.around));if(ar.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){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ar.getInnerOrigin(t,n.origin);lt.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 $o(i,ar.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(ar.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return kt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Ko(nr,t.worldTransform),ir(nr,e.scrollWorldTransform),i?nr:Object.assign({},nr)),drop(t,e,i,s){t.setTransform(ar.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ar.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),y.requestRender(()=>ar.animateMove(t,e,i))}}},ar=rr,{updateAllMatrix:hr,updateMatrix:lr,updateAllWorldOpacity:dr,updateAllChange:cr,updateChange:ur}=ar;function gr(t,e){return t.updateLayout(),t.parent?lt.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)=>fr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>fr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>fr(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 _r;function fr(t,e){return e||(_r=0),t.__.mask&&(_r=1),_r<0?null:(_r&&(_r=-1),!0)}const{updateBounds:mr}=rr,yr={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),vr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[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++)wr(e[t],e)},updateBounds(t,e){const i=[t];wr(t,i),xr(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++)mr(s[t]);e&&e===i||mr(i)}}},{pushAllChildBranch:vr,pushAllBranchStack:wr,updateBoundsByBranchStack:xr}=yr,br={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:kr,updateBounds:Sr}=rr,{toOuterOf:Er,getPoints:Br,copy:Tr}=Ht,Rr="_localContentBounds",Cr="_worldContentBounds",Or="_worldBoxBounds",Pr="_worldStrokeBounds";class Lr{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 Er(this.contentBounds,this.leaf.__localMatrix,this[Rr]||(this[Rr]={})),this[Rr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Er(this.contentBounds,this.leaf.__world,this[Cr]||(this[Cr]={})),this[Cr]}get worldBoxBounds(){return Er(this.boxBounds,this.leaf.__world,this[Or]||(this[Or]={})),this[Or]}get worldStrokeBounds(){return Er(this.strokeBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}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 Sr(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,y.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return kr(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 Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=kr(s,e,!0)}if(r||(r=$.getLayout(o)),Tr(r,a),lt.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:s}=this,n=Br(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return i(o)||n.forEach(t=>s.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 Ar{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Dr extends Ar{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Dr.ADD="child.add",Dr.REMOVE="child.remove",Dr.CREATED="created",Dr.MOUNTED="mounted",Dr.UNMOUNTED="unmounted",Dr.DESTROY="destroy";const Mr="property.scroll";class Fr extends Ar{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Fr.CHANGE="property.change",Fr.LEAFER_CHANGE="property.leafer_change",Fr.SCROLL=Mr;const Ir={scrollX:Mr,scrollY:Mr};class Wr extends Ar{constructor(t,e){super(t),Object.assign(this,e)}}Wr.LOAD="image.load",Wr.LOADED="image.loaded",Wr.ERROR="image.error";class zr extends Ar{static checkHas(t,e,i){"on"===i?e===Hr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Yr)||t.hasEvent(Nr)||t.hasEvent(Xr),t.__hasWorldEvent=t.hasEvent(Hr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Yr,t),"inner"===e&&t.emit(Nr,t)),t.emit(Xr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Hr,this)}}zr.RESIZE="bounds.resize",zr.INNER="bounds.inner",zr.LOCAL="bounds.local",zr.WORLD="bounds.world";const{RESIZE:Yr,INNER:Nr,LOCAL:Xr,WORLD:Hr}=zr,Vr={};[Yr,Nr,Xr,Hr].forEach(t=>Vr[t]=1);class jr extends Ar{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){d(t)?(super(jr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}jr.RESIZE="resize";class Ur extends Ar{constructor(t,e){super(t),this.data=e}}Ur.REQUEST="watch.request",Ur.DATA="watch.data";class Gr extends Ar{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 qr extends Ar{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}qr.REQUEST="render.request",qr.CHILD_START="render.child_start",qr.CHILD_END="render.child_end",qr.START="render.start",qr.BEFORE="render.before",qr.RENDER="render",qr.AFTER="render.after",qr.AGAIN="render.again",qr.END="render.end",qr.NEXT="render.next";class Kr extends Ar{}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:Jr,ROTATE:$r,SKEW:Qr}=Kr,ta={x:Zr,y:Zr,scaleX:Jr,scaleY:Jr,rotation:$r,skewX:Qr,skewY:Qr},ea={};class ia{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,r;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const a=sa(this,s,!0),h=n(t)?t.split(" "):t,d=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(d):a[t]=[d],Vr[t]&&zr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=sa(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],Vr[t]&&zr.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):l(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=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(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 l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.get(t,{type:t,target:this,current:this}));const s=sa(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:s,__captureMap:n}=this,o=s&&s[t],r=n&&n[t];return!!(i(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function sa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ea)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ea)}}const{on:na,on_:oa,off:ra,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroy:ua}=ia.prototype,ga={on:na,on_:oa,off:ra,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroyEventer:ua},pa=$t.get("setAttr"),_a={__setAttr(t,e,s){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!s||o(e)||i(e)||(pa.warn(this.innerName,t,e),e=void 0),d(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Fr(Fr.LEAFER_CHANGE,this,t,n,e));const i=ta[t];i&&(this.emitEvent(new Kr(i,this)),this.emitEvent(new Kr(Kr.TRANSFORM,this)))}this.emitPropertyEvent(Fr.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 Fr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:fa,multiplyParent:ma,translateInner:ya,defaultWorld:va}=$,{toPoint:wa,tempPoint:xa}=kt,ba={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ma(this.__local||e,t?t.__scrollWorld||t.__world:va,i,!!e.affectScaleOrRotation,n),s&&ya(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)&&(fa(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)&&(wa(i.around||i.origin,t.boxBounds,xa),ya(e,-xa.x,-xa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ka,updateAllMatrix:Sa}=rr,{updateBounds:Ea}=yr,{toOuterOf:Ba,copyAndSpread:Ta,copy:Ra}=Ht,{toBounds:Ca}=An,Oa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ba(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&zr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&zr.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?Ca(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(),Sa(this),Ea(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Sa(this),Ea(this,this))):ka(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ta(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;r(i)&&i<=0?Ra(e.renderBounds,e.strokeBounds):Ta(e.renderBounds,e.boxBounds,i)}},Pa={__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),rr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);$t.showBounds&&$t.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:La}=pr,Aa={__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++)La(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++)La(i[s],e)||i[s].__clip(t,e)}}},Da={},{LEAF:Ma,create:Fa}=w,{stintSet:Ia}=g,{toInnerPoint:Wa,toOuterPoint:za,multiplyParent:Ya}=$,{toOuterOf:Na}=Ht,{copy:Xa,move:Ha}=lt,{moveLocal:Va,zoomOfLocal:ja,rotateOfLocal:Ua,skewOfLocal:Ga,moveWorld:qa,zoomOfWorld:Ka,rotateOfWorld:Za,skewOfWorld:Ja,transform:$a,transformWorld:Qa,setTransform:th,getFlipTransform:eh,getLocalOrigin:ih,getRelativeWorld:sh,drop:nh}=rr;let oh=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 _}get __LayoutProcessor(){return Lr}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=Fa(Ma),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Dr.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(Dr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Dr.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(Dr.MOUNTED)):this.__emitLifeEvent(Dr.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){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(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 Ya(i,t.matrix,e,void 0,i),Na(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),Da.scaleX=i,Da.scaleY=s,Da}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?sh(this,e):this.worldTransform,n=i?t:{};return Na(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Xa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Xa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Wa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){za(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 Ha(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 Ha(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){th(this,t,e,i)}transform(t,e,i){$a(this,t,e,i)}move(t,e,i){Va(this,t,e,i)}moveInner(t,e,i){qa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){ja(this,ih(this,t),e,i,s,n)}rotateOf(t,e,i){Ua(this,ih(this,t),e,i)}skewOf(t,e,i,s,n){Ga(this,ih(this,t),e,i,s,n)}transformWorld(t,e,i){Qa(this,t,e,i)}moveWorld(t,e,i){qa(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){Ja(this,t,e,i,s,n)}flip(t,e){$a(this,eh(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 oe.need("path")}getMotionPoint(t){return oe.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){nh(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):zo(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 Dr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Dr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};oh=pe([Uo(_a),Uo(ba),Uo(Oa),Uo(ga),Uo(Pa)],oh);const{setListWithFn:rh}=Ht,{sort:ah}=yr,{localBoxBounds:hh,localStrokeBounds:lh,localRenderBounds:dh,maskLocalBoxBounds:ch,maskLocalStrokeBounds:uh,maskLocalRenderBounds:gh}=pr,ph=new $t("Branch");let _h=class extends oh{__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){rh(e||this.__layout.boxBounds,this.children,this.__hasMask?ch:hh)}__updateStrokeBounds(t){rh(t||this.__layout.strokeBounds,this.children,this.__hasMask?uh:lh)}__updateRenderBounds(t){rh(t||this.__layout.renderBounds,this.children,this.__hasMask?gh:dh)}__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(ah),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ph.warn("add self or destroyed");const s=i(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),s||e++});t=he.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?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(Dr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Dr.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)):i(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(Dr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Dr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Dr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};_h=pe([Uo(Aa)],_h);class fh{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,n=i.length;t<n;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let n=0,o=e.length;n<o;n++)i(s)?e[n].innerId===t.innerId&&(s=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;i(s)||e.splice(s,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 fh;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 mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const yh="1.11.0";class vh extends Ce{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=y.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}}Vn(OffscreenCanvasRenderingContext2D.prototype),Vn(Path2D.prototype);const{mineType:wh}=jn;function xh(t,e){y.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:wh(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:wh(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",y.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()})},y.canvas=re.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(re,{canvas:(t,e)=>new vh(t,e),image:t=>new so(t)}),y.name="web",y.isWorker=!0,y.backgrounder=!0,y.requestRender=function(t){requestAnimationFrame(t)},no(y,"devicePixelRatio",{get:()=>1});const{userAgent:bh}=navigator;bh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),bh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):bh.indexOf("Mac")>-1?y.os="Mac":bh.indexOf("Linux")>-1&&(y.os="Linux");class kh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new fh;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 fh,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(qr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Dr.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 Ur(Ur.DATA,{updatedList:this.updatedList})),this.__updatedList=new fh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Fr.CHANGE,this.__onAttrChange,this],[[Dr.ADD,Dr.REMOVE],this.__onChildEvent,this],[Ur.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Sh,updateBounds:Eh,updateChange:Bh}=rr,{pushAllChildBranch:Th,pushAllParent:Rh}=yr;const{worldBounds:Ch}=pr;class Oh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new fh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ch)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ch),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:Ph,updateAllChange:Lh}=rr,Ah=$t.get("Layouter");class Dh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new mh,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){Ah.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ah.warn("layouting"):this.times>3?Ah.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ur.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=ie.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?(Sh(t,!0),e.add(t),t.isBranch&&Th(t,e),Rh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Rh(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||Eh(s[t])}Eh(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,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Gr,o=this.getBlocks(new fh(e));e.emitEvent(new Gr(i,o,this.times)),Dh.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),ie.end(t)}static fullLayout(t){Ph(t,!0),t.isBranch?yr.updateBounds(t):rr.updateBounds(t),Lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Oh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Oh(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],[Ur.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Mh=$t.get("Renderer");class Fh{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(qr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(qr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(qr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Mh.log(e.innerName,"---\x3e");try{this.emitRender(qr.START),this.renderOnce(t),this.emitRender(qr.END,this.totalBounds),Qn.clearRecycled()}catch(t){this.rendering=!1,Mh.error(t)}Mh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Mh.warn("rendering");if(this.times>3)return Mh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(qr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(qr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(qr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(qr.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=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Gt(s);i.save(),s.spread(Fh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.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),$t.showRepaint&&$t.drawRepaint(i,t),y.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 Gt;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 y.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()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(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 Gt(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||Mh.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 qr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[qr.REQUEST,this.update,this],[Gr.END,this.__onLayoutEnd,this],[qr.AGAIN,this.renderAgain,this],[jr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Fh.clipSpread=10;const{hitRadiusPoint:Ih}=Ht;class Wh{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 fh(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 fh;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||rr.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&rr.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=>rr.worldHittable(t))}getPath(t){const e=new fh,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 fh;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 fh,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||Ih(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 zh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Wh(this.target=t,this),this.finder=re.finder&&re.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return y.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):oe.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Yh(t){return ao(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Nh(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Xh(){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}})}}function Hh(t){return(e,i)=>{no(e,i,ro(i,t))}}Object.assign(re,{watcher:(t,e)=>new kh(t,e),layouter:(t,e)=>new Dh(t,e),renderer:(t,e,i)=>new Fh(t,e,i),selector:(t,e)=>new zh(t,e)}),y.layout=Dh.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new fh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Vh={},jh={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}},Uh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Gh={},qh={},Kh={},Zh={},Jh={},$h={apply(){oe.need("filter")}},Qh={},tl={setStyleName:()=>oe.need("state"),set:()=>oe.need("state")},el={list:{},register(t,e){el.list[t]=e},get:t=>el.list[t]},{parse:il,objectToCanvasData:sl}=Qi,{stintSet:nl}=g,{hasTransparent:ol}=jh,rl={originPaint:{}},al=$t.get("UIData");class hl extends _{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,al.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,al.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(nl(this,"__isTransparentFill",ol(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(nl(this,"__isTransparentStroke",ol(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?il(t):sl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ll(this,"shadow",t)}setInnerShadow(t){ll(this,"innerShadow",t)}setFilter(t){ll(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&qh.compute("fill",this.__leaf),e&&qh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){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(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=rl)):(this.__isStrokes=!0,this._stroke||(this._stroke=rl))}__removePaint(t,e){e&&this.__removeInput(t),Kh.recycleImage(t,this),"fill"===t?(nl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(nl(this,"__isAlphaPixelStroke",void 0),nl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ll(t,e,i){t.__setInput(e,i),l(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 dl extends hl{}class cl extends dl{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 ul extends dl{__getInputData(t,e){const i=super.__getInputData(t,e);return Re.forEach(t=>delete i[t]),i}}class gl extends cl{}class pl extends hl{get __usePathBox(){return this.points||this.__pathInputed}}class _l extends hl{get __boxStroke(){return!this.__pathInputed}}class fl extends hl{get __boxStroke(){return!this.__pathInputed}}class ml extends pl{}class yl extends hl{}class vl extends hl{get __pathInputed(){return 2}}class wl extends dl{}const xl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class bl extends hl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=xl[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=he.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 kl extends _l{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 Sl extends _l{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:El,add:Bl}=T,Tl={__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=El(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=Jh.getShadowRenderSpread(this,e)),s&&(t=El(t,s)),o&&(t=Bl(t,$h.getSpread(o))),r&&(t=Bl(t,r)),a&&(t=Bl(t,a));let l=t;return i&&(l=El(l,Jh.getInnerShadowSpread(this,i))),n&&(l=El(l,n)),this.__layout.renderShapeSpread=l,h?El(h.__updateRenderSpread(),t):t}},{stintSet:Rl}=g,Cl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Rl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Rl(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;Rl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),Rl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ol(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=qh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Jh.shadow(this,t,h),a&&(s.__isStrokes?qh.strokes(o,this,t,e):qh.stroke(o,this,t,e)),n&&(s.__isFills?qh.fills(n,this,t,e):qh.fill(n,this,t,e)),r&&this.__drawAfterFill(t,e),d&&Jh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?qh.strokes(o,this,t,e):qh.stroke(o,this,t,e)),c&&$h.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?qh.strokes(o,this,t,e):qh.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,jh.string(e.color))}n&&(s.__isFills?qh.fills(n,this,t,e):qh.fill(n,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?qh.strokes(o,this,t,e):qh.stroke(o,this,t,e))}}else s.__pathInputed?Ol(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?qh.fills(s,this,t,e):qh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?qh.strokes(n,this,t,e):qh.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 Ol(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&qh.stroke(n,t,e,i),s&&qh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),n&&!r&&qh.stroke(n,t,e,i)}const Pl={__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 Ll;let Al=Ll=class extends oh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Xn.set(this.path=t||[]),t||this.__drawPathByBox(Xn),Xn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return oe.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return oe.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Xn.set(i=[]),this.__drawPathByBox(Xn)),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||Qh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Yn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Gh.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,r(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){qh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),oe.need("animate")}killAnimate(t,e){}export(t,e){return oe.need("export")}syncExport(t,e){return oe.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Ll.one(e)}static one(t,e,i,s,n){return he.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Go()(this)}static registerData(t){Io(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};pe([Io(hl)],Al.prototype,"__",void 0),pe([Xh()],Al.prototype,"zoomLayer",void 0),pe([co("")],Al.prototype,"id",void 0),pe([co("")],Al.prototype,"name",void 0),pe([co("")],Al.prototype,"className",void 0),pe([Bo("pass-through")],Al.prototype,"blendMode",void 0),pe([Ro(1)],Al.prototype,"opacity",void 0),pe([Co(!0)],Al.prototype,"visible",void 0),pe([Bo(!1)],Al.prototype,"locked",void 0),pe([To(!1)],Al.prototype,"dim",void 0),pe([To(!1)],Al.prototype,"dimskip",void 0),pe([Lo(0)],Al.prototype,"zIndex",void 0),pe([Ao(!1)],Al.prototype,"mask",void 0),pe([Do(!1)],Al.prototype,"eraser",void 0),pe([uo(0,!0)],Al.prototype,"x",void 0),pe([uo(0,!0)],Al.prototype,"y",void 0),pe([mo(100,!0)],Al.prototype,"width",void 0),pe([mo(100,!0)],Al.prototype,"height",void 0),pe([_o(1,!0)],Al.prototype,"scaleX",void 0),pe([_o(1,!0)],Al.prototype,"scaleY",void 0),pe([fo(0,!0)],Al.prototype,"rotation",void 0),pe([fo(0,!0)],Al.prototype,"skewX",void 0),pe([fo(0,!0)],Al.prototype,"skewY",void 0),pe([uo(0,!0)],Al.prototype,"offsetX",void 0),pe([uo(0,!0)],Al.prototype,"offsetY",void 0),pe([go(0,!0)],Al.prototype,"scrollX",void 0),pe([go(0,!0)],Al.prototype,"scrollY",void 0),pe([po()],Al.prototype,"origin",void 0),pe([po()],Al.prototype,"around",void 0),pe([co(!1)],Al.prototype,"lazy",void 0),pe([yo(1)],Al.prototype,"pixelRatio",void 0),pe([Eo(0)],Al.prototype,"renderSpread",void 0),pe([wo()],Al.prototype,"path",void 0),pe([xo()],Al.prototype,"windingRule",void 0),pe([xo(!0)],Al.prototype,"closed",void 0),pe([mo(0)],Al.prototype,"padding",void 0),pe([mo(!1)],Al.prototype,"lockRatio",void 0),pe([mo()],Al.prototype,"widthRange",void 0),pe([mo()],Al.prototype,"heightRange",void 0),pe([co(!1)],Al.prototype,"draggable",void 0),pe([co()],Al.prototype,"dragBounds",void 0),pe([co("auto")],Al.prototype,"dragBoundsType",void 0),pe([co(!1)],Al.prototype,"editable",void 0),pe([Mo(!0)],Al.prototype,"hittable",void 0),pe([Mo("path")],Al.prototype,"hitFill",void 0),pe([So("path")],Al.prototype,"hitStroke",void 0),pe([Mo(!1)],Al.prototype,"hitBox",void 0),pe([Mo(!0)],Al.prototype,"hitChildren",void 0),pe([Mo(!0)],Al.prototype,"hitSelf",void 0),pe([Mo()],Al.prototype,"hitRadius",void 0),pe([Fo("")],Al.prototype,"cursor",void 0),pe([Bo()],Al.prototype,"fill",void 0),pe([So(void 0,!0)],Al.prototype,"stroke",void 0),pe([So("inside")],Al.prototype,"strokeAlign",void 0),pe([So(1,!0)],Al.prototype,"strokeWidth",void 0),pe([So(!1)],Al.prototype,"strokeWidthFixed",void 0),pe([So("none")],Al.prototype,"strokeCap",void 0),pe([So("miter")],Al.prototype,"strokeJoin",void 0),pe([So()],Al.prototype,"dashPattern",void 0),pe([So(0)],Al.prototype,"dashOffset",void 0),pe([So(10)],Al.prototype,"miterLimit",void 0),pe([xo(0)],Al.prototype,"cornerRadius",void 0),pe([xo()],Al.prototype,"cornerSmoothing",void 0),pe([Yh()],Al.prototype,"shadow",void 0),pe([Yh()],Al.prototype,"innerShadow",void 0),pe([Yh()],Al.prototype,"blur",void 0),pe([Yh()],Al.prototype,"backgroundBlur",void 0),pe([Yh()],Al.prototype,"grayscale",void 0),pe([Yh()],Al.prototype,"filter",void 0),pe([Bo()],Al.prototype,"placeholderColor",void 0),pe([co(100)],Al.prototype,"placeholderDelay",void 0),pe([co({})],Al.prototype,"data",void 0),pe([Ho(oh.prototype.reset)],Al.prototype,"reset",null),Al=Ll=pe([Uo(Tl),Uo(Cl),Vo()],Al);let Dl=class extends Al{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ml;pe([Io(dl)],Dl.prototype,"__",void 0),pe([mo(0)],Dl.prototype,"width",void 0),pe([mo(0)],Dl.prototype,"height",void 0),Dl=pe([Uo(_h),Go()],Dl);const Fl=$t.get("Leafer");let Il=Ml=class extends Dl{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),Ml.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=re.canvas(s);this.__controllers.push(this.renderer=re.renderer(this,n,s),this.watcher=re.watcher(this,s),this.layouter=re.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=re.selector(this),this.interaction=re.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.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))),br.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 Gt(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 jr(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 Kt(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),br.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Kr.VIEW_READY),br.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){br.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),br.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 oe.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=ie.start("FirstCreate "+this.innerName);this.once([[Kr.START,()=>ie.end(t)],[Gr.START,this.updateLazyBounds,this],[qr.START,this.__onCreated,this],[qr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ur.DATA,this.__onWatchData,this],[Gr.END,this.__onLayoutEnd,this],[qr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ml.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){Fl.error(t)}}};t?e():setTimeout(e)}};Il.list=new fh,pe([Io(ul)],Il.prototype,"__",void 0),pe([mo()],Il.prototype,"pixelRatio",void 0),pe([co("normal")],Il.prototype,"mode",void 0),Il=Ml=pe([Go()],Il);let Wl=class extends Al{get __tag(){return"Rect"}};pe([Io(_l)],Wl.prototype,"__",void 0),Wl=pe([Uo(Pl),Vo(),Go()],Wl);const{add:zl,includes:Yl,scroll:Nl}=Ht,Xl=Wl.prototype,Hl=Dl.prototype;let Vl=class extends Dl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(zl(a,o),Nl(a,i)),this.__updateRectRenderBounds(),t=!Yl(o,a),t&&"show"===r&&zl(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))}};pe([Io(cl)],Vl.prototype,"__",void 0),pe([mo(100)],Vl.prototype,"width",void 0),pe([mo(100)],Vl.prototype,"height",void 0),pe([co(!1)],Vl.prototype,"resizeChildren",void 0),pe([Eo("show")],Vl.prototype,"overflow",void 0),pe([Ho(Xl.__updateStrokeSpread)],Vl.prototype,"__updateStrokeSpread",null),pe([Ho(Xl.__updateRenderSpread)],Vl.prototype,"__updateRectRenderSpread",null),pe([Ho(Xl.__updateBoxBounds)],Vl.prototype,"__updateRectBoxBounds",null),pe([Ho(Xl.__updateStrokeBounds)],Vl.prototype,"__updateStrokeBounds",null),pe([Ho(Xl.__updateRenderBounds)],Vl.prototype,"__updateRectRenderBounds",null),pe([Ho(Xl.__updateChange)],Vl.prototype,"__updateRectChange",null),pe([Ho(Xl.__render)],Vl.prototype,"__renderRect",null),pe([Ho(Hl.__render)],Vl.prototype,"__renderGroup",null),Vl=pe([Vo(),Go()],Vl);let jl=class extends Vl{get __tag(){return"Frame"}get isFrame(){return!0}};pe([Io(gl)],jl.prototype,"__",void 0),pe([Bo("#FFFFFF")],jl.prototype,"fill",void 0),pe([Eo("hide")],jl.prototype,"overflow",void 0),jl=pe([Go()],jl);const{moveTo:Ul,closePath:Gl,ellipse:ql}=bs;let Kl=class extends Al{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&&ql(a,o,r,o*i,r*i,0,s,n,!1),ql(a,o,r,o,r,0,n,s,!0),i<1&&Gl(a)):(i<1&&(ql(a,o,r,o*i,r*i),Ul(a,t,r)),ql(a,o,r,o,r,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Ul(a,o,r),ql(a,o,r,o,r,0,s,n,!1),Gl(a)):ql(a,o,r,o,r)}};pe([Io(fl)],Kl.prototype,"__",void 0),pe([xo(0)],Kl.prototype,"innerRadius",void 0),pe([xo(0)],Kl.prototype,"startAngle",void 0),pe([xo(0)],Kl.prototype,"endAngle",void 0),Kl=pe([Go()],Kl);const{sin:Zl,cos:Jl,PI:$l}=Math,{moveTo:Ql,lineTo:td,closePath:ed,drawPoints:id}=bs;let sd=class extends Al{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)id(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Ql(e,o,0);for(let t=1;t<n;t++)td(e,o+o*Zl(2*t*$l/n),r-r*Jl(2*t*$l/n));ed(e)}}};pe([Io(ml)],sd.prototype,"__",void 0),pe([xo(3)],sd.prototype,"sides",void 0),pe([xo()],sd.prototype,"points",void 0),pe([xo(0)],sd.prototype,"curve",void 0),sd=pe([Vo(),Go()],sd);const{sin:nd,cos:od,PI:rd}=Math,{moveTo:ad,lineTo:hd,closePath:ld}=bs;let dd=class extends Al{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];ad(r,n,0);for(let t=1;t<2*i;t++)hd(r,n+(t%2==0?n:n*s)*nd(t*rd/i),o-(t%2==0?o:o*s)*od(t*rd/i));ld(r)}};pe([Io(yl)],dd.prototype,"__",void 0),pe([xo(5)],dd.prototype,"corners",void 0),pe([xo(.382)],dd.prototype,"innerRadius",void 0),dd=pe([Go()],dd);const{moveTo:cd,lineTo:ud,drawPoints:gd}=bs,{rotate:pd,getAngle:_d,getDistance:fd,defaultPoint:md}=lt;let yd=class extends Al{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&pd(i,e),i}set toPoint(t){this.width=fd(md,t),this.rotation=_d(md,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?gd(e,t.points,t.curve,t.closed):(cd(e,0,0),ud(e,this.width,0))}};pe([Io(pl)],yd.prototype,"__",void 0),pe([bo("center")],yd.prototype,"strokeAlign",void 0),pe([mo(0)],yd.prototype,"height",void 0),pe([xo()],yd.prototype,"points",void 0),pe([xo(0)],yd.prototype,"curve",void 0),pe([xo(!1)],yd.prototype,"closed",void 0),yd=pe([Go()],yd);let vd=class extends Wl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}};pe([Io(kl)],vd.prototype,"__",void 0),pe([mo("")],vd.prototype,"url",void 0),vd=pe([Go()],vd);const wd=vd;let xd=class extends Wl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.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 Wr(Wr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),o=new ft;e&&o.translate(e.x,e.y),i&&(r(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()}};pe([Io(Sl)],xd.prototype,"__",void 0),pe([Nh(100)],xd.prototype,"width",void 0),pe([Nh(100)],xd.prototype,"height",void 0),pe([Nh(1)],xd.prototype,"pixelRatio",void 0),pe([Nh(!0)],xd.prototype,"smooth",void 0),pe([co(!1)],xd.prototype,"safeResize",void 0),pe([Nh()],xd.prototype,"contextSettings",void 0),xd=pe([Go()],xd);const{copyAndSpread:bd,includes:kd,spread:Sd,setList:Ed}=Ht,{stintSet:Bd}=g;let Td=class extends Al{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=Uh.number(e,n),t.__letterSpacing=Uh.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"}`,Bd(t,"__padding",l&&I.fourNumber(l)),Bd(t,"__clipText","show"!==h&&!t.__autoSize),Bd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Vh.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&&Sd(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",!kd(h,a)),this.isOverflow?(Ed(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;bd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};pe([Io(bl)],Td.prototype,"__",void 0),pe([mo(0)],Td.prototype,"width",void 0),pe([mo(0)],Td.prototype,"height",void 0),pe([Bo()],Td.prototype,"boxStyle",void 0),pe([co(!1)],Td.prototype,"resizeFontSize",void 0),pe([Bo("#000000")],Td.prototype,"fill",void 0),pe([bo("outside")],Td.prototype,"strokeAlign",void 0),pe([Mo("all")],Td.prototype,"hitFill",void 0),pe([mo("")],Td.prototype,"text",void 0),pe([mo("")],Td.prototype,"placeholder",void 0),pe([mo("caption")],Td.prototype,"fontFamily",void 0),pe([mo(12)],Td.prototype,"fontSize",void 0),pe([mo("normal")],Td.prototype,"fontWeight",void 0),pe([mo(!1)],Td.prototype,"italic",void 0),pe([mo("none")],Td.prototype,"textCase",void 0),pe([mo("none")],Td.prototype,"textDecoration",void 0),pe([mo(0)],Td.prototype,"letterSpacing",void 0),pe([mo({type:"percent",value:1.5})],Td.prototype,"lineHeight",void 0),pe([mo(0)],Td.prototype,"paraIndent",void 0),pe([mo(0)],Td.prototype,"paraSpacing",void 0),pe([mo("x")],Td.prototype,"writingMode",void 0),pe([mo("left")],Td.prototype,"textAlign",void 0),pe([mo("top")],Td.prototype,"verticalAlign",void 0),pe([mo(!0)],Td.prototype,"autoSizeAlign",void 0),pe([mo("normal")],Td.prototype,"textWrap",void 0),pe([mo("show")],Td.prototype,"textOverflow",void 0),pe([Bo(!1)],Td.prototype,"textEditing",void 0),Td=pe([Go()],Td);let Rd=class extends Al{get __tag(){return"Path"}};pe([Io(vl)],Rd.prototype,"__",void 0),pe([bo("center")],Rd.prototype,"strokeAlign",void 0),Rd=pe([Go()],Rd);let Cd=class extends Dl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Rd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};pe([Io(wl)],Cd.prototype,"__",void 0),pe([(t,e)=>{no(t,e,{get(){return this.__path}})}],Cd.prototype,"path",void 0),Cd=pe([Uo(zs,["set","path","paint"]),Go()],Cd);let Od=class extends Il{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&&re.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Il(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),i(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],[qr.START,this.__onCreated,this],[qr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(qr.END,this.__onChildRenderEnd,this))}};Od=pe([Go()],Od);const Pd={},Ld={isHoldSpaceKey:()=>Ld.isHold("Space"),isHold:t=>Pd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Pd[t]||(Pd[t]=!0)},setUpCode(t){Pd[t]=!1}},Ad={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 Dd extends Ar{get spaceKey(){return Ld.isHoldSpaceKey()}get left(){return Ad.left(this)}get right(){return Ad.right(this)}get middle(){return Ad.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ld.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){ce.changeName(t,e)}}const{min:Md,max:Fd,abs:Id}=Math,{float:Wd,sign:zd}=I,{minX:Yd,maxX:Nd,minY:Xd,maxY:Hd}=Ht,Vd=new Gt,jd=new Gt,Ud={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Gd.getValidMove(t.__localBoxBounds,Gd.getDragBounds(t),s,e,!0),Gd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:o}=t;n&&Gd.getValidScaleOf(t.__localBoxBounds,Gd.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)),Gd.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),Gd.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=Wd(s.x),s.y=Wd(s.y),s},getValidScaleOf(t,e,i,s,n,r,a){a||(n=Object.assign({},n)),jd.set(e),Vd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,g,p,_,f=1,m=1;return Gd.isInnerMode(t,e,i,"width")?(n.x<0&&Vd.scaleOf(s,f=1/n.x,1),p=Wd(Vd.minX-jd.minX),_=Wd(jd.maxX-Vd.maxX),u=h&&p>0?1+p/(h*Vd.width):1,g=l&&_>0?1+_/(l*Vd.width):1,f*=Fd(u,g)):(n.x<0&&((Wd(Yd(t)-Yd(e))<=0||Wd(Nd(e)-Nd(t))<=0)&&Vd.scaleOf(s,f=1/n.x,1),Vd.unsign()),p=Wd(jd.minX-Vd.minX),_=Wd(Vd.maxX-jd.maxX),u=h&&p>0?1-p/(h*Vd.width):1,g=l&&_>0?1-_/(l*Vd.width):1,f*=Md(u,g)),Gd.isInnerMode(t,e,i,"height")?(n.y<0&&Vd.scaleOf(s,1,m=1/n.y),p=Wd(Vd.minY-jd.minY),_=Wd(jd.maxY-Vd.maxY),u=d&&p>0?1+p/(d*Vd.height):1,g=c&&_>0?1+_/(c*Vd.height):1,m*=Fd(u,g),r&&(u=Fd(Id(f),Id(m)),f=zd(f)*u,m=zd(m)*u)):(n.y<0&&((Wd(Xd(t)-Xd(e))<=0||Wd(Hd(e)-Hd(t))<=0)&&Vd.scaleOf(s,1,m=1/n.y),Vd.unsign()),p=Wd(jd.minY-Vd.minY),_=Wd(Vd.maxY-jd.maxY),u=d&&p>0?1-p/(d*Vd.height):1,g=c&&_>0?1-_/(c*Vd.height):1,m*=Md(u,g)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},Gd=Ud;let qd=class extends Dd{};qd.POINTER="pointer",qd.BEFORE_DOWN="pointer.before_down",qd.BEFORE_MOVE="pointer.before_move",qd.BEFORE_UP="pointer.before_up",qd.DOWN="pointer.down",qd.MOVE="pointer.move",qd.UP="pointer.up",qd.OVER="pointer.over",qd.OUT="pointer.out",qd.ENTER="pointer.enter",qd.LEAVE="pointer.leave",qd.TAP="tap",qd.DOUBLE_TAP="double_tap",qd.CLICK="click",qd.DOUBLE_CLICK="double_click",qd.LONG_PRESS="long_press",qd.LONG_TAP="long_tap",qd.MENU="pointer.menu",qd.MENU_TAP="pointer.menu_tap",qd=pe([qo()],qd);const Kd=qd,Zd={};let Jd=class extends qd{static setList(t){this.list=t instanceof fh?t:new fh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Ud.axisMove(t,n),n}static limitMove(t,e){Ud.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Zd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Zd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Zd,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){Zd.x=t?this.totalX:this.moveX,Zd.y=t?this.totalY:this.moveY}};Jd.BEFORE_DRAG="drag.before_drag",Jd.START="drag.start",Jd.DRAG="drag",Jd.END="drag.end",Jd.OVER="drag.over",Jd.OUT="drag.out",Jd.ENTER="drag.enter",Jd.LEAVE="drag.leave",Jd=pe([qo()],Jd);const $d=Jd;let Qd=class extends qd{static setList(t){Jd.setList(t)}static setData(t){Jd.setData(t)}};Qd.DROP="drop",Qd=pe([qo()],Qd);let tc=class extends Jd{};tc.BEFORE_MOVE="move.before_move",tc.START="move.start",tc.MOVE="move",tc.END="move.end",tc=pe([qo()],tc);let ec=class extends Dd{};ec=pe([qo()],ec);const ic=ec;let sc=class extends qd{};sc.BEFORE_ROTATE="rotate.before_rotate",sc.START="rotate.start",sc.ROTATE="rotate",sc.END="rotate.end",sc=pe([qo()],sc);let nc=class extends Jd{};nc.SWIPE="swipe",nc.LEFT="swipe.left",nc.RIGHT="swipe.right",nc.UP="swipe.up",nc.DOWN="swipe.down",nc=pe([qo()],nc);let oc=class extends qd{};oc.BEFORE_ZOOM="zoom.before_zoom",oc.START="zoom.start",oc.ZOOM="zoom",oc.END="zoom.end",oc=pe([qo()],oc);let rc=class extends Dd{};rc.BEFORE_DOWN="key.before_down",rc.BEFORE_UP="key.before_up",rc.DOWN="key.down",rc.HOLD="key.hold",rc.UP="key.up",rc=pe([qo()],rc);const ac={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?nc.UP:t>45&&t<135?nc.DOWN:t<=45&&t>=-45?nc.RIGHT:nc.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:hc.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:i(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 fh,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>rr.draggable(t)||!t.isLeafer&&t.hasEvent(Jd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},hc=ac,lc=new fh,{getDragEventData:dc,getDropEventData:cc,getSwipeEventData:uc}=ac;class gc{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=dc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Jd.list||this.draggableList||lc;return this.dragging&&(s?t?lc:new fh(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(tc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Ad.left(t),this.dragging&&(this.interaction.emit(Jd.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],rr.draggable(e)){this.draggableList=new fh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=dc(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(tc.BEFORE_MOVE,this.dragData),e.emit(tc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(Jd.BEFORE_DRAG,this.dragData),e.emit(Jd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:a}=e.p,h=!a||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=Jd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},h||s);a&&!s&&t?rr.animateMove(e,l,r(a)?a:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Jd.OUT,t,i),e.emit(Jd.OVER,t,s)):e.emit(Jd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Jd.LEAVE,t,i,s),e.emit(Jd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=dc(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(tc.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Jd.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=uc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=cc(t,e,Jd.data);s.path=i,this.interaction.emit(Qd.DROP,s),this.interaction.emit(Jd.LEAVE,t,i)}dragReset(){Jd.list=Jd.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 pc=$t.get("emit");const _c=["move","zoom","rotate","key"];function fc(t,e,i,s,n){if(_c.some(t=>e.startsWith(t))&&t.__.hitChildren&&!yc(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&&mc(o,e,i,s,n)}}function mc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!yc(t,n)&&(tl.updateEventStyle&&!s&&tl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ce.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function yc(t,e){return e&&e.has(t)}const vc={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:wc,pathCanDrag:xc,pathHasOutside:bc}=ac;class kc{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&&Ad.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Ad.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ld.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(vc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new fh(t),this.createTransformer(),this.dragger=new gc(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Ad.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(qd.BEFORE_DOWN,t),this.emit(qd.DOWN,t),Ad.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Ad.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Ad.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(qd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(qd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Ad.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(qd.BEFORE_UP,t),this.emit(qd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(qd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(qd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(rc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ld.setDownCode(e),this.emit(rc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(rc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(rc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ld.setUpCode(e),this.emit(rc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new fh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(qd.OUT,t,i),this.emit(qd.OVER,t,e)):this.emit(qd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(qd.LEAVE,t,i,e),this.emit(qd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(qd.LEAVE,t),this.dragger.dragging&&this.emit(Qd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[qd.DOUBLE_TAP,qd.DOUBLE_CLICK].some(e=>wc(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:n,target:o}=this;y.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&&!bc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!xc(t.path))&&!bc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:qd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&<.round(s),s}emitTap(t){this.emit(qd.TAP,t),this.emit(qd.CLICK,t)}emitDoubleTap(t){this.emit(qd.DOUBLE_TAP,t),this.emit(qd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(qd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(qd.LONG_TAP,t),(wc(t.path,qd.LONG_TAP)||wc(t.path,qd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(r(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(jr.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],mc(n,t,e,!0,s))return;n.isApp&&fc(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&fc(n,t,e,!1,s),mc(n,t,e,!1,s))return}catch(t){pc.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 Sc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Sc.custom={};class Ec extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new fh,this.pixelList=new fh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),re.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),re.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()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())};const{toInnerRadiusPointOf:Bc,copy:Tc,setRadius:Rc}=lt,{hitRadiusPoint:Cc,hitPoint:Oc}=Ht,Pc={},Lc={},Ac=oh.prototype;Ac.hit=function(t,e=0){this.updateLayout(),Tc(Lc,t),Rc(Lc,e);const i=this.__world;return!!(e?Cc(i,Lc):Oc(i,Lc))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},Lc),e,{target:this}):this.__hitWorld(Lc))},Ac.__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&&(Tc(Pc,t),Rc(t=Pc,e.hitRadius)),Bc(t,i,Pc),e.hitBox||n){if(Ht.hitRadiusPoint(s.boxBounds,Pc))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Pc)},Ac.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Ac.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Ac.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Ac.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Dc=new ft,Mc=Al.prototype;Mc.__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=y.image.hitCanvasSize,r=o.hitScale=qt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=qt.set(t).scale(r);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),Qn.patternLocked=!0,this.__renderShape(o,{matrix:Dc.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)},Mc.__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 Fc=Al.prototype,Ic=Wl.prototype,Wc=Vl.prototype;Ic.__updateHitCanvas=Wc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Fc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ic.__hitFill=Wc.__hitFill=function(t){return this.__hitCanvas?Fc.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},Td.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))},Dl.prototype.pick=function(t,i){return i||(i=e),this.updateLayout(),y.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const zc=Ce.prototype;function Yc(t,e,i){t.__.__font?qh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Nc(t,e,i,s,n){const o=i.__;d(t)?qh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&qh.strokeArrow(t,i,s,n)}function Xc(t,e,i,s,n){const o=i.__;d(t)?qh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),qh.drawTextStroke(i,s,n))}function Hc(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Xc(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",qh.fillText(i,o,n),o.blendMode="normal",rr.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}zc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},zc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},zc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),qt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Vc,copyAndSpread:jc,toOuterOf:Uc,getOuterOf:Gc,getByMove:qc,move:Kc,getIntersectData:Zc}=Ht,Jc={};let $c;const{stintSet:Qc}=g,{hasTransparent:tu}=jh;function eu(t,e,s){if(!d(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:r}=s.__layout;switch(e.type){case"image":o=Kh.image(s,t,e,r,!$c||!$c[e.url]);break;case"linear":o=Zh.linearGradient(e,r);break;case"radial":o=Zh.radialGradient(e,r);break;case"angular":o=Zh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;o={type:n,style:jh.string(a,h)};break;default:i(e.r)||(o={type:"solid",style:jh.string(e)})}if(o&&(o.originPaint=e,n(o.style)&&tu(o.style)&&(o.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}return o}const iu={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];l(a)||(a=[a]),$c=Kh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=eu(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?(Qc(i,"__isAlphaPixelFill",n),Qc(i,"__isTransparentFill",o)):(Qc(i,"__isAlphaPixelStroke",n),Qc(i,"__isTransparentStroke",o),Qc(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Yc(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,Kh.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===o.scaleFixed||"zoom-in"===o.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}o.blendMode&&(i.blendMode=o.blendMode),Yc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Yc(e,i,s),i.restoreBlendMode()):Yc(e,i,s)}},fillPathOrText:Yc,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)qh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Nc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Nc(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)Nc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Nc(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),rr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){qh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Xc(t,1,e,i,s);break;case"inside":Hc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Xc(t,2,e,i,s):Hc(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||!Kh.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?qh.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?qh.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,o=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;Uc(r.strokeSpread?(jc(Jc,r.boxBounds,r.strokeSpread),Jc):r.boxBounds,o,a);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))g=s,h=u=a,l=o;else{let s;if(y.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Vc(n,T.swapAndScale(r.renderShapeSpread,p,_)):n;s=Zc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),p*=f,_*=m),u=Gc(a,c),h=qc(u,-c.e,-c.f),l=Gc(o,c),Kc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:p,scaleY:_}}};let su,nu=new Gt;const{isSame:ou}=Ht;function ru(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||Kh.createData(n,s,i,o),!0}function au(t,e){du(t,Wr.LOAD,e)}function hu(t,e){du(t,Wr.LOADED,e)}function lu(t,e,i){e.error=i,t.forceUpdate("surface"),du(t,Wr.ERROR,e)}function du(t,e,i){t.hasEvent(e)&&t.emitEvent(new Wr(e,i))}function cu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:uu,translate:gu}=$,pu=new Gt,_u={},fu={};function mu(t,e,i,s){const o=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let yu={},vu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:wu,set:xu,rotateOfOuter:bu,translate:ku,scaleOfOuter:Su,multiplyParent:Eu,scale:Bu,rotate:Tu,skew:Ru}=$;function Cu(t,e,i,s,n,o,r,a){r&&Tu(t,r),a&&Ru(t,a.x,a.y),n&&Bu(t,n,o),ku(t,e.x+i,e.y+s)}const{get:Ou,scale:Pu,copy:Lu}=$,{getFloorScale:Au}=I,{abs:Du}=Math;const Mu={image:function(t,e,i,s,n){let o,r;const a=Qn.get(i);return su&&i===su.paint&&ou(s,su.boxBounds)?o=su.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),su=a.use>1?{leafPaint:o,paint:i,boxBounds:nu.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(ru(t,e,i,a,o,s),n&&(au(t,r),hu(t,r))):a.error?n&&lu(t,r,a.error):(n&&(cu(t,!0),au(t,r)),o.loadId=a.load(()=>{cu(t,!1),t.destroyed||(ru(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),hu(t,r)),o.loadId=void 0},e=>{cu(t,!1),lu(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}=Kh.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===o+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&jr.isResizing(i)||d||(e=y.image.isLarge(a,o,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Kh.drawImage(t,o,r,i,s,n),!0):(!t.style||l.sync||d?Kh.createPattern(t,i,s,n):Kh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let g,{width:p,height:_}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),g&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,p,_),n.restore()):(r.scaleX&&(p*=r.scaleX,_*=r.scaleY),n.drawImage(c,0,0,p,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,n,o,r,a;for(let h=0,d=i.length;h<d;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]||[],l(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(()=>_e(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Kh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:o}=Kh.getImageRenderScaleData(t,e,i,s),r=n+"-"+o;if(t.patternId!==r&&!e.destroyed&&(!y.image.isLarge(t.image,n,o)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Kh.getPatternFixScale(t,n,o);let d,c,u,{width:g,height:p}=i;l&&(n*=l,o*=l),g*=n,p*=o,h&&(c=h.x*n/Du(s.scaleX||1),u=h.y*o/Du(s.scaleY||1)),(a||1!==n||1!==o)&&(n*=Au(g+(c||0)),o*=Au(p+(u||0)),d=Ou(),a&&Lu(d,a),Pu(d,1/n,1/o));const _=i.getCanvas(g,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,o=y.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):o>r&&(o=r),(r*=e*i)>o&&(n=Math.sqrt(o/r)),n},createData:function(t,e,i,s){t.data=Kh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=pu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:o}=i,{opacity:r,mode:a,align:h,offset:l,scale:c,size:u,rotation:g,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Ht.set(fu,0,0,x?o:s,x?s:o),a&&"cover"!==a&&"fit"!==a?((c||u)&&(I.getScaleData(c,u,i,_u),b=_u.scaleX,k=_u.scaleY),(h||m||f)&&(b&&Ht.scale(fu,b,k,!0),h&&Bt.toPoint(h,fu,e,fu,!0,!0))):v&&!g||(b=k=Ht.getFitScale(e,fu,"fit"!==a),Ht.put(e,i,h,b,!1,fu),Ht.scale(fu,b,k,!0)),l&<.move(fu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/o,Kh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(fu.x||fu.y||b||_||g||p){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Kh.clipMode(w,e,fu.x,fu.y,b,k,g,p,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||p)&&Kh.repeatMode(w,e,s,o,fu.x,fu.y,b,k,g,p,h,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;d(t)?(o=t.x,r=t.y):o=r=t;return{x:mu(o,i,n.width,e&&e.x),y:mu(r,s,n.height,e&&e.y)}}(m,i&&f,fu.width,fu.height,e));break;default:b&&Kh.fillOrFitMode(w,e,fu.x,fu.y,b,k,g)}return w.transform||(e.x||e.y)&&gu(w.transform=uu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const n=wu(),{x:o,y:r}=e;o||r?ku(n,o,r):n.onlyScale=!0,Bu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=wu();ku(a,e.x+i,e.y+s),Bu(a,n,o),r&&bu(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=wu();Cu(d,e,i,s,n,o,r,a),h&&(r||a?(xu(vu),Su(vu,e,h,l),Eu(d,vu)):Su(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,o,r,a,h,l,d,c){const u=wu();if(c)Cu(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)bu(u,{x:i/2,y:s/2},h);else switch(Tu(u,h),h){case 90:ku(u,s,0);break;case 180:ku(u,i,s);break;case 270:ku(u,0,i)}yu.x=e.x+n,yu.y=e.y+o,ku(u,yu.x,yu.y),r&&Su(u,yu,r,a)}t.transform=u}},{toPoint:Fu}=kt,{hasTransparent:Iu}=jh,Wu={},zu={};function Yu(t,e,i,s){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],n(o)?(a=t/(l-1),r=jh.string(o,s)):(a=o.offset,r=jh.string(o.color,s)),e.addColorStop(a,r),!h&&Iu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Nu,getDistance:Xu}=lt,{get:Hu,rotateOfOuter:Vu,scaleOfOuter:ju}=$,{toPoint:Uu}=kt,Gu={},qu={};function Ku(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Nu(e,i);o=Hu(),n?(ju(o,e,r/a*(s||1),1),Vu(o,e,t+90)):(ju(o,e,1,r/a*(s||1)),Vu(o,e,t))}return o}const{getDistance:Zu}=lt,{toPoint:Ju}=kt,$u={},Qu={};const tg={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:o}=t;Fu(i||"top",e,Wu),Fu(s||"bottom",e,zu);const r=y.canvas.createLinearGradient(Wu.x,Wu.y,zu.x,zu.y),a={type:n,style:r};return Yu(a,r,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;Uu(i||"center",e,Gu),Uu(s||"bottom",e,qu);const a=y.canvas.createRadialGradient(Gu.x,Gu.y,0,Gu.x,Gu.y,Xu(Gu,qu)),h={type:n,style:a};Yu(h,a,t.stops,o);const l=Ku(e,Gu,qu,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:o,stretch:r}=t;Ju(i||"center",e,$u),Ju(s||"bottom",e,Qu);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,$u.x,$u.y):y.canvas.createRadialGradient($u.x,$u.y,0,$u.x,$u.y,Zu($u,Qu)),h={type:n,style:a};Yu(h,a,t.stops,o);const l=Ku(e,$u,Qu,r||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Ku},{copy:eg,move:ig,toOffsetOutBounds:sg}=Ht,{max:ng,abs:og}=Math,rg={},ag=new ft,hg={};function lg(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=og(t.spread||0),r=ng(r,n+o-s),a=ng(a,n+o+i),h=ng(h,n+o+s),l=ng(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function dg(t,e,i){const{shapeBounds:s}=i;let n,o;y.fullImageShadow?(eg(rg,t.bounds),ig(rg,e.x-s.x,e.y-s.y),n=t.bounds,o=rg):(n=s,o=e),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:cg}=Ht,ug={};const gg=lg;const pg={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;sg(h,hg,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.setWorldShadow(hg.offsetX+(r.x||0)*c*f,hg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,jh.string(r.color)),n=Jh.getShadowTransform(t,g,i,r,hg,f),n&&g.setTransform(n),dg(g,hg,i),n&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,o,"copy"),s=o),a?g.copyWorld(a,o,o,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),rr.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;cg(h,ug,l),r.forEach((r,_)=>{let f=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(ug.offsetX+(r.x||0)*c*f,ug.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),n=Jh.getShadowTransform(t,g,i,r,ug,f,!0),n&&g.setTransform(n),dg(g,ug,i),g.restore(),a?(g.copyWorld(g,l,o,"copy"),g.copyWorld(a,o,o,"source-out"),s=o):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,jh.string(r.color),"source-in"),rr.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:lg,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 ag.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),ag}},isTransformShadow(t){},getInnerShadowSpread:gg},{excludeRenderBounds:_g}=pr;let fg;function mg(t,e,i,s,n,o,r,a){switch(e){case"grayscale":fg||(fg=!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);vg(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":vg(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function yg(t){return t.getSameCanvas(!1,!0)}function vg(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)}Dl.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&&(mg(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||_g(i,e)||i.__render(t,e),o=i.__.opacity,fg=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=yg(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=yg(t)),n||(n=yg(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&mg(this,r,t,n,s,o,void 0,!1),_g(i,e)||i.__render(n||t,e),d&&mg(this,r,t,n,s,o,d,!1)}mg(this,r,t,n,s,o,void 0,!0)};const wg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",xg=wg+"_#~&*+\\=|≮≯≈≠=…",bg=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 kg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Sg=kg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Eg=kg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Bg=kg(wg),Tg=kg(xg),Rg=kg("- —/~|┆·");var Cg;!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"}(Cg||(Cg={}));const{Letter:Og,Single:Pg,Before:Lg,After:Ag,Symbol:Dg,Break:Mg}=Cg;function Fg(t){return Sg[t]?Og:Rg[t]?Mg:Eg[t]?Lg:Bg[t]?Ag:Tg[t]?Dg:bg.test(t)?Pg:Og}const Ig={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 Wg(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:zg}=Ig,{Letter:Yg,Single:Ng,Before:Xg,After:Hg,Symbol:Vg,Break:jg}=Cg;let Ug,Gg,qg,Kg,Zg,Jg,$g,Qg,tp,ep,ip,sp,np,op,rp,ap,hp,lp=[];function dp(t,e){tp&&!Qg&&(Qg=tp),Ug.data.push({char:t,width:e}),qg+=e}function cp(){Kg+=qg,Ug.width=qg,Gg.words.push(Ug),Ug={data:[]},qg=0}function up(){op&&(rp.paraNumber++,Gg.paraStart=!0,op=!1),tp&&(Gg.startCharSize=Qg,Gg.endCharSize=tp,Qg=0),Gg.width=Kg,ap.width?zg(Gg):hp&&gp(),lp.push(Gg),Gg={words:[]},Kg=0}function gp(){Kg>(rp.maxWidth||0)&&(rp.maxWidth=Kg)}const{top:pp,right:_p,bottom:fp,left:mp}=wt;function yp(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 vp={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,o=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(i=a[mp],o-=a[_p]+a[mp],!o&&(o=.01)):e.autoSizeAlign||(i=a[mp]),r?(s=a[pp],r-=a[pp]+a[fp],!r&&(r=.01)):e.autoSizeAlign||(s=a[pp]));const h={bounds:{x:i,y:s,width:o,height:r},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){rp=t,lp=t.rows,ap=t.bounds,hp=!ap.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:r}=y,{width:a}=ap;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;op=!0,ip=null,Qg=$g=tp=qg=Kg=0,Ug={data:[]},Gg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)Jg=e[i],"\n"===Jg?(qg&&cp(),Gg.paraEnd=!0,up(),op=!0):(ep=Fg(Jg),ep===Yg&&"none"!==o&&(Jg=Wg(Jg,o,!qg)),$g=r.measureText(Jg).width,s&&(s<0&&(tp=$g),$g+=s),sp=ep===Ng&&(ip===Ng||ip===Yg)||ip===Ng&&ep!==Hg,np=!(ep!==Xg&&ep!==Ng||ip!==Vg&&ip!==Hg),Zg=op&&n?a-n:a,t&&a&&Kg+qg+$g>Zg&&(h?(qg&&cp(),Kg&&up()):(np||(np=ep===Yg&&ip==Hg),sp||np||ep===jg||ep===Xg||ep===Ng||qg+$g>Zg?(qg&&cp(),Kg&&up()):Kg&&up()))," "===Jg&&!0!==op&&Kg+qg===0||(ep===jg?(" "===Jg&&qg&&cp(),dp(Jg,$g),cp()):sp||np?(qg&&cp(),dp(Jg,$g)):dp(Jg,$g)),ip=ep);qg&&cp(),Kg&&up(),lp.length>0&&(lp[lp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{rp.paraNumber++,Kg=r.measureText(t).width,lp.push({x:n||0,text:t,width:Kg,paraStart:!0}),hp&&gp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":yp(e,"x",t[mp]);break;case"right":yp(e,"x",-t[_p])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":yp(e,"y",t[pp]);break;case"bottom":yp(e,"y",-t[fp])}}(a,h,e,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:g,y:p,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-m)/2;break;case"bottom":p+=f-m}y+=p;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=g,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,g,p,_,f,m,y,v;s.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-p,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===_?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,o),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?y.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,o),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,d(o)?(i=o.type,o.color&&(t.decorationColor=jh.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 wp={string:function(t,e){if(!t)return"#000";const s=r(e)&&e<1;if(n(t)){if(!s||!jh.object)return t;t=jh.object(t)}let o=i(t.a)?1:t.a;s&&(o*=e);const a=t.r+","+t.g+","+t.b;return 1===o?"rgb("+a+")":"rgba("+a+","+o+")"}};function xp(t){return t?l(t)?t:[t]:[]}Object.assign(Vh,vp),Object.assign(jh,wp),Object.assign(qh,iu),Object.assign(Kh,Mu),Object.assign(Zh,tg),Object.assign(Jh,pg),Object.assign(re,{interaction:(t,e,i,s)=>new kc(t,e,i,s),hitCanvas:(t,e)=>new vh(t,e),hitCanvasManager:()=>new Ec}),xh();class bp extends Ar{get list(){return xp(this.value)}get oldList(){return xp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function kp(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(d(i))e=i;else if(!1===i)return}o.setDimOthers(!1),o.setBright(!1),l(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?bp.BEFORE_SELECT:bp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new bp(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}bp.BEFORE_SELECT="editor.before_select",bp.SELECT="editor.select",bp.AFTER_SELECT="editor.after_select",bp.BEFORE_HOVER="editor.before_hover",bp.HOVER="editor.hover";const{abs:Sp}=Math,{copy:Ep,scale:Bp}=$,{setListWithFn:Tp}=Ht,{worldBounds:Rp}=pr,Cp={a:1,b:0,c:0,d:1,e:0,f:0},Op={x:0,y:0,width:0,height:0};class Pp extends Al{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?(Tp(Op,e,Rp),t&&this.set(t),this.set(Op),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:r,strokeWidth:a,fill:h}=o,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Sp(c.scaleX),l=Sp(c.scaleY);if(Ep(Cp,c),Cp.half=a%2,i!==l){Bp(Cp,1/i,1/l),t.setWorld(Cp,e.matrix),t.beginPath(),o.strokeWidth=a;const{x:n,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,r*l,h*i,d*l)}else t.setWorld(Cp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=a/Sp(c.scaleX);r&&(n(r)?qh.stroke(r,this,t,e):qh.strokes(r,this,t,e)),h&&(n(h)?qh.fill(h,this,t,e):qh.fills(h,this,t,e))}}o.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}pe([kp(function(t){const e=t.target;t.list=e?l(e)?e:[e]:[]})],Pp.prototype,"target",void 0);class Lp extends Dl{constructor(t){super(t),this.strokeArea=new Wl({strokeAlign:"center"}),this.fillArea=new Wl,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 Ap={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Dp([t],i,e),i}};function Dp(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&&Dp(s.children,e,i)}}const{findOne:Mp,findByBounds:Fp}=Ap;class Ip extends Dl{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 Pp,this.targetStroker=new Pp,this.bounds=new Gt,this.selectArea=new Lp,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 fh(Fp(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)&&!Mp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new fh(this.editor.editBox.rect)};return Mp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Mp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[bp.HOVER,this.onHover,this],[bp.SELECT,this.onSelect,this]]),e.on_([[qd.MOVE,this.onPointerMove,this],[qd.BEFORE_DOWN,this.onBeforeDown,this],[qd.TAP,this.onTap,this],[Jd.START,this.onDragStart,this,!0],[Jd.DRAG,this.onDrag,this],[Jd.END,this.onDragEnd,this],[tc.MOVE,this.onAutoMove,this],[[oc.ZOOM,tc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Wp,top:zp,topRight:Yp,right:Np,bottomRight:Xp,bottom:Hp,bottomLeft:Vp,left:jp}=xt,{toPoint:Up}=kt,{within:Gp,sign:qp}=I,{abs:Kp}=Math,Zp={getScaleData(t,e,i,s,n,o,a,h){let l,d,c={},u=1,g=1;const{boxBounds:p,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=qp(x),S=qp(b),E=h?x:k*p.width/v,B=h?b:S*p.height/w;if(r(s))u=g=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case zp:g=t,l="bottom";break;case Np:u=e,l="left";break;case Hp:g=r,l="top";break;case jp:u=a,l="right";break;case Wp:g=t,u=a,l="bottom-right";break;case Yp:g=t,u=e,l="bottom-left";break;case Xp:g=r,u=e,l="top-left";break;case Vp:g=r,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case zp:case Hp:u=g;break;case jp:case Np:g=u;break;default:d=Math.sqrt(Kp(u*g)),u=qp(u)*d,g=qp(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!a){const{worldTransform:e}=t;u<0&&(u=1/p.width/e.scaleX),g<0&&(g=1/p.height/e.scaleY)}if(Up(o||l,p,c,!0),m){const e={x:u,y:g};Ud.limitScaleOf(t,c,e,n),u=e.x,g=e.y}if(T&&_){const e=p.width*t.scaleX;u=Gp(e*u,_)/e}if(R&&f){const e=p.height*t.scaleY;g=Gp(e*g,f)/e}return T&&Kp(u*y.width)<1&&(u=qp(u)/y.width),R&&Kp(g*y.height)<1&&(g=qp(g)/y.height),n&&u!==g&&(d=Math.min(Kp(u),Kp(g)),u=qp(u)*d,g=qp(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case Wp:o="bottom-right";break;case Yp:o="bottom-left";break;case Xp:o="top-left";break;case Vp:o="top-right";break;default:o="center"}return Up(n||o,t.boxBounds,r,!0),{origin:r,rotation:lt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case zp:case Wp:o={x:.5,y:0},n="bottom",a=1;break;case Hp:case Xp:o={x:.5,y:1},n="top",a=1;break;case jp:case Vp:o={x:0,y:.5},n="right",h=1;break;case Np:case Yp: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,Up(s||n,t,r,!0);const c=lt.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 jp:t=Np;break;case Wp:t=Yp;break;case Vp:t=Xp;break;case Np:t=jp;break;case Yp:t=Wp;break;case Xp:t=Vp}if(i)switch(t){case zp:t=Hp;break;case Wp:t=Vp;break;case Yp:t=Xp;break;case Hp:t=zp;break;case Vp:t=Wp;break;case Xp:t=Yp}return t}},Jp={};function $p(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 Qp(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:p,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(p||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?g:o?c:u:v?g:y?c:u;h+=45*(Zp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(I.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;Jp[S]?i.cursor=Jp[S]:Jp[S]=i.cursor={url:t_(x,h),x:b,y:k}}function Qp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function t_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class e_ extends Vl{constructor(t){super(t),this.useFastShadow=!0}}const i_=["top","right","bottom","left"],s_=void 0;class n_ extends Dl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return n(t)||n(e)||n(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Dl,this.rect=new e_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new e_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Dl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new e_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new e_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new e_({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:n,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])),n.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:s_},e.rect||{}));const f=s(e.rectThrough)?i:e.rectThrough;n.hittable=!f,f&&(t.syncEventer=n,this.app.interaction.bottomList=[{target:n,proxy:t}]),i&&g.stintSet(t.__world,"ignorePixelSnap",d),Qp(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:a,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:p,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Ht.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=r(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)kt.toPoint(kt.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!p),v.visible=y&&p&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,_&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),a.visible=y&&a.children.length>0||0,a.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=i_.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=i_.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Zp.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:s_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return l(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return l(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return l(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)}$p(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&&(jr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof Jd||t instanceof tc)&&this.transformTool.onMove(t),this.resizing&&(jr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),n(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case tc.START:this.onTransformStart(t);break;case tc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case oc.START:this.onTransformStart(t);break;case oc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case oc.START:this.onTransformStart(t);break;case oc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){$p(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Td)||t.find(t=>t instanceof Td);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Jd.START,this.onDragStart,this],[Jd.DRAG,this.onDrag,this],[Jd.END,this.onDragEnd,this],[qd.ENTER,e=>{this.enterPoint=t,$p(this,e)}],[qd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[qd.DOUBLE_TAP,this.onDoubleTap,this],[qd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[rc.HOLD,rc.UP],this.onKey,this],[rc.DOWN,this.onArrow,this],[[tc.START,tc.BEFORE_MOVE,tc.END],this.onMove,this,!0],[[oc.START,oc.BEFORE_ZOOM,oc.END],this.onScale,this,!0],[[sc.START,sc.BEFORE_ROTATE,sc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const o_={x:0,y:0,width:1e5,height:1e5};class r_ extends Al{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,o_),Object.assign(this.__world,o_)}__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 a_='\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"/>',h_={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${a_}\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${a_}\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${a_}\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},l_=new Gt;function d_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{l_.setListWithFn(i,t=>t.getBounds("box","page")),0===l_.width&&(l_.width=.1),0===l_.height&&(l_.height=.1),e.reset(l_.get())}),s.add(e)}const c_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),u_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),g_={group(t,e,i){t.sort(u_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Dl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(c_);const r=new ft(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(c_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(u_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},p_=$t.get("EditToolCreator");function __(){return t=>{m_.register(t)}}const f_=__,m_={list:{},register(t){const{tag:e}=t.prototype;y_[e]&&p_.repeat(e),y_[e]=t},get:(t,e)=>new y_[t](e)},{list:y_}=m_;class v_ extends bp{constructor(t,e){super(t,e)}}v_.BEFORE_OPEN="innerEditor.before_open",v_.OPEN="innerEditor.open",v_.BEFORE_CLOSE="innerEditor.before_close",v_.CLOSE="innerEditor.close";class w_ extends bp{constructor(t,e){super(t,e)}}w_.BEFORE_GROUP="editor.before_group",w_.GROUP="editor.group",w_.BEFORE_UNGROUP="editor.before_ungroup",w_.UNGROUP="editor.ungroup",w_.BEFORE_OPEN="editor.before_open_group",w_.OPEN="editor.open_group",w_.BEFORE_CLOSE="editor.before_close_group",w_.CLOSE="editor.close_group";const{updateMatrix:x_}=rr,b_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},k_="top-left";class S_ extends Wl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Fr.CHANGE,e=>{if(this.checkChange&&b_[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,x_(this.parent),x_(this);const a=new ft(this.__world);switch(r[i]=s,this.__layout.rotationChange(),x_(this),this.changedTransform=new ft(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(k_,o);break;case"scaleX":t.scaleOf(k_,o,1);break;case"scaleY":t.scaleOf(k_,1,o);break;case"skewX":t.skewOf(k_,o,0);break;case"skewY":t.skewOf(k_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class E_ extends bp{constructor(t,e){super(t,e)}}E_.BEFORE_MOVE="editor.before_move",E_.MOVE="editor.move";class B_ extends bp{constructor(t,e){super(t,e)}}B_.BEFORE_SCALE="editor.before_scale",B_.SCALE="editor.scale";class T_ extends bp{constructor(t,e){super(t,e)}}T_.BEFORE_ROTATE="editor.before_rotate",T_.ROTATE="editor.rotate";class R_ extends bp{constructor(t,e){super(t,e)}}R_.BEFORE_SKEW="editor.before_skew",R_.SKEW="editor.skew";class C_{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:a}=i;const h=t.type===tc.END||t.type===Jd.END,l=n(e.draggable),d=!a||h||l,c={x:t.totalX,y:t.totalY};t instanceof tc&<.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),o=Jd.getValidMove(e,s.point,c,d),(o.x||o.y)&&(a&&!l&&h?rr.animateMove(this,o,r(a)?a:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let o,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof oc?(r=e.getBoxPoint(t),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=Zp.getScaleData(e,n.bounds,d,o,a,Zp.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof Jd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),lt.move(n.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof sc)d=t.rotation,l=o?kt.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=Zp.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||n||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=I.float(I.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),lt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Zp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Zp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;d(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(d(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 E_(E_.BEFORE_MOVE,h));const l=new E_(E_.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 B_(B_.BEFORE_SCALE,t));const o=new B_(B_.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(d(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:c};this.emitEvent(new B_(B_.BEFORE_SCALE,u));const g=new B_(B_.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new ft(rr.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 B_(B_.BEFORE_SCALE,r));const a=new B_(B_.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:a}=s;if(a){const s=a({target:i,origin:t,rotation:e});if(r(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 T_(T_.BEFORE_ROTATE,d));const c=new T_(T_.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(d(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:c};this.emitEvent(new R_(R_.BEFORE_SKEW,u));const g=new R_(R_.SKEW,u);this.doSkew(g),this.emitEvent(g)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(rr.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ft(e.worldTransform);return t(),new ft(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let O_=class extends Dl{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 fh,this.openedGroupList=new fh,this.simulateTarget=new S_(this),this.editBox=new n_(this),this.editToolList={},this.selector=new Ip(this),this.editMask=new r_(this),this.targetEventIds=[];let i=g.clone(h_);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),oe.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?l(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&&d_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||m_.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(n(s))e=s;else if(!1===s)return}if(m_.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(w_.BEFORE_GROUP),this.target=g_.group(this.list,this.element,t),this.emitGroupEvent(w_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(w_.BEFORE_UNGROUP,t)),this.target=g_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(w_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(w_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(w_.OPEN,t)}closeGroup(t){this.emitGroupEvent(w_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(w_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!rr.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 w_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||m_.get(t,this)}openInnerEditor(t,e,i){let s;if(n(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(n(i))s=i;else if(!1===i)return}m_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(v_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(v_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(v_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(v_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new v_(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&&(g_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(g_.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_(qr.START,this.onRenderStart,this),i&&i.on_(Fr.SCROLL,this.onChildScroll,this),t.on_(qr.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())}};pe([(t,e)=>{no(t,e,{get(){const{config:t,element:e,dragPoint:n,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),n&&(n.editConfig&&Object.assign(a,n.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===n.pointType&&(a.around||(a.around="center"),s(a.lockRatio)&&(a.lockRatio=!0))),i(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],O_.prototype,"mergeConfig",void 0),pe([kp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof fh?i:new fh(i),t.multiple&&d_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new bp(bp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new bp(bp.AFTER_SELECT,s))})],O_.prototype,"target",void 0),pe([kp(function(t,e){t.emitEvent(new bp(bp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],O_.prototype,"hoverTarget",void 0),O_=pe([Uo(C_,["editBox","editTool","emitEvent"])],O_);class P_{static registerInnerEditor(){m_.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 Dl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let L_=class extends P_{static registerEditTool(){m_.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()}};L_=pe([__()],L_);const{left:A_,right:D_}=xt,{move:M_,copy:F_,toNumberPoints:I_}=lt;let W_=class extends L_{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===A_;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=I_(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?(M_(t,o,r),s&&M_(e,-o,-r)):(s&&M_(t,-o,-r),M_(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),F_(s[7],i),F_(e[7],i),F_(s[3],a),F_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===A_||t===D_,s[t].visible=a,e[t].visible=!r&&a}};W_=pe([__()],W_);const{M:z_,L:Y_,C:N_,Q:X_,Z:H_,N:V_,D:j_,X:U_,G:G_,F:q_,O:K_,P:Z_,U:J_}=Le,$_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case z_:case Y_:Q_(t,e,i,n,1),n+=3;break;case N_:Q_(t,e,i,n,3),n+=7;break;case X_:Q_(t,e,i,n,2),n+=5;break;case H_:n+=1;break;case V_:Q_(t,e,i,n,2),n+=5;break;case j_:Q_(t,e,i,n,2),n+=9;break;case U_:Q_(t,e,i,n,2),n+=6;break;case G_:Q_(t,e,i,n,2),n+=9;break;case q_:Q_(t,e,i,n,2),n+=5;break;case K_:t[n]=G_,t.splice(n+4,0,t[n+3],0),Q_(t,e,i,n,2),n+=9,o+=2;break;case Z_:t[n]=q_,t.splice(n+4,0,t[n+3]),Q_(t,e,i,n,2),n+=5,o+=1;break;case J_:Q_(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:Q_}=$_,tf=$.get(),{topLeft:ef,top:sf,topRight:nf,right:of,bottom:rf,left:af}=xt;function hf(t,e,i){t.pathInputed?df(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function lf(t,e,s,n){let o=e;if(!i(n)){const i=t.__layout;let{width:r,height:a}=i.boxBounds;switch(r*=s-e,a*=e-s,n){case sf:case rf:o=s,i.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case af:case of:i.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case ef:case nf:i.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=l(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function df(t,e,i){$_.scale(t.__.path,e,i),t.path=t.__.path}function cf(t,e,i){const{points:s}=t;d(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):$_.scalePoints(s,e,i),t.points=s}function uf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)tf.a=e,tf.d=i,s[t].transform(tf,!0)}const gf=oh.prototype;gf.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))},gf.__scaleResize=function(t,e){hf(this,t,e)},gf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},gf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Td.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)lf(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),hf(this,t,e)}},Rd.prototype.__scaleResize=function(t,e){df(this,t,e)},yd.prototype.__scaleResize=function(t,e){this.pathInputed?df(this,t,e):this.points?cf(this,t,e):this.width*=t},sd.prototype.__scaleResize=function(t,e){this.pathInputed?df(this,t,e):this.points?cf(this,t,e):hf(this,t,e)},Dl.prototype.__scaleResize=function(t,e){uf(this,t,e)},Vl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||hf(this,t,e),i&&uf(this,t,e)},oe.add("resize"),oe.add("editor","resize"),re.editor=function(t,e){const i=new O_(t);return e&&e.sky.add(e.editor=i),i},Vl.addAttr("textBox",!1,co),Al.addAttr("editConfig",void 0,co),Al.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),co),Al.addAttr("editInner","PathEditor",co),Dl.addAttr("editInner","",co),Td.addAttr("editInner","TextEditor",co),Al.setEditConfig=function(t){this.changeAttr("editConfig",t)},Al.setEditOuter=function(t){this.changeAttr("editOuter",t)},Al.setEditInner=function(t){this.changeAttr("editInner",t)};const pf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},_f={top:"flex-start",middle:"center",bottom:"flex-end"},ff={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function mf(t,e,s){const{style:o}=t,{fill:r,padding:a,textWrap:h,textOverflow:c,textDecoration:u}=e;let g;o.fontFamily=e.fontFamily,o.fontSize=e.fontSize*s+"px",function(t,e){let s="black";l(e)&&(e=e[0]);if(d(e))switch(e.type){case"solid":s=jh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];s=jh.string(n(t)?t:t.color);break;default:i(e.r)||(s=jh.string(e))}else s=e;t.color=s}(o,r),o.fontStyle=e.italic?"italic":"normal",o.fontWeight=e.fontWeight,d(u)?(g=u.type,u.color&&(o.textDecorationColor=jh.string(u.color))):g=u,o.textDecoration=ff[g],o.textTransform=pf[e.textCase],o.textAlign="both"===e.textAlign?"justify":e.textAlign,o.display="flex",o.flexDirection="column",o.justifyContent=_f[e.verticalAlign],o.lineHeight=(e.__.__lineHeight||0)*s+"px",o.letterSpacing=(e.__.__letterSpacing||0)*s+"px",o.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",o.wordBreak="break"===h?"break-all":"normal",o.textIndent=(e.paraIndent||0)*s+"px",o.padding=l(a)?a.map(t=>t*s+"px").join(" "):(a||0)*s+"px",o.textOverflow="show"===c?"":"hide"===c?"clip":c}let yf=class extends P_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Td),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div");s.classList.add("leafer-text-editor");const{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(qd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];t&&(a.setStartAfter(t),a.setEndAfter(t)),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth)switch(i+=20,r.textAlign){case"center":n=r.autoSizeAlign?-i/2:-10;break;case"right":n=r.autoSizeAlign?-i:-20}if(r.__autoHeight)switch(s+=20,r.verticalAlign){case"middle":o=r.autoSizeAlign?-s/2:-10;break;case"bottom":o=r.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:g,f:p}=new ft(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${g},${p})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||mf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function vf(t,e,i){wf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(tc.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(tc.END,e=>{rr.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(oc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function wf(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)}yf=pe([f_()],yf),oe.add("text-editor","editor");const xf=$t.get("LeaferTypeCreator"),bf={list:{},register(t,e){kf[t]&&xf.repeat(t),kf[t]=e},run(t,e){const i=kf[t];i&&i(e)}},{list:kf,register:Sf}=bf;Sf("viewport",vf),Sf("custom",function(t){vf(t,null,!0)}),Sf("design",function(t){vf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Sf("document",function(t){vf(t,{zoom:{min:1},move:{scroll:"limit"}})});const Ef={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),n=lt.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=lt.getDistance(e.from,i.from);return{move:o,scale:lt.getDistance(e.to,i.to)/r,rotation:lt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=Bf,s=Bf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Bf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Bf.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Bf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Bf=Ef,{abs:Tf,max:Rf}=Math,{sign:Cf,within:Of}=I,Pf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Tf(s),r=Tf(n);return o>50&&(s=Rf(50,o/3)*Cf(s)),r>50&&(n=Rf(50,r/3)*Cf(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&&(y.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=Of(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=Of(1-Tf(r)/(4*i)*o,.5,2);s=r>0?n:1/n}return s}};let Lf,Af,Df,Mf;class Ff{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Lf=0,Af=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Lf,totalY:Af}),e.emit(tc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Lf+=t.moveX,t.totalY=Af+=t.moveY,e.emit(tc.BEFORE_MOVE,t),e.emit(tc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Df=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Df}),e.emit(oc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Df*=t.scale,e.emit(oc.BEFORE_ZOOM,t),e.emit(oc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Mf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Mf}),e.emit(sc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Mf+=t.rotation,e.emit(sc.BEFORE_ROTATE,t),e.emit(sc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(tc.END,Object.assign(Object.assign({},e),{totalX:Lf,totalY:Af})),i&&t.emit(oc.END,Object.assign(Object.assign({},i),{totalScale:Df})),s&&t.emit(sc.END,Object.assign(Object.assign({},s),{totalRotation:Mf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const If=Il.prototype,Wf=new Gt,zf=new pt;function Yf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Nf(t,e){return Object.assign(Object.assign({},e),{scale:t})}If.initType=function(t){bf.run(t,this)},If.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(zf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?zf.y=0:t.includes("y")?zf.x=0:Math.abs(zf.x)>Math.abs(zf.y)?zf.y=0:zf.x=0,i&&t.includes("limit")&&(Wf.set(this.__world).addPoint(this.zoomLayer),Ud.getValidMove(Wf,this.canvas.bounds,"inner",zf,!0),t.includes("x")?zf.y=0:t.includes("y")&&(zf.x=0))}return{x:n?0:zf.x,y:n?0:zf.y}},If.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 Xf=kc.prototype;Xf.createTransformer=function(){this.transformer=new Ff(this)},Xf.move=function(t){this.transformer.move(t)},Xf.zoom=function(t){this.transformer.zoom(t)},Xf.rotate=function(t){this.transformer.rotate(t)},Xf.transformEnd=function(){this.transformer.transformEnd()},Xf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Pf.getScale(t,e);if(1!==o)this.zoom(Nf(o,t));else{const s=e.getMove?e.getMove(t,e):Pf.getMove(t,e);i.snap&<.round(s),this.move(Yf(s,t))}},Xf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=Ef.getData(e),{moving:o,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(Ef.detect(n,d(s)?s:{})){case"move":o=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}Ef.reset()}o||(n.center=Ef.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(Nf(n.scale,t)),o&&this.move(Yf(n.move,t))};const Hf=gc.prototype,{abs:Vf}=Math;function jf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Hf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=Vf(i),o=Vf(s),a=e?1:.1,h=this.canAnimate&&this.moving&&(n>a||o>a)&&this.interaction.m.dragAnimate;if(h){const a="touch"===t.pointerType?3:1,l=70;n*(e=e?r(h)?h:.95:a)>l?e=l/n:o*e>l&&(e=l/o),t=Object.assign({},t),lt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Hf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Hf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Hf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Ht.maxX(r),d=Ht.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let g=0,p=0;this.autoMoveTimer=setInterval(()=>{g+=c,p+=u,lt.move(i,c,u),lt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},Hf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},oe.add("viewport"),oe.add("view"),Il.prototype.zoom=function(t,e,i,o){let a;this.killAnimate(),c(e)?(a=e.padding,i=e.scroll,o=e.transition):a=e;const{zoomLayer:h}=this,u=this.canvas.bounds.clone().shrink(s(a)?30:a),g=new Gt,p={x:u.x+u.width/2,y:u.y+u.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(n(t))switch(t){case"in":_=jf(y,"in");break;case"out":_=jf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Gt(this.boxBounds)).height=0;break;case"fit-height":(t=new Gt(this.boxBounds)).width=0}else r(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(p,_,_,!1,o);else if(d(t)){const e={x:f,y:m,scaleX:y,scaleY:v},s=l(t);if(s||t.tag){const e=s?t:[t];g.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,u);g.set(h.getWorldBounds(e))}const{width:n,height:r}=g;let a=u.x-g.x,d=u.y-g.y;return i?(a+=Math.max((u.width-n)/2,0),d+=Math.max((u.height-r)/2,0)):(_=this.getValidScale(Math.min(u.width/n,u.height/r)),a+=(u.width-n*_)/2,d+=(u.height-r*_)/2,lt.scaleOf(e,g,_),g.scaleOf(g,_),e.scaleX*=_,e.scaleY*=_),"x"===i?d=0:"y"===i&&(a=0),lt.move(e,a,d),g.move(a,d),h.set(e,o),g}return h.worldBoxBounds};class Uf extends Dl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&g.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;n(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Vl,this.scrollYBar=new Vl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Gt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:p,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?_.width+6:2,u?p.height+6:2,2]);p.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Jd.DRAG,this.onDrag,this),e.on_(Jd.DRAG,this.onDrag,this),t.on_(Jd.END,this.onDragEnd,this),e.on_(Jd.END,this.onDragEnd,this),this.target.on_(qr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(jr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}oe.add("scroll");class Gf extends kl{setText(t){this._text=t,this.__htmlChanged=!0}}const qf={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};let Kf=class extends vd{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=qf[e],void 0!==i)){s+=i,n=o+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){n(t)?qf[t]=e:Object.assign(qf,t)}};pe([Io(Gf)],Kf.prototype,"__",void 0),pe([mo("")],Kf.prototype,"text",void 0),pe([co("TextEditor")],Kf.prototype,"editInner",void 0),pe([Bo(!1)],Kf.prototype,"textEditing",void 0),Kf=pe([Go()],Kf),oe.add("html");class Zf extends pl{}function Jf(t){return ao(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;ko(this);const e="none"!==t.startArrow||"none"!==t.endArrow;(e||t.__useArrow!==e)&&vo(this)}}}))}let $f=class extends yd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Gh.register(t,e)}};pe([Io(Zf)],$f.prototype,"__",void 0),pe([Jf("angle")],$f.prototype,"endArrow",void 0),$f=pe([Go()],$f);const{M:Qf,L:tm,C:em,Q:im,O:sm}=Le,{rotate:nm,copyFrom:om,scale:rm}=lt,am={},hm={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 Qf:case tm:lm(t,l+1,e,i,s,n,o,r),l+=3;break;case em:for(h=1;h<6;h+=2)lm(t,l+h,e,i,s,n,o,r);l+=7;break;case im:for(h=1;h<4;h+=2)lm(t,l+h,e,i,s,n,o,r);l+=5;break;case sm: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){hm.layout(t,0,0,1,1,e,i)}};function lm(t,e,i,s,n,o,r,a){om(am,t[e],t[e+1]),r&&nm(am,r,a),n&&rm(am,n,o),t[e]=i+am.x,t[e+1]=s+am.y}const{layout:dm,rotate:cm}=hm,{getAngle:um}=lt,gm={x:-.5},pm={connect:gm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},_m={connect:gm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},fm={connect:gm,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},mm={connect:gm,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},ym={offset:gm,path:[...fm.path],dashPath:[1,-2.5,0,2,-1,0]};cm(ym.path,180,{x:-1.5,y:0});const vm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},wm={connect:{x:.5},path:[...vm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},xm={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},bm={path:[...xm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},km=g.clone(xm),Sm=g.clone(bm);cm(km.path,45),cm(Sm.path,45);const Em={angle:pm,"angle-side":_m,arrow:mm,triangle:fm,"triangle-flip":ym,circle:wm,"circle-line":vm,square:bm,"square-line":xm,diamond:Sm,"diamond-line":km,mark:{offset:gm,path:[1,0,-2,2,0,2]}};function Bm(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:c}=t.__;d(e)?e.type?(h=e.scale,a=Em[e.type]):a=e:a=Em[e];const{offset:u,connect:g,path:p,dashPath:_}=a;let f=g?g.x:0,m=u?u.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===c&&u.roundJoin?m+=u.roundJoin:"bevel"===c&&u.bevelJoin&&(m+=u.bevelJoin)),h&&dm(y,0,0,h,h),m&&dm(y,m,0),dm(y,s.x,s.y,n,n,um(i,s)),o.x=(f+m)*n,y}const{M:Tm,L:Rm,C:Cm,Q:Om,Z:Pm,N:Lm,D:Am,X:Dm,G:Mm,F:Fm,O:Im,P:Wm,U:zm}=Le,{copy:Ym,copyFrom:Nm,getDistancePoint:Xm}=lt,Hm={},Vm={},jm={},Um={},Gm={},qm={list:Em,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 Rm:(c<2||l+6>=d)&&(Nm(Gm,o[l+1],o[l+2]),!c&&u&&Ym(Vm,Gm)),l+=3;break;case Cm:(1===c||l+7>=d-3)&&Km(o,Um,Gm,l+3),l+=7;break;case Om:(1===c||l+5>=d-3)&&Km(o,Um,Gm,l+1),l+=5;break;case Pm:return;case Lm:l+=5;break;case Am:l+=9;break;case Dm:l+=6;break;case Mm:l+=9;break;case Fm:l+=5;break;case Im:l+=7;break;case Wm:l+=4;break;case zm:(1===c||l+6>=d-3)&&(Km(o,Um,Gm,l+1),l+6!==d&&(Gm.x-=(Gm.x-Um.x)/10,Gm.y-=(Gm.y-Um.y)/10)),l+=6}if(c++,1===c&&h!==Tm)return;if(2===c&&u&&Ym(jm,h===Rm?Gm:Um),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Bm(t,e,jm,Vm,s,Hm,!!n);n?d.push(...i):r.push(...i),Hm.x&&(Xm(Vm,jm,-Hm.x,!0),r[1]=jm.x,r[2]=jm.y)}if(i&&"none"!==i){const e=Bm(t,i,Um,Gm,s,Hm,!!n);if(n?d.push(...e):r.push(...e),Hm.x){let t;switch(Xm(Gm,Um,-Hm.x,!0),h){case Rm:t=l-3+1;break;case Cm:t=l-7+5;break;case Om:t=l-5+3;break;case zm:t=l-6+3}t&&Zm(r,Um,t)}}}else Ym(Um,Gm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Km(t,e,i,s){Nm(e,t[s],t[s+1]),Nm(i,t[s+2],t[s+3])}function Zm(t,e,i){t[i]=e.x,t[i+1]=e.y}oe.add("arrow"),Al.addAttr("startArrow","none",Jf),Al.addAttr("endArrow","none",Jf),Object.assign(Gh,qm),Object.assign(qh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Jm=class extends Vl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};pe([Io(class extends cl{})],Jm.prototype,"__",void 0),pe([po("x")],Jm.prototype,"flow",void 0),Jm=pe([Go()],Jm);const $m={},Qm={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},ty={"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 ey(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;Bt.toPoint(i,e,n,$m),e.x=s.__autoWidth?n.x:$m.x,e.y=s.__autoHeight?n.y:$m.y}const{move:iy}=lt;function sy(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)),iy(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function ny(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 oy={};function ry(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:r,__autoHeight:a}=t.__,l=o&&(e?!r:!a);return d(i)?(oy.xGap=i.x||0,oy.yGap=i.y||0):oy.xGap=oy.yGap=h(i),oy.isAutoXGap=n(oy.xGap)&&!r,oy.isAutoYGap=n(oy.yGap)&&!a,oy.complex=l||"top-left"!==s||t.__hasGrow||oy.isAutoXGap||oy.isAutoYGap,oy.wrap=l,oy.complex&&(oy.isFitXGap="fit"===oy.xGap&&!r,oy.isFitYGap="fit"===oy.yGap&&!a,d(s)?(oy.contentAlign=s.content||"top-left",oy.rowXAlign=s.x||"from",oy.rowYAlign=s.y||"from"):(oy.contentAlign=s,oy.rowXAlign=Qm[s],oy.rowYAlign=ty[s])),oy}function ay(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function hy(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 ly(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:dy}=I;function cy(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=uy(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=uy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function uy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?dy(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:gy}=I;function py(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=_y(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=_y(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function _y(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?gy(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:fy}=lt;function my(t,e){const i="width",{children:s,itemBox:n}=t,o=ry(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=ly(p,n),r?(p.__flowBounds=_,y||(y=ay(m,g)),a&&y.count&&y.width+_.width>x&&(y.grow?cy(t,y,x,e):d&&hy(y,i,x,c),ny(u,y,i),y=ay(m,g)),f=_.width,p.__widthGrow&&(y.grow+=p.__widthGrow,f=0,p.__.widthRange&&(y.hasRangeSize=!0)),p.__heightGrow&&_y(p,_,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,_.height),y.count++):(fy(p,v-_.x,w-_.y),v+=_.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:g}=o;y.count&&(y.grow?cy(t,y,x,e):d&&hy(y,i,x,c),a&&ny(u,y,i)),a?(s?hy(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){ey(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Qm[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],sy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(ey(t,y,r),sy(t,y,0,y.y,g,e))}}const{move:yy}=lt;function vy(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)),yy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:wy}=lt;function xy(t,e){const i="height",{children:s,itemBox:n}=t,o=ry(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let p,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[m=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(_=ly(p,n),r?(p.__flowBounds=_,y||(y=ay(m,g)),a&&y.count&&y.height+_.height>b&&(y.grow&&py(t,y,b,e),d&&hy(y,i,b,c),ny(u,y,i),y=ay(m,g)),f=_.height,p.__heightGrow&&(y.grow+=p.__heightGrow,f=0,p.__.heightRange&&(y.hasRangeSize=!0)),p.__widthGrow&&uy(p,_,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,_.width),y.count++):(wy(p,v-_.x,w-_.y),w+=_.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:g}=o;y.count&&(y.grow&&py(t,y,b,e),d&&hy(y,i,b,c),a&&ny(u,y,i)),a?(s?hy(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){ey(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=ty[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],vy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(ey(t,y,r),vy(t,y,y.x,0,l,e))}}function by(t){return ao(t,t=>({set(e){const i=r(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)}}))}oe.add("flow","resize");const ky=Vl.prototype,{__updateBoxBounds:Sy}=Dl.prototype;Al.addAttr("flow",!1,po),Al.addAttr("gap",0,mo),Al.addAttr("flowAlign","top-left",mo),Al.addAttr("flowWrap",!1,mo),Al.addAttr("itemBox","box",mo),Al.addAttr("inFlow",!0,mo),Al.addAttr("autoWidth",void 0,by),Al.addAttr("autoHeight",void 0,by),Al.addAttr("autoBox",void 0,mo);const{copyAndSpread:Ey}=Ht;ky.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:my(this);break;case"y":xy(this);break;case"x-reverse":my(this,!0);break;case"y-reverse":xy(this,!0)}t&&(this.leafer.created=!0)},ky.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Ey(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},ky.__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():Sy.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&&Ey(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:By,sin:Ty,pow:Ry,sqrt:Cy,abs:Oy,ceil:Py,floor:Ly,round:Ay,PI:Dy}=Math,My=5*Dy,Fy=1.70158,Iy=2.5949095,Wy=7.5625,zy=2.75;function Yy(t){return e=>Ry(e,t)}function Ny(t){return e=>1-Ry(1-e,t)}function Xy(t){return e=>e<.5?.5*Ry(2*e,t):1-.5*Ry(2-2*e,t)}function Hy(t){return t<1/zy?Wy*t*t:t<2/zy?Wy*(t-=1.5/zy)*t+.75:t<2.5/zy?Wy*(t-=2.25/zy)*t+.9375:Wy*(t-=2.625/zy)*t+.984375}function Vy(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=jy(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Oy(l)<1e-6));e++)c-=d/l;return n[r]=jy(c,e,s)}}function jy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Uy={get(t){const{list:e}=Uy;return n(t)?e[t||"ease"]:d(t)?e[t.name].apply(e,l(t.value)?t.value:[t.value]):e.ease},register(t,e){Uy.list[t]=e},list:{linear:t=>t,ease:Vy(.25,.1,.25,1),"ease-in":Vy(.42,0,1,1),"ease-out":Vy(0,0,.58,1),"ease-in-out":Vy(.42,0,.58,1),"sine-in":t=>1-By(t*Dy*.5),"sine-out":t=>Ty(t*Dy*.5),"sine-in-out":t=>.5*(1-By(t*Dy)),"quad-in":Yy(2),"quad-out":Ny(2),"quad-in-out":Xy(2),"cubic-in":Yy(3),"cubic-out":Ny(3),"cubic-in-out":Xy(3),"quart-in":Yy(4),"quart-out":Ny(4),"quart-in-out":Xy(4),"quint-in":Yy(5),"quint-out":Ny(5),"quint-in-out":Xy(5),"expo-in":t=>t?Ry(2,10*t-10):0,"expo-out":t=>1===t?1:1-Ry(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Ry(2,2*t*10-10):.5*(2-Ry(2,10-2*t*10)),"circ-in":t=>1-Cy(1-Ry(t,2)),"circ-out":t=>Cy(1-Ry(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Cy(1-Ry(2*t,2))):.5*(Cy(1-Ry(2-2*t,2))+1),"back-in":t=>((Fy+1)*t-Fy)*t*t,"back-out":t=>(t-=1)*t*((Fy+1)*t+Fy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Iy+1)*t-Iy)*.5:.5*((t=2*t-2)*t*((Iy+1)*t+Iy)+2),"elastic-in":t=>0===t||1===t?t:-Ry(2,10*(t-1))*Ty((t-1.1)*My),"elastic-out":t=>0===t||1===t?t:Ry(2,-10*t)*Ty((t-.1)*My)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Ry(2,10*((t*=2)-1))*Ty((t-1.1)*My)*.5:Ry(2,10*(1-(t*=2)))*Ty((t-1.1)*My)*.5+1,"bounce-in":t=>1-Hy(1-t),"bounce-out":Hy,"bounce-in-out":t=>t<.5?.5*(1-Hy(1-2*t)):.5*(1+Hy(2*t-1)),"cubic-bezier":Vy,steps:function(t,e="floor"){return i=>("floor"===e?Ly(i*t):"ceil"===e?Py(i*t):Ay(i*t))/t}}};function Gy(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 qy{}qy.CREATED="created",qy.PLAY="play",qy.PAUSE="pause",qy.STOP="stop",qy.SEEK="seek",qy.UPDATE="update",qy.COMPLETED="completed";let Ky=class extends ia{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&&r(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=l(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=Uy.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(qy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(qy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(qy.STOP))}seek(t){this.destroyed||(d(t)&&(t=Uh.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(qy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:s,config:n}=this,{length:o}=s,a=!(o>1)||this.join;let h,l,d,c,u,g=0,p=0;o>1&&(this.fromStyle={},this.toStyle={});for(let n=0;n<o;n++){if(l=s[n],c=l.style||l,h||(h=a?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:a}=l;o&&(d.swing=r(o)?o:2,u=2*d.swing-1),a&&(d.loop=u=r(a)?a:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=Uy.get(n))}if(!d.autoDuration&&i(d.duration)&&(o>1?n>0||a?p+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}p?((this.duration<=g||!n||!n.duration)&&this.changeDuration(g+.2*p),this.allocateTime((this.duration-g)/p)):g&&this.changeDuration(g),this.emitType(qy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,s){const{fromStyle:n,toStyle:o,target:r}=this;for(let a in e)i(n[a])&&(n[a]=o[a]=e===s?s[a]:r[a]),t.beforeStyle[a]=i(s[a])?o[a]:s[a],o[a]=e[a]}allocateTime(t){let e,{frames:s}=this,{length:n}=s;for(let o=0;o<n;o++)e=s[o],i(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(),y.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(qy.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={}),el.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(qy.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 r(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};pe([Gy("ease")],Ky.prototype,"easing",void 0),pe([Gy(0)],Ky.prototype,"delay",void 0),pe([Gy(.2)],Ky.prototype,"duration",void 0),pe([Gy("auto")],Ky.prototype,"ending",void 0),pe([Gy(!1)],Ky.prototype,"reverse",void 0),pe([Gy(!1)],Ky.prototype,"swing",void 0),pe([Gy(!1)],Ky.prototype,"loop",void 0),pe([Gy(0)],Ky.prototype,"loopDelay",void 0),pe([Gy(1)],Ky.prototype,"speed",void 0),pe([Gy(!0)],Ky.prototype,"autoplay",void 0),pe([Gy()],Ky.prototype,"join",void 0),pe([Gy()],Ky.prototype,"attrs",void 0),Ky=pe([Uo(ga)],Ky);let Zy=class extends Ky{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Ky(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(qy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(qy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(qy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(qy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case qy.COMPLETED:this.completed&&this.emitType(t);break;case qy.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)}};Zy=pe([Uo(ga)],Zy);const Jy={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"},$y=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Qy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,tv=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,ev=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,iv=parseInt,sv=parseFloat,{round:nv}=Math;let ov={},rv=0;function av(t){let e,i,s,n=1;switch(t.length){case 9:e=iv(t.slice(1,3),16),i=iv(t.slice(3,5),16),s=iv(t.slice(5,7),16),n=iv(t.slice(7,9),16)/255;break;case 7:e=iv(t.slice(1,3),16),i=iv(t.slice(3,5),16),s=iv(t.slice(5,7),16);break;case 5:e=iv(t[1]+t[1],16),i=iv(t[2]+t[2],16),s=iv(t[3]+t[3],16),n=iv(t[4]+t[4],16)/255;break;case 4:e=iv(t[1]+t[1],16),i=iv(t[2]+t[2],16),s=iv(t[3]+t[3],16);break;case 3:e=i=s=iv(t[1]+t[2],16);break;case 2:e=i=s=iv(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const hv=1/6,lv=.5,dv=2/3,cv=1/3;function uv(t,e,i){return i<0?i++:i>1&&i--,i<hv?t+6*(e-t)*i:i<lv?e:i<dv?t+(e-t)*(dv-i)*6:t}function gv(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=uv(a,s,t+cv),o=uv(a,s,t),r=uv(a,s,t-cv)}return{r:nv(255*n),g:nv(255*o),b:nv(255*r),a:s}}oe.add("color"),jh.object=function(t,e){let s,o=!i(e)&&e<1;if(n(t)){const e=ov[t];if(e)s=Object.assign({},e);else{switch(t[0]){case"#":s=av(t);break;case"R":case"r":"("===t[4]&&Qy.test(t)?s=function(t){const e=Qy.exec(t);return{r:iv(e[1]),g:iv(e[2]),b:iv(e[3]),a:sv(e[4])}}(t):"("===t[3]&&$y.test(t)&&(s=function(t){const e=$y.exec(t);return{r:iv(e[1]),g:iv(e[2]),b:iv(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&ev.test(t)?s=function(t){const e=ev.exec(t);return gv(sv(e[1]),sv(e[2]),sv(e[3]),sv(e[4]))}(t):"("===t[3]&&tv.test(t)&&(s=function(t){const e=tv.exec(t);return gv(sv(e[1]),sv(e[2]),sv(e[3]),1)}(t))}if(!s){const e=Jy[t.toLowerCase()];e&&(s=av("#"+e))}s&&(rv++,rv>1e4&&(ov={},rv=0),ov[t]=Object.assign({},s))}}else d(t)&&(i(t.a)&&(t.a=1),o&&(t=Object.assign({},t)),s=t);return s||(s={r:255,g:255,b:255,a:1}),o&&(s.a*=e),s};const{round:pv}=Math,{fourNumber:_v}=I,fv={fill:xv,stroke:xv,cornerRadius:(t,e,i)=>r(t)&&r(e)?vv(t,e,i):(t=_v(t),e=_v(e),t.map((t,s)=>vv(t,e[s],i))),text(t,e,i){if(n(t)&&n(e)){const s=t.length,n=e.length,o=vv(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return r(t)||r(e)?I.float(vv(t,e,i),Math.max(yv(t),yv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return el.setBetweenStyle(n,t,e,n,i,s),n},shadow:bv,innerShadow:bv},mv={value:function(t,e,i){const s=r(t),n=r(e);return s&&n?t+(e-t)*i:n||s?vv(t,e,i):t},number:vv,color:wv,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=el;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 yv(t){const e=String(t).split(".")[1];return e?e.length:0}function vv(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?pv(n):n}function wv(t,e,i){t=jh.object(t),e=jh.object(e);const s=vv(t.r,e.r,i,1)+","+vv(t.g,e.g,i,1)+","+vv(t.b,e.b,i,1),n=vv(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function xv(t,e,i){return n(t)&&n(e)?wv(t,e,i):e}function bv(t,e,i){return l(t)||l(e)?e:(e=e||{},{x:vv((t=t||{}).x,e.x,i),y:vv(t.y,e.y,i),blur:vv(t.blur,e.blur,i),spread:vv(t.spread,e.spread,i),color:wv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}oe.add("animate","color"),tl.canAnimate=!0,Object.assign(el.list,fv),Object.assign(el,mv);const kv=Al.prototype;Al.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"))}}))}),Al.addAttr("animationOut",void 0,co),Al.addAttr("transition",!0,co),Al.addAttr("transitionOut",void 0,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.animate=function(t,e,s,n){if(i(t))return this.__animate;let o=l(t)&&!e&&s?new Zy(this,t,n):new Ky(this,t,e,n);this.killAnimate(s,o.toStyle);const r=this.__animate;return r&&(o instanceof Zy?o.list.unshift(r):o=new Zy(this,[r,o])),this.__animate=o},kv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Zy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},kv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(qy.COMPLETED,e)};const Sv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Ev=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Bv}=Math,{getDerivative:Tv}=oi,Rv={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,g,p,_=0,f=h/2;for(let h=0;h<Sv.length;h++)l=f*(1+Sv[h]),d=f*(1-Sv[h]),c=Tv(l,t,i,n,r),u=Tv(l,e,s,o,a),g=Tv(d,t,i,n,r),p=Tv(d,e,s,o,a),_+=Ev[h]*(Bv(c*c+u*u)+Bv(g*g+p*p));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Tv(t,e,s,o,a),d=Tv(t,i,n,r,h);return Math.atan2(d,l)/z},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,g=t/e,p=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>p;)Cv(i,s,n,o,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,g=d*n+e*r,p=d*o+e*a,_=d*c+e*g,f=d*u+e*p,m=d*_+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*p+e*(d*a+e*l));t.push(Le.C,c,u,_,f,m,y)}},{getDistance:Cv}=Rv,{M:Ov,L:Pv,C:Lv,Z:Av}=Le,Dv={},Mv={},Fv={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Ov:case Pv:Fv.transformPoints(t,e,s,1),s+=3;break;case Lv:Fv.transformPoints(t,e,s,3),s+=7;break;case Av:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Dv.x=t[n],Dv.y=t[n+1],$.toOuterPoint(e,Dv),t[n]=Dv.x,t[n+1]=Dv.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 Ov:case Pv:i=t[a+1],s=t[a+2],e=n===Pv&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Lv:i=t[a+5],s=t[a+6],e=Rv.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 Av: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=Uh.number(e,t.total);let o,r,a,h,l,d,c,u,g,p=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Ov:case Pv:if(r=n[f+1],a=n[f+2],o=s[m],p+o>=e||!t.total)return f||(y=r,v=a),Mv.x=y,Mv.y=v,_.x=r,_.y=a,lt.getDistancePoint(Mv,_,e-p,!0),_.rotation=lt.getAngle(Mv,_),_;y=r,v=a,f+=3;break;case Lv:if(r=n[f+5],a=n[f+6],o=s[m],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],g=Rv.getT(e-p,o,y,v,l,d,c,u,r,a,i),oi.getPointAndSet(g,y,v,l,d,c,u,r,a,_),_.rotation=Rv.getRotation(g,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case Av:f+=1;default:o=0}m++,p+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Uh.number(e,t.total);let r,a,h,l,d,c,u,g,p,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case Ov:case Pv:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),Mv.x=v,Mv.y=w,f.x=a,f.y=h,lt.getDistancePoint(Mv,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case Lv:if(d=n[m+1],c=n[m+2],u=n[m+3],g=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return p=Rv.getT(e-_,r,v,w,d,c,u,g,a,h,i),Rv.cut(o,p,v,w,d,c,u,g,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,g,a,h);break;case Av:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function Iv(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!s(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}oe.add("motion-path"),el.register("motion",function(t,e,i,s){return d(t)&&(t=Uh.number(t,s.getMotionTotal())),d(e)&&(e=Uh.number(e,s.getMotionTotal())),el.number(t||0,e||0,i)}),el.register("motionRotation",function(t,e,i){return el.number(t,e,i)});const Wv=Al.prototype,{updateMatrix:zv,updateAllMatrix:Yv}=rr,{updateBounds:Nv}=yr;function Xv(t){const{motion:e,leaferIsCreated:i}=t;if(!s(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Vv(t);i.total&&(t.__.__pathForRender=Fv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Yv(t),Nv(t,t)):zv(t));i&&(t.leafer.created=!0)}}function Hv(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 Vv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Fv.getMotionPathData(t.getPath(!0,!0))}function jv(t,e){return ao(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?tl.setStyleName(this,e,i):tl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Uv(t){return ao(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Gv(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 qv(t,e){d(e)||(e=void 0),Jv(t,e,"in")}function Kv(t,e){const{normalStyle:i}=t;d(e)||(e=void 0),i&&(e||(e=i),Jv(t,e,"out"))}Al.addAttr("motionPath",void 0,Iv),Al.addAttr("motionPrecision",1,Iv),Al.addAttr("motion",void 0,Iv),Al.addAttr("motionRotation",!0,Iv),Wv.getMotionPathData=function(){return Vv(Hv(this))},Wv.getMotionPoint=function(t){const e=Hv(this),i=Vv(e);if(!i.total)return{};const s=Fv.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:r(n)&&(s.rotation+=n),s},Wv.getMotionTotal=function(){return this.getMotionPathData().total},Wv.__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],s(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Xv(t))}else Xv(this)};const Zv={};function Jv(t,e,i){const{normalStyle:n}=t;e||(e=Zv),e.scale&&(I.assignScale(e,e.scale),delete e.scale),e!==Zv&&tl.canAnimate||(i=null);let o=!!i&&function(t,e,i){let n="in"===t?"transition":"transitionOut";"out"===t&&s(i[n])&&s(e[n])&&(n="transition");return s(e[n])?i[n]:e[n]}(i,e,t);const r=o?function(t,e){const i=tw(e,t),s=t.animate();s&&tw(i,t,s.fromStyle);return i}(t,e):void 0;tl.canAnimate&&$v(t)&&t.killAnimate("transition"),n&&t.set(n,"temp");const a=$v(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=Qv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=Qv(r,t);t.set(r,"temp"),t.animate([r,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function $v(t){let e;const i={},s=Gv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&tl.isState(n,t,s)&&(e=ew(i,o));const r=i.selectedStyle||t.selectedStyle;r&&tl.isSelected(t,s)&&(e=ew(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&tl.isPlacehold(t,s)&&(e=ew(i,a)),tl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=ew(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&tl.isFocus(t,s)&&(e=ew(i,n));const o=i.hoverStyle||t.hoverStyle;o&&tl.isHover(t,s)&&(e=ew(i,o));const r=i.pressStyle||t.pressStyle;r&&tl.isPress(t,s)&&(e=ew(i,r))}return e?i:void 0}function Qv(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&tl.animateExcludes[t]||(n[t]=e[t]);return n}function tw(t,e,i){return Qv(t,e,i,!0)}function ew(t,e){return Object.assign(t,e),!0}function iw(t,e){const i=t[e];i&&qv(t,i),t.button&&nw(t.children,e)}function sw(t,e,i){i||(i=t.states[e]),qv(t,i),t.button&&nw(t.children,null,e)}function nw(t,e,s){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":tl.isHover(n)&&(o=!1);break;case"pressStyle":tl.isPress(n)&&(o=!1);break;case"focusStyle":tl.isFocus(n)&&(o=!1)}o&&iw(n,e)}else i(s)||sw(n,s);n.isBranch&&nw(n.children,e,s)}}function ow(t,e){const i=t[e];i&&Kv(t,i),t.button&&aw(t.children,e)}function rw(t,e,i){Kv(t,i),t.button&&aw(t.children,null,e)}function aw(t,e,s){if(!t)return;let n;for(let o=0,r=t.length;o<r;o++)n=t[o],e?ow(n,e):i(s)||rw(n,s),n.isBranch&&aw(n.children,e,s)}function hw(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Gv(e,i);o&&(s=n[t](o))}return s}function lw(t,e,i){let s=e[t];if(!s&&i){const n=Gv(e,i);n&&(s=n[t])}return s}oe.add("state"),tl.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},tl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Gv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},tl.isSelected=function(t,e){return lw("selected",t,e)},tl.isDisabled=function(t,e){return lw("disabled",t,e)},tl.isFocus=function(t,e){return hw("isFocus",t,e)},tl.isHover=function(t,e){return hw("isHover",t,e)},tl.isPress=function(t,e){return hw("isPress",t,e)},tl.isPlacehold=function(t,e){return t.__.__isPlacehold},tl.isDrag=function(t,e){return hw("isDrag",t,e)},tl.setStyleName=function(t,e,i){i?sw(t,e,t[e]):rw(t,e,t[e])},tl.set=function(t,e){const i=t.states[e];i?sw(t,e,i):rw(t,e,i)},tl.getStyle=$v,tl.updateStyle=Jv,tl.updateEventStyle=function(t,e){switch(e){case qd.ENTER:iw(t,"hoverStyle");break;case qd.LEAVE:ow(t,"hoverStyle");break;case qd.DOWN:iw(t,"pressStyle");break;case qd.UP:ow(t,"pressStyle")}};const dw=Al.prototype;Al.addAttr("selected",!1,jv,"selectedStyle"),Al.addAttr("disabled",!1,jv,"disabledStyle"),Al.addAttr("states",{},Uv),Al.addAttr("state","",jv),Al.addAttr("normalStyle",void 0,co),Al.addAttr("hoverStyle",void 0,Uv),Al.addAttr("pressStyle",void 0,Uv),Al.addAttr("focusStyle",void 0,Uv),Al.addAttr("selectedStyle",void 0,Uv),Al.addAttr("disabledStyle",void 0,Uv),Al.addAttr("placeholderStyle",void 0,Uv),Al.addAttr("button",!1,co),dw.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))},dw.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?iw(this,"focusStyle"):ow(this,"focusStyle")})},dw.updateState=function(){tl.updateStyle(this,void 0,"in")};const cw=Td.prototype,uw="text";no(cw,uw,Object.assign(Object.assign({},oo(cw,uw)),{set(t){const e=this,i=e.text;e.__setAttr(uw,t)&&(vo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class gw extends hl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let pw=class extends Al{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;l(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),!i(t))if(r(t))this.now=t;else if(d(t)){const e=l(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:a}=e,{width:h,height:l}=o&&(r(o)?{width:o,height:o}:o)||(a>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 Wr(Wr.LOADED,{image:t}))}__runAction(t,e){let{FPS:s,loop:n,__action:o}=this;o&&(o.FPS&&(s=o.FPS),i(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/s)}__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()}};pe([Io(gw)],pw.prototype,"__",void 0),pe([mo()],pw.prototype,"robot",void 0),pe([co()],pw.prototype,"actions",void 0),pe([co("")],pw.prototype,"action",void 0),pe([Bo(0)],pw.prototype,"now",void 0),pe([co(12)],pw.prototype,"FPS",void 0),pe([co(!0)],pw.prototype,"loop",void 0),pw=pe([Go()],pw),oe.add("robot");const{Yes:_w,NoAndSkip:fw,YesAndSkip:mw}=t,yw={},vw={},ww={};class xw{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,s,n){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return s?o:o?[o]:[];case"string":switch(t[0]){case"#":yw.id=t.substring(1),t=yw;break;case".":vw.className=t.substring(1),t=vw;break;default:ww.tag=t,t=ww}case"object":if(i(t.id)){if(t.tag){const{tag:i}=t,n=l(i);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,s,n?g.toMap(i):i)}return this.getByMethod(this.methods.className,e,s,t.className)}{const i=this.getById(t.id,e);return s?i:i?[i]:[]}case"function":return this.getByMethod(t,e,s,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&&rr.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===_w||o===mw){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<fw&&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_(Dr.REMOVE,this.__onRemoveChild,this),this.target.on_(Fr.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 bw=Al.prototype;function kw(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())}bw.find=function(t,e){return kw(this).getBy(t,this,!1,e)},bw.findOne=function(t,e){return kw(this).getBy(t,this,!0,e)},oe.add("find"),re.finder=function(t){return new xw(t)};const{setPoint:Sw,addPoint:Ew,toBounds:Bw}=yt;const Tw={syncExport(t,e,s){let n;Qh.running=!0;try{const o=jn.fileType(e),r=e.includes(".");s=jn.getExportOptions(s);const{toURL:a}=y,{download:h}=y.origin;if("json"===o)r&&h(a(JSON.stringify(t.toJSON(s.json)),"text"),e),n={data:!!r||t.toJSON(s.json)};else if("svg"===o)r&&h(a(t.toSVG(),"svg"),e),n={data:!!r||t.toSVG()};else{let o,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:p,trim:_,screenshot:f,padding:m,onCanvas:v}=s,w=i(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&i(s.fill)?t.fill:s.fill,k=jn.isOpaqueImage(e)||b,S=new ft;if(f)o=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}o=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};I.getScaleData(s.scale,s.size,o,E);let B=s.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Gt(o).scale(E.scaleX,E.scaleY);p&&(T+=p.x,R+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let L,A=re.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(L=t,L.__worldOpacity=0,t=c||t,P.bounds=A.bounds),A.save();const D=u&&!i(b),M=t.get("fill");if(D&&(t.fill=""),y.render(t,A,P),D&&(t.fill=M),A.restore(),L&&L.__updateWorldOpacity(),_){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Ew(r,n,o):Sw(r={},n,o)),a++;const h=new Gt;return r&&(Bw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=re.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=I.fourNumber(m),n=A,{width:o,height:r}=n;A=re.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),v&&v(A);n={data:"canvas"===e?A:A.export(e,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:o,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Qh.running=!1,n},export(t,e,i){return Qh.running=!0,function(t){Rw||(Rw=new Kn);return new Promise(e=>{Rw.add(()=>_e(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const o=()=>_e(this,void 0,void 0,function*(){if(!Jn.isComplete)return y.requestRender(o);const r=Qh.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),n()});t.updateLayout(),Cw(t);const{leafer:r}=t;r?r.waitViewCompleted(o):o()}))}};let Rw;function Cw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Cw(t))}const Ow=Ce.prototype,Pw=$t.get("@leafer-in/export");Ow.export=function(t,e){const{quality:i,blob:s}=jn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Ow.toBlob=function(t,e){return new Promise(i=>{y.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Pw.error(t),i(null)})})},Ow.toDataURL=function(t,e){return y.origin.canvasToDataURL(this.view,t,e)},Ow.saveAs=function(t,e){return new Promise(i=>{y.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Pw.error(t),i(!1)})})},oe.add("export"),Object.assign(Qh,Tw),Al.prototype.export=function(t,e){return Qh.export(this,t,e)},Al.prototype.syncExport=function(t,e){return Qh.syncExport(this,t,e)},oe.add("filter"),Object.assign($h,{list:{},register(t,e){$h.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=$h.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=$h.list[t.type],e&&(i+=e.getSpread(t))}),i}}),oe.add("bright"),Al.addAttr("bright",!1,To);export{Bt as AlignHelper,Ky as Animate,Uy as AnimateEasing,qy as AnimateEvent,Zy as AnimateList,t as Answer,Od as App,kt as AroundHelper,$f as Arrow,Zf as ArrowData,Kt as AutoBounds,oi as BezierHelper,Gt as Bounds,zr as BoundsEvent,Ht as BoundsHelper,Vl as Box,cl as BoxData,_h as Branch,yr as BranchHelper,Aa as BranchRender,xd as Canvas,Sl as CanvasData,ge as CanvasManager,Dr as ChildEvent,jh as ColorConvert,re as Creator,Sc as Cursor,g as DataHelper,$t as Debug,wt as Direction4,xt as Direction9,Ud as DragBoundsHelper,Jd as DragEvent,gc as Dragger,Qd as DropEvent,n_ as EditBox,Zp as EditDataHelper,e_ as EditPoint,Ip as EditSelect,Ap as EditSelectHelper,L_ as EditTool,m_ as EditToolCreator,O_ as Editor,bp as EditorEvent,w_ as EditorGroupEvent,g_ as EditorHelper,E_ as EditorMoveEvent,T_ as EditorRotateEvent,B_ as EditorScaleEvent,R_ as EditorSkewEvent,Jh as Effect,Kl as Ellipse,fl as EllipseData,pi as EllipseHelper,Ar as Event,ce as EventCreator,ia as Eventer,Qh as Export,jn as FileHelper,$h as Filter,xw as Finder,Jm as Flow,T as FourNumberHelper,jl as Frame,gl as FrameData,Dl as Group,dl as GroupData,Kf as HTMLText,Gf as HTMLTextData,Rv as HighBezierHelper,Fv as HighCurveHelper,Ec as HitCanvasManager,vd as Image,kl as ImageData,Wr as ImageEvent,Qn as ImageManager,w as IncrementId,P_ as InnerEditor,v_ as InnerEditorEvent,kc as InteractionBase,ac as InteractionHelper,rc as KeyEvent,Ld as Keyboard,Gr as LayoutEvent,Dh as Layouter,oh as Leaf,Oa as LeafBounds,pr as LeafBoundsHelper,_ as LeafData,_a as LeafDataProxy,ga as LeafEventer,rr as LeafHelper,Lr as LeafLayout,mh as LeafLevelList,fh as LeafList,ba as LeafMatrix,Pa as LeafRender,Il as Leafer,vh as LeaferCanvas,Ce as LeaferCanvasBase,ul as LeaferData,Kr as LeaferEvent,so as LeaferImage,bf as LeaferTypeCreator,yd as Line,pl as LineData,W_ as LineEditTool,I as MathHelper,ft as Matrix,$ as MatrixHelper,tc as MoveEvent,Ef as MultiTouchHelper,$d as MyDragEvent,wd as MyImage,Kd as MyPointerEvent,ic as MyTouchEvent,De as NeedConvertToCanvasCommandMap,z as OneRadian,Y as PI2,N as PI_2,qh as Paint,Zh as PaintGradient,Kh as PaintImage,Rd as Path,Gh as PathArrow,qm as PathArrowModule,An as PathBounds,bs as PathCommandDataHelper,Le as PathCommandMap,_i as PathCommandNodeHelper,Qi as PathConvert,Yn as PathCorner,zs as PathCreator,vl as PathData,tn as PathDrawer,Oe as PathHelper,hm as PathMatrixHelper,We as PathNumberCommandLengthMap,Ie as PathNumberCommandMap,$_ as PathScaler,Cd as Pen,wl as PenData,Wh as Picker,y as Platform,oe as Plugin,pt as Point,lt as PointHelper,Ad as PointerButton,qd as PointerEvent,sd as Polygon,ml as PolygonData,Fr as PropertyEvent,Wl as Rect,_l as RectData,ze as RectHelper,Pl as RectRender,qr as RenderEvent,Fh as Renderer,jr as ResizeEvent,Jn as Resource,pw as Robot,gw as RobotData,sc as RotateEvent,ie as Run,Uf as ScrollBar,Lp as SelectArea,zh as Selector,dd as Star,yl as StarData,tl as State,Zt as StringNumberMap,Pp as Stroker,nc as SwipeEvent,qn as TaskItem,Kn as TaskProcessor,Td as Text,Vh as TextConvert,bl as TextData,yf as TextEditor,ec as TouchEvent,C_ as TransformTool,Ff as Transformer,el as Transition,yt as TwoPointBoundsHelper,Al as UI,Tl as UIBounds,he as UICreator,hl as UIData,Dd as UIEvent,Cl as UIRender,Uh as UnitConvert,br as WaitHelper,Ur as WatchEvent,kh as Watcher,Pf as WheelEventHelper,oc as ZoomEvent,vf as addViewport,wf as addViewportConfig,Eo as affectRenderBoundsType,bo as affectStrokeBoundsType,Jf as arrowType,ho as attr,po as autoLayoutType,mo as boundsType,Vn as canvasPatch,Re as canvasSizeAttrs,Hh as createAttr,ro as createDescriptor,Fo as cursorType,Io as dataProcessor,co as dataType,ao as decorateLeafAttr,zo as defineDataProcessor,no as defineKey,lo as defineLeafAttr,To as dimType,vo as doBoundsType,ko as doStrokeType,Yh as effectType,e as emptyData,Do as eraserType,Ir as extraPropertyEventMap,H as getBoundsData,oo as getDescriptor,V as getMatrixData,X as getPointData,Mo as hitType,l as isArray,c as isData,u as isEmptyData,o as isFinite,s as isNull,r as isNumber,d as isObject,n as isString,i as isUndefined,Wo as layoutProcessor,ta as leaferTransformAttrMap,Ao as maskType,Iv as motionPathType,yo as naturalBoundsType,Ro as opacityType,Nn as path,wo as pathInputType,xo as pathType,Xn as pen,uo as positionType,__ as registerEditTool,f_ as registerInnerEditor,Go as registerUI,qo as registerUIEvent,Nh as resizeType,Ho as rewrite,Vo as rewriteAble,fo as rotationType,hf as scaleResize,lf as scaleResizeFontSize,uf as scaleResizeGroup,df as scaleResizePath,cf as scaleResizePoints,_o as scaleType,go as scrollType,Lo as sortType,Uv as stateStyleType,jv as stateType,So as strokeType,Bo as surfaceType,qt as tempBounds,mt as tempMatrix,_t as tempPoint,h as tryToNumber,xh as useCanvas,Uo as useModule,yh as version,Co as visibleType,Xh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|