@leafer-ui/worker 2.0.0 → 2.0.1
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.cjs +3 -3
- package/dist/worker.esm.js +3 -3
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +17 -17
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +17 -17
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:a}=Number;function o(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return g(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&g(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,k=[0,0,0,0],B={zero:[...k],tempFour:k,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>S(k,t,e,i,s),toTempAB(t,e,i){v=i?o(t)?e:t:[],o(t)?(x=R(t),w=e):o(e)?(x=t,w=R(e)):(x=t,w=e),4!==x.length&&(x=P(x)),4!==w.length&&(w=P(w))},get(t,e){let i;if(!o(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>o(t)&&o(e)?b(t,e):(C(t,e,i),S(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,i)=>o(t)&&o(e)?t+e:(C(t,e,i),S(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,i,s){if(o(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,h,l]=4===t.length?t:P(t);return S(r,h*i,l*e,n*i,a*e)}},{set:S,get:P,setTemp:R,toTempAB:C}=B,{round:E,pow:T,max:L,floor:O,PI:A}=Math,D={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:B.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),D.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:T(10,e);return-0===(t=E(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(o(e)?e:e.width||0)/i.width,r=(o(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&D.assignScale(s,t);return s},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(O(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const I=A/180,W=2*A,F=A/2;function N(){return{x:0,y:0}}function z(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:U,sqrt:V}=Math,{float:j}=D,G={};function q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const K={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:Y,getWorld:q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,G),Q.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=H(e*=I),o=X(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,G),Q.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=I,t.a=s+n*i,t.b=r+a*i),e&&(e*=I,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,G),Q.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,r,n){const{e:a,f:o}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*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:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*I,a=H(n),o=X(n);if(s||r){const e=s*I,i=r*I;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||r)&&Q.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?U(e):-U(e)}else{c=V(a*a+o*o),d=t/c;const e=a/c;u=F-(o>0?U(-e):-U(e))}const e=j(H(u)),i=X(u);d=j(d),c=j(c),_=e?j((a/c+i)/e/I,9):0,p=e?j((n/d-i)/e/I,9):0,u=j(u/I)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=V(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=K,{float:J}=D,{toInnerPoint:Z,toOuterPoint:$}=K,{sin:tt,cos:et,abs:it,sqrt:st,atan2:rt,min:nt,round:at}=Math,ot={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ht.defaultPoint);const s=et(e*=I),r=tt(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=ht;return dt(i,t),Z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ht;return dt(i,t),$(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ht;return dt(i,t),ht.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(dt(t,e),ct(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),Z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){Z(e,t,i)},toOuterOf(t,e,i){$(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=it(i-t),n=it(s-e);return st(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>nt(lt(t,e,i,s),lt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/I,getRotation:(t,e,i,s)=>(s||(s=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,r,n,a,o,h){s(o)&&(o=i,h=r);const l=t-i,d=e-r,c=n-o,u=a-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,r){const n=ut(t,e);return r&&(t=e),s||(e={}),e.x=t.x+et(n)*i,e.y=t.y+tt(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){ht.reset(t)}},ht=ot,{getDistanceFrom:lt,copy:dt,setRadius:ct,getAtan2:ut}=ht;class _t{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new _t(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(ot.getDistancePoint(this,t,e,i,s))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}isSame(t){return ot.isSame(this,t)}reset(){return ot.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?K.copy(this,t):K.set(this,t,e,i,s,r,n),this}setWith(t){return K.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return K.translate(this,t,e),this}translateInner(t,e){return K.translateInner(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleWith(t,e){return K.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return K.pixelScale(this,t),this}scaleOfOuter(t,e,i){return K.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return K.scaleOfInner(this,t,e,i),this}rotate(t){return K.rotate(this,t),this}rotateOfOuter(t,e){return K.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return K.rotateOfInner(this,t,e),this}skew(t,e){return K.skew(this,t,e),this}skewOfOuter(t,e,i){return K.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return K.skewOfInner(this,t,e,i),this}multiply(t){return K.multiply(this,t),this}multiplyParent(t){return K.multiplyParent(this,t),this}divide(t){return K.divide(this,t),this}divideParent(t){return K.divideParent(this,t),this}invert(){return K.invert(this),this}invertWith(){return K.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){K.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){K.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return K.setLayout(this,t,e,i),this}getLayout(t,e,i){return K.getLayout(this,t,e,i)}withScale(t,e){return K.withScale(this,t,e)}reset(){K.reset(this)}}const ft=new gt,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,r){mt(t,e,i),mt(t,e+s,i+r)},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:mt}=yt;var xt,wt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(wt||(wt={}));const vt=[{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}];vt.forEach(t=>t.type="percent");const bt={directionData:vt,tempPoint:{},get:kt,toPoint(t,e,i,s,r,n){const a=kt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function kt(t){return n(t)?vt[wt[t]]:t}const{toPoint:Bt}=bt,St={toPoint(t,e,i,s,r,n){Bt(t,i,s,r,e,n)}},{tempPointBounds:Pt,setPoint:Rt,addPoint:Ct,toBounds:Et}=yt,{toOuterPoint:Tt}=K,{float:Lt,fourNumber:Ot}=D,{floor:At,ceil:Dt}=Math;let Mt,It,Wt,Ft;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=Ot(i);s?Ht.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Nt.x=t.x,Nt.y=t.y,Tt(e,Nt,zt),Rt(Pt,zt.x,zt.y),Nt.x=t.x+t.width,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Nt.y=t.y+t.height,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Nt.x=t.x,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Et(Pt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,a){a||(a=e),n(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=r?e.width*=s:e.width*s,Yt.height=r?e.height*=s:e.height*s,St.toPoint(i,Yt,t,a,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=At(t.x),t.y=At(t.y),t.width=e>t.x?Dt(t.width+e-t.x):Dt(t.width),t.height=i>t.y?Dt(t.height+i-t.y):Dt(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){Mt=t.x+t.width,It=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),Mt=Mt>Wt?Mt:Wt,It=It>Ft?It:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=It-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Vt(t,r)):Ut(t,r));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Pt,t.x,t.y):Ct(Pt,t.x,t.y)),Et(Pt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Ut(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ot.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Mt=s+n,It=r+a,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Mt=Mt<Wt?Mt:Wt,It=It<Ft?It:Ft,n=Mt-s,a=It-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:Ut,copy:Vt}=Ht;class jt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new jt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new jt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Gt=new jt;class qt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new jt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Kt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Jt,max:Zt}=Math,$t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||te.maxCacheSize),isSuperLarge:(t,e,i)=>te.isLarge(t,e,i,te.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=te;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h,l){const d=Zt(Jt(e+(s||0)),1),c=Zt(Jt(i+(r||0)),1);let u,_,p;l&&(p=Kt.number(l.offset,(u="x"===l.type)?e:i))&&(u||(_=!0));const g=$t.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(o&&(f.globalAlpha=o),f.imageSmoothingEnabled=!1!==a,te.canUse(t)){if(n){const s=e/n.width,r=i/n.height;f.setTransform(s,0,0,r,-n.x*s,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:te}=$t,{randColor:ee}=D;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=se(t)}static set exclude(t){this.excludeList=se(t)}static drawRepaint(t,e){const i=ee();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ie.showBounds,r=t.__nowWorld,n=ee();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function se(t){return t?n(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const re=ie,ne=ie.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=y.create(y.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ne.log(s,r,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=ae,he=[],le={list:{},add(t,...e){this.list[t]=!0,he.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>he.forEach(t=>le.has(t,!0)));const de={editor:t=>le.need("editor")},ce=ie.get("UICreator"),ue={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ce.repeat(e),_e[e]=t},get(t,e,i,r,n,a){_e[t]||ce.error("not register "+t);const o=new _e[t](e);return s(i)||(o.x=i,r&&(o.y=r),n&&(o.width=n),a&&(o.height=a)),o}},{list:_e}=ue,pe=ie.get("EventCreator"),ge={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(fe[e]&&pe.repeat(e),fe[e]=t)})},changeName(t,e){const i=fe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,fe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new fe[t](...e)},{nameList:fe}=ge;class ye{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=de.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function me(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function xe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function we(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 ve=[];function be(){return(t,e)=>{ve.push(e)}}const ke=[];let Be=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ve.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};me([we("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),me([we("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),me([we("globalAlpha")],Be.prototype,"opacity",void 0),me([we()],Be.prototype,"fillStyle",void 0),me([we()],Be.prototype,"strokeStyle",void 0),me([we("lineWidth")],Be.prototype,"strokeWidth",void 0),me([we("lineCap")],Be.prototype,"strokeCap",void 0),me([we("lineJoin")],Be.prototype,"strokeJoin",void 0),me([we("lineDashOffset")],Be.prototype,"dashOffset",void 0),me([we()],Be.prototype,"miterLimit",void 0),me([we()],Be.prototype,"shadowBlur",void 0),me([we()],Be.prototype,"shadowColor",void 0),me([we()],Be.prototype,"shadowOffsetX",void 0),me([we()],Be.prototype,"shadowOffsetY",void 0),me([we()],Be.prototype,"filter",void 0),me([we()],Be.prototype,"font",void 0),me([we()],Be.prototype,"fontKerning",void 0),me([we()],Be.prototype,"fontStretch",void 0),me([we()],Be.prototype,"fontVariantCaps",void 0),me([we()],Be.prototype,"textAlign",void 0),me([we()],Be.prototype,"textBaseline",void 0),me([we()],Be.prototype,"textRendering",void 0),me([we()],Be.prototype,"wordSpacing",void 0),me([we()],Be.prototype,"letterSpacing",void 0),me([we()],Be.prototype,"direction",void 0),me([be()],Be.prototype,"setTransform",null),me([be()],Be.prototype,"resetTransform",null),me([be()],Be.prototype,"getTransform",null),me([be()],Be.prototype,"save",null),me([be()],Be.prototype,"restore",null),me([be()],Be.prototype,"translate",null),me([be()],Be.prototype,"scale",null),me([be()],Be.prototype,"rotate",null),me([be()],Be.prototype,"fill",null),me([be()],Be.prototype,"stroke",null),me([be()],Be.prototype,"clip",null),me([be()],Be.prototype,"fillRect",null),me([be()],Be.prototype,"strokeRect",null),me([be()],Be.prototype,"clearRect",null),me([be()],Be.prototype,"beginPath",null),me([be()],Be.prototype,"moveTo",null),me([be()],Be.prototype,"lineTo",null),me([be()],Be.prototype,"bezierCurveTo",null),me([be()],Be.prototype,"quadraticCurveTo",null),me([be()],Be.prototype,"closePath",null),me([be()],Be.prototype,"arc",null),me([be()],Be.prototype,"arcTo",null),me([be()],Be.prototype,"ellipse",null),me([be()],Be.prototype,"rect",null),me([be()],Be.prototype,"roundRect",null),me([be()],Be.prototype,"createConicGradient",null),me([be()],Be.prototype,"createLinearGradient",null),me([be()],Be.prototype,"createPattern",null),me([be()],Be.prototype,"createRadialGradient",null),me([be()],Be.prototype,"fillText",null),me([be()],Be.prototype,"measureText",null),me([be()],Be.prototype,"strokeText",null);const{copy:Se,multiplyParent:Pe,pixelScale:Re}=K,{round:Ce}=Math,Ee=new jt,Te=new jt,Le={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class Ae extends Be{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=Le),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||$t.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;p.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new jt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&Pe(t,e,r),Re(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ce(r.e-.5)+.5,r.f=Ce(r.f-.5)+.5):(r.e=Ce(r.e),r.f=Ce(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Te):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,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),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,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Ee.x,Ee.y,Ee.width,Ee.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,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(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):de.canvas(Object.assign({},i));return r.save(),t&&(Se(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}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 De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Me),We={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ne=Object.assign(Object.assign({},Fe),Me),ze=Ie,Ye={};for(let t in ze)Ye[ze[t]]=t;const Xe={};for(let t in ze)Xe[ze[t]]=We[t];const He={drawRoundRect(t,e,i,s,r,n){const a=D.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ue,cos:Ve,hypot:je,atan2:Ge,ceil:qe,abs:Ke,PI:Qe,sqrt:Je,pow:Ze}=Math,{setPoint:$e,addPoint:ti}=yt,{set:ei,toNumberPoints:ii}=ot,{M:si,L:ri,C:ni,Q:ai,Z:oi}=Ie,hi={},li={points(t,e,i,s){let r=ii(e);if(t.push(si,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y,m,x=r.length;const w=!0===i?.5:i;s&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let i=2;i<x-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=a-e,g=o-n,f=Je(Ze(p,2)+Ze(g,2)),y=Je(Ze(h-a,2)+Ze(l-o,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=n,d=a-f*h,c=o-f*l,2===i?s||t.push(ai,d,c,a,o):(p||g)&&t.push(ni,u,_,d,c,a,o),u=a+y*h,_=o+y*l);s||t.push(ai,u,_,r[x-2],r[x-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ri,r[e],r[e+1]);s&&t.push(oi)},rect(t,e,i,s,r){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){De.creator.path=[],He.drawRoundRect(De.creator,e,i,s,r,n),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Ge(u,c),f=Ge(p,_);const y=je(c,u),m=je(_,p);let x=f-g;if(x<0&&(x+=W),y<1e-12||m<1e-12||x<1e-12||Ke(x-Qe)<1e-12)return t&&t.push(ri,s,r),h&&($e(h,e,i),ti(h,s,r)),d&&ei(d,e,i),void(l&&ei(l,s,r));const w=c*p-_*u<0,v=w?-1:1,b=o/Ve(x/2),k=s+b*Ve(g+x/2+F*v),B=r+b*Ue(g+x/2+F*v);return g-=F*v,f-=F*v,ui(t,k,B,o,o,0,g/I,f/I,w,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>ui(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*I,_=Ue(u),p=Ve(u);let g=a*I,f=o*I;g>Qe&&(g-=W),f<0&&(f+=W);let y=f-g;y<0?y+=W:y>W&&(y-=W),h&&(y-=W);const m=qe(Ke(y/F)),x=y/m,w=Ue(x/4),v=8/3*w*w/Ue(x/2);f=g+x;let b,k,B,S,P,R,C,E,T=Ve(g),L=Ue(g),O=B=p*s*T-_*r*L,A=S=_*s*T+p*r*L,D=e+B,M=i+S;t&&t.push(t.length?ri:si,D,M),l&&$e(l,D,M),c&&ei(c,D,M);for(let n=0;n<m;n++)b=Ve(f),k=Ue(f),B=p*s*b-_*r*k,S=_*s*b+p*r*k,P=e+O-v*(p*s*L+_*r*T),R=i+A-v*(_*s*L-p*r*T),C=e+B+v*(p*s*k+_*r*b),E=i+S+v*(_*s*k-p*r*b),t&&t.push(ni,P,R,C,E,e+B,i+S),l&&ci(e+O,i+A,P,R,C,E,e+B,i+S,l,!0),O=B,A=S,T=b,L=k,g=f,f+=x;d&&ei(d,e+B,i+S)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ni,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){ci(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=i,v=r,b=a;for(let t=0;t<2;++t)if(1==t&&(x=e,w=s,v=n,b=o),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ti(h,t,e):$e(h,t,e),ti(h,a,o);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,r,n,a,o,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return di(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:_i,cos:pi,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*I,p=_i(_),g=pi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,x=r*r,w=y*y,v=f*f,b=m*x-m*w-x*v;let k=0;if(b<0){const t=gi(1-b/(m*x));s*=t,r*=t}else k=(a===o?-1:1)*gi(b/(m*w+x*v));const B=k*s*y/r,S=-k*r*f/s,P=fi((y-S)/r,(f-B)/s),R=fi((-y-S)/r,(-f-B)/s);let C=R-P;0===o&&C>0?C-=W:1===o&&C<0&&(C+=W);const E=e+c+g*B-p*S,T=i+u+p*B+g*S,L=C<0?1:0;d||$t.ellipseToCurve?yi(t,E,T,s,r,n,P/I,R/I,L):s!==r||n?t.push(Ie.G,E,T,s,r,n,P/I,R/I,L):t.push(Ie.O,E,T,s,P/I,R/I,L)}},xi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:vi,L:bi,l:ki,H:Bi,h:Si,V:Pi,v:Ri,C:Ci,c:Ei,S:Ti,s:Li,Q:Oi,q:Ai,T:Di,t:Mi,A:Ii,a:Wi,Z:Fi,z:Ni,N:zi,D:Yi,X:Xi,G:Hi,F:Ui,O:Vi,P:ji,U:Gi}=Ie,{rect:qi,roundRect:Ki,arcTo:Qi,arc:Ji,ellipse:Zi,quadraticCurveTo:$i}=li,{ellipticalArc:ts}=mi,es=ie.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Xe[s],o+=s===r?" ":Ye[s];for(let s=1;s<i;s++)o+=D.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Ne:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(rs.dot&&(ns(a,n),n=""),rs.dot++),"0"===n&&"."!==s&&(ns(a,n),n=""),n+=s):Ie[s]?(n&&(ns(a,n),n=""),rs.name=Ie[s],rs.length=We[s],rs.index=0,ns(a,rs.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ns(a,n),n=s):n&&(ns(a,n),n=""),r=s;return n&&ns(a,n),i?ss.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case vi:t[c+1]+=o,t[c+2]+=h;case wi:o=t[c+1],h=t[c+2],_.push(wi,o,h),c+=3;break;case Si:t[c+1]+=o;case Bi:o=t[c+1],_.push(bi,o,h),c+=2;break;case Ri:t[c+1]+=h;case Pi:h=t[c+1],_.push(bi,o,h),c+=2;break;case ki:t[c+1]+=o,t[c+2]+=h;case bi:o=t[c+1],h=t[c+2],_.push(bi,o,h),c+=3;break;case Li:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ti;case Ti:a=n===Ci||n===Ti,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Ci,l,d,i,s,o,h),c+=5;break;case Ei:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Ci;case Ci:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Ci,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Mi:t[c+1]+=o,t[c+2]+=h,r=Di;case Di:a=n===Oi||n===Di,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?$i(_,o,h,i,s,t[c+1],t[c+2]):_.push(Oi,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Ai:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Oi;case Oi:i=t[c+1],s=t[c+2],e?$i(_,o,h,i,s,t[c+3],t[c+4]):_.push(Oi,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Wi:t[c+6]+=o,t[c+7]+=h;case Ii:ts(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Ni:case Fi:_.push(Fi),c++;break;case zi:o=t[c+1],h=t[c+2],e?qi(_,o,h,t[c+3],t[c+4]):as(_,t,c,5),c+=5;break;case Yi:o=t[c+1],h=t[c+2],e?Ki(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):as(_,t,c,9),c+=9;break;case Xi:o=t[c+1],h=t[c+2],e?Ki(_,o,h,t[c+3],t[c+4],t[c+5]):as(_,t,c,6),c+=6;break;case Hi:Zi(e?_:as(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,is),o=is.x,h=is.y,c+=9;break;case Ui:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):as(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:Ji(e?_:as(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),o=is.x,h=is.y,c+=7;break;case ji:e?Ji(_,t[c+1],t[c+2],t[c+3],0,360,!1):as(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Gi:Qi(e?_:as(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),o=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return xi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ci,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:ns,copyData:as}=ss,{M:os,L:hs,C:ls,Q:ds,Z:cs,N:us,D:_s,X:ps,G:gs,F:fs,O:ys,P:ms,U:xs}=Ie,{getMinDistanceFrom:ws,getRadianFrom:vs}=ot,{tan:bs,min:ks,abs:Bs}=Math,Ss={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ls,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(ds,e,i,s,r)},closePath(t){t.push(cs)},rect(t,e,i,s,r){t.push(us,e,i,s,r)},roundRect(t,e,i,s,r,n){if(o(n))t.push(ps,e,i,s,r,n);else{const a=D.fourNumber(n);a?t.push(_s,e,i,s,r,...a):t.push(us,e,i,s,r)}},ellipse(t,e,i,s,n,a,o,h,l){if(s===n)return Cs(t,e,i,s,o,h,l);r(a)?t.push(fs,e,i,s,n):(r(o)&&(o=0),r(h)&&(h=360),t.push(gs,e,i,s,n,a,o,h,l?1:0))},arc(t,e,i,s,n,a,o){r(n)?t.push(ms,e,i,s):(r(n)&&(n=0),r(a)&&(a=360),t.push(ys,e,i,s,n,a,o?1:0))},arcTo(t,e,i,r,n,a,o,h){if(!s(o)){const t=ws(o,h,e,i,r,n);a=ks(a,ks(t/2,t/2*Bs(bs(vs(o,h,e,i,r,n)/2))))}t.push(xs,e,i,r,n,a)},drawEllipse(t,e,i,s,n,a,o,h,l){li.ellipse(null,e,i,s,n,r(a)?0:a,r(o)?0:o,r(h)?360:h,l,null,null,Ss),t.push(os,Ss.x,Ss.y),Rs(t,e,i,s,n,a,o,h,l)},drawArc(t,e,i,s,n,a,o){li.arc(null,e,i,s,r(n)?0:n,r(a)?360:a,o,null,null,Ss),t.push(os,Ss.x,Ss.y),Cs(t,e,i,s,n,a,o)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Rs,arc:Cs}=Ps,{moveTo:Es,lineTo:Ts,quadraticCurveTo:Ls,bezierCurveTo:Os,closePath:As,beginPath:Ds,rect:Ms,roundRect:Is,ellipse:Ws,arc:Fs,arcTo:Ns,drawEllipse:zs,drawArc:Ys,drawPoints:Xs}=Ps;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Es(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Os(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return As(this.__path),this.paint(),this}rect(t,e,i,s){return Ms(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Ws(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Fs(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ns(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return zs(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Ys(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Vs,C:js,Q:Gs,Z:qs,N:Ks,D:Qs,X:Js,G:Zs,F:$s,O:tr,P:er,U:ir}=Ie,sr=ie.get("PathDrawer"),rr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case tr:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case er:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case ir:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sr.error(`command: ${i} [index:${s}]`,e)}}},{M:nr,L:ar,C:or,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:gr,P:fr,U:yr}=Ie,{toTwoPointBounds:mr,toTwoPointBoundsByQuadraticCurve:xr,arcTo:wr,arc:vr,ellipse:br}=li,{addPointBounds:kr,copy:Br,addPoint:Sr,setPoint:Pr,addBounds:Rr,toBounds:Cr}=yt,Er=ie.get("PathBounds");let Tr,Lr,Or;const Ar={},Dr={},Mr={},Ir={toBounds(t,e){Ir.toTwoPointBounds(t,Dr),Cr(Dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Pr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===lr||a===or||a===hr?Pr(e,h,l):Pr(e,t[o+1],t[o+2])),a){case nr:case ar:h=t[o+1],l=t[o+2],Sr(e,h,l),o+=3;break;case or:r=t[o+5],n=t[o+6],mr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Ar),kr(e,Ar),h=r,l=n,o+=7;break;case hr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],xr(h,l,i,s,r,n,Ar),kr(e,Ar),h=r,l=n,o+=5;break;case lr:o+=1;break;case dr:h=t[o+1],l=t[o+2],Rr(e,h,l,t[o+3],t[o+4]),o+=5;break;case cr:case ur:h=t[o+1],l=t[o+2],Rr(e,h,l,t[o+3],t[o+4]),o+=a===cr?9:6;break;case _r:br(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=9;break;case pr:h=t[o+1],l=t[o+2],Lr=t[o+3],Or=t[o+4],Rr(e,h-Lr,l-Or,2*Lr,2*Or),h+=Lr,o+=5;break;case gr:vr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=7;break;case fr:h=t[o+1],l=t[o+2],Tr=t[o+3],Rr(e,h-Tr,l-Tr,2*Tr,2*Tr),h+=Tr,o+=4;break;case yr:wr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=6;break;default:return void Er.error(`command: ${a} [index:${o}]`,t)}}},{M:Wr,L:Fr,Z:Nr}=Ie,{getCenterX:zr,getCenterY:Yr}=ot,{arcTo:Xr}=Ps,Hr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=[];for(;a<f;){switch(s=t[a],s){case Wr:l=p=t[a+1],c=g=t[a+2],a+=3,t[a]===Fr?(u=t[a+1],_=t[a+2],y.push(Wr,zr(l,u),Yr(c,_))):y.push(Wr,l,c);break;case Fr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Fr:Xr(y,o,h,t[a+1],t[a+2],e,p,g);break;case Nr:Xr(y,o,h,l,c,e,p,g);break;default:y.push(Fr,o,h)}p=o,g=h;break;case Nr:r!==Nr&&(Xr(y,l,c,u,_,e,p,g),y.push(Nr)),a+=1;break;default:n=Xe[s];for(let e=0;e<n;e++)y.push(t[a+e]);a+=n}r=s}return s!==Nr&&(y[1]=l,y[2]=c),y}};function Ur(t){return new Hs(t)}const Vr=Ur();De.creator=Ur(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:jr}=He;function Gr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){jr(this,t,e,i,s,r)})}(t)}const qr={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=Kr.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{}}}},Kr=qr;Kr.alphaPixelTypes.forEach(t=>Kr.upperCaseTypeMap[t]=t.toUpperCase());const Qr=ie.get("TaskProcessor");class Jr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return xe(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Qr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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&&p.assign(this.config,t),this.empty()}add(t,e,i){let r,n,a,h;const l=new Jr(t);return l.parent=this,o(e)?h=e:e&&(n=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(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 $r=ie.get("Resource"),tn={tasker:new Zr,map:{},get isComplete(){return en.tasker.isComplete},set(t,e){en.map[t]&&$r.repeat(t),en.map[t]=e},get:t=>en.map[t],remove(t){const e=en.map[t];e&&(e.destroy&&e.destroy(),delete en.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),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=de.image(s)),en.set(t,e),e},destroy(){en.map={}}},en=tn,sn={maxRecycled:10,recycledList:[],patternTasker:new Zr({parallel:1}),get(t){let e=tn.get(t.url);return e||tn.set(t.url,e=de.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||($t.image.isLarge(t)?t.url&&tn.remove(t.url):(t.clearLevels(),rn.recycledList.push(t)))})},recyclePaint(t){rn.recycle(t.image)},clearRecycled(t){const e=rn.recycledList;(e.length>rn.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tn.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qr.alphaPixelTypes.some(e=>rn.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:"+qr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},rn=sn,{IMAGE:nn,create:an}=y;class on{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?$t.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=an(nn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sn.isFormat("svg",t)&&(this.isSVG=!0),sn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tn.tasker.add(()=>xe(this,void 0,void 0,function*(){return yield $t.origin.loadImage(this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=$t.image.resize(this.view,t,e,r,n,void 0,a,i,s,o);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const r=$t.canvas.createPattern(t,e);return $t.image.setPatternTransform(r,i,s),r}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function hn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ln(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function cn(t,e){return(i,s)=>_n(i,s,t,e&&e(s))}function un(t){return t}function _n(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};hn(t,e,Object.assign(r,s||{})),Xn(t,e,i)}function pn(t){return cn(t)}function gn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function yn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),bn(this))}}))}function mn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function xn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function wn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&bn(this)}}))}function vn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(bn(this),this.__.__removeNaturalSize())}}))}function bn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function kn(t){return cn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),bn(this)}}))}const Bn=wn;function Sn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i)&&(Pn(this),e&&(this.__.__useStroke=!0))}}))}function Pn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&bn(t)}const Rn=Sn;function Cn(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function En(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tn(t){return cn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Ln(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&An(this)}}))}function On(t){return cn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Dn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Dn(this,t,e,i),this.mask&&An(this)}}))}function An(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Dn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||bn(t))}function Mn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function In(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Wn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ie.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Nn(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function zn(t){return(e,i)=>{hn(e,"__DataProcessor",{get:()=>t})}}function Yn(t){return(e,i)=>{hn(e,"__LayoutProcessor",{get:()=>t})}}function Xn(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=dn(e,i);if(s(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=_(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=r;for(;!l&&d;)l=ln(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),r[a]&&(o.set=r[a],delete r[a]),hn(r,e,o)}const Hn=new ie("rewrite"),Un=[],Vn=["destroy","constructor"];function jn(t){return(e,i)=>{Un.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Gn(){return t=>{qn()}}function qn(t){Un.length&&(Un.forEach(e=>{t&&Hn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Un.length=0)}function Kn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Vn.includes(s)||e&&e.includes(s)))if(t.prototype){ln(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Qn(){return t=>{ue.register(t)}}function Jn(){return t=>{ge.register(t)}}setTimeout(()=>qn(!0));const{copy:Zn,toInnerPoint:$n,toOuterPoint:ta,scaleOfOuter:ea,rotateOfOuter:ia,skewOfOuter:sa,multiplyParent:ra,divideParent:na,getLayout:aa}=K,oa={},{round:ha}=Math,la={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),ua(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ca(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++)_a(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&_a(t),t.__updateChange()},updateAllChange(t){if(ga(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)pa(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,r,n){s||(s=t.__nowWorld),t.__worldFlipped||$t.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?ta(t.localTransform,n,n,!0):t.parent&&$n(t.parent.scrollWorldTransform,n,n,!0),da.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ha(e),i=ha(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){da.zoomOfLocal(t,fa(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(o(s)||(s&&(n=s),s=i),Zn(oa,a),ea(oa,e,i,s),da.hasHighPosition(t))da.setTransform(t,oa,r,n);else{const e=t.x+oa.e-a.e,o=t.y+oa.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){da.rotateOfLocal(t,fa(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Zn(oa,r),ia(oa,e,i),da.hasHighPosition(t)?da.setTransform(t,oa,!1,s):t.set({x:t.x+oa.e-r.e,y:t.y+oa.f-r.f,rotation:D.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){da.skewOfLocal(t,fa(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Zn(oa,t.__localMatrix),sa(oa,e,i,s),da.setTransform(t,oa,r,n)},transformWorld(t,e,i,s){Zn(oa,t.worldTransform),ra(oa,e),t.parent&&na(oa,t.parent.scrollWorldTransform),da.setTransform(t,oa,i,s)},transform(t,e,i,s){Zn(oa,t.localTransform),ra(oa,e),da.setTransform(t,oa,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&da.getInnerOrigin(t,r.origin),a=aa(e,n,r.around&&da.getInnerOrigin(t,r.around));if(da.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=da.getInnerOrigin(t,r.origin);ot.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return ea(i,da.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(da.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zn(oa,t.worldTransform),na(oa,e.scrollWorldTransform),i?oa:Object.assign({},oa)),drop(t,e,i,s){t.setTransform(da.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||da.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,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),$t.requestRender(()=>da.animateMove(t,e,i))}}},da=la,{updateAllMatrix:ca,updateMatrix:ua,updateAllWorldOpacity:_a,updateAllChange:pa,updateChange:ga}=da;function fa(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ya={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)=>xa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>xa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>xa(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 ma;function xa(t,e){return e||(ma=0),t.__.mask&&(ma=1),ma<0?null:(ma&&(ma=-1),!0)}const{updateBounds:wa}=la,va={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,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ba(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ka(e[t],e)},updateBounds(t,e){const i=[t];ka(t,i),Ba(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)wa(s[t]);e&&e===i||wa(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,a=r.length;n<a;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Sa(t,e,i)},scale(t,e,i,s,r,n,a){let o;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)o=(t=h[c]).__world,o.a*=s,o.d*=r,(o.b||o.c)&&(o.b*=s,o.c*=r),o.e===o.x&&o.f===o.y?(o.x=o.e+=(o.e-n)*l+e,o.y=o.f+=(o.f-a)*d+i):(o.e+=(o.e-n)*l+e,o.f+=(o.f-a)*d+i,o.x+=(o.x-n)*l+e,o.y+=(o.y-a)*d+i),o.width*=s,o.height*=r,o.scaleX*=s,o.scaleY*=r,t.isBranch&&Pa(t,e,i,s,r,n,a)}},{pushAllChildBranch:ba,pushAllBranchStack:ka,updateBoundsByBranchStack:Ba,move:Sa,scale:Pa}=va,Ra={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:Ca,updateBounds:Ea}=la,{toOuterOf:Ta,getPoints:La,copy:Oa}=Xt,Aa="_localContentBounds",Da="_worldContentBounds",Ma="_worldBoxBounds",Ia="_worldStrokeBounds";class Wa{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 Ta(this.contentBounds,this.leaf.__localMatrix,this[Aa]||(this[Aa]={})),this[Aa]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ta(this.contentBounds,this.leaf.__world,this[Da]||(this[Da]={})),this[Da]}get worldBoxBounds(){return Ta(this.boxBounds,this.leaf.__world,this[Ma]||(this[Ma]={})),this[Ma]}get worldStrokeBounds(){return Ta(this.strokeBounds,this.leaf.__world,this[Ia]||(this[Ia]={})),this[Ia]}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 Ea(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,$t.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 K.defaultMatrix;case"page":t=e.zoomLayer;default:return Ca(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new jt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=K.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=Ca(s,e,!0)}if(a||(a=K.getLayout(n)),Oa(a,o),ot.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=La(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}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 Fa{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&$t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&$t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&$t.event.stop(this.origin)}}class Na extends Fa{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Na.ADD="child.add",Na.REMOVE="child.remove",Na.CREATED="created",Na.MOUNTED="mounted",Na.UNMOUNTED="unmounted",Na.DESTROY="destroy";const za="property.scroll";class Ya extends Fa{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Ya.CHANGE="property.change",Ya.LEAFER_CHANGE="property.leafer_change",Ya.SCROLL=za;const Xa={scrollX:za,scrollY:za};class Ha extends Fa{constructor(t,e){super(t),Object.assign(this,e)}}Ha.LOAD="image.load",Ha.LOADED="image.loaded",Ha.ERROR="image.error";class Ua extends Fa{static checkHas(t,e,i){"on"===i?e===qa?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Va)||t.hasEvent(ja)||t.hasEvent(Ga),t.__hasWorldEvent=t.hasEvent(qa))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Va,t),"inner"===e&&t.emit(ja,t)),t.emit(Ga,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(qa,this)}}Ua.RESIZE="bounds.resize",Ua.INNER="bounds.inner",Ua.LOCAL="bounds.local",Ua.WORLD="bounds.world";const{RESIZE:Va,INNER:ja,LOCAL:Ga,WORLD:qa}=Ua,Ka={};[Va,ja,Ga,qa].forEach(t=>Ka[t]=1);class Qa extends Fa{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Qa.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Qa.RESIZE="resize";class Ja extends Fa{constructor(t,e){super(t),this.data=e}}Ja.REQUEST="watch.request",Ja.DATA="watch.data";class Za extends Fa{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Za.REQUEST="layout.request",Za.START="layout.start",Za.BEFORE="layout.before",Za.LAYOUT="layout",Za.AFTER="layout.after",Za.AGAIN="layout.again",Za.END="layout.end";class $a extends Fa{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}$a.REQUEST="render.request",$a.CHILD_START="render.child_start",$a.CHILD_END="render.child_end",$a.START="render.start",$a.BEFORE="render.before",$a.RENDER="render",$a.AFTER="render.after",$a.AGAIN="render.again",$a.END="render.end",$a.NEXT="render.next";class to extends Fa{}to.START="leafer.start",to.BEFORE_READY="leafer.before_ready",to.READY="leafer.ready",to.AFTER_READY="leafer.after_ready",to.VIEW_READY="leafer.view_ready",to.VIEW_COMPLETED="leafer.view_completed",to.STOP="leafer.stop",to.RESTART="leafer.restart",to.END="leafer.end",to.UPDATE_MODE="leafer.update_mode",to.TRANSFORM="leafer.transform",to.MOVE="leafer.move",to.SCALE="leafer.scale",to.ROTATE="leafer.rotate",to.SKEW="leafer.skew";const{MOVE:eo,SCALE:io,ROTATE:so,SKEW:ro}=to,no={x:eo,y:eo,scaleX:io,scaleY:io,rotation:so,skewX:ro,skewY:ro},ao={};class oo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,a;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=ho(this,s,!0),h=n(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(a=o[t],a?-1===a.findIndex(t=>t.listener===e)&&a.push(l):o[t]=[l],Ka[t]&&Ua.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=ho(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Ka[t]&&Ua.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ge.has(t)&&(e=ge.get(t,{type:t,target:this,current:this}));const s=ho(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:r}=this,n=i&&i[t],a=r&&r[t];return!!(s(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ho(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ao)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ao)}}const{on:lo,on_:co,off:uo,off_:_o,once:po,emit:go,emitEvent:fo,hasEvent:yo,destroy:mo}=oo.prototype,xo={on:lo,on_:co,off:uo,off_:_o,once:po,emit:go,emitEvent:fo,hasEvent:yo,destroyEventer:mo},wo=ie.get("setAttr"),vo={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||a(e)||s(e)||(wo.warn(this.innerName,t,e),e=void 0),c(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ya(Ya.LEAFER_CHANGE,this,t,r,e));const i=no[t];i&&(this.emitEvent(new to(i,this)),this.emitEvent(new to(to.TRANSFORM,this)))}this.emitPropertyEvent(Ya.CHANGE,t,r,e);const i=Xa[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Ya(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:bo,multiplyParent:ko,translateInner:Bo,defaultWorld:So}=K,{toPoint:Po,tempPoint:Ro}=bt,Co={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;ko(this.__local||e,t?t.__scrollWorld||t.__world:So,i,!!e.affectScaleOrRotation,r),s&&Bo(Object.assign(s,i),r.scrollX,r.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)&&(bo(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)&&(Po(i.around||i.origin,t.boxBounds,Ro),Bo(e,-Ro.x,-Ro.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Eo,updateAllMatrix:To}=la,{updateBounds:Lo}=va,{toOuterOf:Oo,copyAndSpread:Ao,copy:Do}=Xt,{toBounds:Mo}=Ir,Io={__updateWorldBounds(){const{__layout:t,__world:e}=this;Oo(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ua.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ua.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(),Oo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Oo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Oo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Mo(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(),To(this),Lo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(To(this),Lo(this,this))):Eo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ao(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;o(i)&&i<=0?Do(e.renderBounds,e.strokeBounds):Ao(e.renderBounds,e.boxBounds,i)}},Wo={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),la.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Fo}=ya,{hasSize:No}=Xt,zo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&No(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Fo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Fo(i[s],e)||i[s].__clip(t,e)}}},Yo={},{LEAF:Xo,create:Ho}=y,{stintSet:Uo}=p,{toInnerPoint:Vo,toOuterPoint:jo,multiplyParent:Go}=K,{toOuterOf:qo}=Xt,{copy:Ko,move:Qo}=ot,{moveLocal:Jo,zoomOfLocal:Zo,rotateOfLocal:$o,skewOfLocal:th,moveWorld:eh,zoomOfWorld:ih,rotateOfWorld:sh,skewOfWorld:rh,transform:nh,transformWorld:ah,setTransform:oh,getFlipTransform:hh,getLocalOrigin:lh,getRelativeWorld:dh,drop:ch}=la;let uh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Wa}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=Ho(Xo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Na.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(Na.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Na.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(Na.MOUNTED)):this.__emitLifeEvent(Na.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Go(i,t.matrix,e,void 0,i),qo(this.__layout.renderBounds,e,e),Uo(e,"half",i.half),Uo(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}=sn.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),Yo.scaleX=i,Yo.scaleY=s,Yo}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?dh(this,e):this.worldTransform,r=i?t:{};return qo(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ko(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ko(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Vo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){jo(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 r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Qo(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Qo(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}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 r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){oh(this,t,e,i)}transform(t,e,i){nh(this,t,e,i)}move(t,e,i){Jo(this,t,e,i)}moveInner(t,e,i){eh(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Zo(this,lh(this,t),e,i,s,r)}rotateOf(t,e,i){$o(this,lh(this,t),e,i)}skewOf(t,e,i,s,r){th(this,lh(this,t),e,i,s,r)}transformWorld(t,e,i){ah(this,t,e,i)}moveWorld(t,e,i){eh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){ih(this,t,e,i,s,r)}rotateOfWorld(t,e){sh(this,t,e)}skewOfWorld(t,e,i,s,r){rh(this,t,e,i,s,r)}flip(t,e){nh(this,hh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return le.need("path")}getMotionPoint(t){return le.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){ch(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Xn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=wn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Na(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Na.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};uh=me([Kn(vo),Kn(Co),Kn(Io),Kn(xo),Kn(Wo)],uh);const{setListWithFn:_h}=Xt,{sort:ph}=va,{localBoxBounds:gh,localStrokeBounds:fh,localRenderBounds:yh,maskLocalBoxBounds:mh,maskLocalStrokeBounds:xh,maskLocalRenderBounds:wh}=ya,vh=new ie("Branch");let bh=class extends uh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){_h(e||this.__layout.boxBounds,this.children,this.__hasMask?mh:gh)}__updateStrokeBounds(t){_h(t||this.__layout.strokeBounds,this.children,this.__hasMask?xh:fh)}__updateRenderBounds(t){_h(t||this.__layout.renderBounds,this.children,this.__hasMask?wh:yh)}__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(ph),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ue.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Na.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Na.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Na.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Na.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Na(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};bh=me([Kn(zo)],bh);class kh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new kh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Sh="2.0.0";class Ph extends Ae{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=$t.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}}Gr(OffscreenCanvasRenderingContext2D.prototype),Gr(Path2D.prototype);const{mineType:Rh}=qr;function Ch(t,e){$t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:Rh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Rh(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",$t.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()})},$t.canvas=de.canvas(),$t.conicGradientSupport=!!$t.canvas.context.createConicGradient}Object.assign(de,{canvas:(t,e)=>new Ph(t,e),image:t=>new on(t)}),$t.name="web",$t.isWorker=!0,$t.backgrounder=!0,$t.requestRender=function(t){requestAnimationFrame(t)},hn($t,"devicePixelRatio",{get:()=>1});const{userAgent:Eh}=navigator;Eh.indexOf("Firefox")>-1?($t.conicGradientRotate90=!0,$t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&($t.fullImageShadow=!0),Eh.indexOf("Windows")>-1?($t.os="Windows",$t.intWheelDeltaY=!0):Eh.indexOf("Mac")>-1?$t.os="Mac":Eh.indexOf("Linux")>-1&&($t.os="Linux");class Th{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new kh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new kh,this.target=t,e&&(this.config=p.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($a.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Na.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 Ja(Ja.DATA,{updatedList:this.updatedList})),this.__updatedList=new kh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ya.CHANGE,this.__onAttrChange,this],[[Na.ADD,Na.REMOVE],this.__onChildEvent,this],[Ja.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Oh,updateChange:Ah}=la,{pushAllChildBranch:Dh,pushAllParent:Mh}=va;const{worldBounds:Ih}=ya;class Wh{constructor(t){this.updatedBounds=new jt,this.beforeBounds=new jt,this.afterBounds=new jt,d(t)&&(t=new kh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ih),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Fh,updateAllChange:Nh}=la,zh=ie.get("Layouter");class Yh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Bh,this.target=t,e&&(this.config=p.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(Za.START),this.layoutOnce(),t.emitEvent(new Za(Za.END,this.layoutedBlocks,this.times))}catch(t){zh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?zh.warn("layouting"):this.times>3?zh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ja.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ae.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Za,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Za(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Lh(t,!0),e.add(t),t.isBranch&&Dh(t,e),Mh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Oh(s[t])}Oh(i)}})}(this.__levelList),function(t){t.list.forEach(Ah)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Za(n,o,this.times)),i.emitEvent(new Za(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Za,n=this.getBlocks(new kh(e));e.emitEvent(new Za(i,n,this.times)),Yh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Za(s,n,this.times)),e.emitEvent(new Za(r,n,this.times)),this.addBlocks(n),ae.end(t)}static fullLayout(t){Fh(t,!0),t.isBranch?va.updateBounds(t):la.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Wh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Wh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Za.REQUEST,this.layout,this],[Za.AGAIN,this.layoutAgain,this],[Ja.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Xh=ie.get("Renderer");class Hh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Za.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit($a.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit($a.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit($a.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new jt,Xh.log(e.innerName,"---\x3e");try{this.emitRender($a.START),this.renderOnce(t),this.emitRender($a.END,this.totalBounds),sn.clearRecycled()}catch(t){this.rendering=!1,Xh.error(t)}Xh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Xh.warn("rendering");if(this.times>3)return Xh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new jt,this.renderOptions={},t)this.emitRender($a.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender($a.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender($a.RENDER,this.renderBounds,this.renderOptions),this.emitRender($a.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=ae.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new jt(s);i.save(),s.spread(Hh.clipSpread).ceil();const{ceilPartPixel:n}=this.config;i.clipWorld(s,n),i.clearWorld(s,n),this.__render(s,r),i.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),$t.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new jt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return $t.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()};$t.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new jt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new jt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Xh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new $a(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[$a.REQUEST,this.update,this],[Za.END,this.__onLayoutEnd,this],[$a.AGAIN,this.renderAgain,this],[Qa.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Hh.clipSpread=10;const Uh={},{copyRadiusPoint:Vh}=ot,{hitRadiusPoint:jh}=Xt;class Gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new kh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new kh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||la.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&la.hasParent(t,e))){r.reset();break}return r.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),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>la.worldHittable(t))}getPath(t){const e=new kh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new kh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new kh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],r=i.__,r.visible&&(!e||r.mask))if(s=jh(i.__world,r.hitRadius?Vh(Uh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))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,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.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 qh{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new Gh(this.target=t,this),this.finder=de.finder&&de.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return $t.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):le.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Kh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Qh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Jh(){return(t,e)=>{const i="_"+e;hn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Zh(t){return(e,i)=>{hn(e,i,dn(i,t))}}Object.assign(de,{watcher:(t,e)=>new Th(t,e),layouter:(t,e)=>new Yh(t,e),renderer:(t,e,i)=>new Hh(t,e,i),selector:(t,e)=>new qh(t,e)}),$t.layout=Yh.fullLayout,$t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new kh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const $h={},tl={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},el=Kt,il={},sl={},rl={},nl={},al={},ol={apply(){le.need("filter")}},hl={},ll={setStyleName:()=>le.need("state"),set:()=>le.need("state")},dl={list:{},register(t,e){dl.list[t]=e},get:t=>dl.list[t]},{parse:cl,objectToCanvasData:ul}=ss,{stintSet:_l}=p,{hasTransparent:pl}=tl,gl={originPaint:{}},fl=ie.get("UIData");class yl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,fl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,fl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(_l(this,"__isTransparentFill",pl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(_l(this,"__isTransparentStroke",pl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?cl(t):ul(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ml(this,"shadow",t)}setInnerShadow(t){ml(this,"innerShadow",t)}setFilter(t){ml(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&sl.compute("fill",this.__leaf),e&&sl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gl)):(this.__isStrokes=!0,this._stroke||(this._stroke=gl))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ml(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class xl extends yl{}class wl extends xl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class vl extends xl{__getInputData(t,e){const i=super.__getInputData(t,e);return Oe.forEach(t=>delete i[t]),i}}class bl extends wl{}class kl extends yl{get __usePathBox(){return this.points||this.__pathInputed}}class Bl extends yl{get __boxStroke(){return!this.__pathInputed}}class Sl extends yl{get __boxStroke(){return!this.__pathInputed}}class Pl extends kl{}class Rl extends yl{}class Cl extends yl{get __pathInputed(){return 2}}class El extends xl{}const Tl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ll extends yl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=Tl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ue.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ol extends Bl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Al extends Bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Dl,add:Ml}=B,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Dl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Dl(t,s)),n&&(t=Ml(t,ol.getSpread(n))),a&&(t=Ml(t,a)),o&&(t=Ml(t,o));let l=t;return i&&(l=Dl(l,al.getInnerShadowSpread(this,i))),r&&(l=Dl(l,r)),this.__layout.renderShapeSpread=l,h?Dl(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=p,Fl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=sl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),c&&ol.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,tl.string(e.color))}r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e))}}else s.__pathForRender?Nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?sl.fills(s,this,t,e):sl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?sl.strokes(r,this,t,e):sl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Nl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&sl.stroke(r,t,e,i),s&&sl.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&sl.stroke(r,t,e,i)}const zl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Yl;let Xl=Yl=class extends uh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){D.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 Vr.set(this.path=t||[]),t||this.__drawPathByBox(Vr),Vr}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 le.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return le.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Vr.set(i=[]),this.__drawPathByBox(Vr,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||hl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&il.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rr.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,o(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){sl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),le.need("animate")}killAnimate(t,e){}export(t,e){return le.need("export")}syncExport(t,e){return le.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Yl.one(e)}static one(t,e,i,s,r){return ue.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Qn()(this)}static registerData(t){zn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([zn(yl)],Xl.prototype,"__",void 0),me([Jh()],Xl.prototype,"zoomLayer",void 0),me([pn("")],Xl.prototype,"id",void 0),me([pn("")],Xl.prototype,"name",void 0),me([pn("")],Xl.prototype,"className",void 0),me([En("pass-through")],Xl.prototype,"blendMode",void 0),me([Ln(1)],Xl.prototype,"opacity",void 0),me([On(!0)],Xl.prototype,"visible",void 0),me([En(!1)],Xl.prototype,"locked",void 0),me([Tn(!1)],Xl.prototype,"dim",void 0),me([Tn(!1)],Xl.prototype,"dimskip",void 0),me([Mn(0)],Xl.prototype,"zIndex",void 0),me([In(!1)],Xl.prototype,"mask",void 0),me([Wn(!1)],Xl.prototype,"eraser",void 0),me([gn(0,!0)],Xl.prototype,"x",void 0),me([gn(0,!0)],Xl.prototype,"y",void 0),me([wn(100,!0)],Xl.prototype,"width",void 0),me([wn(100,!0)],Xl.prototype,"height",void 0),me([mn(1,!0)],Xl.prototype,"scaleX",void 0),me([mn(1,!0)],Xl.prototype,"scaleY",void 0),me([xn(0,!0)],Xl.prototype,"rotation",void 0),me([xn(0,!0)],Xl.prototype,"skewX",void 0),me([xn(0,!0)],Xl.prototype,"skewY",void 0),me([gn(0,!0)],Xl.prototype,"offsetX",void 0),me([gn(0,!0)],Xl.prototype,"offsetY",void 0),me([fn(0,!0)],Xl.prototype,"scrollX",void 0),me([fn(0,!0)],Xl.prototype,"scrollY",void 0),me([yn()],Xl.prototype,"origin",void 0),me([yn()],Xl.prototype,"around",void 0),me([pn(!1)],Xl.prototype,"lazy",void 0),me([vn(1)],Xl.prototype,"pixelRatio",void 0),me([Cn(0)],Xl.prototype,"renderSpread",void 0),me([kn()],Xl.prototype,"path",void 0),me([Bn()],Xl.prototype,"windingRule",void 0),me([Bn(!0)],Xl.prototype,"closed",void 0),me([wn(0)],Xl.prototype,"padding",void 0),me([wn(!1)],Xl.prototype,"lockRatio",void 0),me([wn()],Xl.prototype,"widthRange",void 0),me([wn()],Xl.prototype,"heightRange",void 0),me([pn(!1)],Xl.prototype,"draggable",void 0),me([pn()],Xl.prototype,"dragBounds",void 0),me([pn("auto")],Xl.prototype,"dragBoundsType",void 0),me([pn(!1)],Xl.prototype,"editable",void 0),me([Fn(!0)],Xl.prototype,"hittable",void 0),me([Fn("path")],Xl.prototype,"hitFill",void 0),me([Rn("path")],Xl.prototype,"hitStroke",void 0),me([Fn(!1)],Xl.prototype,"hitBox",void 0),me([Fn(!0)],Xl.prototype,"hitChildren",void 0),me([Fn(!0)],Xl.prototype,"hitSelf",void 0),me([Fn()],Xl.prototype,"hitRadius",void 0),me([Nn("")],Xl.prototype,"cursor",void 0),me([En()],Xl.prototype,"fill",void 0),me([Rn(void 0,!0)],Xl.prototype,"stroke",void 0),me([Rn("inside")],Xl.prototype,"strokeAlign",void 0),me([Rn(1,!0)],Xl.prototype,"strokeWidth",void 0),me([Rn(!1)],Xl.prototype,"strokeWidthFixed",void 0),me([Rn("none")],Xl.prototype,"strokeCap",void 0),me([Rn("miter")],Xl.prototype,"strokeJoin",void 0),me([Rn()],Xl.prototype,"dashPattern",void 0),me([Rn(0)],Xl.prototype,"dashOffset",void 0),me([Rn(10)],Xl.prototype,"miterLimit",void 0),me([Bn(0)],Xl.prototype,"cornerRadius",void 0),me([Bn()],Xl.prototype,"cornerSmoothing",void 0),me([Kh()],Xl.prototype,"shadow",void 0),me([Kh()],Xl.prototype,"innerShadow",void 0),me([Kh()],Xl.prototype,"blur",void 0),me([Kh()],Xl.prototype,"backgroundBlur",void 0),me([Kh()],Xl.prototype,"grayscale",void 0),me([Kh()],Xl.prototype,"filter",void 0),me([En()],Xl.prototype,"placeholderColor",void 0),me([pn(100)],Xl.prototype,"placeholderDelay",void 0),me([pn({})],Xl.prototype,"data",void 0),me([jn(uh.prototype.reset)],Xl.prototype,"reset",null),Xl=Yl=me([Kn(Il),Kn(Fl),Gn()],Xl);let Hl=class extends Xl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ul;me([zn(xl)],Hl.prototype,"__",void 0),me([wn(0)],Hl.prototype,"width",void 0),me([wn(0)],Hl.prototype,"height",void 0),Hl=me([Kn(bh),Qn()],Hl);const Vl=ie.get("Leafer");let jl=Ul=class extends Hl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tn.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const r=this.canvas=de.canvas(s);this.__controllers.push(this.renderer=de.renderer(this,r,s),this.watcher=de.watcher(this,s),this.layouter=de.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=de.selector(this),this.interaction=de.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=de.hitCanvasManager()),this.canvasManager=new ye,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Ra.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(to.RESTART):this.emitLeafer(to.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(to.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Oe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new jt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=p.copyAttrs({},this.canvas,Oe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Qa(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Oe),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Oe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(to.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Oe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=p.copyAttrs({},s,Oe);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(to.BEFORE_READY),this.emitLeafer(to.READY),this.emitLeafer(to.AFTER_READY),Ra.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(to.VIEW_READY),Ra.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ra.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(to.VIEW_COMPLETED),Ra.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return le.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new to(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[to.START,()=>ae.end(t)],[Za.START,this.updateLazyBounds,this],[$a.START,this.__onCreated,this],[$a.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ja.DATA,this.__onWatchData,this],[Za.END,this.__onLayoutEnd,this],[$a.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(to.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sn.clearRecycled()},100)}catch(t){Vl.error(t)}}};t?e():setTimeout(e)}};jl.list=new kh,me([zn(vl)],jl.prototype,"__",void 0),me([wn()],jl.prototype,"pixelRatio",void 0),me([pn("normal")],jl.prototype,"mode",void 0),jl=Ul=me([Qn()],jl);let Gl=class extends Xl{get __tag(){return"Rect"}};me([zn(Bl)],Gl.prototype,"__",void 0),Gl=me([Kn(zl),Gn(),Qn()],Gl);const{add:ql,includes:Kl,scroll:Ql}=Xt,Jl=Gl.prototype,Zl=Hl.prototype;let $l=class extends Hl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(ql(o,n),Ql(o,i)),this.__updateRectRenderBounds(),t=!Kl(n,o),t&&"show"===a&&ql(r,o)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([zn(wl)],$l.prototype,"__",void 0),me([wn(100)],$l.prototype,"width",void 0),me([wn(100)],$l.prototype,"height",void 0),me([pn(!1)],$l.prototype,"resizeChildren",void 0),me([Cn("show")],$l.prototype,"overflow",void 0),me([jn(Jl.__updateStrokeSpread)],$l.prototype,"__updateStrokeSpread",null),me([jn(Jl.__updateRenderSpread)],$l.prototype,"__updateRectRenderSpread",null),me([jn(Jl.__updateBoxBounds)],$l.prototype,"__updateRectBoxBounds",null),me([jn(Jl.__updateStrokeBounds)],$l.prototype,"__updateStrokeBounds",null),me([jn(Jl.__updateRenderBounds)],$l.prototype,"__updateRectRenderBounds",null),me([jn(Jl.__updateChange)],$l.prototype,"__updateRectChange",null),me([jn(Jl.__render)],$l.prototype,"__renderRect",null),me([jn(Zl.__render)],$l.prototype,"__renderGroup",null),$l=me([Gn(),Qn()],$l);let td=class extends $l{get __tag(){return"Frame"}get isFrame(){return!0}};me([zn(bl)],td.prototype,"__",void 0),me([En("#FFFFFF")],td.prototype,"fill",void 0),me([Cn("hide")],td.prototype,"overflow",void 0),td=me([Qn()],td);const{moveTo:ed,closePath:id,ellipse:sd}=Ps;let rd=class extends Xl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];let h;i?s||r?(i<1?sd(o,n,a,n*i,a*i,0,s,r,!1):h=!0,sd(o,n,a,n,a,0,r,s,!0)):(i<1&&(sd(o,n,a,n*i,a*i),ed(o,t,a)),sd(o,n,a,n,a,0,360,0,!0)):s||r?(ed(o,n,a),sd(o,n,a,n,a,0,s,r,!1)):sd(o,n,a,n,a),h||id(o),$t.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([zn(Sl)],rd.prototype,"__",void 0),me([Bn(0)],rd.prototype,"innerRadius",void 0),me([Bn(0)],rd.prototype,"startAngle",void 0),me([Bn(0)],rd.prototype,"endAngle",void 0),rd=me([Qn()],rd);const{sin:nd,cos:ad,PI:od}=Math,{moveTo:hd,lineTo:ld,closePath:dd,drawPoints:cd}=Ps;let ud=class extends Xl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)cd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;hd(e,n,0);for(let t=1;t<r;t++)ld(e,n+n*nd(2*t*od/r),a-a*ad(2*t*od/r));dd(e)}}};me([zn(Pl)],ud.prototype,"__",void 0),me([Bn(3)],ud.prototype,"sides",void 0),me([Bn()],ud.prototype,"points",void 0),me([Bn(0)],ud.prototype,"curve",void 0),ud=me([Gn(),Qn()],ud);const{sin:_d,cos:pd,PI:gd}=Math,{moveTo:fd,lineTo:yd,closePath:md}=Ps;let xd=class extends Xl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];fd(a,r,0);for(let t=1;t<2*i;t++)yd(a,r+(t%2==0?r:r*s)*_d(t*gd/i),n-(t%2==0?n:n*s)*pd(t*gd/i));md(a)}};me([zn(Rl)],xd.prototype,"__",void 0),me([Bn(5)],xd.prototype,"corners",void 0),me([Bn(.382)],xd.prototype,"innerRadius",void 0),xd=me([Qn()],xd);const{moveTo:wd,lineTo:vd,drawPoints:bd}=Ps,{rotate:kd,getAngle:Bd,getDistance:Sd,defaultPoint:Pd}=ot;let Rd=class extends Xl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&kd(i,e),i}set toPoint(t){this.width=Sd(Pd,t),this.rotation=Bd(Pd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?bd(e,t.points,t.curve,t.closed):(wd(e,0,0),vd(e,this.width,0))}};me([zn(kl)],Rd.prototype,"__",void 0),me([Sn("center")],Rd.prototype,"strokeAlign",void 0),me([wn(0)],Rd.prototype,"height",void 0),me([Bn()],Rd.prototype,"points",void 0),me([Bn(0)],Rd.prototype,"curve",void 0),me([Bn(!1)],Rd.prototype,"closed",void 0),Rd=me([Qn()],Rd);let Cd=class extends Gl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([zn(Ol)],Cd.prototype,"__",void 0),me([wn("")],Cd.prototype,"url",void 0),Cd=me([Qn()],Cd);const Ed=Cd;let Td=class extends Gl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=de.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new on({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ha(Ha.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(o(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};me([zn(Al)],Td.prototype,"__",void 0),me([Qh(100)],Td.prototype,"width",void 0),me([Qh(100)],Td.prototype,"height",void 0),me([Qh(1)],Td.prototype,"pixelRatio",void 0),me([Qh(!0)],Td.prototype,"smooth",void 0),me([pn(!1)],Td.prototype,"safeResize",void 0),me([Qh()],Td.prototype,"contextSettings",void 0),Td=me([Qn()],Td);const{copyAndSpread:Ld,includes:Od,spread:Ad,setList:Dd}=Xt,{stintSet:Md}=p;let Id=class extends Xl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=el.number(e,r),t.__letterSpacing=el.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,Md(t,"__padding",l&&D.fourNumber(l)),Md(t,"__clipText","show"!==h&&!t.__autoSize),Md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=$h.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&Ad(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),p.stintSet(this,"isOverflow",!Od(h,o)),this.isOverflow?(Dd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ld(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([zn(Ll)],Id.prototype,"__",void 0),me([wn(0)],Id.prototype,"width",void 0),me([wn(0)],Id.prototype,"height",void 0),me([En()],Id.prototype,"boxStyle",void 0),me([pn(!1)],Id.prototype,"resizeFontSize",void 0),me([En("#000000")],Id.prototype,"fill",void 0),me([Sn("outside")],Id.prototype,"strokeAlign",void 0),me([Fn("all")],Id.prototype,"hitFill",void 0),me([wn("")],Id.prototype,"text",void 0),me([wn("")],Id.prototype,"placeholder",void 0),me([wn("caption")],Id.prototype,"fontFamily",void 0),me([wn(12)],Id.prototype,"fontSize",void 0),me([wn("normal")],Id.prototype,"fontWeight",void 0),me([wn(!1)],Id.prototype,"italic",void 0),me([wn("none")],Id.prototype,"textCase",void 0),me([wn("none")],Id.prototype,"textDecoration",void 0),me([wn(0)],Id.prototype,"letterSpacing",void 0),me([wn({type:"percent",value:1.5})],Id.prototype,"lineHeight",void 0),me([wn(0)],Id.prototype,"paraIndent",void 0),me([wn(0)],Id.prototype,"paraSpacing",void 0),me([wn("x")],Id.prototype,"writingMode",void 0),me([wn("left")],Id.prototype,"textAlign",void 0),me([wn("top")],Id.prototype,"verticalAlign",void 0),me([wn(!0)],Id.prototype,"autoSizeAlign",void 0),me([wn("normal")],Id.prototype,"textWrap",void 0),me([wn("show")],Id.prototype,"textOverflow",void 0),me([En(!1)],Id.prototype,"textEditing",void 0),Id=me([Qn()],Id);let Wd=class extends Xl{get __tag(){return"Path"}};me([zn(Cl)],Wd.prototype,"__",void 0),me([Sn("center")],Wd.prototype,"strokeAlign",void 0),Wd=me([Qn()],Wd);let Fd=class extends Hl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Wd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};me([zn(El)],Fd.prototype,"__",void 0),me([(t,e)=>{hn(t,e,{get(){return this.__path}})}],Fd.prototype,"path",void 0),Fd=me([Kn(Hs,["set","path","paint"]),Qn()],Fd);let Nd=class extends jl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&de.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new jl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Oe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Za.END,this.__onReady,this],[$a.START,this.__onCreated,this],[$a.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_($a.END,this.__onChildRenderEnd,this))}};Nd=me([Qn()],Nd);const zd={},Yd={isHoldSpaceKey:()=>Yd.isHold("Space"),isHold:t=>zd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){zd[t]||(zd[t]=!0)},setUpCode(t){zd[t]=!1}},Xd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Hd extends Fa{get spaceKey(){return Yd.isHoldSpaceKey()}get left(){return Xd.left(this)}get right(){return Xd.right(this)}get middle(){return Xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Yd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ge.changeName(t,e)}}const{min:Ud,max:Vd,abs:jd}=Math,{float:Gd,sign:qd}=D,{minX:Kd,maxX:Qd,minY:Jd,maxY:Zd}=Xt,$d=new jt,tc=new jt,ec={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ic.getValidMove(t.__localBoxBounds,ic.getDragBounds(t),s,e,!0),ic.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&ic.getValidScaleOf(t.__localBoxBounds,ic.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),ic.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),ic.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=Gd(s.x),s.y=Gd(s.y),s},getValidScaleOf(t,e,i,s,r,n,o){o||(r=Object.assign({},r)),tc.set(e),$d.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return ic.isInnerMode(t,e,i,"width")?(r.x<0&&$d.scaleOf(s,f=1/r.x,1),p=Gd($d.minX-tc.minX),g=Gd(tc.maxX-$d.maxX),u=h&&p>0?1+p/(h*$d.width):1,_=l&&g>0?1+g/(l*$d.width):1,f*=Vd(u,_)):(r.x<0&&((Gd(Kd(t)-Kd(e))<=0||Gd(Qd(e)-Qd(t))<=0)&&$d.scaleOf(s,f=1/r.x,1),$d.unsign()),p=Gd(tc.minX-$d.minX),g=Gd($d.maxX-tc.maxX),u=h&&p>0?1-p/(h*$d.width):1,_=l&&g>0?1-g/(l*$d.width):1,f*=Ud(u,_)),ic.isInnerMode(t,e,i,"height")?(r.y<0&&$d.scaleOf(s,1,y=1/r.y),p=Gd($d.minY-tc.minY),g=Gd(tc.maxY-$d.maxY),u=d&&p>0?1+p/(d*$d.height):1,_=c&&g>0?1+g/(c*$d.height):1,y*=Vd(u,_),n&&(u=Vd(jd(f),jd(y)),f=qd(f)*u,y=qd(y)*u)):(r.y<0&&((Gd(Jd(t)-Jd(e))<=0||Gd(Zd(e)-Zd(t))<=0)&&$d.scaleOf(s,1,y=1/r.y),$d.unsign()),p=Gd(tc.minY-$d.minY),g=Gd($d.maxY-tc.maxY),u=d&&p>0?1-p/(d*$d.height):1,_=c&&g>0?1-g/(c*$d.height):1,y*=Ud(u,_)),r.x*=a(f)?f:1,r.y*=a(y)?y:1,r}},ic=ec;let sc=class extends Hd{};sc.POINTER="pointer",sc.BEFORE_DOWN="pointer.before_down",sc.BEFORE_MOVE="pointer.before_move",sc.BEFORE_UP="pointer.before_up",sc.DOWN="pointer.down",sc.MOVE="pointer.move",sc.UP="pointer.up",sc.OVER="pointer.over",sc.OUT="pointer.out",sc.ENTER="pointer.enter",sc.LEAVE="pointer.leave",sc.TAP="tap",sc.DOUBLE_TAP="double_tap",sc.CLICK="click",sc.DOUBLE_CLICK="double_click",sc.LONG_PRESS="long_press",sc.LONG_TAP="long_tap",sc.MENU="pointer.menu",sc.MENU_TAP="pointer.menu_tap",sc=me([Jn()],sc);const rc=sc,nc={};let ac=class extends sc{static setList(t){this.list=t instanceof kh?t:new kh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ot.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),ec.axisMove(t,r),r}static limitMove(t,e){ec.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(nc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(nc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(nc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){nc.x=t?this.totalX:this.moveX,nc.y=t?this.totalY:this.moveY}};ac.BEFORE_DRAG="drag.before_drag",ac.START="drag.start",ac.DRAG="drag",ac.END="drag.end",ac.OVER="drag.over",ac.OUT="drag.out",ac.ENTER="drag.enter",ac.LEAVE="drag.leave",ac=me([Jn()],ac);const oc=ac;let hc=class extends sc{static setList(t){ac.setList(t)}static setData(t){ac.setData(t)}};hc.DROP="drop",hc=me([Jn()],hc);let lc=class extends ac{};lc.BEFORE_MOVE="move.before_move",lc.START="move.start",lc.MOVE="move",lc.DRAG_ANIMATE="move.drag_animate",lc.END="move.end",lc.PULL_DOWN="move.pull_down",lc.REACH_BOTTOM="move.reach_bottom",lc=me([Jn()],lc);let dc=class extends Hd{};dc=me([Jn()],dc);const cc=dc;let uc=class extends sc{};uc.BEFORE_ROTATE="rotate.before_rotate",uc.START="rotate.start",uc.ROTATE="rotate",uc.END="rotate.end",uc=me([Jn()],uc);let _c=class extends ac{};_c.SWIPE="swipe",_c.LEFT="swipe.left",_c.RIGHT="swipe.right",_c.UP="swipe.up",_c.DOWN="swipe.down",_c=me([Jn()],_c);let pc=class extends sc{};pc.BEFORE_ZOOM="zoom.before_zoom",pc.START="zoom.start",pc.ZOOM="zoom",pc.END="zoom.end",pc=me([Jn()],pc);let gc=class extends Hd{};gc.BEFORE_DOWN="key.before_down",gc.BEFORE_UP="key.before_up",gc.DOWN="key.down",gc.HOLD="key.hold",gc.UP="key.up",gc=me([Jn()],gc);const fc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?_c.UP:t>45&&t<135?_c.DOWN:t<=45&&t>=-45?_c.RIGHT:_c.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:yc.getSwipeDirection(ot.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new kh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>la.draggable(t)||!t.isLeafer&&t.hasEvent(ac.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},yc=fc,mc=new kh,{getDragEventData:xc,getDropEventData:wc,getSwipeEventData:vc}=fc;class bc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=xc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,r=ac.list||this.draggableList||mc;return this.dragging&&(s?t?mc:new kh(e?[...i.list,...i.dragHoverExclude]:i.list):r)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(lc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Xd.left(t),this.dragging&&(this.interaction.emit(ac.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],la.draggable(e)){this.draggableList=new kh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:n}=s;this.dragData=xc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(lc.BEFORE_MOVE,this.dragData),e.emit(lc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(ac.BEFORE_DRAG,this.dragData),e.emit(ac.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:r}=this.dragData,{dragLimitAnimate:a}=e.p,h=!a||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=ac.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:r},h||s);a&&!s&&t?la.animateMove(e,l,o(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(ac.OUT,t,i),e.emit(ac.OVER,t,s)):e.emit(ac.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(ac.LEAVE,t,i,s),e.emit(ac.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:n}=i,a=xc(i,t,t);if(n&&(a.throughPath=n),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",e.emit(lc.END,a)),this.dragging){const r=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(ac.END,a),this.swipe(t,i,s,a),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ot.getDistance(e,t)>r.config.pointer.swipeDistance){const t=vc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=wc(t,e,ac.data);s.path=i,this.interaction.emit(hc.DROP,s),this.interaction.emit(ac.LEAVE,t,i)}dragReset(){ac.list=ac.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const kc=ie.get("emit");const Bc=["move","zoom","rotate","key"];function Sc(t,e,i,s,r){if(Bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Rc(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Pc(n,e,i,s,r)}}function Pc(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Rc(t,r)&&(ll.updateEventStyle&&!s&&ll.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ge.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Rc(t,e){return e&&e.has(t)}const Cc={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:Ec,pathCanDrag:Tc,pathHasOutside:Lc}=fc;class Oc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Yd.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=p.clone(Cc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new kh(t),this.createTransformer(),this.dragger=new bc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Xd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(sc.BEFORE_DOWN,t),this.emit(sc.DOWN,t),Xd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Xd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(sc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ot.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(sc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Xd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(sc.BEFORE_UP,t),this.emit(sc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(sc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(sc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Yd.setDownCode(e),this.emit(gc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(gc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Yd.setUpCode(e),this.emit(gc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new kh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(sc.OUT,t,i),this.emit(sc.OVER,t,e)):this.emit(sc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(sc.LEAVE,t,i,e),this.emit(sc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(sc.LEAVE,t),this.dragger.dragging&&this.emit(hc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[sc.DOUBLE_TAP,sc.DOUBLE_CLICK].some(e=>Ec(t.path,e));s<e.tapTime+50&&r?(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:r,target:n}=this;$t.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Tc(t.path))&&!Lc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:sc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(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:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ot.round(s),s}emitTap(t){this.emit(sc.TAP,t),this.emit(sc.CLICK,t)}emitDoubleTap(t){this.emit(sc.DOUBLE_TAP,t),this.emit(sc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(sc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(sc.LONG_TAP,t),(Ec(t.path,sc.LONG_TAP)||Ec(t.path,sc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new jt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(o(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Qa.RESIZE,this.__onResize,this)],t.once(to.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 r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Pc(r,t,e,!0,s))return;r.isApp&&Sc(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Sc(r,t,e,!1,s),Pc(r,t,e,!1,s))return}catch(t){kc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Ac{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ac.custom={};class Dc extends ye{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new kh,this.pixelList=new kh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),de.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),de.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}$t.getSelector=function(t){return t.leafer?t.leafer.selector:$t.selector||($t.selector=de.selector())};const{toInnerRadiusPointOf:Mc,copyRadiusPoint:Ic}=ot,{hitRadiusPoint:Wc,hitPoint:Fc}=Xt,Nc={},zc={},Yc=uh.prototype;Yc.hit=function(t,e=0){this.updateLayout(),Ic(zc,t,e);const i=this.__world;return!!(e?Wc(i,zc):Fc(i,zc))&&(this.isBranch?$t.getSelector(this).hitPoint(Object.assign({},zc),e,{target:this}):this.__hitWorld(zc))},Yc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(Ic(Nc,t,i.hitRadius),t=Nc),Mc(t,s,Nc),i.hitBox||n){if(Xt.hitRadiusPoint(r.boxBounds,Nc))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(Nc,e)},Yc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Yc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Yc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Yc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Xc=new gt,Hc=Xl.prototype;Hc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=$t.image.hitCanvasSize,a=n.hitScale=Gt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Gt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),sn.patternLocked=!0,this.__renderShape(n,{matrix:Xc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Hc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:a}=i,o=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!o)return!1;const h=2*t.radiusX;let l=h;if(o)switch(i.strokeAlign){case"inside":if(l+=2*a,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=a;break;case"outside":if(l+=2*a,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Xl.prototype,Vc=Gl.prototype,jc=$l.prototype;Vc.__updateHitCanvas=jc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Vc.__hitFill=jc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},Id.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},Hl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),$t.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Gc=Ae.prototype;function qc(t,e,i){t.__.__font?sl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Kc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&sl.strokeArrow(t,i,s,r)}function Qc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),sl.drawTextStroke(i,s,r))}function Jc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Qc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",sl.fillText(i,n,r),n.blendMode="normal",la.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}Gc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Gc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Gc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Gt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:Zc,copyAndSpread:$c,toOuterOf:tu,getOuterOf:eu,getByMove:iu,move:su,getIntersectData:ru}=Xt,nu={};let au;const{stintSet:ou}=p,{hasTransparent:hu}=tl;function lu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:a}=i.__layout;switch(e.type){case"image":if(!e.url)return;r=rl.image(i,t,e,a,!au||!au[e.url]);break;case"linear":r=nl.linearGradient(e,a);break;case"radial":r=nl.radialGradient(e,a);break;case"angular":r=nl.conicGradient(e,a);break;case"solid":const{type:n,color:o,opacity:h}=e;r={type:n,style:tl.string(o,h)};break;default:s(e.r)||(r={type:"solid",style:tl.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&hu(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const du={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),au=rl.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=lu(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(ou(i,"__isAlphaPixelFill",r),ou(i,"__isTransparentFill",n)):(ou(i,"__isAlphaPixelStroke",r),ou(i,"__isTransparentStroke",n),ou(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,qc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,rl.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.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),qc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),qc(e,i,s),i.restoreBlendMode()):qc(e,i,s)}},fillPathOrText:qc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)sl.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Kc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)Kc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Kc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),la.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){sl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Qc(t,1,e,i,s);break;case"inside":Jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Qc(t,2,e,i,s):Jc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!rl.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?sl.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?sl.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;tu(a.strokeSpread?($c(nu,a.boxBounds,a.strokeSpread),nu):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if($t.fullImageShadow)s=o;else{const t=a.renderShapeSpread?Zc(r,B.swapAndScale(a.renderShapeSpread,p,g)):r;s=ru(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=eu(o,c),h=iu(u,-c.e,-c.f),l=eu(n,c),su(l,-c.e,-c.f);const m=i.matrix;m?(d=new gt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let cu,uu=new jt;const{isSame:_u}=Xt;function pu(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||rl.createData(r,s,i,n),!0}function gu(t,e){mu(t,Ha.LOAD,e)}function fu(t,e){mu(t,Ha.LOADED,e)}function yu(t,e,i){e.error=i,t.forceUpdate("surface"),mu(t,Ha.ERROR,e)}function mu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ha(e,i))}function xu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:vu}=K,bu=new jt,ku={},Bu={};function Su(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Pu={},Ru={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Cu,set:Eu,rotateOfOuter:Tu,translate:Lu,scaleOfOuter:Ou,multiplyParent:Au,scale:Du,rotate:Mu,skew:Iu}=K;function Wu(t,e,i,s,r,n,a,o){a&&Mu(t,a),o&&Iu(t,o.x,o.y),r&&Du(t,r,n),Lu(t,e.x+i,e.y+s)}const{get:Fu,scale:Nu,copy:zu}=K,{getFloorScale:Yu}=D,{abs:Xu}=Math;const Hu={image:function(t,e,i,s,r){let n,a;const o=sn.get(i);return cu&&i===cu.paint&&_u(s,cu.boxBounds)?n=cu.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),cu=o.use>1?{leafPaint:n,paint:i,boxBounds:uu.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(pu(t,e,i,o,n,s),r&&(gu(t,a),fu(t,a))):o.error?r&&yu(t,a,o.error):(r&&(xu(t,!0),gu(t,a)),n.loadId=o.load(()=>{xu(t,!1),t.destroyed||(pu(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),fu(t,a)),n.loadId=void 0},e=>{xu(t,!1),yu(t,a,e),n.loadId=void 0},i.lod&&o.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=rl.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d,snapshot:c}=r;return!(!h||t.patternId===n+"-"+a&&!d||c)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===$t.name&&Qa.isResizing(i)||d||(e=$t.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),rl.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?rl.createPattern(t,i,s,r):rl.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,sn.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=sn.patternTasker.add(()=>xe(this,void 0,void 0,function*(){rl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=rl.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!$t.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=rl.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/Xu(s.scaleX||1),u=h.y*n/Xu(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=Yu(_+(c||0)),n*=Yu(p+(u||0)),d=Fu(),o&&zu(d,o),Nu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth,s.interlace),f=i.getPattern(g,s.repeat||$t.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=$t.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=bu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:a,mode:h,align:l,offset:d,scale:u,size:_,rotation:p,skew:g,clipSize:f,repeat:y,gap:m,filters:x,interlace:w}=t,v=e.width===s&&e.height===r,b={mode:h},k="center"!==l&&(p||0)%180==90;let B,S;switch(Xt.set(Bu,0,0,k?r:s,k?s:r),h&&"cover"!==h&&"fit"!==h?((u||_)&&(D.getScaleData(u,_,i,ku),B=ku.scaleX,S=ku.scaleY),(l||m||y)&&(B&&Xt.scale(Bu,B,S,!0),l&&St.toPoint(l,Bu,e,Bu,!0,!0))):v&&!p||(B=S=Xt.getFitScale(e,Bu,"fit"!==h),Xt.put(e,i,l,B,!1,Bu),Xt.scale(Bu,B,S,!0)),d&&ot.move(Bu,d),h){case"stretch":v?B&&(B=S=void 0):(B=e.width/s,S=e.height/r,rl.stretchMode(b,e,B,S));break;case"normal":case"clip":if(Bu.x||Bu.y||B||f||p||g){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),rl.clipMode(b,e,Bu.x,Bu.y,B,S,p,g,t,i),t&&(B=B?B*t:t,S=S?S*i:i)}break;case"repeat":(!v||B||p||g)&&rl.repeatMode(b,e,s,r,Bu.x,Bu.y,B,S,p,g,l,t.freeTransform),y||(b.repeat="repeat");const i=c(y);(m||i)&&(b.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:Su(n,i,r.width,e&&e.x),y:Su(a,s,r.height,e&&e.y)}}(m,i&&y,Bu.width,Bu.height,e));break;default:B&&rl.fillOrFitMode(b,e,Bu.x,Bu.y,B,S,p)}return b.transform||(e.x||e.y)&&vu(b.transform=wu(),e.x,e.y),B&&(b.scaleX=B,b.scaleY=S),a&&a<1&&(b.opacity=a),x&&(b.filters=x),y&&(b.repeat=n(y)?"x"===y?"repeat-x":"repeat-y":"repeat"),w&&(b.interlace=o(w)||"percent"===w.type?{type:"x",offset:w}:w),b},stretchMode:function(t,e,i,s){const r=Cu(),{x:n,y:a}=e;n||a?Lu(r,n,a):r.onlyScale=!0,Du(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Cu();Lu(o,e.x+i,e.y+s),Du(o,r,n),a&&Tu(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Cu();Wu(d,e,i,s,r,n,a,o),h&&(a||o?(Eu(Ru),Ou(Ru,e,h,l),Au(d,Ru)):Ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Cu();if(c)Wu(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Tu(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Lu(u,s,0);break;case 180:Lu(u,i,s);break;case 270:Lu(u,0,i)}Pu.x=e.x+r,Pu.y=e.y+n,Lu(u,Pu.x,Pu.y),a&&Ou(u,Pu,a,o)}t.transform=u}},{toPoint:Uu}=bt,{hasTransparent:Vu}=tl,ju={},Gu={};function qu(t,e,i,s){if(i){let r,a,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(o=t/(l-1),a=tl.string(r,s)):(o=r.offset,a=tl.string(r.color,s)),e.addColorStop(o,a),!h&&Vu(a)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ku,getDistance:Qu}=ot,{get:Ju,rotateOfOuter:Zu,scaleOfOuter:$u}=K,{toPoint:t_}=bt,e_={},i_={};function s_(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=Ku(e,i);n=Ju(),r?($u(n,e,a/o*(s||1),1),Zu(n,e,t+90)):($u(n,e,1,a/o*(s||1)),Zu(n,e,t))}return n}const{getDistance:r_}=ot,{toPoint:n_}=bt,a_={},o_={};const h_={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;Uu(i||"top",e,ju),Uu(s||"bottom",e,Gu);const a=$t.canvas.createLinearGradient(ju.x,ju.y,Gu.x,Gu.y),o={type:r,style:a};return qu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;t_(i||"center",e,e_),t_(s||"bottom",e,i_);const o=$t.canvas.createRadialGradient(e_.x,e_.y,0,e_.x,e_.y,Qu(e_,i_)),h={type:r,style:o};qu(h,o,t.stops,n);const l=s_(e,e_,i_,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;n_(i||"center",e,a_),n_(s||"bottom",e,o_);const o=$t.conicGradientSupport?$t.canvas.createConicGradient(0,a_.x,a_.y):$t.canvas.createRadialGradient(a_.x,a_.y,0,a_.x,a_.y,r_(a_,o_)),h={type:r,style:o};qu(h,o,t.stops,n);const l=s_(e,a_,o_,a||1,$t.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:s_},{copy:l_,move:d_,toOffsetOutBounds:c_}=Xt,{max:u_,abs:__}=Math,p_={},g_=new gt,f_={};function y_(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=__(t.spread||0),a=u_(a,r+n-s),o=u_(o,r+n+i),h=u_(h,r+n+s),l=u_(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function m_(t,e,i){const{shapeBounds:s}=i;let r,n;$t.fullImageShadow?(l_(p_,t.bounds),d_(p_,e.x-s.x,e.y-s.y),r=t.bounds,n=p_):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:x_}=Xt,w_={};const v_=y_;const b_={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;c_(h,f_,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(f_.offsetX+(a.x||0)*c*f,f_.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,tl.string(a.color)),r=al.getShadowTransform(t,_,i,a,f_,f),r&&_.setTransform(r),m_(_,f_,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),la.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;x_(h,w_,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(w_.offsetX+(a.x||0)*c*f,w_.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=al.getShadowTransform(t,_,i,a,w_,f,!0),r&&_.setTransform(r),m_(_,w_,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,tl.string(a.color),"source-in"),la.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:y_,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return g_.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),g_}},isTransformShadow(t){},getInnerShadowSpread:v_},{excludeRenderBounds:k_}=ya;let B_;function S_(t,e,i,s,r,n,a,o){switch(e){case"grayscale":B_||(B_=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);R_(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":R_(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function P_(t){return t.getSameCanvas(!1,!0)}function R_(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}Hl.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(S_(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||k_(i,e)||i.__render(t,e),n=i.__.opacity,B_=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=P_(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=P_(t)),r||(r=P_(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&S_(this,a,t,r,s,n,void 0,!1),k_(i,e)||i.__render(r||t,e),d&&S_(this,a,t,r,s,n,d,!1)}S_(this,a,t,r,s,n,void 0,!0)};const C_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",E_=C_+"_#~&*+\\=|≮≯≈≠=…",T_=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function L_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const O_=L_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),A_=L_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),D_=L_(C_),M_=L_(E_),I_=L_("- —/~|┆·");var W_;!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"}(W_||(W_={}));const{Letter:F_,Single:N_,Before:z_,After:Y_,Symbol:X_,Break:H_}=W_;function U_(t){return O_[t]?F_:I_[t]?H_:A_[t]?z_:D_[t]?Y_:M_[t]?X_:T_.test(t)?N_:F_}const V_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function j_(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:G_}=V_,{Letter:q_,Single:K_,Before:Q_,After:J_,Symbol:Z_,Break:$_}=W_;let tp,ep,ip,sp,rp,np,ap,op,hp,lp,dp,cp,up,_p,pp,gp,fp,yp=[];function mp(t,e){hp&&!op&&(op=hp),tp.data.push({char:t,width:e}),ip+=e}function xp(){sp+=ip,tp.width=ip,ep.words.push(tp),tp={data:[]},ip=0}function wp(){_p&&(pp.paraNumber++,ep.paraStart=!0,_p=!1),hp&&(ep.startCharSize=op,ep.endCharSize=hp,op=0),ep.width=sp,gp.width?G_(ep):fp&&vp(),yp.push(ep),ep={words:[]},sp=0}function vp(){sp>(pp.maxWidth||0)&&(pp.maxWidth=sp)}const{top:bp,right:kp,bottom:Bp,left:Sp}=xt;function Pp(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const Rp={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[Sp],r-=o[kp]+o[Sp],!r&&(r=.01)):e.autoSizeAlign||(i=o[Sp]),a?(s=o[bp],a-=o[bp]+o[Bp],!a&&(a=.01)):e.autoSizeAlign||(s=o[bp]));const h={bounds:{x:i,y:s,width:r,height:a},rows:[],paraNumber:0,font:$t.canvas.font=e.__font};return function(t,e,i){pp=t,yp=t.rows,gp=t.bounds,fp=!gp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=$t,{width:o}=gp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;_p=!0,dp=null,op=ap=hp=ip=sp=0,tp={data:[]},ep={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)np=e[i],"\n"===np?(ip&&xp(),ep.paraEnd=!0,wp(),_p=!0):(lp=U_(np),lp===q_&&"none"!==n&&(np=j_(np,n,!ip)),ap=a.measureText(np).width,s&&(s<0&&(hp=ap),ap+=s),cp=lp===K_&&(dp===K_||dp===q_)||dp===K_&&lp!==J_,up=!(lp!==Q_&&lp!==K_||dp!==Z_&&dp!==J_),rp=_p&&r?o-r:o,t&&o&&sp+ip+ap>rp&&(h?(ip&&xp(),sp&&wp()):(up||(up=lp===q_&&dp==J_),cp||up||lp===$_||lp===Q_||lp===K_||ip+ap>rp?(ip&&xp(),sp&&wp()):sp&&wp()))," "===np&&!0!==_p&&sp+ip===0||(lp===$_?(" "===np&&ip&&xp(),mp(np,ap),xp()):cp||up?(ip&&xp(),mp(np,ap)):mp(np,ap)),dp=lp);ip&&xp(),sp&&wp(),yp.length>0&&(yp[yp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{pp.paraNumber++,sp=a.measureText(t).width,yp.push({x:r||0,text:t,width:sp,paraStart:!0}),fp&&vp()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Pp(e,"x",t[Sp]);break;case"right":Pp(e,"x",-t[kp])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Pp(e,"y",t[bp]);break;case"bottom":Pp(e,"y",-t[Bp])}}(o,h,e,r,a),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(x=i[a],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&a>0&&(m+=c),x.y=m,m+=n,t.overflow>a&&m>y&&(x.isOverflow=!0,t.overflow=a+1),w=x.x,v=x.width,o<0&&(x.width<0?(v=-x.width+e.fontSize+o,w-=v,v+=e.fontSize):v-=o),w<s.x&&(s.x=w),v>s.width&&(s.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,__letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(x=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(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===g?(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,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?$t.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<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:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=tl.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const Cp={string:function(t,e){if(!t)return"#000";const i=o(e)&&e<1;if(n(t)){if(!i||!tl.object)return t;t=tl.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const a=t.r+","+t.g+","+t.b;return 1===r?"rgb("+a+")":"rgba("+a+","+r+")"}};Object.assign($h,Rp),Object.assign(tl,Cp),Object.assign(sl,du),Object.assign(rl,Hu),Object.assign(nl,h_),Object.assign(al,b_),Object.assign(de,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new Ph(t,e),hitCanvasManager:()=>new Dc}),Ch();export{St as AlignHelper,e as Answer,Nd as App,bt as AroundHelper,qt as AutoBounds,li as BezierHelper,jt as Bounds,Ua as BoundsEvent,Xt as BoundsHelper,$l as Box,wl as BoxData,bh as Branch,va as BranchHelper,zo as BranchRender,Td as Canvas,Al as CanvasData,ye as CanvasManager,Na as ChildEvent,tl as ColorConvert,de as Creator,Ac as Cursor,p as DataHelper,ie as Debug,xt as Direction4,wt as Direction9,ec as DragBoundsHelper,ac as DragEvent,bc as Dragger,hc as DropEvent,al as Effect,rd as Ellipse,Sl as EllipseData,mi as EllipseHelper,Fa as Event,ge as EventCreator,oo as Eventer,hl as Export,qr as FileHelper,ol as Filter,B as FourNumberHelper,td as Frame,bl as FrameData,Hl as Group,xl as GroupData,Dc as HitCanvasManager,Cd as Image,Ol as ImageData,Ha as ImageEvent,sn as ImageManager,y as IncrementId,Oc as InteractionBase,fc as InteractionHelper,gc as KeyEvent,Yd as Keyboard,Za as LayoutEvent,Yh as Layouter,uh as Leaf,Io as LeafBounds,ya as LeafBoundsHelper,f as LeafData,vo as LeafDataProxy,xo as LeafEventer,la as LeafHelper,Wa as LeafLayout,Bh as LeafLevelList,kh as LeafList,Co as LeafMatrix,Wo as LeafRender,jl as Leafer,Ph as LeaferCanvas,Ae as LeaferCanvasBase,vl as LeaferData,to as LeaferEvent,on as LeaferImage,Rd as Line,kl as LineData,D as MathHelper,gt as Matrix,K as MatrixHelper,lc as MoveEvent,oc as MyDragEvent,Ed as MyImage,rc as MyPointerEvent,cc as MyTouchEvent,Fe as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,F as PI_2,sl as Paint,nl as PaintGradient,rl as PaintImage,Wd as Path,il as PathArrow,Ir as PathBounds,Ps as PathCommandDataHelper,Ie as PathCommandMap,xi as PathCommandNodeHelper,ss as PathConvert,Hr as PathCorner,Hs as PathCreator,Cl as PathData,rr as PathDrawer,De as PathHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Fd as Pen,El as PenData,Gh as Picker,$t as Platform,le as Plugin,_t as Point,ot as PointHelper,Xd as PointerButton,sc as PointerEvent,ud as Polygon,Pl as PolygonData,Ya as PropertyEvent,Gl as Rect,Bl as RectData,He as RectHelper,zl as RectRender,$a as RenderEvent,Hh as Renderer,Qa as ResizeEvent,tn as Resource,uc as RotateEvent,ae as Run,qh as Selector,xd as Star,Rl as StarData,ll as State,Qt as StringNumberMap,_c as SwipeEvent,Jr as TaskItem,Zr as TaskProcessor,Id as Text,$h as TextConvert,Ll as TextData,dc as TouchEvent,dl as Transition,yt as TwoPointBoundsHelper,Xl as UI,Il as UIBounds,ue as UICreator,yl as UIData,Hd as UIEvent,Fl as UIRender,el as UnitConvert,Kt as UnitConvertHelper,Ra as WaitHelper,Ja as WatchEvent,Th as Watcher,pc as ZoomEvent,Cn as affectRenderBoundsType,Sn as affectStrokeBoundsType,un as attr,yn as autoLayoutType,wn as boundsType,Gr as canvasPatch,Oe as canvasSizeAttrs,Zh as createAttr,dn as createDescriptor,Nn as cursorType,zn as dataProcessor,pn as dataType,cn as decorateLeafAttr,Xn as defineDataProcessor,hn as defineKey,_n as defineLeafAttr,Tn as dimType,bn as doBoundsType,Pn as doStrokeType,Kh as effectType,i as emptyData,Wn as eraserType,Xa as extraPropertyEventMap,z as getBoundsData,ln as getDescriptor,Y as getMatrixData,N as getPointData,Fn as hitType,d as isArray,u as isData,_ as isEmptyData,a as isFinite,r as isNull,o as isNumber,c as isObject,n as isString,s as isUndefined,Yn as layoutProcessor,no as leaferTransformAttrMap,In as maskType,vn as naturalBoundsType,Ln as opacityType,Ur as path,kn as pathInputType,Bn as pathType,Vr as pen,gn as positionType,Qn as registerUI,Jn as registerUIEvent,Qh as resizeType,jn as rewrite,Gn as rewriteAble,xn as rotationType,mn as scaleType,fn as scrollType,Mn as sortType,Rn as strokeType,En as surfaceType,Gt as tempBounds,ft as tempMatrix,pt as tempPoint,l as tryToNumber,Ch as useCanvas,Kn as useModule,Sh as version,On as visibleType,Jh as zoomLayerType};
|
|
1
|
+
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:a}=Number;function o(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return g(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&g(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const y={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=m;return e[t]?e[t]++:(e[t]=1,0)}},m=y;let x,w,v;const{max:b}=Math,k=[0,0,0,0],B={zero:[...k],tempFour:k,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>S(k,t,e,i,s),toTempAB(t,e,i){v=i?o(t)?e:t:[],o(t)?(x=R(t),w=e):o(e)?(x=t,w=R(e)):(x=t,w=e),4!==x.length&&(x=P(x)),4!==w.length&&(w=P(w))},get(t,e){let i;if(!o(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>o(t)&&o(e)?b(t,e):(C(t,e,i),S(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,i)=>o(t)&&o(e)?t+e:(C(t,e,i),S(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,i,s){if(o(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,h,l]=4===t.length?t:P(t);return S(r,h*i,l*e,n*i,a*e)}},{set:S,get:P,setTemp:R,toTempAB:C}=B,{round:E,pow:T,max:L,floor:O,PI:A}=Math,D={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:B.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),D.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:T(10,e);return-0===(t=E(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(o(e)?e:e.width||0)/i.width,r=(o(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&D.assignScale(s,t);return s},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>L(O(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const I=A/180,W=2*A,F=A/2;function N(){return{x:0,y:0}}function z(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:H,acos:U,sqrt:V}=Math,{float:j}=D,G={};function q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const K={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:Y,getWorld:q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,G),Q.scaleOfInner(t,G,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=H(e*=I),o=X(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,G),Q.rotateOfInner(t,G,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=I,t.a=s+n*i,t.b=r+a*i),e&&(e*=I,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,G),Q.skewOfInner(t,G,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,r,n){const{e:a,f:o}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*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:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*I,a=H(n),o=X(n);if(s||r){const e=s*I,i=r*I;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||r)&&Q.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?U(e):-U(e)}else{c=V(a*a+o*o),d=t/c;const e=a/c;u=F-(o>0?U(-e):-U(e))}const e=j(H(u)),i=X(u);d=j(d),c=j(c),_=e?j((a/c+i)/e/I,9):0,p=e?j((n/d-i)/e/I,9):0,u=j(u/I)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=V(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=K,{float:J}=D,{toInnerPoint:Z,toOuterPoint:$}=K,{sin:tt,cos:et,abs:it,sqrt:st,atan2:rt,min:nt,round:at}=Math,ot={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ht.defaultPoint);const s=et(e*=I),r=tt(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=ht;return dt(i,t),Z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ht;return dt(i,t),$(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ht;return dt(i,t),ht.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(dt(t,e),ct(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),Z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){Z(e,t,i)},toOuterOf(t,e,i){$(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>lt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=it(i-t),n=it(s-e);return st(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>nt(lt(t,e,i,s),lt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/I,getRotation:(t,e,i,s)=>(s||(s=e),ht.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,r,n,a,o,h){s(o)&&(o=i,h=r);const l=t-i,d=e-r,c=n-o,u=a-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,r){const n=ut(t,e);return r&&(t=e),s||(e={}),e.x=t.x+et(n)*i,e.y=t.y+tt(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){ht.reset(t)}},ht=ot,{getDistanceFrom:lt,copy:dt,setRadius:ct,getAtan2:ut}=ht;class _t{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(t){return new _t(ot.getCenter(this,t))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(ot.getDistancePoint(this,t,e,i,s))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}isSame(t){return ot.isSame(this,t)}reset(){return ot.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?K.copy(this,t):K.set(this,t,e,i,s,r,n),this}setWith(t){return K.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return K.translate(this,t,e),this}translateInner(t,e){return K.translateInner(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleWith(t,e){return K.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return K.pixelScale(this,t),this}scaleOfOuter(t,e,i){return K.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return K.scaleOfInner(this,t,e,i),this}rotate(t){return K.rotate(this,t),this}rotateOfOuter(t,e){return K.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return K.rotateOfInner(this,t,e),this}skew(t,e){return K.skew(this,t,e),this}skewOfOuter(t,e,i){return K.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return K.skewOfInner(this,t,e,i),this}multiply(t){return K.multiply(this,t),this}multiplyParent(t){return K.multiplyParent(this,t),this}divide(t){return K.divide(this,t),this}divideParent(t){return K.divideParent(this,t),this}invert(){return K.invert(this),this}invertWith(){return K.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){K.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){K.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return K.setLayout(this,t,e,i),this}getLayout(t,e,i){return K.getLayout(this,t,e,i)}withScale(t,e){return K.withScale(this,t,e)}reset(){K.reset(this)}}const ft=new gt,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,r){mt(t,e,i),mt(t,e+s,i+r)},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:mt}=yt;var xt,wt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(wt||(wt={}));const vt=[{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}];vt.forEach(t=>t.type="percent");const bt={directionData:vt,tempPoint:{},get:kt,toPoint(t,e,i,s,r,n){const a=kt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function kt(t){return n(t)?vt[wt[t]]:t}const{toPoint:Bt}=bt,St={toPoint(t,e,i,s,r,n){Bt(t,i,s,r,e,n)}},{tempPointBounds:Pt,setPoint:Rt,addPoint:Ct,toBounds:Et}=yt,{toOuterPoint:Tt}=K,{float:Lt,fourNumber:Ot}=D,{floor:At,ceil:Dt}=Math;let Mt,It,Wt,Ft;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=Ot(i);s?Ht.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Nt.x=t.x,Nt.y=t.y,Tt(e,Nt,zt),Rt(Pt,zt.x,zt.y),Nt.x=t.x+t.width,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Nt.y=t.y+t.height,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Nt.x=t.x,Tt(e,Nt,zt),Ct(Pt,zt.x,zt.y),Et(Pt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,a){a||(a=e),n(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=r?e.width*=s:e.width*s,Yt.height=r?e.height*=s:e.height*s,St.toPoint(i,Yt,t,a,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=At(t.x),t.y=At(t.y),t.width=e>t.x?Dt(t.width+e-t.x):Dt(t.width),t.height=i>t.y?Dt(t.height+i-t.y):Dt(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){Mt=t.x+t.width,It=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),Mt=Mt>Wt?Mt:Wt,It=It>Ft?It:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=It-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Vt(t,r)):Ut(t,r));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Pt,t.x,t.y):Ct(Pt,t.x,t.y)),Et(Pt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){Ut(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ot.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=ot.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Mt=s+n,It=r+a,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Mt=Mt<Wt?Mt:Wt,It=It<Ft?It:Ft,n=Mt-s,a=It-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:Ut,copy:Vt}=Ht;class jt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new jt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new jt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Gt=new jt;class qt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new jt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Kt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:Jt,max:Zt}=Math,$t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||te.maxCacheSize),isSuperLarge:(t,e,i)=>te.isLarge(t,e,i,te.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=te;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h,l){const d=Zt(Jt(e+(s||0)),1),c=Zt(Jt(i+(r||0)),1);let u,_,p;l&&(p=Kt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=$t.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(o&&(f.globalAlpha=o),f.imageSmoothingEnabled=!1!==a,te.canUse(t)){if(n){const s=e/n.width,r=i/n.height;f.setTransform(s,0,0,r,-n.x*s,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:te}=$t,{randColor:ee}=D;class ie{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ie(t)}static set filter(t){this.filterList=se(t)}static set exclude(t){this.excludeList=se(t)}static drawRepaint(t,e){const i=ee();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ie.showBounds,r=t.__nowWorld,n=ee();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(re.enable){if(re.filterList.length&&re.filterList.every(t=>t!==this.name))return;if(re.excludeList.length&&re.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){re.enable&&this.warn(...t)}warn(...t){re.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function se(t){return t?n(t)&&(t=[t]):t=[],t}ie.filterList=[],ie.excludeList=[],ie.showWarn=!0;const re=ie,ne=ie.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=y.create(y.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ne.log(s,r,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=ae,he=[],le={list:{},add(t,...e){this.list[t]=!0,he.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>he.forEach(t=>le.has(t,!0)));const de={editor:t=>le.need("editor")},ce=ie.get("UICreator"),ue={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&ce.repeat(e),_e[e]=t},get(t,e,i,r,n,a){_e[t]||ce.error("not register "+t);const o=new _e[t](e);return s(i)||(o.x=i,r&&(o.y=r),n&&(o.width=n),a&&(o.height=a)),o}},{list:_e}=ue,pe=ie.get("EventCreator"),ge={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(fe[e]&&pe.repeat(e),fe[e]=t)})},changeName(t,e){const i=fe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,fe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new fe[t](...e)},{nameList:fe}=ge;class ye{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=de.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function me(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function xe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function we(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 ve=[];function be(){return(t,e)=>{ve.push(e)}}const ke=[];let Be=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ke)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ve.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};me([we("imageSmoothingEnabled")],Be.prototype,"smooth",void 0),me([we("imageSmoothingQuality")],Be.prototype,"smoothLevel",void 0),me([we("globalAlpha")],Be.prototype,"opacity",void 0),me([we()],Be.prototype,"fillStyle",void 0),me([we()],Be.prototype,"strokeStyle",void 0),me([we("lineWidth")],Be.prototype,"strokeWidth",void 0),me([we("lineCap")],Be.prototype,"strokeCap",void 0),me([we("lineJoin")],Be.prototype,"strokeJoin",void 0),me([we("lineDashOffset")],Be.prototype,"dashOffset",void 0),me([we()],Be.prototype,"miterLimit",void 0),me([we()],Be.prototype,"shadowBlur",void 0),me([we()],Be.prototype,"shadowColor",void 0),me([we()],Be.prototype,"shadowOffsetX",void 0),me([we()],Be.prototype,"shadowOffsetY",void 0),me([we()],Be.prototype,"filter",void 0),me([we()],Be.prototype,"font",void 0),me([we()],Be.prototype,"fontKerning",void 0),me([we()],Be.prototype,"fontStretch",void 0),me([we()],Be.prototype,"fontVariantCaps",void 0),me([we()],Be.prototype,"textAlign",void 0),me([we()],Be.prototype,"textBaseline",void 0),me([we()],Be.prototype,"textRendering",void 0),me([we()],Be.prototype,"wordSpacing",void 0),me([we()],Be.prototype,"letterSpacing",void 0),me([we()],Be.prototype,"direction",void 0),me([be()],Be.prototype,"setTransform",null),me([be()],Be.prototype,"resetTransform",null),me([be()],Be.prototype,"getTransform",null),me([be()],Be.prototype,"save",null),me([be()],Be.prototype,"restore",null),me([be()],Be.prototype,"translate",null),me([be()],Be.prototype,"scale",null),me([be()],Be.prototype,"rotate",null),me([be()],Be.prototype,"fill",null),me([be()],Be.prototype,"stroke",null),me([be()],Be.prototype,"clip",null),me([be()],Be.prototype,"fillRect",null),me([be()],Be.prototype,"strokeRect",null),me([be()],Be.prototype,"clearRect",null),me([be()],Be.prototype,"beginPath",null),me([be()],Be.prototype,"moveTo",null),me([be()],Be.prototype,"lineTo",null),me([be()],Be.prototype,"bezierCurveTo",null),me([be()],Be.prototype,"quadraticCurveTo",null),me([be()],Be.prototype,"closePath",null),me([be()],Be.prototype,"arc",null),me([be()],Be.prototype,"arcTo",null),me([be()],Be.prototype,"ellipse",null),me([be()],Be.prototype,"rect",null),me([be()],Be.prototype,"roundRect",null),me([be()],Be.prototype,"createConicGradient",null),me([be()],Be.prototype,"createLinearGradient",null),me([be()],Be.prototype,"createPattern",null),me([be()],Be.prototype,"createRadialGradient",null),me([be()],Be.prototype,"fillText",null),me([be()],Be.prototype,"measureText",null),me([be()],Be.prototype,"strokeText",null);const{copy:Se,multiplyParent:Pe,pixelScale:Re}=K,{round:Ce}=Math,Ee=new jt,Te=new jt,Le={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class Ae extends Be{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=Le),this.manager=e,this.innerId=y.create(y.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||$t.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;p.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new jt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&Pe(t,e,r),Re(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ce(r.e-.5)+.5,r.f=Ce(r.f-.5)+.5):(r.e=Ce(r.e),r.f=Ce(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Te):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,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),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,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Ee.x,Ee.y,Ee.width,Ee.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,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(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):de.canvas(Object.assign({},i));return r.save(),t&&(Se(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}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 De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Me),We={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ne=Object.assign(Object.assign({},Fe),Me),ze=Ie,Ye={};for(let t in ze)Ye[ze[t]]=t;const Xe={};for(let t in ze)Xe[ze[t]]=We[t];const He={drawRoundRect(t,e,i,s,r,n){const a=D.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ue,cos:Ve,hypot:je,atan2:Ge,ceil:qe,abs:Ke,PI:Qe,sqrt:Je,pow:Ze}=Math,{setPoint:$e,addPoint:ti}=yt,{set:ei,toNumberPoints:ii}=ot,{M:si,L:ri,C:ni,Q:ai,Z:oi}=Ie,hi={},li={points(t,e,i,s){let r=ii(e);if(t.push(si,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y,m,x=r.length;const w=!0===i?.5:i;s&&(r=[r[x-2],r[x-1],...r,r[0],r[1],r[2],r[3]],x=r.length);for(let i=2;i<x-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=a-e,g=o-n,f=Je(Ze(p,2)+Ze(g,2)),y=Je(Ze(h-a,2)+Ze(l-o,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=n,d=a-f*h,c=o-f*l,2===i?s||t.push(ai,d,c,a,o):(p||g)&&t.push(ni,u,_,d,c,a,o),u=a+y*h,_=o+y*l);s||t.push(ai,u,_,r[x-2],r[x-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ri,r[e],r[e+1]);s&&t.push(oi)},rect(t,e,i,s,r){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){De.creator.path=[],He.drawRoundRect(De.creator,e,i,s,r,n),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Ge(u,c),f=Ge(p,_);const y=je(c,u),m=je(_,p);let x=f-g;if(x<0&&(x+=W),y<1e-12||m<1e-12||x<1e-12||Ke(x-Qe)<1e-12)return t&&t.push(ri,s,r),h&&($e(h,e,i),ti(h,s,r)),d&&ei(d,e,i),void(l&&ei(l,s,r));const w=c*p-_*u<0,v=w?-1:1,b=o/Ve(x/2),k=s+b*Ve(g+x/2+F*v),B=r+b*Ue(g+x/2+F*v);return g-=F*v,f-=F*v,ui(t,k,B,o,o,0,g/I,f/I,w,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>ui(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*I,_=Ue(u),p=Ve(u);let g=a*I,f=o*I;g>Qe&&(g-=W),f<0&&(f+=W);let y=f-g;y<0?y+=W:y>W&&(y-=W),h&&(y-=W);const m=qe(Ke(y/F)),x=y/m,w=Ue(x/4),v=8/3*w*w/Ue(x/2);f=g+x;let b,k,B,S,P,R,C,E,T=Ve(g),L=Ue(g),O=B=p*s*T-_*r*L,A=S=_*s*T+p*r*L,D=e+B,M=i+S;t&&t.push(t.length?ri:si,D,M),l&&$e(l,D,M),c&&ei(c,D,M);for(let n=0;n<m;n++)b=Ve(f),k=Ue(f),B=p*s*b-_*r*k,S=_*s*b+p*r*k,P=e+O-v*(p*s*L+_*r*T),R=i+A-v*(_*s*L-p*r*T),C=e+B+v*(p*s*k+_*r*b),E=i+S+v*(_*s*k-p*r*b),t&&t.push(ni,P,R,C,E,e+B,i+S),l&&ci(e+O,i+A,P,R,C,E,e+B,i+S,l,!0),O=B,A=S,T=b,L=k,g=f,f+=x;d&&ei(d,e+B,i+S)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ni,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){ci(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=i,v=r,b=a;for(let t=0;t<2;++t)if(1==t&&(x=e,w=s,v=n,b=o),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ti(h,t,e):$e(h,t,e),ti(h,a,o);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,r,n,a,o,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return di(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:_i,cos:pi,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*I,p=_i(_),g=pi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,x=r*r,w=y*y,v=f*f,b=m*x-m*w-x*v;let k=0;if(b<0){const t=gi(1-b/(m*x));s*=t,r*=t}else k=(a===o?-1:1)*gi(b/(m*w+x*v));const B=k*s*y/r,S=-k*r*f/s,P=fi((y-S)/r,(f-B)/s),R=fi((-y-S)/r,(-f-B)/s);let C=R-P;0===o&&C>0?C-=W:1===o&&C<0&&(C+=W);const E=e+c+g*B-p*S,T=i+u+p*B+g*S,L=C<0?1:0;d||$t.ellipseToCurve?yi(t,E,T,s,r,n,P/I,R/I,L):s!==r||n?t.push(Ie.G,E,T,s,r,n,P/I,R/I,L):t.push(Ie.O,E,T,s,P/I,R/I,L)}},xi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:vi,L:bi,l:ki,H:Bi,h:Si,V:Pi,v:Ri,C:Ci,c:Ei,S:Ti,s:Li,Q:Oi,q:Ai,T:Di,t:Mi,A:Ii,a:Wi,Z:Fi,z:Ni,N:zi,D:Yi,X:Xi,G:Hi,F:Ui,O:Vi,P:ji,U:Gi}=Ie,{rect:qi,roundRect:Ki,arcTo:Qi,arc:Ji,ellipse:Zi,quadraticCurveTo:$i}=li,{ellipticalArc:ts}=mi,es=ie.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Xe[s],o+=s===r?" ":Ye[s];for(let s=1;s<i;s++)o+=D.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Ne:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(rs.dot&&(ns(a,n),n=""),rs.dot++),"0"===n&&"."!==s&&(ns(a,n),n=""),n+=s):Ie[s]?(n&&(ns(a,n),n=""),rs.name=Ie[s],rs.length=We[s],rs.index=0,ns(a,rs.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ns(a,n),n=s):n&&(ns(a,n),n=""),r=s;return n&&ns(a,n),i?ss.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case vi:t[c+1]+=o,t[c+2]+=h;case wi:o=t[c+1],h=t[c+2],_.push(wi,o,h),c+=3;break;case Si:t[c+1]+=o;case Bi:o=t[c+1],_.push(bi,o,h),c+=2;break;case Ri:t[c+1]+=h;case Pi:h=t[c+1],_.push(bi,o,h),c+=2;break;case ki:t[c+1]+=o,t[c+2]+=h;case bi:o=t[c+1],h=t[c+2],_.push(bi,o,h),c+=3;break;case Li:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ti;case Ti:a=n===Ci||n===Ti,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Ci,l,d,i,s,o,h),c+=5;break;case Ei:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Ci;case Ci:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Ci,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Mi:t[c+1]+=o,t[c+2]+=h,r=Di;case Di:a=n===Oi||n===Di,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?$i(_,o,h,i,s,t[c+1],t[c+2]):_.push(Oi,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Ai:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Oi;case Oi:i=t[c+1],s=t[c+2],e?$i(_,o,h,i,s,t[c+3],t[c+4]):_.push(Oi,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Wi:t[c+6]+=o,t[c+7]+=h;case Ii:ts(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Ni:case Fi:_.push(Fi),c++;break;case zi:o=t[c+1],h=t[c+2],e?qi(_,o,h,t[c+3],t[c+4]):as(_,t,c,5),c+=5;break;case Yi:o=t[c+1],h=t[c+2],e?Ki(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):as(_,t,c,9),c+=9;break;case Xi:o=t[c+1],h=t[c+2],e?Ki(_,o,h,t[c+3],t[c+4],t[c+5]):as(_,t,c,6),c+=6;break;case Hi:Zi(e?_:as(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,is),o=is.x,h=is.y,c+=9;break;case Ui:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):as(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:Ji(e?_:as(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),o=is.x,h=is.y,c+=7;break;case ji:e?Ji(_,t[c+1],t[c+2],t[c+3],0,360,!1):as(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Gi:Qi(e?_:as(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),o=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return xi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ci,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:ns,copyData:as}=ss,{M:os,L:hs,C:ls,Q:ds,Z:cs,N:us,D:_s,X:ps,G:gs,F:fs,O:ys,P:ms,U:xs}=Ie,{getMinDistanceFrom:ws,getRadianFrom:vs}=ot,{tan:bs,min:ks,abs:Bs}=Math,Ss={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ls,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(ds,e,i,s,r)},closePath(t){t.push(cs)},rect(t,e,i,s,r){t.push(us,e,i,s,r)},roundRect(t,e,i,s,r,n){if(o(n))t.push(ps,e,i,s,r,n);else{const a=D.fourNumber(n);a?t.push(_s,e,i,s,r,...a):t.push(us,e,i,s,r)}},ellipse(t,e,i,s,n,a,o,h,l){if(s===n)return Cs(t,e,i,s,o,h,l);r(a)?t.push(fs,e,i,s,n):(r(o)&&(o=0),r(h)&&(h=360),t.push(gs,e,i,s,n,a,o,h,l?1:0))},arc(t,e,i,s,n,a,o){r(n)?t.push(ms,e,i,s):(r(n)&&(n=0),r(a)&&(a=360),t.push(ys,e,i,s,n,a,o?1:0))},arcTo(t,e,i,r,n,a,o,h,l){if(!s(o)){const t=ws(o,h,e,i,r,n)/(l?1:2);a=ks(a,ks(t,t*Bs(bs(vs(o,h,e,i,r,n)/2))))}t.push(xs,e,i,r,n,a)},drawEllipse(t,e,i,s,n,a,o,h,l){li.ellipse(null,e,i,s,n,r(a)?0:a,r(o)?0:o,r(h)?360:h,l,null,null,Ss),t.push(os,Ss.x,Ss.y),Rs(t,e,i,s,n,a,o,h,l)},drawArc(t,e,i,s,n,a,o){li.arc(null,e,i,s,r(n)?0:n,r(a)?360:a,o,null,null,Ss),t.push(os,Ss.x,Ss.y),Cs(t,e,i,s,n,a,o)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Rs,arc:Cs}=Ps,{moveTo:Es,lineTo:Ts,quadraticCurveTo:Ls,bezierCurveTo:Os,closePath:As,beginPath:Ds,rect:Ms,roundRect:Is,ellipse:Ws,arc:Fs,arcTo:Ns,drawEllipse:zs,drawArc:Ys,drawPoints:Xs}=Ps;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Es(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Os(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return As(this.__path),this.paint(),this}rect(t,e,i,s){return Ms(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Ws(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Fs(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ns(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return zs(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Ys(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Vs,C:js,Q:Gs,Z:qs,N:Ks,D:Qs,X:Js,G:Zs,F:$s,O:tr,P:er,U:ir}=Ie,sr=ie.get("PathDrawer"),rr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case tr:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case er:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case ir:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sr.error(`command: ${i} [index:${s}]`,e)}}},{M:nr,L:ar,C:or,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:gr,P:fr,U:yr}=Ie,{toTwoPointBounds:mr,toTwoPointBoundsByQuadraticCurve:xr,arcTo:wr,arc:vr,ellipse:br}=li,{addPointBounds:kr,copy:Br,addPoint:Sr,setPoint:Pr,addBounds:Rr,toBounds:Cr}=yt,Er=ie.get("PathBounds");let Tr,Lr,Or;const Ar={},Dr={},Mr={},Ir={toBounds(t,e){Ir.toTwoPointBounds(t,Dr),Cr(Dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Pr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===lr||a===or||a===hr?Pr(e,h,l):Pr(e,t[o+1],t[o+2])),a){case nr:case ar:h=t[o+1],l=t[o+2],Sr(e,h,l),o+=3;break;case or:r=t[o+5],n=t[o+6],mr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Ar),kr(e,Ar),h=r,l=n,o+=7;break;case hr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],xr(h,l,i,s,r,n,Ar),kr(e,Ar),h=r,l=n,o+=5;break;case lr:o+=1;break;case dr:h=t[o+1],l=t[o+2],Rr(e,h,l,t[o+3],t[o+4]),o+=5;break;case cr:case ur:h=t[o+1],l=t[o+2],Rr(e,h,l,t[o+3],t[o+4]),o+=a===cr?9:6;break;case _r:br(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=9;break;case pr:h=t[o+1],l=t[o+2],Lr=t[o+3],Or=t[o+4],Rr(e,h-Lr,l-Or,2*Lr,2*Or),h+=Lr,o+=5;break;case gr:vr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=7;break;case fr:h=t[o+1],l=t[o+2],Tr=t[o+3],Rr(e,h-Tr,l-Tr,2*Tr,2*Tr),h+=Tr,o+=4;break;case yr:wr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Ar,Mr),0===o?Br(e,Ar):kr(e,Ar),h=Mr.x,l=Mr.y,o+=6;break;default:return void Er.error(`command: ${a} [index:${o}]`,t)}}},{M:Wr,L:Fr,Z:Nr}=Ie,{getCenterX:zr,getCenterY:Yr}=ot,{arcTo:Xr}=Ps,Hr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;a<f;){switch(s=t[a],s){case Wr:l=p=t[a+1],c=g=t[a+2],a+=3,t[a]===Fr?(u=t[a+1],_=t[a+2],y?m.push(Wr,l,c):m.push(Wr,zr(l,u),Yr(c,_))):m.push(Wr,l,c);break;case Fr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Fr:Xr(m,o,h,t[a+1],t[a+2],e,p,g,y);break;case Nr:Xr(m,o,h,l,c,e,p,g,y);break;default:m.push(Fr,o,h)}p=o,g=h;break;case Nr:r!==Nr&&(Xr(m,l,c,u,_,e,p,g,y),m.push(Nr)),a+=1;break;default:n=Xe[s];for(let e=0;e<n;e++)m.push(t[a+e]);a+=n}r=s}return s!==Nr&&(m[1]=l,m[2]=c),m}};function Ur(t){return new Hs(t)}const Vr=Ur();De.creator=Ur(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:jr}=He;function Gr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){jr(this,t,e,i,s,r)})}(t)}const qr={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=Kr.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{}}}},Kr=qr;Kr.alphaPixelTypes.forEach(t=>Kr.upperCaseTypeMap[t]=t.toUpperCase());const Qr=ie.get("TaskProcessor");class Jr{constructor(t){this.parallel=!0,this.time=1,this.id=y.create(y.TASK),this.task=t}run(){return xe(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){Qr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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&&p.assign(this.config,t),this.empty()}add(t,e,i){let r,n,a,h;const l=new Jr(t);return l.parent=this,o(e)?h=e:e&&(n=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.run()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(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 $r=ie.get("Resource"),tn={tasker:new Zr,map:{},get isComplete(){return en.tasker.isComplete},set(t,e){en.map[t]&&$r.repeat(t),en.map[t]=e},get:t=>en.map[t],remove(t){const e=en.map[t];e&&(e.destroy&&e.destroy(),delete en.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),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=de.image(s)),en.set(t,e),e},destroy(){en.map={}}},en=tn,sn={maxRecycled:10,recycledList:[],patternTasker:new Zr({parallel:1}),get(t){let e=tn.get(t.url);return e||tn.set(t.url,e=de.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||($t.image.isLarge(t)?t.url&&tn.remove(t.url):(t.clearLevels(),rn.recycledList.push(t)))})},recyclePaint(t){rn.recycle(t.image)},clearRecycled(t){const e=rn.recycledList;(e.length>rn.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&tn.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qr.alphaPixelTypes.some(e=>rn.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:"+qr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},rn=sn,{IMAGE:nn,create:an}=y;class on{get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return s(t)?$t.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=an(nn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}sn.isFormat("svg",t)&&(this.isSVG=!0),sn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,tn.tasker.add(()=>xe(this,void 0,void 0,function*(){return yield $t.origin.loadImage(this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width||(this.width=t.width,this.height=t.height,this.view=t),this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a,o){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=$t.image.resize(this.view,t,e,r,n,void 0,a,i,s,o);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const r=$t.canvas.createPattern(t,e);return $t.image.setPatternTransform(r,i,s),r}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function hn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ln(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function cn(t,e){return(i,s)=>_n(i,s,t,e&&e(s))}function un(t){return t}function _n(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};hn(t,e,Object.assign(r,s||{})),Xn(t,e,i)}function pn(t){return cn(t)}function gn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function fn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function yn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),bn(this))}}))}function mn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function xn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function wn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i,e)&&bn(this)}}))}function vn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(bn(this),this.__.__removeNaturalSize())}}))}function bn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function kn(t){return cn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),bn(this)}}))}const Bn=wn;function Sn(t,e){return cn(t,t=>({set(i){this.__setAttr(t,i)&&(Pn(this),e&&(this.__.__useStroke=!0))}}))}function Pn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&bn(t)}const Rn=Sn;function Cn(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function En(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tn(t){return cn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Ln(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&An(this)}}))}function On(t){return cn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Dn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Dn(this,t,e,i),this.mask&&An(this)}}))}function An(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Dn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||bn(t))}function Mn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function In(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Wn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fn(t){return cn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===ie.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Nn(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function zn(t){return(e,i)=>{hn(e,"__DataProcessor",{get:()=>t})}}function Yn(t){return(e,i)=>{hn(e,"__LayoutProcessor",{get:()=>t})}}function Xn(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=dn(e,i);if(s(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=_(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=r;for(;!l&&d;)l=ln(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),r[a]&&(o.set=r[a],delete r[a]),hn(r,e,o)}const Hn=new ie("rewrite"),Un=[],Vn=["destroy","constructor"];function jn(t){return(e,i)=>{Un.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Gn(){return t=>{qn()}}function qn(t){Un.length&&(Un.forEach(e=>{t&&Hn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Un.length=0)}function Kn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Vn.includes(s)||e&&e.includes(s)))if(t.prototype){ln(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Qn(){return t=>{ue.register(t)}}function Jn(){return t=>{ge.register(t)}}setTimeout(()=>qn(!0));const{copy:Zn,toInnerPoint:$n,toOuterPoint:ta,scaleOfOuter:ea,rotateOfOuter:ia,skewOfOuter:sa,multiplyParent:ra,divideParent:na,getLayout:aa}=K,oa={},{round:ha}=Math,la={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),ua(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ca(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++)_a(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&_a(t),t.__updateChange()},updateAllChange(t){if(ga(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)pa(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,r,n){s||(s=t.__nowWorld),t.__worldFlipped||$t.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?ta(t.localTransform,n,n,!0):t.parent&&$n(t.parent.scrollWorldTransform,n,n,!0),da.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ha(e),i=ha(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){da.zoomOfLocal(t,fa(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(o(s)||(s&&(n=s),s=i),Zn(oa,a),ea(oa,e,i,s),da.hasHighPosition(t))da.setTransform(t,oa,r,n);else{const e=t.x+oa.e-a.e,o=t.y+oa.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){da.rotateOfLocal(t,fa(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Zn(oa,r),ia(oa,e,i),da.hasHighPosition(t)?da.setTransform(t,oa,!1,s):t.set({x:t.x+oa.e-r.e,y:t.y+oa.f-r.f,rotation:D.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){da.skewOfLocal(t,fa(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Zn(oa,t.__localMatrix),sa(oa,e,i,s),da.setTransform(t,oa,r,n)},transformWorld(t,e,i,s){Zn(oa,t.worldTransform),ra(oa,e),t.parent&&na(oa,t.parent.scrollWorldTransform),da.setTransform(t,oa,i,s)},transform(t,e,i,s){Zn(oa,t.localTransform),ra(oa,e),da.setTransform(t,oa,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&da.getInnerOrigin(t,r.origin),a=aa(e,n,r.around&&da.getInnerOrigin(t,r.around));if(da.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=da.getInnerOrigin(t,r.origin);ot.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return ea(i,da.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(da.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zn(oa,t.worldTransform),na(oa,e.scrollWorldTransform),i?oa:Object.assign({},oa)),drop(t,e,i,s){t.setTransform(da.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||da.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,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),$t.requestRender(()=>da.animateMove(t,e,i))}}},da=la,{updateAllMatrix:ca,updateMatrix:ua,updateAllWorldOpacity:_a,updateAllChange:pa,updateChange:ga}=da;function fa(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ya={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)=>xa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>xa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>xa(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 ma;function xa(t,e){return e||(ma=0),t.__.mask&&(ma=1),ma<0?null:(ma&&(ma=-1),!0)}const{updateBounds:wa}=la,va={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,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ba(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ka(e[t],e)},updateBounds(t,e){const i=[t];ka(t,i),Ba(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)wa(s[t]);e&&e===i||wa(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,a=r.length;n<a;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Sa(t,e,i)},scale(t,e,i,s,r,n,a){let o;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)o=(t=h[c]).__world,o.a*=s,o.d*=r,(o.b||o.c)&&(o.b*=s,o.c*=r),o.e===o.x&&o.f===o.y?(o.x=o.e+=(o.e-n)*l+e,o.y=o.f+=(o.f-a)*d+i):(o.e+=(o.e-n)*l+e,o.f+=(o.f-a)*d+i,o.x+=(o.x-n)*l+e,o.y+=(o.y-a)*d+i),o.width*=s,o.height*=r,o.scaleX*=s,o.scaleY*=r,t.isBranch&&Pa(t,e,i,s,r,n,a)}},{pushAllChildBranch:ba,pushAllBranchStack:ka,updateBoundsByBranchStack:Ba,move:Sa,scale:Pa}=va,Ra={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:Ca,updateBounds:Ea}=la,{toOuterOf:Ta,getPoints:La,copy:Oa}=Xt,Aa="_localContentBounds",Da="_worldContentBounds",Ma="_worldBoxBounds",Ia="_worldStrokeBounds";class Wa{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 Ta(this.contentBounds,this.leaf.__localMatrix,this[Aa]||(this[Aa]={})),this[Aa]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ta(this.contentBounds,this.leaf.__world,this[Da]||(this[Da]={})),this[Da]}get worldBoxBounds(){return Ta(this.boxBounds,this.leaf.__world,this[Ma]||(this[Ma]={})),this[Ma]}get worldStrokeBounds(){return Ta(this.strokeBounds,this.leaf.__world,this[Ia]||(this[Ia]={})),this[Ia]}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 Ea(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,$t.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 K.defaultMatrix;case"page":t=e.zoomLayer;default:return Ca(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new jt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=K.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=Ca(s,e,!0)}if(a||(a=K.getLayout(n)),Oa(a,o),ot.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=La(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}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 Fa{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&$t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&$t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&$t.event.stop(this.origin)}}class Na extends Fa{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Na.ADD="child.add",Na.REMOVE="child.remove",Na.CREATED="created",Na.MOUNTED="mounted",Na.UNMOUNTED="unmounted",Na.DESTROY="destroy";const za="property.scroll";class Ya extends Fa{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Ya.CHANGE="property.change",Ya.LEAFER_CHANGE="property.leafer_change",Ya.SCROLL=za;const Xa={scrollX:za,scrollY:za};class Ha extends Fa{constructor(t,e){super(t),Object.assign(this,e)}}Ha.LOAD="image.load",Ha.LOADED="image.loaded",Ha.ERROR="image.error";class Ua extends Fa{static checkHas(t,e,i){"on"===i?e===qa?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Va)||t.hasEvent(ja)||t.hasEvent(Ga),t.__hasWorldEvent=t.hasEvent(qa))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Va,t),"inner"===e&&t.emit(ja,t)),t.emit(Ga,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(qa,this)}}Ua.RESIZE="bounds.resize",Ua.INNER="bounds.inner",Ua.LOCAL="bounds.local",Ua.WORLD="bounds.world";const{RESIZE:Va,INNER:ja,LOCAL:Ga,WORLD:qa}=Ua,Ka={};[Va,ja,Ga,qa].forEach(t=>Ka[t]=1);class Qa extends Fa{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Qa.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Qa.RESIZE="resize";class Ja extends Fa{constructor(t,e){super(t),this.data=e}}Ja.REQUEST="watch.request",Ja.DATA="watch.data";class Za extends Fa{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Za.REQUEST="layout.request",Za.START="layout.start",Za.BEFORE="layout.before",Za.LAYOUT="layout",Za.AFTER="layout.after",Za.AGAIN="layout.again",Za.END="layout.end";class $a extends Fa{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}$a.REQUEST="render.request",$a.CHILD_START="render.child_start",$a.CHILD_END="render.child_end",$a.START="render.start",$a.BEFORE="render.before",$a.RENDER="render",$a.AFTER="render.after",$a.AGAIN="render.again",$a.END="render.end",$a.NEXT="render.next";class to extends Fa{}to.START="leafer.start",to.BEFORE_READY="leafer.before_ready",to.READY="leafer.ready",to.AFTER_READY="leafer.after_ready",to.VIEW_READY="leafer.view_ready",to.VIEW_COMPLETED="leafer.view_completed",to.STOP="leafer.stop",to.RESTART="leafer.restart",to.END="leafer.end",to.UPDATE_MODE="leafer.update_mode",to.TRANSFORM="leafer.transform",to.MOVE="leafer.move",to.SCALE="leafer.scale",to.ROTATE="leafer.rotate",to.SKEW="leafer.skew";const{MOVE:eo,SCALE:io,ROTATE:so,SKEW:ro}=to,no={x:eo,y:eo,scaleX:io,scaleY:io,rotation:so,skewX:ro,skewY:ro},ao={};class oo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,a;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=ho(this,s,!0),h=n(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(a=o[t],a?-1===a.findIndex(t=>t.listener===e)&&a.push(l):o[t]=[l],Ka[t]&&Ua.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=ho(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Ka[t]&&Ua.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ge.has(t)&&(e=ge.get(t,{type:t,target:this,current:this}));const s=ho(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:r}=this,n=i&&i[t],a=r&&r[t];return!!(s(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ho(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ao)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ao)}}const{on:lo,on_:co,off:uo,off_:_o,once:po,emit:go,emitEvent:fo,hasEvent:yo,destroy:mo}=oo.prototype,xo={on:lo,on_:co,off:uo,off_:_o,once:po,emit:go,emitEvent:fo,hasEvent:yo,destroyEventer:mo},wo=ie.get("setAttr"),vo={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||a(e)||s(e)||(wo.warn(this.innerName,t,e),e=void 0),c(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ya(Ya.LEAFER_CHANGE,this,t,r,e));const i=no[t];i&&(this.emitEvent(new to(i,this)),this.emitEvent(new to(to.TRANSFORM,this)))}this.emitPropertyEvent(Ya.CHANGE,t,r,e);const i=Xa[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Ya(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:bo,multiplyParent:ko,translateInner:Bo,defaultWorld:So}=K,{toPoint:Po,tempPoint:Ro}=bt,Co={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;ko(this.__local||e,t?t.__scrollWorld||t.__world:So,i,!!e.affectScaleOrRotation,r),s&&Bo(Object.assign(s,i),r.scrollX,r.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)&&(bo(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)&&(Po(i.around||i.origin,t.boxBounds,Ro),Bo(e,-Ro.x,-Ro.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Eo,updateAllMatrix:To}=la,{updateBounds:Lo}=va,{toOuterOf:Oo,copyAndSpread:Ao,copy:Do}=Xt,{toBounds:Mo}=Ir,Io={__updateWorldBounds(){const{__layout:t,__world:e}=this;Oo(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ua.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ua.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(),Oo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Oo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Oo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Mo(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(),To(this),Lo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(To(this),Lo(this,this))):Eo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ao(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;o(i)&&i<=0?Do(e.renderBounds,e.strokeBounds):Ao(e.renderBounds,e.boxBounds,i)}},Wo={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),la.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ie.showBounds&&ie.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Fo}=ya,{hasSize:No}=Xt,zo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&No(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Fo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Fo(i[s],e)||i[s].__clip(t,e)}}},Yo={},{LEAF:Xo,create:Ho}=y,{stintSet:Uo}=p,{toInnerPoint:Vo,toOuterPoint:jo,multiplyParent:Go}=K,{toOuterOf:qo}=Xt,{copy:Ko,move:Qo}=ot,{moveLocal:Jo,zoomOfLocal:Zo,rotateOfLocal:$o,skewOfLocal:th,moveWorld:eh,zoomOfWorld:ih,rotateOfWorld:sh,skewOfWorld:rh,transform:nh,transformWorld:ah,setTransform:oh,getFlipTransform:hh,getLocalOrigin:lh,getRelativeWorld:dh,drop:ch}=la;let uh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Wa}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=Ho(Xo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Na.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(Na.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Na.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(Na.MOUNTED)):this.__emitLifeEvent(Na.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Go(i,t.matrix,e,void 0,i),qo(this.__layout.renderBounds,e,e),Uo(e,"half",i.half),Uo(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}=sn.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),Yo.scaleX=i,Yo.scaleY=s,Yo}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?dh(this,e):this.worldTransform,r=i?t:{};return qo(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ko(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ko(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Vo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){jo(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 r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Qo(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Qo(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}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 r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){oh(this,t,e,i)}transform(t,e,i){nh(this,t,e,i)}move(t,e,i){Jo(this,t,e,i)}moveInner(t,e,i){eh(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Zo(this,lh(this,t),e,i,s,r)}rotateOf(t,e,i){$o(this,lh(this,t),e,i)}skewOf(t,e,i,s,r){th(this,lh(this,t),e,i,s,r)}transformWorld(t,e,i){ah(this,t,e,i)}moveWorld(t,e,i){eh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){ih(this,t,e,i,s,r)}rotateOfWorld(t,e){sh(this,t,e)}skewOfWorld(t,e,i,s,r){rh(this,t,e,i,s,r)}flip(t,e){nh(this,hh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return le.need("path")}getMotionPoint(t){return le.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){ch(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Xn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=wn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Na(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Na.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};uh=me([Kn(vo),Kn(Co),Kn(Io),Kn(xo),Kn(Wo)],uh);const{setListWithFn:_h}=Xt,{sort:ph}=va,{localBoxBounds:gh,localStrokeBounds:fh,localRenderBounds:yh,maskLocalBoxBounds:mh,maskLocalStrokeBounds:xh,maskLocalRenderBounds:wh}=ya,vh=new ie("Branch");let bh=class extends uh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){_h(e||this.__layout.boxBounds,this.children,this.__hasMask?mh:gh)}__updateStrokeBounds(t){_h(t||this.__layout.strokeBounds,this.children,this.__hasMask?xh:fh)}__updateRenderBounds(t){_h(t||this.__layout.renderBounds,this.children,this.__hasMask?wh:yh)}__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(ph),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return vh.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=ue.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Na.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Na.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Na.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Na.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Na(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};bh=me([Kn(zo)],bh);class kh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new kh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Bh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Sh="2.0.1";class Ph extends Ae{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=$t.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}}Gr(OffscreenCanvasRenderingContext2D.prototype),Gr(Path2D.prototype);const{mineType:Rh}=qr;function Ch(t,e){$t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:Rh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Rh(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",$t.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()})},$t.canvas=de.canvas(),$t.conicGradientSupport=!!$t.canvas.context.createConicGradient}Object.assign(de,{canvas:(t,e)=>new Ph(t,e),image:t=>new on(t)}),$t.name="web",$t.isWorker=!0,$t.backgrounder=!0,$t.requestRender=function(t){requestAnimationFrame(t)},hn($t,"devicePixelRatio",{get:()=>1});const{userAgent:Eh}=navigator;Eh.indexOf("Firefox")>-1?($t.conicGradientRotate90=!0,$t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&($t.fullImageShadow=!0),Eh.indexOf("Windows")>-1?($t.os="Windows",$t.intWheelDeltaY=!0):Eh.indexOf("Mac")>-1?$t.os="Mac":Eh.indexOf("Linux")>-1&&($t.os="Linux");class Th{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new kh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new kh,this.target=t,e&&(this.config=p.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($a.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Na.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 Ja(Ja.DATA,{updatedList:this.updatedList})),this.__updatedList=new kh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ya.CHANGE,this.__onAttrChange,this],[[Na.ADD,Na.REMOVE],this.__onChildEvent,this],[Ja.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Oh,updateChange:Ah}=la,{pushAllChildBranch:Dh,pushAllParent:Mh}=va;const{worldBounds:Ih}=ya;class Wh{constructor(t){this.updatedBounds=new jt,this.beforeBounds=new jt,this.afterBounds=new jt,d(t)&&(t=new kh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ih),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Fh,updateAllChange:Nh}=la,zh=ie.get("Layouter");class Yh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Bh,this.target=t,e&&(this.config=p.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(Za.START),this.layoutOnce(),t.emitEvent(new Za(Za.END,this.layoutedBlocks,this.times))}catch(t){zh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?zh.warn("layouting"):this.times>3?zh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ja.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ae.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Za,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Za(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Lh(t,!0),e.add(t),t.isBranch&&Dh(t,e),Mh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Mh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Oh(s[t])}Oh(i)}})}(this.__levelList),function(t){t.list.forEach(Ah)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Za(n,o,this.times)),i.emitEvent(new Za(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ae.end(e)}fullLayout(){const t=ae.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Za,n=this.getBlocks(new kh(e));e.emitEvent(new Za(i,n,this.times)),Yh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Za(s,n,this.times)),e.emitEvent(new Za(r,n,this.times)),this.addBlocks(n),ae.end(t)}static fullLayout(t){Fh(t,!0),t.isBranch?va.updateBounds(t):la.updateBounds(t),Nh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Wh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Wh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Za.REQUEST,this.layout,this],[Za.AGAIN,this.layoutAgain,this],[Ja.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Xh=ie.get("Renderer");class Hh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Za.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit($a.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit($a.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit($a.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new jt,Xh.log(e.innerName,"---\x3e");try{this.emitRender($a.START),this.renderOnce(t),this.emitRender($a.END,this.totalBounds),sn.clearRecycled()}catch(t){this.rendering=!1,Xh.error(t)}Xh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Xh.warn("rendering");if(this.times>3)return Xh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new jt,this.renderOptions={},t)this.emitRender($a.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender($a.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender($a.RENDER,this.renderBounds,this.renderOptions),this.emitRender($a.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=ae.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new jt(s);i.save(),s.spread(Hh.clipSpread).ceil();const{ceilPartPixel:n}=this.config;i.clipWorld(s,n),i.clearWorld(s,n),this.__render(s,r),i.restore(),ae.end(e)}fullRender(){const t=ae.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ae.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),ie.showRepaint&&ie.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),$t.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new jt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return $t.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()};$t.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new jt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new jt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Xh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new $a(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[$a.REQUEST,this.update,this],[Za.END,this.__onLayoutEnd,this],[$a.AGAIN,this.renderAgain,this],[Qa.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Hh.clipSpread=10;const Uh={},{copyRadiusPoint:Vh}=ot,{hitRadiusPoint:jh}=Xt;class Gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new kh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new kh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||la.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&la.hasParent(t,e))){r.reset();break}return r.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),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>la.worldHittable(t))}getPath(t){const e=new kh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new kh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new kh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],r=i.__,r.visible&&(!e||r.mask))if(s=jh(i.__world,r.hitRadius?Vh(Uh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))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,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.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 qh{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new Gh(this.target=t,this),this.finder=de.finder&&de.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return $t.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):le.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Kh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Qh(t){return cn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Jh(){return(t,e)=>{const i="_"+e;hn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Zh(t){return(e,i)=>{hn(e,i,dn(i,t))}}Object.assign(de,{watcher:(t,e)=>new Th(t,e),layouter:(t,e)=>new Yh(t,e),renderer:(t,e,i)=>new Hh(t,e,i),selector:(t,e)=>new qh(t,e)}),$t.layout=Yh.fullLayout,$t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new kh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const $h={},tl={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},el=Kt,il={},sl={},rl={},nl={},al={},ol={apply(){le.need("filter")}},hl={},ll={setStyleName:()=>le.need("state"),set:()=>le.need("state")},dl={list:{},register(t,e){dl.list[t]=e},get:t=>dl.list[t]},{parse:cl,objectToCanvasData:ul}=ss,{stintSet:_l}=p,{hasTransparent:pl}=tl,gl={originPaint:{}},fl=ie.get("UIData");class yl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,fl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,fl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(_l(this,"__isTransparentFill",pl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(_l(this,"__isTransparentStroke",pl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?cl(t):ul(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ml(this,"shadow",t)}setInnerShadow(t){ml(this,"innerShadow",t)}setFilter(t){ml(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&sl.compute("fill",this.__leaf),e&&sl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gl)):(this.__isStrokes=!0,this._stroke||(this._stroke=gl))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ml(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class xl extends yl{}class wl extends xl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class vl extends xl{__getInputData(t,e){const i=super.__getInputData(t,e);return Oe.forEach(t=>delete i[t]),i}}class bl extends wl{}class kl extends yl{get __usePathBox(){return this.points||this.__pathInputed}}class Bl extends yl{get __boxStroke(){return!this.__pathInputed}}class Sl extends yl{get __boxStroke(){return!this.__pathInputed}}class Pl extends kl{}class Rl extends yl{}class Cl extends yl{get __pathInputed(){return 2}}class El extends xl{}const Tl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ll extends yl{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=Tl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=ue.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ol extends Bl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Al extends Bl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Dl,add:Ml}=B,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Dl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Dl(t,s)),n&&(t=Ml(t,ol.getSpread(n))),a&&(t=Ml(t,a)),o&&(t=Ml(t,o));let l=t;return i&&(l=Dl(l,al.getInnerShadowSpread(this,i))),r&&(l=Dl(l,r)),this.__layout.renderShapeSpread=l,h?Dl(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=p,Fl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=sl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),c&&ol.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,tl.string(e.color))}r&&(s.__isFills?sl.fills(r,this,t,e):sl.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?sl.strokes(n,this,t,e):sl.stroke(n,this,t,e))}}else s.__pathForRender?Nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?sl.fills(s,this,t,e):sl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?sl.strokes(r,this,t,e):sl.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Nl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&sl.stroke(r,t,e,i),s&&sl.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&sl.stroke(r,t,e,i)}const zl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Yl;let Xl=Yl=class extends uh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){D.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 Vr.set(this.path=t||[]),t||this.__drawPathByBox(Vr),Vr}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 le.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return le.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Vr.set(i=[]),this.__drawPathByBox(Vr,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||hl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Hr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&il.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?rr.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,o(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){sl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),le.need("animate")}killAnimate(t,e){}export(t,e){return le.need("export")}syncExport(t,e){return le.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Yl.one(e)}static one(t,e,i,s,r){return ue.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Qn()(this)}static registerData(t){zn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};me([zn(yl)],Xl.prototype,"__",void 0),me([Jh()],Xl.prototype,"zoomLayer",void 0),me([pn("")],Xl.prototype,"id",void 0),me([pn("")],Xl.prototype,"name",void 0),me([pn("")],Xl.prototype,"className",void 0),me([En("pass-through")],Xl.prototype,"blendMode",void 0),me([Ln(1)],Xl.prototype,"opacity",void 0),me([On(!0)],Xl.prototype,"visible",void 0),me([En(!1)],Xl.prototype,"locked",void 0),me([Tn(!1)],Xl.prototype,"dim",void 0),me([Tn(!1)],Xl.prototype,"dimskip",void 0),me([Mn(0)],Xl.prototype,"zIndex",void 0),me([In(!1)],Xl.prototype,"mask",void 0),me([Wn(!1)],Xl.prototype,"eraser",void 0),me([gn(0,!0)],Xl.prototype,"x",void 0),me([gn(0,!0)],Xl.prototype,"y",void 0),me([wn(100,!0)],Xl.prototype,"width",void 0),me([wn(100,!0)],Xl.prototype,"height",void 0),me([mn(1,!0)],Xl.prototype,"scaleX",void 0),me([mn(1,!0)],Xl.prototype,"scaleY",void 0),me([xn(0,!0)],Xl.prototype,"rotation",void 0),me([xn(0,!0)],Xl.prototype,"skewX",void 0),me([xn(0,!0)],Xl.prototype,"skewY",void 0),me([gn(0,!0)],Xl.prototype,"offsetX",void 0),me([gn(0,!0)],Xl.prototype,"offsetY",void 0),me([fn(0,!0)],Xl.prototype,"scrollX",void 0),me([fn(0,!0)],Xl.prototype,"scrollY",void 0),me([yn()],Xl.prototype,"origin",void 0),me([yn()],Xl.prototype,"around",void 0),me([pn(!1)],Xl.prototype,"lazy",void 0),me([vn(1)],Xl.prototype,"pixelRatio",void 0),me([Cn(0)],Xl.prototype,"renderSpread",void 0),me([kn()],Xl.prototype,"path",void 0),me([Bn()],Xl.prototype,"windingRule",void 0),me([Bn(!0)],Xl.prototype,"closed",void 0),me([wn(0)],Xl.prototype,"padding",void 0),me([wn(!1)],Xl.prototype,"lockRatio",void 0),me([wn()],Xl.prototype,"widthRange",void 0),me([wn()],Xl.prototype,"heightRange",void 0),me([pn(!1)],Xl.prototype,"draggable",void 0),me([pn()],Xl.prototype,"dragBounds",void 0),me([pn("auto")],Xl.prototype,"dragBoundsType",void 0),me([pn(!1)],Xl.prototype,"editable",void 0),me([Fn(!0)],Xl.prototype,"hittable",void 0),me([Fn("path")],Xl.prototype,"hitFill",void 0),me([Rn("path")],Xl.prototype,"hitStroke",void 0),me([Fn(!1)],Xl.prototype,"hitBox",void 0),me([Fn(!0)],Xl.prototype,"hitChildren",void 0),me([Fn(!0)],Xl.prototype,"hitSelf",void 0),me([Fn()],Xl.prototype,"hitRadius",void 0),me([Nn("")],Xl.prototype,"cursor",void 0),me([En()],Xl.prototype,"fill",void 0),me([Rn(void 0,!0)],Xl.prototype,"stroke",void 0),me([Rn("inside")],Xl.prototype,"strokeAlign",void 0),me([Rn(1,!0)],Xl.prototype,"strokeWidth",void 0),me([Rn(!1)],Xl.prototype,"strokeWidthFixed",void 0),me([Rn("none")],Xl.prototype,"strokeCap",void 0),me([Rn("miter")],Xl.prototype,"strokeJoin",void 0),me([Rn()],Xl.prototype,"dashPattern",void 0),me([Rn(0)],Xl.prototype,"dashOffset",void 0),me([Rn(10)],Xl.prototype,"miterLimit",void 0),me([Bn(0)],Xl.prototype,"cornerRadius",void 0),me([Bn()],Xl.prototype,"cornerSmoothing",void 0),me([Kh()],Xl.prototype,"shadow",void 0),me([Kh()],Xl.prototype,"innerShadow",void 0),me([Kh()],Xl.prototype,"blur",void 0),me([Kh()],Xl.prototype,"backgroundBlur",void 0),me([Kh()],Xl.prototype,"grayscale",void 0),me([Kh()],Xl.prototype,"filter",void 0),me([En()],Xl.prototype,"placeholderColor",void 0),me([pn(100)],Xl.prototype,"placeholderDelay",void 0),me([pn({})],Xl.prototype,"data",void 0),me([jn(uh.prototype.reset)],Xl.prototype,"reset",null),Xl=Yl=me([Kn(Il),Kn(Fl),Gn()],Xl);let Hl=class extends Xl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ul;me([zn(xl)],Hl.prototype,"__",void 0),me([wn(0)],Hl.prototype,"width",void 0),me([wn(0)],Hl.prototype,"height",void 0),Hl=me([Kn(bh),Qn()],Hl);const Vl=ie.get("Leafer");let jl=Ul=class extends Hl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&tn.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ul.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(s,t));const r=this.canvas=de.canvas(s);this.__controllers.push(this.renderer=de.renderer(this,r,s),this.watcher=de.watcher(this,s),this.layouter=de.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=de.selector(this),this.interaction=de.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=de.hitCanvasManager()),this.canvasManager=new ye,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Ra.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(to.RESTART):this.emitLeafer(to.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(to.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Oe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new jt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=p.copyAttrs({},this.canvas,Oe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Qa(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Oe),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Oe.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(to.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Oe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=p.copyAttrs({},s,Oe);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(to.BEFORE_READY),this.emitLeafer(to.READY),this.emitLeafer(to.AFTER_READY),Ra.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(to.VIEW_READY),Ra.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ra.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(to.VIEW_COMPLETED),Ra.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return le.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new to(t,this))}__listenEvents(){const t=ae.start("FirstCreate "+this.innerName);this.once([[to.START,()=>ae.end(t)],[Za.START,this.updateLazyBounds,this],[$a.START,this.__onCreated,this],[$a.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ja.DATA,this.__onWatchData,this],[Za.END,this.__onLayoutEnd,this],[$a.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ul.list.remove(this);try{this.stop(),this.emitLeafer(to.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{sn.clearRecycled()},100)}catch(t){Vl.error(t)}}};t?e():setTimeout(e)}};jl.list=new kh,me([zn(vl)],jl.prototype,"__",void 0),me([wn()],jl.prototype,"pixelRatio",void 0),me([pn("normal")],jl.prototype,"mode",void 0),jl=Ul=me([Qn()],jl);let Gl=class extends Xl{get __tag(){return"Rect"}};me([zn(Bl)],Gl.prototype,"__",void 0),Gl=me([Kn(zl),Gn(),Qn()],Gl);const{add:ql,includes:Kl,scroll:Ql}=Xt,Jl=Gl.prototype,Zl=Hl.prototype;let $l=class extends Hl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(ql(o,n),Ql(o,i)),this.__updateRectRenderBounds(),t=!Kl(n,o),t&&"show"===a&&ql(r,o)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};me([zn(wl)],$l.prototype,"__",void 0),me([wn(100)],$l.prototype,"width",void 0),me([wn(100)],$l.prototype,"height",void 0),me([pn(!1)],$l.prototype,"resizeChildren",void 0),me([Cn("show")],$l.prototype,"overflow",void 0),me([jn(Jl.__updateStrokeSpread)],$l.prototype,"__updateStrokeSpread",null),me([jn(Jl.__updateRenderSpread)],$l.prototype,"__updateRectRenderSpread",null),me([jn(Jl.__updateBoxBounds)],$l.prototype,"__updateRectBoxBounds",null),me([jn(Jl.__updateStrokeBounds)],$l.prototype,"__updateStrokeBounds",null),me([jn(Jl.__updateRenderBounds)],$l.prototype,"__updateRectRenderBounds",null),me([jn(Jl.__updateChange)],$l.prototype,"__updateRectChange",null),me([jn(Jl.__render)],$l.prototype,"__renderRect",null),me([jn(Zl.__render)],$l.prototype,"__renderGroup",null),$l=me([Gn(),Qn()],$l);let td=class extends $l{get __tag(){return"Frame"}get isFrame(){return!0}};me([zn(bl)],td.prototype,"__",void 0),me([En("#FFFFFF")],td.prototype,"fill",void 0),me([Cn("hide")],td.prototype,"overflow",void 0),td=me([Qn()],td);const{moveTo:ed,closePath:id,ellipse:sd}=Ps;let rd=class extends Xl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];let h;i?s||r?(i<1?sd(o,n,a,n*i,a*i,0,s,r,!1):h=!0,sd(o,n,a,n,a,0,r,s,!0)):(i<1&&(sd(o,n,a,n*i,a*i),ed(o,t,a)),sd(o,n,a,n,a,0,360,0,!0)):s||r?(ed(o,n,a),sd(o,n,a,n,a,0,s,r,!1)):sd(o,n,a,n,a),h||id(o),$t.ellipseToCurve&&(this.__.path=this.getPath(!0))}};me([zn(Sl)],rd.prototype,"__",void 0),me([Bn(0)],rd.prototype,"innerRadius",void 0),me([Bn(0)],rd.prototype,"startAngle",void 0),me([Bn(0)],rd.prototype,"endAngle",void 0),rd=me([Qn()],rd);const{sin:nd,cos:ad,PI:od}=Math,{moveTo:hd,lineTo:ld,closePath:dd,drawPoints:cd}=Ps;let ud=class extends Xl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)cd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;hd(e,n,0);for(let t=1;t<r;t++)ld(e,n+n*nd(2*t*od/r),a-a*ad(2*t*od/r));dd(e)}}};me([zn(Pl)],ud.prototype,"__",void 0),me([Bn(3)],ud.prototype,"sides",void 0),me([Bn()],ud.prototype,"points",void 0),me([Bn(0)],ud.prototype,"curve",void 0),ud=me([Gn(),Qn()],ud);const{sin:_d,cos:pd,PI:gd}=Math,{moveTo:fd,lineTo:yd,closePath:md}=Ps;let xd=class extends Xl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];fd(a,r,0);for(let t=1;t<2*i;t++)yd(a,r+(t%2==0?r:r*s)*_d(t*gd/i),n-(t%2==0?n:n*s)*pd(t*gd/i));md(a)}};me([zn(Rl)],xd.prototype,"__",void 0),me([Bn(5)],xd.prototype,"corners",void 0),me([Bn(.382)],xd.prototype,"innerRadius",void 0),xd=me([Qn()],xd);const{moveTo:wd,lineTo:vd,drawPoints:bd}=Ps,{rotate:kd,getAngle:Bd,getDistance:Sd,defaultPoint:Pd}=ot;let Rd=class extends Xl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&kd(i,e),i}set toPoint(t){this.width=Sd(Pd,t),this.rotation=Bd(Pd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?bd(e,t.points,t.curve,t.closed):(wd(e,0,0),vd(e,this.width,0))}};me([zn(kl)],Rd.prototype,"__",void 0),me([Sn("center")],Rd.prototype,"strokeAlign",void 0),me([wn(0)],Rd.prototype,"height",void 0),me([Bn()],Rd.prototype,"points",void 0),me([Bn(0)],Rd.prototype,"curve",void 0),me([Bn(!1)],Rd.prototype,"closed",void 0),Rd=me([Qn()],Rd);let Cd=class extends Gl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};me([zn(Ol)],Cd.prototype,"__",void 0),me([wn("")],Cd.prototype,"url",void 0),Cd=me([Qn()],Cd);const Ed=Cd;let Td=class extends Gl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=de.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new on({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ha(Ha.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(o(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};me([zn(Al)],Td.prototype,"__",void 0),me([Qh(100)],Td.prototype,"width",void 0),me([Qh(100)],Td.prototype,"height",void 0),me([Qh(1)],Td.prototype,"pixelRatio",void 0),me([Qh(!0)],Td.prototype,"smooth",void 0),me([pn(!1)],Td.prototype,"safeResize",void 0),me([Qh()],Td.prototype,"contextSettings",void 0),Td=me([Qn()],Td);const{copyAndSpread:Ld,includes:Od,spread:Ad,setList:Dd}=Xt,{stintSet:Md}=p;let Id=class extends Xl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=el.number(e,r),t.__letterSpacing=el.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,Md(t,"__padding",l&&D.fourNumber(l)),Md(t,"__clipText","show"!==h&&!t.__autoSize),Md(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=$h.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&Ad(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),p.stintSet(this,"isOverflow",!Od(h,o)),this.isOverflow?(Dd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ld(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};me([zn(Ll)],Id.prototype,"__",void 0),me([wn(0)],Id.prototype,"width",void 0),me([wn(0)],Id.prototype,"height",void 0),me([En()],Id.prototype,"boxStyle",void 0),me([pn(!1)],Id.prototype,"resizeFontSize",void 0),me([En("#000000")],Id.prototype,"fill",void 0),me([Sn("outside")],Id.prototype,"strokeAlign",void 0),me([Fn("all")],Id.prototype,"hitFill",void 0),me([wn("")],Id.prototype,"text",void 0),me([wn("")],Id.prototype,"placeholder",void 0),me([wn("caption")],Id.prototype,"fontFamily",void 0),me([wn(12)],Id.prototype,"fontSize",void 0),me([wn("normal")],Id.prototype,"fontWeight",void 0),me([wn(!1)],Id.prototype,"italic",void 0),me([wn("none")],Id.prototype,"textCase",void 0),me([wn("none")],Id.prototype,"textDecoration",void 0),me([wn(0)],Id.prototype,"letterSpacing",void 0),me([wn({type:"percent",value:1.5})],Id.prototype,"lineHeight",void 0),me([wn(0)],Id.prototype,"paraIndent",void 0),me([wn(0)],Id.prototype,"paraSpacing",void 0),me([wn("x")],Id.prototype,"writingMode",void 0),me([wn("left")],Id.prototype,"textAlign",void 0),me([wn("top")],Id.prototype,"verticalAlign",void 0),me([wn(!0)],Id.prototype,"autoSizeAlign",void 0),me([wn("normal")],Id.prototype,"textWrap",void 0),me([wn("show")],Id.prototype,"textOverflow",void 0),me([En(!1)],Id.prototype,"textEditing",void 0),Id=me([Qn()],Id);let Wd=class extends Xl{get __tag(){return"Path"}};me([zn(Cl)],Wd.prototype,"__",void 0),me([Sn("center")],Wd.prototype,"strokeAlign",void 0),Wd=me([Qn()],Wd);let Fd=class extends Hl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Wd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};me([zn(El)],Fd.prototype,"__",void 0),me([(t,e)=>{hn(t,e,{get(){return this.__path}})}],Fd.prototype,"path",void 0),Fd=me([Kn(Hs,["set","path","paint"]),Qn()],Fd);let Nd=class extends jl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&de.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new jl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Oe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Za.END,this.__onReady,this],[$a.START,this.__onCreated,this],[$a.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_($a.END,this.__onChildRenderEnd,this))}};Nd=me([Qn()],Nd);const zd={},Yd={isHoldSpaceKey:()=>Yd.isHold("Space"),isHold:t=>zd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){zd[t]||(zd[t]=!0)},setUpCode(t){zd[t]=!1}},Xd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Hd extends Fa{get spaceKey(){return Yd.isHoldSpaceKey()}get left(){return Xd.left(this)}get right(){return Xd.right(this)}get middle(){return Xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Yd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ge.changeName(t,e)}}const{min:Ud,max:Vd,abs:jd}=Math,{float:Gd,sign:qd}=D,{minX:Kd,maxX:Qd,minY:Jd,maxY:Zd}=Xt,$d=new jt,tc=new jt,ec={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ic.getValidMove(t.__localBoxBounds,ic.getDragBounds(t),s,e,!0),ic.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&ic.getValidScaleOf(t.__localBoxBounds,ic.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),ic.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),ic.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=Gd(s.x),s.y=Gd(s.y),s},getValidScaleOf(t,e,i,s,r,n,o){o||(r=Object.assign({},r)),tc.set(e),$d.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return ic.isInnerMode(t,e,i,"width")?(r.x<0&&$d.scaleOf(s,f=1/r.x,1),p=Gd($d.minX-tc.minX),g=Gd(tc.maxX-$d.maxX),u=h&&p>0?1+p/(h*$d.width):1,_=l&&g>0?1+g/(l*$d.width):1,f*=Vd(u,_)):(r.x<0&&((Gd(Kd(t)-Kd(e))<=0||Gd(Qd(e)-Qd(t))<=0)&&$d.scaleOf(s,f=1/r.x,1),$d.unsign()),p=Gd(tc.minX-$d.minX),g=Gd($d.maxX-tc.maxX),u=h&&p>0?1-p/(h*$d.width):1,_=l&&g>0?1-g/(l*$d.width):1,f*=Ud(u,_)),ic.isInnerMode(t,e,i,"height")?(r.y<0&&$d.scaleOf(s,1,y=1/r.y),p=Gd($d.minY-tc.minY),g=Gd(tc.maxY-$d.maxY),u=d&&p>0?1+p/(d*$d.height):1,_=c&&g>0?1+g/(c*$d.height):1,y*=Vd(u,_),n&&(u=Vd(jd(f),jd(y)),f=qd(f)*u,y=qd(y)*u)):(r.y<0&&((Gd(Jd(t)-Jd(e))<=0||Gd(Zd(e)-Zd(t))<=0)&&$d.scaleOf(s,1,y=1/r.y),$d.unsign()),p=Gd(tc.minY-$d.minY),g=Gd($d.maxY-tc.maxY),u=d&&p>0?1-p/(d*$d.height):1,_=c&&g>0?1-g/(c*$d.height):1,y*=Ud(u,_)),r.x*=a(f)?f:1,r.y*=a(y)?y:1,r}},ic=ec;let sc=class extends Hd{};sc.POINTER="pointer",sc.BEFORE_DOWN="pointer.before_down",sc.BEFORE_MOVE="pointer.before_move",sc.BEFORE_UP="pointer.before_up",sc.DOWN="pointer.down",sc.MOVE="pointer.move",sc.UP="pointer.up",sc.OVER="pointer.over",sc.OUT="pointer.out",sc.ENTER="pointer.enter",sc.LEAVE="pointer.leave",sc.TAP="tap",sc.DOUBLE_TAP="double_tap",sc.CLICK="click",sc.DOUBLE_CLICK="double_click",sc.LONG_PRESS="long_press",sc.LONG_TAP="long_tap",sc.MENU="pointer.menu",sc.MENU_TAP="pointer.menu_tap",sc=me([Jn()],sc);const rc=sc,nc={};let ac=class extends sc{static setList(t){this.list=t instanceof kh?t:new kh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ot.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),ec.axisMove(t,r),r}static limitMove(t,e){ec.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(nc,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(nc,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(nc,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){nc.x=t?this.totalX:this.moveX,nc.y=t?this.totalY:this.moveY}};ac.BEFORE_DRAG="drag.before_drag",ac.START="drag.start",ac.DRAG="drag",ac.END="drag.end",ac.OVER="drag.over",ac.OUT="drag.out",ac.ENTER="drag.enter",ac.LEAVE="drag.leave",ac=me([Jn()],ac);const oc=ac;let hc=class extends sc{static setList(t){ac.setList(t)}static setData(t){ac.setData(t)}};hc.DROP="drop",hc=me([Jn()],hc);let lc=class extends ac{};lc.BEFORE_MOVE="move.before_move",lc.START="move.start",lc.MOVE="move",lc.DRAG_ANIMATE="move.drag_animate",lc.END="move.end",lc.PULL_DOWN="move.pull_down",lc.REACH_BOTTOM="move.reach_bottom",lc=me([Jn()],lc);let dc=class extends Hd{};dc=me([Jn()],dc);const cc=dc;let uc=class extends sc{};uc.BEFORE_ROTATE="rotate.before_rotate",uc.START="rotate.start",uc.ROTATE="rotate",uc.END="rotate.end",uc=me([Jn()],uc);let _c=class extends ac{};_c.SWIPE="swipe",_c.LEFT="swipe.left",_c.RIGHT="swipe.right",_c.UP="swipe.up",_c.DOWN="swipe.down",_c=me([Jn()],_c);let pc=class extends sc{};pc.BEFORE_ZOOM="zoom.before_zoom",pc.START="zoom.start",pc.ZOOM="zoom",pc.END="zoom.end",pc=me([Jn()],pc);let gc=class extends Hd{};gc.BEFORE_DOWN="key.before_down",gc.BEFORE_UP="key.before_up",gc.DOWN="key.down",gc.HOLD="key.hold",gc.UP="key.up",gc=me([Jn()],gc);const fc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?_c.UP:t>45&&t<135?_c.DOWN:t<=45&&t>=-45?_c.RIGHT:_c.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:yc.getSwipeDirection(ot.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new kh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>la.draggable(t)||!t.isLeafer&&t.hasEvent(ac.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},yc=fc,mc=new kh,{getDragEventData:xc,getDropEventData:wc,getSwipeEventData:vc}=fc;class bc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=xc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,r=ac.list||this.draggableList||mc;return this.dragging&&(s?t?mc:new kh(e?[...i.list,...i.dragHoverExclude]:i.list):r)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(lc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Xd.left(t),this.dragging&&(this.interaction.emit(ac.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],la.draggable(e)){this.draggableList=new kh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:n}=s;this.dragData=xc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(lc.BEFORE_MOVE,this.dragData),e.emit(lc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(ac.BEFORE_DRAG,this.dragData),e.emit(ac.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:r}=this.dragData,{dragLimitAnimate:a}=e.p,h=!a||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=ac.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:r},h||s);a&&!s&&t?la.animateMove(e,l,o(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(ac.OUT,t,i),e.emit(ac.OVER,t,s)):e.emit(ac.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(ac.LEAVE,t,i,s),e.emit(ac.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:n}=i,a=xc(i,t,t);if(n&&(a.throughPath=n),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",e.emit(lc.END,a)),this.dragging){const r=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(ac.END,a),this.swipe(t,i,s,a),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ot.getDistance(e,t)>r.config.pointer.swipeDistance){const t=vc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=wc(t,e,ac.data);s.path=i,this.interaction.emit(hc.DROP,s),this.interaction.emit(ac.LEAVE,t,i)}dragReset(){ac.list=ac.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const kc=ie.get("emit");const Bc=["move","zoom","rotate","key"];function Sc(t,e,i,s,r){if(Bc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Rc(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Pc(n,e,i,s,r)}}function Pc(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Rc(t,r)&&(ll.updateEventStyle&&!s&&ll.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ge.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Rc(t,e){return e&&e.has(t)}const Cc={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:Ec,pathCanDrag:Tc,pathHasOutside:Lc}=fc;class Oc{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Yd.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=p.clone(Cc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new kh(t),this.createTransformer(),this.dragger=new bc(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Xd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(sc.BEFORE_DOWN,t),this.emit(sc.DOWN,t),Xd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Xd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(sc.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ot.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(sc.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Xd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(sc.BEFORE_UP,t),this.emit(sc.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(sc.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(sc.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Yd.setDownCode(e),this.emit(gc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(gc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(gc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Yd.setUpCode(e),this.emit(gc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new kh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(sc.OUT,t,i),this.emit(sc.OVER,t,e)):this.emit(sc.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(sc.LEAVE,t,i,e),this.emit(sc.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(sc.LEAVE,t),this.dragger.dragging&&this.emit(hc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[sc.DOUBLE_TAP,sc.DOUBLE_CLICK].some(e=>Ec(t.path,e));s<e.tapTime+50&&r?(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:r,target:n}=this;$t.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Tc(t.path))&&!Lc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:sc.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(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:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ot.round(s),s}emitTap(t){this.emit(sc.TAP,t),this.emit(sc.CLICK,t)}emitDoubleTap(t){this.emit(sc.DOUBLE_TAP,t),this.emit(sc.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(sc.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(sc.LONG_TAP,t),(Ec(t.path,sc.LONG_TAP)||Ec(t.path,sc.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new jt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(o(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Qa.RESIZE,this.__onResize,this)],t.once(to.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 r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Pc(r,t,e,!0,s))return;r.isApp&&Sc(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Sc(r,t,e,!1,s),Pc(r,t,e,!1,s))return}catch(t){kc.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Ac{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ac.custom={};class Dc extends ye{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new kh,this.pixelList=new kh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),de.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),de.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}$t.getSelector=function(t){return t.leafer?t.leafer.selector:$t.selector||($t.selector=de.selector())};const{toInnerRadiusPointOf:Mc,copyRadiusPoint:Ic}=ot,{hitRadiusPoint:Wc,hitPoint:Fc}=Xt,Nc={},zc={},Yc=uh.prototype;Yc.hit=function(t,e=0){this.updateLayout(),Ic(zc,t,e);const i=this.__world;return!!(e?Wc(i,zc):Fc(i,zc))&&(this.isBranch?$t.getSelector(this).hitPoint(Object.assign({},zc),e,{target:this}):this.__hitWorld(zc))},Yc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(Ic(Nc,t,i.hitRadius),t=Nc),Mc(t,s,Nc),i.hitBox||n){if(Xt.hitRadiusPoint(r.boxBounds,Nc))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(Nc,e)},Yc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Yc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Yc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Yc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Xc=new gt,Hc=Xl.prototype;Hc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=$t.image.hitCanvasSize,a=n.hitScale=Gt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Gt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),sn.patternLocked=!0,this.__renderShape(n,{matrix:Xc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),sn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Hc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:a}=i,o=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!o)return!1;const h=2*t.radiusX;let l=h;if(o)switch(i.strokeAlign){case"inside":if(l+=2*a,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=a;break;case"outside":if(l+=2*a,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const Uc=Xl.prototype,Vc=Gl.prototype,jc=$l.prototype;Vc.__updateHitCanvas=jc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Uc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Vc.__hitFill=jc.__hitFill=function(t){return this.__hitCanvas?Uc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},Id.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},Hl.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),$t.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Gc=Ae.prototype;function qc(t,e,i){t.__.__font?sl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Kc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&sl.strokeArrow(t,i,s,r)}function Qc(t,e,i,s,r){const n=i.__;c(t)?sl.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),sl.drawTextStroke(i,s,r))}function Jc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Qc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",sl.fillText(i,n,r),n.blendMode="normal",la.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}Gc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Gc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Gc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Gt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Gt.x,Gt.y,Gt.width||1,Gt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:Zc,copyAndSpread:$c,toOuterOf:tu,getOuterOf:eu,getByMove:iu,move:su,getIntersectData:ru}=Xt,nu={};let au;const{stintSet:ou}=p,{hasTransparent:hu}=tl;function lu(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:a}=i.__layout;switch(e.type){case"image":if(!e.url)return;r=rl.image(i,t,e,a,!au||!au[e.url]);break;case"linear":r=nl.linearGradient(e,a);break;case"radial":r=nl.radialGradient(e,a);break;case"angular":r=nl.conicGradient(e,a);break;case"solid":const{type:n,color:o,opacity:h}=e;r={type:n,style:tl.string(o,h)};break;default:s(e.r)||(r={type:"solid",style:tl.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&hu(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const du={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),au=rl.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=lu(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(ou(i,"__isAlphaPixelFill",r),ou(i,"__isTransparentFill",n)):(ou(i,"__isAlphaPixelStroke",r),ou(i,"__isTransparentStroke",n),ou(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,qc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,rl.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.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),qc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),qc(e,i,s),i.restoreBlendMode()):qc(e,i,s)}},fillPathOrText:qc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)sl.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":Kc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Kc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)Kc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Kc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),la.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){sl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Qc(t,1,e,i,s);break;case"inside":Jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Qc(t,2,e,i,s):Jc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!rl.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?sl.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?sl.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;tu(a.strokeSpread?($c(nu,a.boxBounds,a.strokeSpread),nu):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if($t.fullImageShadow)s=o;else{const t=a.renderShapeSpread?Zc(r,B.swapAndScale(a.renderShapeSpread,p,g)):r;s=ru(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=eu(o,c),h=iu(u,-c.e,-c.f),l=eu(n,c),su(l,-c.e,-c.f);const m=i.matrix;m?(d=new gt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let cu,uu=new jt;const{isSame:_u}=Xt;function pu(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||rl.createData(r,s,i,n),!0}function gu(t,e){mu(t,Ha.LOAD,e)}function fu(t,e){mu(t,Ha.LOADED,e)}function yu(t,e,i){e.error=i,t.forceUpdate("surface"),mu(t,Ha.ERROR,e)}function mu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Ha(e,i))}function xu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wu,translate:vu}=K,bu=new jt,ku={},Bu={};function Su(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Pu={},Ru={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Cu,set:Eu,rotateOfOuter:Tu,translate:Lu,scaleOfOuter:Ou,multiplyParent:Au,scale:Du,rotate:Mu,skew:Iu}=K;function Wu(t,e,i,s,r,n,a,o){a&&Mu(t,a),o&&Iu(t,o.x,o.y),r&&Du(t,r,n),Lu(t,e.x+i,e.y+s)}const{get:Fu,scale:Nu,copy:zu}=K,{getFloorScale:Yu}=D,{abs:Xu}=Math;const Hu={image:function(t,e,i,s,r){let n,a;const o=sn.get(i);return cu&&i===cu.paint&&_u(s,cu.boxBounds)?n=cu.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),cu=o.use>1?{leafPaint:n,paint:i,boxBounds:uu.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(pu(t,e,i,o,n,s),r&&(gu(t,a),fu(t,a))):o.error?r&&yu(t,a,o.error):(r&&(xu(t,!0),gu(t,a)),n.loadId=o.load(()=>{xu(t,!1),t.destroyed||(pu(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),fu(t,a)),n.loadId=void 0},e=>{xu(t,!1),yu(t,a,e),n.loadId=void 0},i.lod&&o.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=rl.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d,snapshot:c}=r;return!(!h||t.patternId===n+"-"+a&&!d||c)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===$t.name&&Qa.isResizing(i)||d||(e=$t.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),rl.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?rl.createPattern(t,i,s,r):rl.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,sn.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=sn.patternTasker.add(()=>xe(this,void 0,void 0,function*(){rl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=rl.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!$t.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=rl.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/Xu(s.scaleX||1),u=h.y*n/Xu(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=Yu(_+(c||0)),n*=Yu(p+(u||0)),d=Fu(),o&&zu(d,o),Nu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth,s.interlace),f=i.getPattern(g,s.repeat||$t.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=$t.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=bu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:a,mode:h,align:l,offset:d,scale:u,size:_,rotation:p,skew:g,clipSize:f,repeat:y,gap:m,filters:x,interlace:w}=t,v=e.width===s&&e.height===r,b={mode:h},k="center"!==l&&(p||0)%180==90;let B,S;switch(Xt.set(Bu,0,0,k?r:s,k?s:r),h&&"cover"!==h&&"fit"!==h?((u||_)&&(D.getScaleData(u,_,i,ku),B=ku.scaleX,S=ku.scaleY),(l||m||y)&&(B&&Xt.scale(Bu,B,S,!0),l&&St.toPoint(l,Bu,e,Bu,!0,!0))):v&&!p||(B=S=Xt.getFitScale(e,Bu,"fit"!==h),Xt.put(e,i,l,B,!1,Bu),Xt.scale(Bu,B,S,!0)),d&&ot.move(Bu,d),h){case"stretch":v?B&&(B=S=void 0):(B=e.width/s,S=e.height/r,rl.stretchMode(b,e,B,S));break;case"normal":case"clip":if(Bu.x||Bu.y||B||f||p||g){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),rl.clipMode(b,e,Bu.x,Bu.y,B,S,p,g,t,i),t&&(B=B?B*t:t,S=S?S*i:i)}break;case"repeat":(!v||B||p||g)&&rl.repeatMode(b,e,s,r,Bu.x,Bu.y,B,S,p,g,l,t.freeTransform),y||(b.repeat="repeat");const i=c(y);(m||i)&&(b.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:Su(n,i,r.width,e&&e.x),y:Su(a,s,r.height,e&&e.y)}}(m,i&&y,Bu.width,Bu.height,e));break;default:B&&rl.fillOrFitMode(b,e,Bu.x,Bu.y,B,S,p)}return b.transform||(e.x||e.y)&&vu(b.transform=wu(),e.x,e.y),B&&(b.scaleX=B,b.scaleY=S),a&&a<1&&(b.opacity=a),x&&(b.filters=x),y&&(b.repeat=n(y)?"x"===y?"repeat-x":"repeat-y":"repeat"),w&&(b.interlace=o(w)||"percent"===w.type?{type:"x",offset:w}:w),b},stretchMode:function(t,e,i,s){const r=Cu(),{x:n,y:a}=e;n||a?Lu(r,n,a):r.onlyScale=!0,Du(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Cu();Lu(o,e.x+i,e.y+s),Du(o,r,n),a&&Tu(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Cu();Wu(d,e,i,s,r,n,a,o),h&&(a||o?(Eu(Ru),Ou(Ru,e,h,l),Au(d,Ru)):Ou(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Cu();if(c)Wu(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Tu(u,{x:i/2,y:s/2},h);else switch(Mu(u,h),h){case 90:Lu(u,s,0);break;case 180:Lu(u,i,s);break;case 270:Lu(u,0,i)}Pu.x=e.x+r,Pu.y=e.y+n,Lu(u,Pu.x,Pu.y),a&&Ou(u,Pu,a,o)}t.transform=u}},{toPoint:Uu}=bt,{hasTransparent:Vu}=tl,ju={},Gu={};function qu(t,e,i,s){if(i){let r,a,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(o=t/(l-1),a=tl.string(r,s)):(o=r.offset,a=tl.string(r.color,s)),e.addColorStop(o,a),!h&&Vu(a)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ku,getDistance:Qu}=ot,{get:Ju,rotateOfOuter:Zu,scaleOfOuter:$u}=K,{toPoint:t_}=bt,e_={},i_={};function s_(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=Ku(e,i);n=Ju(),r?($u(n,e,a/o*(s||1),1),Zu(n,e,t+90)):($u(n,e,1,a/o*(s||1)),Zu(n,e,t))}return n}const{getDistance:r_}=ot,{toPoint:n_}=bt,a_={},o_={};const h_={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;Uu(i||"top",e,ju),Uu(s||"bottom",e,Gu);const a=$t.canvas.createLinearGradient(ju.x,ju.y,Gu.x,Gu.y),o={type:r,style:a};return qu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;t_(i||"center",e,e_),t_(s||"bottom",e,i_);const o=$t.canvas.createRadialGradient(e_.x,e_.y,0,e_.x,e_.y,Qu(e_,i_)),h={type:r,style:o};qu(h,o,t.stops,n);const l=s_(e,e_,i_,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;n_(i||"center",e,a_),n_(s||"bottom",e,o_);const o=$t.conicGradientSupport?$t.canvas.createConicGradient(0,a_.x,a_.y):$t.canvas.createRadialGradient(a_.x,a_.y,0,a_.x,a_.y,r_(a_,o_)),h={type:r,style:o};qu(h,o,t.stops,n);const l=s_(e,a_,o_,a||1,$t.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:s_},{copy:l_,move:d_,toOffsetOutBounds:c_}=Xt,{max:u_,abs:__}=Math,p_={},g_=new gt,f_={};function y_(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=__(t.spread||0),a=u_(a,r+n-s),o=u_(o,r+n+i),h=u_(h,r+n+s),l=u_(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function m_(t,e,i){const{shapeBounds:s}=i;let r,n;$t.fullImageShadow?(l_(p_,t.bounds),d_(p_,e.x-s.x,e.y-s.y),r=t.bounds,n=p_):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:x_}=Xt,w_={};const v_=y_;const b_={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;c_(h,f_,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(f_.offsetX+(a.x||0)*c*f,f_.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,tl.string(a.color)),r=al.getShadowTransform(t,_,i,a,f_,f),r&&_.setTransform(r),m_(_,f_,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),la.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;x_(h,w_,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(w_.offsetX+(a.x||0)*c*f,w_.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=al.getShadowTransform(t,_,i,a,w_,f,!0),r&&_.setTransform(r),m_(_,w_,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,tl.string(a.color),"source-in"),la.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:y_,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return g_.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),g_}},isTransformShadow(t){},getInnerShadowSpread:v_},{excludeRenderBounds:k_}=ya;let B_;function S_(t,e,i,s,r,n,a,o){switch(e){case"grayscale":B_||(B_=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);R_(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":R_(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function P_(t){return t.getSameCanvas(!1,!0)}function R_(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}Hl.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(S_(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||k_(i,e)||i.__render(t,e),n=i.__.opacity,B_=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=P_(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=P_(t)),r||(r=P_(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&S_(this,a,t,r,s,n,void 0,!1),k_(i,e)||i.__render(r||t,e),d&&S_(this,a,t,r,s,n,d,!1)}S_(this,a,t,r,s,n,void 0,!0)};const C_=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",E_=C_+"_#~&*+\\=|≮≯≈≠=…",T_=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function L_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const O_=L_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),A_=L_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),D_=L_(C_),M_=L_(E_),I_=L_("- —/~|┆·");var W_;!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"}(W_||(W_={}));const{Letter:F_,Single:N_,Before:z_,After:Y_,Symbol:X_,Break:H_}=W_;function U_(t){return O_[t]?F_:I_[t]?H_:A_[t]?z_:D_[t]?Y_:M_[t]?X_:T_.test(t)?N_:F_}const V_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function j_(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:G_}=V_,{Letter:q_,Single:K_,Before:Q_,After:J_,Symbol:Z_,Break:$_}=W_;let tp,ep,ip,sp,rp,np,ap,op,hp,lp,dp,cp,up,_p,pp,gp,fp,yp=[];function mp(t,e){hp&&!op&&(op=hp),tp.data.push({char:t,width:e}),ip+=e}function xp(){sp+=ip,tp.width=ip,ep.words.push(tp),tp={data:[]},ip=0}function wp(){_p&&(pp.paraNumber++,ep.paraStart=!0,_p=!1),hp&&(ep.startCharSize=op,ep.endCharSize=hp,op=0),ep.width=sp,gp.width?G_(ep):fp&&vp(),yp.push(ep),ep={words:[]},sp=0}function vp(){sp>(pp.maxWidth||0)&&(pp.maxWidth=sp)}const{top:bp,right:kp,bottom:Bp,left:Sp}=xt;function Pp(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const Rp={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[Sp],r-=o[kp]+o[Sp],!r&&(r=.01)):e.autoSizeAlign||(i=o[Sp]),a?(s=o[bp],a-=o[bp]+o[Bp],!a&&(a=.01)):e.autoSizeAlign||(s=o[bp]));const h={bounds:{x:i,y:s,width:r,height:a},rows:[],paraNumber:0,font:$t.canvas.font=e.__font};return function(t,e,i){pp=t,yp=t.rows,gp=t.bounds,fp=!gp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=$t,{width:o}=gp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;_p=!0,dp=null,op=ap=hp=ip=sp=0,tp={data:[]},ep={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)np=e[i],"\n"===np?(ip&&xp(),ep.paraEnd=!0,wp(),_p=!0):(lp=U_(np),lp===q_&&"none"!==n&&(np=j_(np,n,!ip)),ap=a.measureText(np).width,s&&(s<0&&(hp=ap),ap+=s),cp=lp===K_&&(dp===K_||dp===q_)||dp===K_&&lp!==J_,up=!(lp!==Q_&&lp!==K_||dp!==Z_&&dp!==J_),rp=_p&&r?o-r:o,t&&o&&sp+ip+ap>rp&&(h?(ip&&xp(),sp&&wp()):(up||(up=lp===q_&&dp==J_),cp||up||lp===$_||lp===Q_||lp===K_||ip+ap>rp?(ip&&xp(),sp&&wp()):sp&&wp()))," "===np&&!0!==_p&&sp+ip===0||(lp===$_?(" "===np&&ip&&xp(),mp(np,ap),xp()):cp||up?(ip&&xp(),mp(np,ap)):mp(np,ap)),dp=lp);ip&&xp(),sp&&wp(),yp.length>0&&(yp[yp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{pp.paraNumber++,sp=a.measureText(t).width,yp.push({x:r||0,text:t,width:sp,paraStart:!0}),fp&&vp()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Pp(e,"x",t[Sp]);break;case"right":Pp(e,"x",-t[kp])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Pp(e,"y",t[bp]);break;case"bottom":Pp(e,"y",-t[Bp])}}(o,h,e,r,a),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(x=i[a],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&a>0&&(m+=c),x.y=m,m+=n,t.overflow>a&&m>y&&(x.isOverflow=!0,t.overflow=a+1),w=x.x,v=x.width,o<0&&(x.width<0?(v=-x.width+e.fontSize+o,w-=v,v+=e.fontSize):v-=o),w<s.x&&(s.x=w),v>s.width&&(s.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,__letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,x;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(x=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(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===g?(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,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,x&&_),x&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(n&&r.splice(n),s&&a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?$t.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<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:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=tl.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const Cp={string:function(t,e){if(!t)return"#000";const i=o(e)&&e<1;if(n(t)){if(!i||!tl.object)return t;t=tl.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const a=t.r+","+t.g+","+t.b;return 1===r?"rgb("+a+")":"rgba("+a+","+r+")"}};Object.assign($h,Rp),Object.assign(tl,Cp),Object.assign(sl,du),Object.assign(rl,Hu),Object.assign(nl,h_),Object.assign(al,b_),Object.assign(de,{interaction:(t,e,i,s)=>new Oc(t,e,i,s),hitCanvas:(t,e)=>new Ph(t,e),hitCanvasManager:()=>new Dc}),Ch();export{St as AlignHelper,e as Answer,Nd as App,bt as AroundHelper,qt as AutoBounds,li as BezierHelper,jt as Bounds,Ua as BoundsEvent,Xt as BoundsHelper,$l as Box,wl as BoxData,bh as Branch,va as BranchHelper,zo as BranchRender,Td as Canvas,Al as CanvasData,ye as CanvasManager,Na as ChildEvent,tl as ColorConvert,de as Creator,Ac as Cursor,p as DataHelper,ie as Debug,xt as Direction4,wt as Direction9,ec as DragBoundsHelper,ac as DragEvent,bc as Dragger,hc as DropEvent,al as Effect,rd as Ellipse,Sl as EllipseData,mi as EllipseHelper,Fa as Event,ge as EventCreator,oo as Eventer,hl as Export,qr as FileHelper,ol as Filter,B as FourNumberHelper,td as Frame,bl as FrameData,Hl as Group,xl as GroupData,Dc as HitCanvasManager,Cd as Image,Ol as ImageData,Ha as ImageEvent,sn as ImageManager,y as IncrementId,Oc as InteractionBase,fc as InteractionHelper,gc as KeyEvent,Yd as Keyboard,Za as LayoutEvent,Yh as Layouter,uh as Leaf,Io as LeafBounds,ya as LeafBoundsHelper,f as LeafData,vo as LeafDataProxy,xo as LeafEventer,la as LeafHelper,Wa as LeafLayout,Bh as LeafLevelList,kh as LeafList,Co as LeafMatrix,Wo as LeafRender,jl as Leafer,Ph as LeaferCanvas,Ae as LeaferCanvasBase,vl as LeaferData,to as LeaferEvent,on as LeaferImage,Rd as Line,kl as LineData,D as MathHelper,gt as Matrix,K as MatrixHelper,lc as MoveEvent,oc as MyDragEvent,Ed as MyImage,rc as MyPointerEvent,cc as MyTouchEvent,Fe as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,F as PI_2,sl as Paint,nl as PaintGradient,rl as PaintImage,Wd as Path,il as PathArrow,Ir as PathBounds,Ps as PathCommandDataHelper,Ie as PathCommandMap,xi as PathCommandNodeHelper,ss as PathConvert,Hr as PathCorner,Hs as PathCreator,Cl as PathData,rr as PathDrawer,De as PathHelper,t as PathNodeHandleType,Xe as PathNumberCommandLengthMap,Ye as PathNumberCommandMap,Fd as Pen,El as PenData,Gh as Picker,$t as Platform,le as Plugin,_t as Point,ot as PointHelper,Xd as PointerButton,sc as PointerEvent,ud as Polygon,Pl as PolygonData,Ya as PropertyEvent,Gl as Rect,Bl as RectData,He as RectHelper,zl as RectRender,$a as RenderEvent,Hh as Renderer,Qa as ResizeEvent,tn as Resource,uc as RotateEvent,ae as Run,qh as Selector,xd as Star,Rl as StarData,ll as State,Qt as StringNumberMap,_c as SwipeEvent,Jr as TaskItem,Zr as TaskProcessor,Id as Text,$h as TextConvert,Ll as TextData,dc as TouchEvent,dl as Transition,yt as TwoPointBoundsHelper,Xl as UI,Il as UIBounds,ue as UICreator,yl as UIData,Hd as UIEvent,Fl as UIRender,el as UnitConvert,Kt as UnitConvertHelper,Ra as WaitHelper,Ja as WatchEvent,Th as Watcher,pc as ZoomEvent,Cn as affectRenderBoundsType,Sn as affectStrokeBoundsType,un as attr,yn as autoLayoutType,wn as boundsType,Gr as canvasPatch,Oe as canvasSizeAttrs,Zh as createAttr,dn as createDescriptor,Nn as cursorType,zn as dataProcessor,pn as dataType,cn as decorateLeafAttr,Xn as defineDataProcessor,hn as defineKey,_n as defineLeafAttr,Tn as dimType,bn as doBoundsType,Pn as doStrokeType,Kh as effectType,i as emptyData,Wn as eraserType,Xa as extraPropertyEventMap,z as getBoundsData,ln as getDescriptor,Y as getMatrixData,N as getPointData,Fn as hitType,d as isArray,u as isData,_ as isEmptyData,a as isFinite,r as isNull,o as isNumber,c as isObject,n as isString,s as isUndefined,Yn as layoutProcessor,no as leaferTransformAttrMap,In as maskType,vn as naturalBoundsType,Ln as opacityType,Ur as path,kn as pathInputType,Bn as pathType,Vr as pen,gn as positionType,Qn as registerUI,Jn as registerUIEvent,Qh as resizeType,jn as rewrite,Gn as rewriteAble,xn as rotationType,mn as scaleType,fn as scrollType,Mn as sortType,Rn as strokeType,En as surfaceType,Gt as tempBounds,ft as tempMatrix,pt as tempPoint,l as tryToNumber,Ch as useCanvas,Kn as useModule,Sh as version,On as visibleType,Jh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|