leafer-ui 1.0.0-rc.5 → 1.0.0-rc.7

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.
@@ -1 +1 @@
1
- const t={imageSuffix:"leaf"},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),t),getGapRotation(t,e){if(e>1){const s=Math.abs(t%e);(s<1||s>e-1)&&(t=Math.round(t/e)*e)}return t},formatSkew:t=>r.within(t,-90,90)},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:g,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,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),i=h(e),{a:r,b:n,c:a,d:d}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=a*s-d*i,t.d=a*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:a}=t;s&&(s*=o,t.a=i+n*s,t.b=r+a*s),e&&(e*=o,t.c=n+i*e,t.d=a+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},preMultiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+o*e.c,t.d=r*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){y.preMultiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t,a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(r*l-o*h)*d,s.y=(o*n-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*n-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,a=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;n=u(i),a=t/n;const r=e/n;h=s>0?d(r):-d(r),l=c(g/i)/o}else{const e=i*i+r*r;a=u(e),n=t/a;const s=i/a;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:C}=Math,k={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=R.defaultPoint);const i=x(e*o),r=w(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*i-a*r,t.y=s.y+n*r+a*i},tempToInnerOf(t,e){const{tempPoint:s}=R;return R.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=R;return R.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=R;return R.copy(s,t),R.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>R.getAtan2(t,e)/o,getChangeAngle(t,e,s,i){i||(i=e);let r=R.getAngle(t,e);const o=R.getAngle(s,i)-r;return o<-180?o+360:o},getAtan2:(t,e)=>C(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=R.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){R.reset(t)}},R=k;class E{constructor(t,e){"object"==typeof t?k.copy(this,t):k.set(this,t,e)}set(t,e){k.set(this,t,e)}copy(t){return k.copy(this,t),this}clone(){return new E(this)}rotate(t,e){return k.rotate(this,t,e),this}toInnerOf(t,e){return k.toInnerOf(this,t,e),this}toOuterOf(t,e){return k.toOuterOf(this,t,e),this}getCenter(t){return k.getCenter(this,t)}getDistance(t){return k.getDistance(this,t)}getAngle(t){return k.getAngle(this,t)}getAtan2(t){return k.getAtan2(this,t)}reset(){k.reset(this)}}class T{constructor(t,e,s,i,r,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,o)}set(t,e,s,i,r,o){f.set(this,t,e,s,i,r,o)}copy(t){return f.copy(this,t),this}clone(){return new T(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e,s){f.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){f.toInnerPoint(this,t,e,s)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const O={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){S(t,e,s),S(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(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:S}=O,{tempPointBounds:P,setPoint:L,addPoint:D,toBounds:M}=O,{toOuterPoint:A}=f;let I,W,F,N;const z={},Y={},X={tempBounds:{},set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,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,s,i){i||(i=s),U.set(t,e.x-s,e.y-i,e.width+2*s,e.height+2*i)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),U.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?V(e,t):e=t,s?(e.offsetX=-(U.right(s)-t.x),e.offsetY=-(U.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),U.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s){s||(s=e),t.x&&(t.x*=e),t.y&&(t.y*=s),t.width*=e,t.height*=s},tempToOuterOf:(t,e)=>(U.copy(U.tempBounds,t),U.toOuterOf(U.tempBounds,e),U.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),U.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else z.x=t.x,z.y=t.y,A(e,z,Y),L(P,Y.x,Y.y),z.x=t.x+t.width,A(e,z,Y),D(P,Y.x,Y.y),z.y=t.y+t.height,A(e,z,Y),D(P,Y.x,Y.y),z.x=t.x,A(e,z,Y),D(P,Y.x,Y.y),M(P,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const i={};return U.copyAndSpread(i,t,e,s),i},spread(t,e,s=e){U.copyAndSpread(t,t,e,s)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(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)},add(t,e){I=t.x+t.width,W=t.y+t.height,F=e.x+e.width,N=e.y+e.height,I=I>F?I:F,W=W>N?W:N,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){U.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){U.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){U.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||V(t,r)):j(t,r));o&&U.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?L(P,t.x,t.y):D(P,t.x,t.y)})),M(P,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=k.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=k.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=U.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=U.tempToOuterOf(e,s)),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,s){s&&(e=U.tempToOuterOf(e,s));let{x:i,y:r,width:o,height:n}=e;return I=i+o,W=r+n,F=t.x+t.width,N=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<F?I:F,W=W<N?W:N,o=I-i,n=W-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){U.copy(t,U.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){U.set(t)}},U=X,{add:j,copy:V}=U;class H{constructor(t,e,s,i){"object"==typeof t?X.copy(this,t):X.set(this,t,e,s,i)}set(t,e,s,i){X.set(this,t,e,s,i)}copy(t){return X.copy(this,t),this}clone(){return new H(this)}scale(t,e){return X.scale(this,t,e),this}toOuterOf(t,e){return X.toOuterOf(this,t,e),this}getFitMatrix(t){return X.getFitMatrix(this,t)}spread(t,e){return X.spread(this,t,e),this}ceil(){return X.ceil(this),this}unsign(){return X.unsign(this),this}add(t){return X.add(this,t),this}addList(t){return X.setByList(this,t,!0),this}setByList(t,e){return X.setByList(this,t,e),this}addListWithHandle(t,e){return X.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return X.setByListWithHandle(this,t,e,s),this}setByPoints(t){return X.setByPoints(this,t),this}hitPoint(t,e){return X.hitPoint(this,t,e)}hitRadiusPoint(t,e){return X.hitRadiusPoint(this,t,e)}hit(t,e){return X.hit(this,t,e)}includes(t,e){return X.includes(this,t,e)}intersect(t,e){return X.intersect(this,t,e),this}getIntersect(t,e){return new H(X.getIntersectData(this,t,e))}isSame(t){return X.isSame(this,t)}isEmpty(){return X.isEmpty(this)}reset(){X.reset(this)}}class G{constructor(t,e,s,i,r,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new H(r,e,o||t.width-r-s,n||t.height-e-i)}}class K{constructor(t,e){O.setPoint(this,t,e)}addPoint(t,e){O.addPoint(this,t,e)}addBounds(t,e,s,i){O.addBounds(this,t,e,s,i)}add(t){O.add(this,t)}}const q={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};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){Q.enable&&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)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const i=s.create(s.RUNTIME);return tt.currentId=tt.idMap[i]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[i]=t,tt.nameToIdMap[t]=i,i}static end(t,e){const s=tt.idMap[t],i=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[i]=void 0,e?$.log(i,performance.now()-s,"µs"):$.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;it[e]?et.repeat(e):it[e]=t},get(t,e,s,i,r,o){const n=new it[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),o&&(n.height=o)),n}},{list:it}=st,rt=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?rt.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,nt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(ut(e,t),ut(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ut(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ut}=ct;class _t{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=null}}const pt={opacityTypes:["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]}};function gt(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function ft(t,e,s,i){return new(s||(s=Promise))((function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}pt.opacityTypes.forEach((t=>pt.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const mt=[];function vt(){return(t,e)=>{mt.push(e)}}const wt=[];let xt=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||wt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;mt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};gt([yt("imageSmoothingEnabled")],xt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],xt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],xt.prototype,"opacity",void 0),gt([yt()],xt.prototype,"fillStyle",void 0),gt([yt()],xt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],xt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],xt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],xt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],xt.prototype,"dashOffset",void 0),gt([yt()],xt.prototype,"miterLimit",void 0),gt([yt()],xt.prototype,"shadowBlur",void 0),gt([yt()],xt.prototype,"shadowColor",void 0),gt([yt()],xt.prototype,"shadowOffsetX",void 0),gt([yt()],xt.prototype,"shadowOffsetY",void 0),gt([yt()],xt.prototype,"filter",void 0),gt([yt()],xt.prototype,"font",void 0),gt([yt()],xt.prototype,"fontKerning",void 0),gt([yt()],xt.prototype,"fontStretch",void 0),gt([yt()],xt.prototype,"fontVariantCaps",void 0),gt([yt()],xt.prototype,"textAlign",void 0),gt([yt()],xt.prototype,"textBaseline",void 0),gt([yt()],xt.prototype,"textRendering",void 0),gt([yt()],xt.prototype,"wordSpacing",void 0),gt([yt()],xt.prototype,"letterSpacing",void 0),gt([yt()],xt.prototype,"direction",void 0),gt([vt()],xt.prototype,"setTransform",null),gt([vt()],xt.prototype,"resetTransform",null),gt([vt()],xt.prototype,"getTransform",null),gt([vt()],xt.prototype,"save",null),gt([vt()],xt.prototype,"restore",null),gt([vt()],xt.prototype,"translate",null),gt([vt()],xt.prototype,"scale",null),gt([vt()],xt.prototype,"rotate",null),gt([vt()],xt.prototype,"fill",null),gt([vt()],xt.prototype,"stroke",null),gt([vt()],xt.prototype,"clip",null),gt([vt()],xt.prototype,"fillRect",null),gt([vt()],xt.prototype,"strokeRect",null),gt([vt()],xt.prototype,"clearRect",null),gt([vt()],xt.prototype,"beginPath",null),gt([vt()],xt.prototype,"moveTo",null),gt([vt()],xt.prototype,"lineTo",null),gt([vt()],xt.prototype,"bezierCurveTo",null),gt([vt()],xt.prototype,"quadraticCurveTo",null),gt([vt()],xt.prototype,"closePath",null),gt([vt()],xt.prototype,"arc",null),gt([vt()],xt.prototype,"arcTo",null),gt([vt()],xt.prototype,"ellipse",null),gt([vt()],xt.prototype,"rect",null),gt([vt()],xt.prototype,"roundRect",null),gt([vt()],xt.prototype,"createConicGradient",null),gt([vt()],xt.prototype,"createLinearGradient",null),gt([vt()],xt.prototype,"createPattern",null),gt([vt()],xt.prototype,"createRadialGradient",null),gt([vt()],xt.prototype,"fillText",null),gt([vt()],xt.prototype,"measureText",null),gt([vt()],xt.prototype,"strokeText",null);const bt=new H,Bt={width:1,height:1,pixelRatio:1},Ct=Z.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Rt extends xt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.worldTransform={},e||(e=Bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=e;this.autoLayout=!r||!o,this.pixelRatio=n,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Ct.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(pt.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Ct.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,kt),this.bounds=new H(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*o+t.b*a)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*o+t.d*a)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*o+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}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,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,X.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,i){this.resetTransform(),this.copyWorld(t,e,s,i),this.useWorldTransform()}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,bt.copy(t).scale(this.pixelRatio),this.fillRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,bt.copy(t).scale(this.pixelRatio),this.strokeRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.clearRect(bt.x,bt.y,bt.width,bt.height)}clipWorld(t,e){this.beginPath(),bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.rect(bt.x,bt.y,bt.width,bt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,o={width:s,height:i,pixelRatio:r},n=this.manager?this.manager.get(o):e.canvas(o);return n.save(),t&&n.useWorldTransform(Object.assign({},this.worldTransform)),n}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:o}=this;t&&(i+=t),s&&(r+=s);const n={width:i,height:r,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.recycled||(this.restore(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Et={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Tt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ot=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},Tt),St={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},Pt={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},Lt=Object.assign(Object.assign({},Pt),Tt),Dt=Ot,Mt={};for(let t in Dt)Mt[Dt[t]]=t;const At={};for(let t in Dt)At[Dt[t]]=St[t];const It={drawRoundRect(t,e,s,i,o,n){let[a,h,l,d]=r.fourNumber(n);const c=Math.min(i/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+o,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+o,e,s+o,l):t.lineTo(e+i,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+i,s,a):t.lineTo(e,s)}},{sin:Wt,cos:Ft,atan2:Nt,ceil:zt,abs:Yt,PI:Xt,sqrt:Ut,pow:jt}=Math,{setPoint:Vt,addPoint:Ht}=O,{set:Gt}=k,{M:Kt,L:qt,C:Zt,Q:Qt,Z:$t}=Ot,Jt={},te={points(t,e,s,i){if(t.push(Kt,e[0],e[1]),s&&e.length>5){let r,o,n,a,h,l,d,c,u,_,p,g,f,y=e.length;const m=!0===s?.5:s;i&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)r=e[s-2],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=Ut(jt(n-r,2)+jt(a-o,2)),g=Ut(jt(h-n,2)+jt(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=r,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(Qt,d,c,n,a):t.push(Zt,u,_,d,c,n,a),u=n+g*h,_=a+g*l;i||t.push(Qt,u,_,e[y-2],e[y-1])}else for(let s=2,i=e.length;s<i;s+=2)t.push(qt,e[s],e[s+1]);i&&t.push($t)},rect(t,e,s,i,r){Et.creator.path=t,Et.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Et.creator.path=[],It.drawRoundRect(Et.creator,e,s,i,r,o),t.push(...Et.convertToCanvasData(Et.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Nt(g,p),v=Nt(y,f),w=v-m;if(w<0&&(w+=n),w===Xt||Yt(p+g)<1e-12||Yt(f+y)<1e-12)return t&&t.push(qt,i,r),c&&(Vt(c,e,s),Ht(c,i,r)),_&&Gt(_,e,s),void(u&&Gt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Ft(w/2),C=i+B*Ft(m+w/2+a*b),k=r+B*Wt(m+w/2+a*b);return m-=a*b,v-=a*b,ie(t,C,k,d,d,0,m/o,v/o,x,c,u,_)},arc:(t,e,s,i,r,o,n,a,h,l)=>ie(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*o,f=Wt(g),y=Ft(g);let m=l*o,v=d*o;m>Xt&&(m-=n),v<0&&(v+=n);let w=v-m;w<0?w+=n:w>n&&(w-=n),c&&(w-=n);const x=zt(Yt(w/a)),b=w/x,B=Wt(b/4),C=8/3*B*B/Wt(b/2);v=m+b;let k,R,E,T,O,S,P,L,D=Ft(m),M=Wt(m),A=E=y*i*D-f*r*M,I=T=f*i*D+y*r*M,W=e+E,F=s+T;t&&t.push(qt,W,F),u&&Vt(u,W,F),p&&Gt(p,W,F);for(let o=0;o<x;o++)k=Ft(v),R=Wt(v),E=y*i*k-f*r*R,T=f*i*k+y*r*R,O=e+A-C*(y*i*M+f*r*D),S=s+I-C*(f*i*M-y*r*D),P=e+E+C*(y*i*R+f*r*k),L=s+T+C*(f*i*R-y*r*k),t&&t.push(Zt,O,S,P,L,e+E,s+T),u&&se(e+A,s+I,O,S,P,L,e+E,s+T,u,!0),A=E,I=T,D=k,M=R,m=v,v+=b;_&&Gt(_,e+E,s+T)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Zt,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){se(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,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?Ht(h,t,e):Vt(h,t,e),Ht(h,n,a);for(let l=0,c=d.length;l<c;l++)ee(d[l],t,e,s,i,r,o,n,a,Jt),Ht(h,Jt.x,Jt.y)},getPointAndSet(t,e,s,i,r,o,n,a,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*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return ee(t,e,s,i,r,o,n,a,h,l),l}},{getPointAndSet:ee,toTwoPointBounds:se,ellipse:ie}=te,{sin:re,cos:oe,sqrt:ne,atan2:ae}=Math,{ellipse:he}=te,le={ellipticalArc(e,s,i,r,a,h,l,d,c,u,_){const p=(c-s)/2,g=(u-i)/2,f=h*o,y=re(f),m=oe(f),v=-m*p-y*g,w=-m*g+y*p,x=r*r,b=a*a,B=w*w,C=v*v,k=x*b-x*B-b*C;let R=0;if(k<0){const t=ne(1-k/(x*b));r*=t,a*=t}else R=(l===d?-1:1)*ne(k/(x*B+b*C));const E=R*r*w/a,T=-R*a*v/r,O=ae((w-T)/a,(v-E)/r),S=ae((-w-T)/a,(-v-E)/r);let P=S-O;0===d&&P>0?P-=n:1===d&&P<0&&(P+=n);const L=s+p+m*E-y*T,D=i+g+y*E+m*T,M=P<0?1:0;_||"node"===t.name?he(e,L,D,r,a,h,O/o,S/o,M):r!==a||h?e.push(Ot.G,L,D,r,a,h,O/o,S/o,M):e.push(Ot.O,L,D,r,O/o,S/o,M)}},{M:de,m:ce,L:ue,l:_e,H:pe,h:ge,V:fe,v:ye,C:me,c:ve,S:we,s:xe,Q:be,q:Be,T:Ce,t:ke,A:Re,a:Ee,Z:Te,z:Oe,N:Se,D:Pe,X:Le,G:De,F:Me,O:Ae,P:Ie,U:We}=Ot,{rect:Fe,roundRect:Ne,arcTo:ze,arc:Ye,ellipse:Xe,quadraticCurveTo:Ue}=te,{ellipticalArc:je}=le,Ve=Z.get("PathConvert"),He={},Ge={current:{dot:0},stringify(t){let e,s,i,r=0,o=t.length,n="";for(;r<o;){s=t[r],e=At[s],n+=s===i?" ":Mt[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,o="";const n=[],a=e?Lt:Pt;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?("."===i&&(Ke.dot++,Ke.dot>1&&(qe(n,o),o="")),o+=i):Ot[i]?(o&&(qe(n,o),o=""),Ke.name=Ot[i],Ke.length=St[i],Ke.index=0,qe(n,Ke.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&qe(n,o),o=i):o&&(qe(n,o),o=""),r=i;return o&&qe(n,o),s?Ge.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ce:t[c+1]+=a,t[c+2]+=h;case de:a=t[c+1],h=t[c+2],_.push(de,a,h),c+=3;break;case ge:t[c+1]+=a;case pe:a=t[c+1],_.push(ue,a,h),c+=2;break;case ye:t[c+1]+=h;case fe:h=t[c+1],_.push(ue,a,h),c+=2;break;case _e:t[c+1]+=a,t[c+2]+=h;case ue:a=t[c+1],h=t[c+2],_.push(ue,a,h),c+=3;break;case xe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=we;case we:n=o===me||o===we,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(me,l,d,s,i,a,h),c+=5;break;case ve:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=me;case me:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(me,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ke:t[c+1]+=a,t[c+2]+=h,r=Ce;case Ce:n=o===be||o===Ce,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ue(_,a,h,s,i,t[c+1],t[c+2]):_.push(be,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Be:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=be;case be:s=t[c+1],i=t[c+2],e?Ue(_,a,h,s,i,t[c+3],t[c+4]):_.push(be,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ee:t[c+6]+=a,t[c+7]+=h;case Re:je(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Oe:case Te:_.push(Te),c++;break;case Se:a=t[c+1],h=t[c+2],e?Fe(_,a,h,t[c+3],t[c+4]):Ze(_,t,c,5),c+=5;break;case Pe:a=t[c+1],h=t[c+2],e?Ne(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ze(_,t,c,9),c+=9;break;case Le:a=t[c+1],h=t[c+2],e?Ne(_,a,h,t[c+3],t[c+4],t[c+5]):Ze(_,t,c,6),c+=6;break;case De:Xe(e?_:Ze(_,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,He),a=He.x,h=He.y,c+=9;break;case Me:e?Xe(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ze(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ae:Ye(e?_:Ze(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,He),a=He.x,h=He.y,c+=7;break;case Ie:e?Ye(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ze(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case We:ze(e?_:Ze(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,He),a=He.x,h=He.y,c+=6;break;default:return Ve.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ke.index===Ke.length&&(Ke.index=1,t.push(Ke.name)),t.push(Number(e)),Ke.index++,Ke.dot=0}},{current:Ke,pushData:qe,copyData:Ze}=Ge,{M:Qe,L:$e,C:Je,Q:ts,Z:es,N:ss,D:is,X:rs,G:os,F:ns,O:as,P:hs,U:ls}=Ot,ds={},cs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Qe,e,s)},lineTo(t,e,s){t.push($e,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Je,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(ts,e,s,i,r)},closePath(t){t.push(es)},rect(t,e,s,i,r){t.push(ss,e,s,i,r)},roundRect(t,e,s,i,o,n){if("number"==typeof n)t.push(rs,e,s,i,o,n);else{const a=r.fourNumber(n);a?t.push(is,e,s,i,o,...a):t.push(ss,e,s,i,o)}},ellipse(t,e,s,i,r,o,n,a,h){void 0===o?t.push(ns,e,s,i,r):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(os,e,s,i,r,o,n,a,h?1:0))},arc(t,e,s,i,r,o,n){void 0===r?t.push(hs,e,s,i):(void 0===o&&(o=360),t.push(as,e,s,i,r,o,n?1:0))},arcTo(t,e,s,i,r,o){t.push(ls,e,s,i,r,o)},drawEllipse(t,e,s,i,r,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),te.ellipse(null,e,s,i,r,o,n,a,h,null,null,ds),t.push(Qe,ds.x,ds.y),us(t,e,s,i,r,o,n,a,h)},drawArc(t,e,s,i,r,o,n){void 0===r&&(r=0),void 0===o&&(o=360),te.arc(null,e,s,i,r,o,n,null,null,ds),t.push(Qe,ds.x,ds.y),_s(t,e,s,i,r,o,n)},drawPoints(t,e,s,i){te.points(t,e,s,i)}},{ellipse:us,arc:_s}=cs,{moveTo:ps,lineTo:gs,quadraticCurveTo:fs,bezierCurveTo:ys,closePath:ms,beginPath:vs,rect:ws,roundRect:xs,ellipse:bs,arc:Bs,arcTo:Cs,drawEllipse:ks,drawArc:Rs,drawPoints:Es}=cs;class Ts{constructor(t){this.path=t?"string"==typeof t?Et.parse(t):t:[]}beginPath(){return vs(this.path),this}moveTo(t,e){return ps(this.path,t,e),this}lineTo(t,e){return gs(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,o){return ys(this.path,t,e,s,i,r,o),this}quadraticCurveTo(t,e,s,i){return fs(this.path,t,e,s,i),this}closePath(){return ms(this.path),this}rect(t,e,s,i){return ws(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return xs(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,o,n,a){return bs(this.path,t,e,s,i,r,o,n,a),this}arc(t,e,s,i,r,o){return Bs(this.path,t,e,s,i,r,o),this}arcTo(t,e,s,i,r){return Cs(this.path,t,e,s,i,r),this}drawEllipse(t,e,s,i,r,o,n,a){return ks(this.path,t,e,s,i,r,o,n,a),this}drawArc(t,e,s,i,r,o){return Rs(this.path,t,e,s,i,r,o),this}drawPoints(t,e,s){return Es(this.path,t,e,s),this}}const{M:Os,L:Ss,C:Ps,Q:Ls,Z:Ds,N:Ms,D:As,X:Is,G:Ws,F:Fs,O:Ns,P:zs,U:Ys}=Ot,Xs=Z.get("PathDrawer"),Us={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Os:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Ss:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ps:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ls:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ds:t.closePath(),i+=1;break;case Ms:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case As:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Is:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ws:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*o,e[i+6]*o,e[i+7]*o,e[i+8]),i+=9;break;case Fs:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,n,!1),i+=5;break;case Ns:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*o,e[i+5]*o,e[i+6]),i+=7;break;case zs:t.arc(e[i+1],e[i+2],e[i+3],0,n,!1),i+=4;break;case Ys:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Xs.error(`command: ${s} [index:${i}]`,e)}}},{M:js,L:Vs,C:Hs,Q:Gs,Z:Ks,N:qs,D:Zs,X:Qs,G:$s,F:Js,O:ti,P:ei,U:si}=Ot,{toTwoPointBounds:ii,toTwoPointBoundsByQuadraticCurve:ri,arcTo:oi,arc:ni,ellipse:ai}=te,{add:hi,copy:li,addPoint:di,setPoint:ci,addBounds:ui,toBounds:_i}=O,pi=Z.get("PathBounds");let gi,fi,yi;const mi={},vi={},wi={},xi={toBounds(t,e){xi.toTwoPointBounds(t,vi),_i(vi,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ci(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Ks||s===Hs||s===Gs?ci(e,h,l):ci(e,t[a+1],t[a+2])),s){case js:case Vs:h=t[a+1],l=t[a+2],di(e,h,l),a+=3;break;case Hs:o=t[a+5],n=t[a+6],ii(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,mi),hi(e,mi),h=o,l=n,a+=7;break;case Gs:i=t[a+1],r=t[a+2],o=t[a+3],n=t[a+4],ri(h,l,i,r,o,n,mi),hi(e,mi),h=o,l=n,a+=5;break;case Ks:a+=1;break;case qs:h=t[a+1],l=t[a+2],ui(e,h,l,t[a+3],t[a+4]),a+=5;break;case Zs:case Qs:h=t[a+1],l=t[a+2],ui(e,h,l,t[a+3],t[a+4]),a+=s===Zs?9:6;break;case $s:ai(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],mi,wi),0===a?li(e,mi):hi(e,mi),h=wi.x,l=wi.y,a+=9;break;case Js:h=t[a+1],l=t[a+2],fi=t[a+3],yi=t[a+4],ui(e,h-fi,l-yi,2*fi,2*yi),h+=fi,a+=5;break;case ti:ni(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],mi,wi),0===a?li(e,mi):hi(e,mi),h=wi.x,l=wi.y,a+=7;break;case ei:h=t[a+1],l=t[a+2],gi=t[a+3],ui(e,h-gi,l-gi,2*gi,2*gi),h+=gi,a+=4;break;case si:oi(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],mi,wi),0===a?li(e,mi):hi(e,mi),h=wi.x,l=wi.y,a+=6;break;default:return void pi.error(`command: ${s} [index:${a}]`,t)}}},bi={smooth:(t,e,s)=>t};Et.creator=new Ts,Et.parse=Ge.parse,Et.convertToCanvasData=Ge.toCanvasData;const{drawRoundRect:Bi}=It;function Ci(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Bi(this,t,e,s,i,r)})}(t)}const ki=Z.get("TaskProcessor");class Ri{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ki.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ei{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,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&ct.assign(this.config,t),this.empty()}add(t,e){let s,i,r,o;const n=new Ri(t);return n.parent=this,"number"==typeof e?o=e:e&&(i=e.parallel,s=e.start,r=e.time,o=e.delay),r&&(n.time=r),!1===i&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber--,this.push(n,s)}),o)),this.isComplete=!1,n}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=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):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;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 Ti={map:{},recycledList:[],tasker:new Ei,patternTasker:new Ei,get isComplete(){return Oi.tasker.isComplete&&Oi.patternTasker.isComplete},get(t){let s=Oi.map[t.url];return s||(s=e.image(t),Oi.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||Oi.recycledList.push(t)}))},clearRecycled(){const t=Oi.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete Oi.map[t.url],t.destroy())})),t.length=0)},isPixel:t=>pt.opacityTypes.some((e=>Oi.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+pt.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+pt.upperCaseTypeMap[t]))return!0;return!1},destroy(){Oi.map={}}},Oi=Ti,{IMAGE:Si,create:Pi}=s;class Li{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=Pi(Si),this.config=t||{url:""},this.isSVG=Ti.isFormat("svg",t)}load(e,s){return this.loading||(this.loading=!0,Ti.tasker.add((()=>ft(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return i&&(n.globalAlpha=i),n.drawImage(this.view,0,0,e,s),o}destroy(){this.config={url:""},this.waitComplete.length=0}}class Di{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 Mi extends Di{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Mi.ADD="child.add",Mi.REMOVE="child.remove";class Ai extends Di{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Ai.CHANGE="property.change";class Ii extends Di{constructor(t,e){super(t),Object.assign(this,e)}}Ii.LOAD="image.load",Ii.LOADED="image.loaded",Ii.ERROR="image.error";class Wi extends Di{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){"object"==typeof t?(super(Wi.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Wi.RESIZE="resize";class Fi extends Di{constructor(t,e){super(t),this.data=e}}Fi.REQUEST="watch.request",Fi.DATA="watch.data";class Ni extends Di{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Ni.CHECK_UPDATE="layout.check_update",Ni.REQUEST="layout.request",Ni.START="layout.start",Ni.BEFORE="layout.before",Ni.LAYOUT="layout.layout",Ni.AFTER="layout.after",Ni.AGAIN="layout.again",Ni.END="layout.end";class zi extends Di{}zi.FRAME="animate.frame";class Yi extends Di{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Yi.REQUEST="render.request",Yi.START="render.start",Yi.BEFORE="render.before",Yi.RENDER="render",Yi.AFTER="render.after",Yi.AGAIN="render.again",Yi.END="render.end";class Xi extends Di{}Xi.START="leafer.start",Xi.BEFORE_READY="leafer.before_ready",Xi.READY="leafer.ready",Xi.AFTER_READY="leafer.after_ready",Xi.VIEW_READY="leafer.view_ready",Xi.VIEW_COMPLETED="leafer.view_completed",Xi.STOP="leafer.stop",Xi.RESTART="leafer.restart",Xi.END="leafer.end";const Ui={},ji={isHoldSpaceKey:()=>ji.isHold("Space"),isHold:t=>Ui[t],setDownCode(t){Ui[t]||(Ui[t]=!0)},setUpCode(t){Ui[t]=!1}},Vi={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 Hi extends Di{get spaceKey(){return ji.isHoldSpaceKey()}get left(){return Vi.left(this)}get right(){return Vi.right(this)}get middle(){return Vi.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.getInnerPoint(this)}getLocal(t){return t||(t=this.current),t.getLocalPoint(this)}static changeName(t,e){ot.changeName(t,e)}}function Gi(t,e,s){Object.defineProperty(t,e,s)}function Ki(t,e){return Object.getOwnPropertyDescriptor(t,e)}function qi(t){return(e,s)=>{Gi(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function Zi(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Gi(t,e,Object.assign(r,i||{})),fr(t,e,s)}function Qi(t){return(e,s)=>{Zi(e,s,t)}}function $i(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}}function Ji(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function tr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function er(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__.around&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const sr=er;function ir(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const rr=ir;function or(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function nr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function ar(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function hr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function lr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function dr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function cr(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}}function ur(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}}function _r(t){return(e,s)=>{Gi(e,"__DataProcessor",{get:()=>t})}}function pr(t){return(e,s)=>{Gi(e,"__LayoutProcessor",{get:()=>t})}}function gr(t,e,s){fr(t.prototype,e,s)}function fr(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[r]}:"width"===e?n.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});const a=Ki(i,e);a&&a.set&&(n.set=a.set),i[o]&&(n.set=i[o],delete i[o]),Object.defineProperty(i,e,n)}const yr=new Z("rewrite"),mr=[],vr=["destroy","constructor"];function wr(t){return(e,s)=>{mr.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function xr(){return t=>{br()}}function br(t){mr.length&&(mr.forEach((e=>{t&&yr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),mr.length=0)}function Br(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(vr.includes(i)||e&&e.includes(i)))if(t.prototype){Ki(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Cr(){return t=>{st.register(t)}}function kr(){return t=>{ot.register(t)}}setTimeout((()=>br(!0)));let Rr=class extends Hi{};Rr.POINTER="pointer",Rr.BEFORE_DOWN="pointer.before_down",Rr.BEFORE_MOVE="pointer.before_move",Rr.BEFORE_UP="pointer.before_up",Rr.DOWN="pointer.down",Rr.MOVE="pointer.move",Rr.UP="pointer.up",Rr.OVER="pointer.over",Rr.OUT="pointer.out",Rr.ENTER="pointer.enter",Rr.LEAVE="pointer.leave",Rr.TAP="tap",Rr.DOUBLE_TAP="double_tap",Rr.CLICK="click",Rr.DOUBLE_CLICK="double_click",Rr.LONG_PRESS="long_press",Rr.LONG_TAP="long_tap",Rr.MENU="pointer.menu",Rr=gt([kr()],Rr);const Er={};let Tr=class extends Rr{static setList(t){this.list=t instanceof ht?t:new ht(t)}static setData(t){this.data=t}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Er,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Er,null,!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}assignMove(t){Er.x=t?this.totalX:this.moveX,Er.y=t?this.totalY:this.moveY}};Tr.BEFORE_DRAG="drag.before_drag",Tr.START="drag.start",Tr.DRAG="drag",Tr.END="drag.end",Tr.OVER="drag.over",Tr.OUT="drag.out",Tr.ENTER="drag.enter",Tr.LEAVE="drag.leave",Tr=gt([kr()],Tr);let Or=class extends Rr{static setList(t){Tr.setList(t)}static setData(t){Tr.setData(t)}};Or.DROP="drop",Or=gt([kr()],Or);let Sr=class extends Tr{};Sr.BEFORE_MOVE="move.before_move",Sr.START="move.start",Sr.MOVE="move",Sr.END="move.end",Sr=gt([kr()],Sr);let Pr=class extends Hi{};Pr.BEFORE_ROTATE="rotate.before_rotate",Pr.START="rotate.start",Pr.ROTATE="rotate",Pr.END="rotate.end",Pr=gt([kr()],Pr);let Lr=class extends Tr{};Lr.SWIPE="swipe",Lr.LEFT="swipe.left",Lr.RIGHT="swipe.right",Lr.UP="swipe.up",Lr.DOWN="swipe.down",Lr=gt([kr()],Lr);let Dr=class extends Hi{};Dr.BEFORE_ZOOM="zoom.before_zoom",Dr.START="zoom.start",Dr.ZOOM="zoom",Dr.END="zoom.end",Dr=gt([kr()],Dr);let Mr=class extends Hi{};Mr.DOWN="key.down",Mr.HOLD="key.hold",Mr.UP="key.up",Mr=gt([kr()],Mr);class Ar{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Sr.START,this.moveData)}t.path=this.moveData.path,e.emit(Sr.BEFORE_MOVE,t),e.emit(Sr.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Dr.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Dr.BEFORE_ZOOM,t),e.emit(Dr.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Pr.START,this.rotateData)}t.path=this.rotateData.path,e.emit(Pr.BEFORE_ROTATE,t),e.emit(Pr.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd()}moveEnd(){this.moveData&&(this.interaction.emit(Sr.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(Dr.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(Pr.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const{copy:Ir,toInnerPoint:Wr,scaleOfOuter:Fr,rotateOfOuter:Nr,skewOfOuter:zr}=f,Yr={},Xr={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)jr(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Vr(e[t])}},updateAllChange(t){if(Vr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Hr(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const i={x:e,y:s};t.parent&&Wr(t.parent.worldTransform,i,i,!0),Ur.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i){this.zoomOfLocal(t,Kr(t,e),s,i)},zoomOfLocal(t,e,s,i=s){Ir(Yr,t.__local),Fr(Yr,e,s,i),Gr(t,Yr),t.scaleX*=s,t.scaleY*=i},rotateOfWorld(t,e,s){this.rotateOfLocal(t,Kr(t,e),s)},rotateOfLocal(t,e,s){Ir(Yr,t.__local),Nr(Yr,e,s),Gr(t,Yr),t.rotation=r.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,i){this.skewOfLocal(t,Kr(t,e),s,i)},skewOfLocal(t,e,s,i){Ir(Yr,t.__local),zr(Yr,e,s,i),Gr(t,Yr),t.skewX=r.formatSkew(t.skewX+s),t.skewY=r.formatSkew(t.skewY+i)},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Ur=Xr,{updateAllWorldMatrix:jr,updateAllWorldOpacity:Vr,updateAllChange:Hr}=Ur;function Gr(t,e){t.x+=e.e-t.__local.e,t.y+=e.f-t.__local.f}function Kr(t,e){return t.__layout.checkUpdate(),t.parent?k.tempToInnerOf(e,t.parent.__world):e}const qr={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Zr={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:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.push(t),Qr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)$r(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:Qr,pushAllBranchStack:$r}=Zr,Jr={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},to={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?Lr.UP:t>45&&t<135?Lr.DOWN:t<=45&&t>=-45?Lr.RIGHT:Lr.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:eo.getSwipeDirection(k.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},eo=to,so=new ht,{getDragEventData:io,getDropEventData:ro,getSwipeEventData:oo}=to;class no{constructor(t){this.interaction=t}setDragData(t){this.dragData=io(t,t,t)}getList(){return this.dragging&&(Tr.list||this.interaction.selector.list||this.dragableList)||so}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Vi.middle(t)&&!Vi.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const o=s.config.move.dragEmpty&&i.target.isLeafer;this.moving=(Vi.middle(t)||s.moveMode||o)&&e,this.moving&&s.emit(Sr.START,r)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=i;this.dragData=io(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(s.emit(Sr.BEFORE_MOVE,this.dragData),s.emit(Sr.MOVE,this.dragData)):this.dragging&&(this.realDrag(),s.emit(Tr.BEFORE_DRAG,this.dragData),s.emit(Tr.DRAG,this.dragData))}dragStart(t,e){this.dragging||(this.dragging=Vi.left(t)&&e,this.dragging&&(this.interaction.emit(Tr.START,this.dragData),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=new ht(e);break}}realDrag(){const{running:t}=this.interaction,e=this.getList();if(e.length&&t){const{moveX:t,moveY:s}=this.dragData;e.forEach((e=>{Xr.moveWorld(e,t,s)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(Tr.OUT,t,s),e.emit(Tr.OVER,t,i)):e.emit(Tr.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(Tr.LEAVE,t,s,i),e.emit(Tr.ENTER,t,i,s),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,o=io(s,t,t);r&&(o.throughPath=r),o.path=i,this.moving&&e.emit(Sr.END,o),this.dragging&&(e.emit(Tr.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(k.getDistance(i,t)>s.config.pointer.swipeDistance){const t=oo(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=ro(t,this.getList(),Tr.data);e.path=this.dragEnterPath,this.interaction.emit(Or.DROP,e),this.interaction.emit(Tr.LEAVE,t,this.dragEnterPath)}dragReset(){Tr.list=Tr.data=this.dragableList=this.dragData=this.dragOverPath=this.dragEnterPath=null,this.dragging=this.moving=!1}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=X.right(o),l=X.bottom(o),d=t.x<n?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,k.move(s,d,c),k.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const ao=["move","zoom","rotate","key"];function ho(t,e,s,i,r){if(ao.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!co(t,r)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&lo(o,e,s,i,r)}}function lo(t,e,s,i,r){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!co(t,r)){s.phase=i?1:t===s.target?2:3;const r=ot.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function co(t,e){return e&&e.has(t)}const uo={getData(t){const e=t[0],s=t[1],i=k.getCenter(e.from,s.from),r=k.getCenter(e.to,s.to),o={x:r.x-i.x,y:r.y-i.y},n=k.getDistance(e.from,s.from);return{move:o,scale:k.getDistance(e.to,s.to)/n,angle:k.getChangeAngle(e.from,s.from,e.to,s.to),center:r}}},{pathHasEventType:_o,getMoveEventData:po,getZoomEventData:go,getRotateEventData:fo}=to;class yo{get dragging(){return this.dragger.dragging}get moveMode(){return ji.isHoldSpaceKey()&&this.config.move.holdSpaceKey||this.downData&&Vi.middle(this.downData)}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1},cursor:{}},this.tapCount=0,this.downKeyMap={},this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ht(e),this.transformer=new Ar(this),this.dragger=new no(this),r&&(this.config=ct.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Vi.defaultLeft(t),this.emit(Rr.BEFORE_DOWN,t,this.defaultPath),this.updateDownData(t),e&&(t.path=this.defaultPath),this.emit(Rr.DOWN,t),this.downTime=Date.now(),this.dragger.setDragData(t),Vi.left(t)&&(this.tapWait(),this.longPressWait(t)),this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;this.downData&&Vi.defaultLeft(t);const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&Vi.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Rr.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=k.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}this.dragger.moving||this.config.pointer.ignoreMove||(this.updateHoverData(t),this.emit(Rr.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t)),this.updateCursor(t))}pointerUp(t){t||(t=this.downData),this.downData&&(Vi.defaultLeft(t),this.emit(Rr.BEFORE_UP,t,this.defaultPath),this.findPath(t),this.emit(Rr.UP,t),this.emit(Rr.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null,this.updateCursor(t))}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:o}=uo.getData(e);this.rotate(fo(o,i,t)),this.zoom(go(o,r,t)),this.move(po(o,s,t))}menu(t){this.findPath(t),this.emit(Rr.MENU,t)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}keyDown(t){const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,ji.setDownCode(e),this.emit(Mr.HOLD,t,this.defaultPath),this.moveMode&&this.updateCursor()),this.emit(Mr.DOWN,t,this.defaultPath)}keyUp(t){const{code:e}=t;this.downKeyMap[e]=!1,ji.setUpCode(e),this.emit(Mr.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(Rr.OUT,t,this.overPath),this.emit(Rr.OVER,t,e)):this.emit(Rr.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(Rr.LEAVE,t,this.enterPath,e),this.emit(Rr.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Rr.LEAVE,t),this.dragger.dragging&&this.emit(Or.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[Rr.DOUBLE_TAP,Rr.DOUBLE_CLICK].some((e=>_o(t.path,e)));i<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:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,e||{through:i});return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isDrag(t){return this.dragger.getList().has(t)}updateDownData(t){t||(t=this.downData),t&&(this.findPath(t),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(),name:Rr.MOVE}),this.hoverData=t)}updateCursor(t){if(this.config.cursor.stop)return;if(t||(this.updateHoverData(),t=this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.moveMode)return this.setCursor(this.downData?"grabbing":"grab");if(!t||this.dragger.dragging)return;let e,s;const{path:i}=t;for(let t=0,r=i.length;t<r&&(e=i.list[t],s=e.cursor,!s);t++);this.setCursor(s)}setCursor(t){this.cursor=t,this.canvas.setCursor(t)}emitTap(t){this.emit(Rr.TAP,t),this.emit(Rr.CLICK,t)}emitDoubleTap(t){this.emit(Rr.DOUBLE_TAP,t),this.emit(Rr.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(Rr.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Rr.LONG_TAP,t),_o(t.path,Rr.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new H(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Wi.RESIZE,this.__onResize,this)],t.once(Xi.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--){if(r=s.list[o],lo(r,t,e,!0,i))return;r.isApp&&ho(r,t,e,!0,i)}for(let o=0,n=s.length;o<n;o++)if(r=s.list[o],r.isApp&&ho(r,t,e,!1,i),lo(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class mo{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}mo.custom={};const{toOuterOf:vo}=X;class wo{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.matrixChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),vo(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),vo(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),vo(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const xo={},bo={on(t,e,s){let i,r,o;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Bo(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let i,r,o;s&&(i="boolean"==typeof s?s:s.capture);const n=Bo(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(o=r.findIndex((t=>t.listener===e)),o>-1&&r.splice(o,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>this.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&ot.has(t)&&(e=ot.get(t,{type:t,target:this,current:this}));const i=Bo(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&(r=i[o],r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Bo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:xo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:xo)}}const Co={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e;const{CHANGE:i}=Ai,r=new Ai(i,this,t,s,e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:ko,cos:Ro}=Math,Eo=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0}),To={x:.5,y:.5},Oo={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Eo,e=this.__local,s=this.__world;if(this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation){s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f;const i=this.__;s.scaleX=t.scaleX*i.scaleX,s.scaleY=t.scaleY*i.scaleY,s.rotation=t.rotation+i.rotation,s.skewX=t.skewX+i.skewX,s.skewY=t.skewY+i.skewY}else s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY,s.rotation=t.rotation,s.skewX=t.skewX,s.skewY=t.skewY},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:n,skewY:a}=this.__;r||n||a?(r*=o,n&&(n*=o),a&&(a*=o),t.a=s*Ro(r+a),t.b=s*ko(r+a),t.c=i*-ko(r-n),t.d=i*Ro(r-n)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}const{x:s,y:i,around:r}=this.__;if(t.e=s,t.f=i,r){const{width:e,height:s}=this.__;if(e&&s){const i="center"===r?To:r,o=e*i.x,n=s*i.y;t.e-=o*t.a+n*t.c,t.f-=o*t.b+n*t.d}}this.__layout.matrixChanged=!1}},{toOuterOf:So,copyAndSpread:Po}=X,Lo={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,So(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else So(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){So(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){So(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){So(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height,this.around&&(e.matrixChanged=!0,this.__updateWorldMatrix())},__updateStrokeBounds(){Po(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Po(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Do,copy:Mo,setRadius:Ao}=k,Io={},Wo={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),this.__.hitRadius&&(Mo(Io,t),Ao(t=Io,this.__.hitRadius)),Do(t,this.__world,Io),this.__hit(Io)},__drawHitPath(t){this.__drawRenderPath(t)}},Fo={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__hasMirror||e.matrix?t.copyWorldByReset(s,null,null,i):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},No={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},zo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__hasMirror||e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,n,o),o.clear(),n.clear()):r=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:r,hideBounds:o}=e;for(let n=0,a=i.length;n<a;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{LEAF:Yo,create:Xo}=s,{toInnerPoint:Uo,toOuterPoint:jo}=f,{tempToOuterOf:Vo,copy:Ho}=k,{moveLocal:Go,zoomOfLocal:Ko,rotateOfLocal:qo,skewOfLocal:Zo}=Xr;let Qo=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 _t}get __LayoutProcessor(){return wo}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get resizeable(){return!0}get __hasMirror(){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}constructor(t){this.innerId=Xo(Yo),this.reset(t)}reset(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,rotation:0,skewX:0,skewY:0},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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t){this.leafer?this.leafer.nextRender(t):this.waitLeafer((()=>this.leafer.nextRender(t)))}__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.__leaferWait&&Jr.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.checkUpdate(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.__world[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Ho(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Ho(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Uo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){jo(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}move(t,e){Go(this,t,e)}scaleOf(t,e,s){Ko(this,Vo(t,this.localTransform),e,s)}rotateOf(t,e){qo(this,Vo(t,this.localTransform),e)}skewOf(t,e,s){Zo(this,Vo(t,this.localTransform),e,s)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};Qo=gt([Br(Co),Br(Oo),Br(Lo),Br(Wo),Br(bo),Br(Fo)],Qo);const{setByListWithHandle:$o}=X,{sort:Jo}=Zr,{localBoxBounds:tn,localEventBounds:en,localRenderBounds:sn,maskLocalBoxBounds:rn,maskLocalEventBounds:on,maskLocalRenderBounds:nn}=qr;let an=class extends Qo{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){$o(this.__layout.boxBounds,this.children,this.__hasMask?rn:tn)}__updateStrokeBounds(){$o(this.__layout.strokeBounds,this.children,this.__hasMask?on:en)}__updateRenderBounds(){$o(this.__layout.renderBounds,this.children,this.__hasMask?nn:sn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Jo),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&Jr.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Mi.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===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()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Mi.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Mi(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};an=gt([Br(zo),Br(No)],an);const hn=Z.get("plugin"),ln={power:{},list:[],onLeafer(t){ln.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function dn(t,e){const s={},{power:i,list:r}=ln;if(i||hn.error("need add PluginManager.power = LeaferUI"),r.includes(t))hn.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:hn.error(t+" non-existent")})):hn.warn("no import");try{t.run(s,e)}catch(t){hn.error(t)}}}class cn{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.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(Yi.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===Mi.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Fi(Fi.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ai.CHANGE,this.__onAttrChange,this),t.on_([Mi.ADD,Mi.REMOVE],this.__onChildEvent,this),t.on_(Fi.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:un,updateAllWorldOpacity:_n}=Xr,{pushAllChildBranch:pn,pushAllParent:gn}=Zr;const{worldBounds:fn}=qr,{setByListWithHandle:yn}=X;class mn{constructor(t){this.updatedBounds=new H,this.beforeBounds=new H,this.afterBounds=new H,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){yn(this.beforeBounds,this.updatedList.list,fn)}setAfter(){yn(this.afterBounds,this.updatedList.list,fn),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:vn,updateAllChange:wn}=Xr,{pushAllBranchStack:xn,updateWorldBoundsByBranchStack:bn}=Zr,Bn=Z.get("Layouter");class Cn{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.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.running)return;const{target:t}=this;this.times=0;try{t.emit(Ni.START),this.layoutOnce(),t.emitEvent(new Ni(Ni.END,this.layoutedBlocks,this.times))}catch(t){Bn.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Bn.warn("layouting"):this.times>3?Bn.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Fi.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Ni,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new Ni(r,a,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(un(t),e.push(t),t.isBranch&&pn(t,e),gn(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),gn(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&_n(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new Ni(o,a,this.times)),s.emitEvent(new Ni(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Ni,o=this.getBlocks(new ht(e));e.emitEvent(new Ni(s,o,this.times)),Cn.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new Ni(i,o,this.times)),e.emitEvent(new Ni(r,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(vn(t),t.isBranch){const e=[t];xn(t,e),bn(e)}else t.__updateWorldBounds();wn(t)}createBlock(t){return new mn(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(){const{target:t}=this;this.__eventIds=[t.on_(Ni.REQUEST,this.layout,this),t.on_(Ni.AGAIN,this.layoutAgain,this),t.on_(Fi.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const kn=Z.get("Renderer");class Rn{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(Ni.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new H,kn.log(e.innerName,"---\x3e");try{this.emitRender(Yi.START),this.renderOnce(t),this.emitRender(Yi.END,this.totalBounds),Ti.clearRecycled()}catch(t){this.rendering=!1,kn.error(t)}kn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?kn.warn("rendering"):this.times>3?kn.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new H,this.renderOptions={},t?(this.emitRender(Yi.BEFORE),t()):(this.requestLayout(),this.emitRender(Yi.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(Yi.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Yi.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return kn.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),o=(new H).copy(i);s.save(),r&&!Z.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,r,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),J.end(t)}__render(t,e,s){const i=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,i),this.renderBounds=s||t,this.renderOptions=i,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(i),Z.showBoundsView&&this.renderBoundsView(i),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new H;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(zi.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new H(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__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||kn.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new Yi(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Yi.REQUEST,this.update,this),t.on_(Ni.END,this.__onLayoutEnd,this),t.on_(Yi.AGAIN,this.renderAgain,this),t.on_(Wi.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:En}=X;class Tn{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Xr.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,o;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(o=i.list[t],!r||!r.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let o=t.length-1;o>-1;o--)s=t[o],!s.__.visible||e&&!s.__.isMask||(i=!!s.__.hitRadius||En(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class On{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new Tn(t,this),this.__listenEvents()}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(Ni.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(Mi.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.findPath.destroy(),this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={})}}Object.assign(e,{watcher:(t,e)=>new cn(t,e),layouter:(t,e)=>new Cn(t,e),renderer:(t,e,s)=>new Rn(t,e,s),selector:(t,e)=>new On(t,e)}),t.layout=Cn.fullLayout;const Sn=Z.get("LeaferCanvas");class Pn extends Rt{init(){const{view:e}=this.config;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;s.display||(s.display="block"),this.parentView=this.view.parentElement,t.syncDomFont&&!this.parentView&&(this.view.style.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}setCursor(t){const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,e,s=0){if(s++,t instanceof Array)t.forEach((t=>this.eachCursor(t,e,s)));else{const i="string"==typeof t&&mo.get(t);i&&s<2?this.eachCursor(i,e,s):e.push(t)}}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;if(t.hasChildNodes()){const{style:e}=s;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(s)}else Sn.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;i.width=t+"px",i.height=e+"px",this.view.width=t*s,this.view.height=e*s}updateClientBounds(){this.clientBounds=this.view.getBoundingClientRect()}startAutoLayout(t,e){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||o!==this.height){const{style:t}=e,{pixelRatio:n}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:r,height:o,pixelRatio:n},h={};ct.copyAttrs(h,this,kt),this.resize(a),void 0!==this.width&&this.resizeListener(new Wi(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Ci(CanvasRenderingContext2D.prototype),Ci(Path2D.prototype);const Ln={convert(t,e){const s=to.getBase(t),i=Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===i.pointerType&&(i.tangentialPressure=t.tangentialPressure,i.tiltX=t.tiltX,i.tiltY=t.tiltY,i.twist=t.twist),i},convertMouse(t,e){const s=to.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const s=Ln.getTouch(t),i=to.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Dn={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:r}=t;return t.shiftKey&&!i&&(i=r,r=0),i>50&&(i=Math.max(50,i/3)),r>50&&(r=Math.max(50,r/3)),{x:-i*s*2,y:-r*s*2}},getScale(e,s){let i,o=1,{zoomMode:n,zoomSpeed:a}=s;const h=e.deltaY||e.deltaX;if(n?(i=!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(i=!0)):i=!e.shiftKey&&(e.metaKey||e.ctrlKey),i){a=r.within(a,0,1);o=1-h/(25*(e.deltaY?s.delta.y:s.delta.x)*(1-a)+10),o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}},Mn={convert(t){const e=to.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{getMoveEventData:An,getZoomEventData:In,getRotateEventData:Wn}=to;class Fn extends yo{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t,e){e&&this.canvas.updateClientBounds();const{clientBounds:s}=this.canvas;return{x:t.clientX-s.x,y:t.clientY-s.y}}getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(Mn.convert(t))}onKeyUp(t){this.keyUp(Mn.convert(t))}onContextMenu(t){this.menu(Ln.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.pointerDown(Ln.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerMove(Ln.convert(t,this.getLocal(t,!0)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(Ln.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Ln.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(Ln.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(Ln.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.multiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=Ln.getTouch(t);this.pointerDown(Ln.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=Ln.getTouch(t);this.pointerMove(Ln.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=Ln.getTouch(t);this.pointerUp(Ln.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),s=this.getKeepTouchList(this.touches,e);s.length>1&&(this.multiTouch(to.getBase(t),s),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let s;const i=[];return t.forEach((t=>{s=e.find((e=>e.identifier===t.identifier)),s&&i.push({from:this.getLocal(t),to:this.getLocal(s)})})),i}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):Dn.getScale(t,e),i=this.getLocal(t),r=to.getBase(t);1!==s?this.zoom(In(i,s,r)):this.move(An(i,e.getMove?e.getMove(t,e):Dn.getMove(t,e),r))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=to.getBase(t),i=t.scale/this.lastGestureScale,o=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=r.within(n,0,1),this.zoom(In(e,i*i,s)),this.rotate(Wn(e,o/Math.PI*180*(n/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}const{mineType:Nn,fileType:zn}=pt;function Yn(s,i){t.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(Nn(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,Nn(e),s))),canvasSaveAs:(t,e,s)=>new Promise((i=>{let r=document.createElement("a");r.href=t.toDataURL(Nn(zn(e)),s),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),i()})),loadImage:e=>new Promise(((s,i)=>{const r=new Image;r.setAttribute("crossOrigin","anonymous"),r.crossOrigin="anonymous",r.onload=()=>{s(r)},r.onerror=t=>{i(t)},!e.startsWith("data:")&&t.imageSuffix&&(e+=(e.includes("?")?"&":"?")+t.imageSuffix),r.src=e}))},t.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Pn(t,e),image:t=>new Li(t),hitCanvas:(t,e)=>new Pn(t,e),interaction:(t,e,s,i)=>new Fn(t,e,s,i)}),t.name="web",t.isMobile="ontouchstart"in window,t.requestRender=function(t){window.requestAnimationFrame(t)},t.devicePixelRatio=devicePixelRatio,t.realtimeLayout=!0;const{userAgent:Xn}=navigator;function Un(t){const{config:e}=t;e.move.dragOut=!1}Xn.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0,t.syncDomFont=!0):Xn.indexOf("Safari")>-1&&-1===Xn.indexOf("Chrome")&&(t.fullImageShadow=!0),Xn.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):Xn.indexOf("Mac")>-1?t.os="Mac":Xn.indexOf("Linux")>-1&&(t.os="Linux");const jn=Z.get("LeaferTypeCreator"),Vn={list:{},register(t,e){Hn[t]?jn.repeat(t):Hn[t]=e},run(t,e){const s=Vn.list[t];s?s(e):jn.error("no",t)}},{list:Hn}=Vn;Vn.register("draw",Un),Vn.register("user",Un),Vn.register("design",(function(t){t.isApp||t.__eventIds.push(t.on_(Sr.BEFORE_MOVE,(e=>{Xr.moveWorld(t.zoomLayer,e.moveX,e.moveY)})),t.on_(Dr.BEFORE_ZOOM,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:o}=e;o*Math.abs(s)<i?o=i/s:o*Math.abs(s)>r&&(o=r/s),1!==o&&Xr.zoomOfWorld(t.zoomLayer,e,o)})))}));const Gn={},Kn={},qn={},Zn={},Qn={},$n={},Jn={},ta=Z.get("UIData");class ea extends _t{setVisible(t){this.__leaf.leafer&&(this.__leaf.leafer.watcher.hasVisible=!0),this._visible=t}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ta.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ta.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Jn)):(this.__isFills&&(this.__removeInput("fill"),Kn.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Jn)):(this.__isStrokes&&(this.__removeInput("stroke"),Kn.recycleImage("stroke",this),this.__isStrokes=!1,this.__pixelStroke&&(this.__pixelStroke=!1)),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const sa={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class ia extends ea{}class ra extends ia{get __boxStroke(){return!0}}class oa extends ea{get __boxStroke(){return!0}}const{parse:na}=Ge;const aa={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ha extends oa{}function la(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function da(t){return(e,s)=>{Zi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ca={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:n}=this.__;if((s||"all"===i)&&n&&"inside"!==r&&(e=t="center"===r?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,r="none"===s?0:n;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(o=Math.max(o,r)),this.__layout.renderShapeSpread=o,t}},ua={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:o}=this.__,n=i&&"path"===r||"all"===r,a=s.hitFill(e,o);if(n&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!n&&a&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!n){if(!a&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},_a={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&Kn.fill(s,this,t),r&&this.__drawAfterFill(t,e),i&&Kn.stroke(i,this,t,e)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=Kn.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&Gn.shadow(this,t,o,e),s&&(this.__.__isFills?Kn.fills(s,this,t):Kn.fill(s,this,t)),r&&this.__drawAfterFill(t,e),a&&Gn.innerShadow(this,t,o,e),i&&(this.__.__isStrokes?Kn.strokes(i,this,t,e):Kn.stroke(i,this,t,e)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?Kn.fills(s,this,t):Kn.fill(s,this,t)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Kn.strokes(i,this,t,e):Kn.stroke(i,this,t,e))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&(this.__.__pixelFill?Kn.fills(s,this,t):Kn.fill("#000000",this,t)),i&&(this.__.__pixelStroke?Kn.strokes(i,this,t,e):Kn.stroke("#000000",this,t,e))}},pa={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:o,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(o,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};var ga;let fa=ga=class extends Qo{set scale(t){"number"==typeof t?this.scaleX=this.scaleY=t:(this.scaleX=t.x,this.scaleY=t.y)}get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}reset(t){}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Ge.toCanvasData(e,!0):e:[]}getPathString(t){return Ge.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Kn.compute("fill",this),e&&Kn.compute("stroke",this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?bi.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return $n.export(this,t,e)}clone(){return ga.one(this.toJSON())}static one(t,e,s,i,r){return st.get(t.tag||this.prototype.__tag,t,e,s,i,r)}destroy(){this.fill=this.stroke=null,super.destroy()}};gt([_r(ea)],fa.prototype,"__",void 0),gt([Qi("")],fa.prototype,"id",void 0),gt([Qi("")],fa.prototype,"name",void 0),gt([Qi("")],fa.prototype,"className",void 0),gt([nr("pass-through")],fa.prototype,"blendMode",void 0),gt([ar(1)],fa.prototype,"opacity",void 0),gt([ar(!0)],fa.prototype,"visible",void 0),gt([lr(!1)],fa.prototype,"isMask",void 0),gt([dr(!1)],fa.prototype,"isEraser",void 0),gt([hr(0)],fa.prototype,"zIndex",void 0),gt([Qi()],fa.prototype,"locked",void 0),gt([$i(0)],fa.prototype,"x",void 0),gt([$i(0)],fa.prototype,"y",void 0),gt([er(100)],fa.prototype,"width",void 0),gt([er(100)],fa.prototype,"height",void 0),gt([Ji(1)],fa.prototype,"scaleX",void 0),gt([Ji(1)],fa.prototype,"scaleY",void 0),gt([tr(0)],fa.prototype,"rotation",void 0),gt([tr(0)],fa.prototype,"skewX",void 0),gt([tr(0)],fa.prototype,"skewY",void 0),gt([$i()],fa.prototype,"around",void 0),gt([Qi(!1)],fa.prototype,"draggable",void 0),gt([cr(!0)],fa.prototype,"hittable",void 0),gt([cr("path")],fa.prototype,"hitFill",void 0),gt([rr("path")],fa.prototype,"hitStroke",void 0),gt([cr(!0)],fa.prototype,"hitChildren",void 0),gt([cr(!0)],fa.prototype,"hitSelf",void 0),gt([cr()],fa.prototype,"hitRadius",void 0),gt([ur("")],fa.prototype,"cursor",void 0),gt([nr()],fa.prototype,"fill",void 0),gt([rr()],fa.prototype,"stroke",void 0),gt([rr("inside")],fa.prototype,"strokeAlign",void 0),gt([rr(1)],fa.prototype,"strokeWidth",void 0),gt([rr("none")],fa.prototype,"strokeCap",void 0),gt([rr("miter")],fa.prototype,"strokeJoin",void 0),gt([rr()],fa.prototype,"dashPattern",void 0),gt([rr()],fa.prototype,"dashOffset",void 0),gt([rr(10)],fa.prototype,"miterLimit",void 0),gt([sr()],fa.prototype,"cornerRadius",void 0),gt([sr()],fa.prototype,"cornerSmoothing",void 0),gt([la()],fa.prototype,"shadow",void 0),gt([la()],fa.prototype,"innerShadow",void 0),gt([la()],fa.prototype,"blur",void 0),gt([la()],fa.prototype,"backgroundBlur",void 0),gt([la()],fa.prototype,"grayscale",void 0),gt([wr(Qo.prototype.reset)],fa.prototype,"reset",null),gt([wr(Us.drawPathByData)],fa.prototype,"__drawPathByData",null),fa=ga=gt([Br(ca),Br(ua),Br(_a),xr()],fa);let ya=class extends fa{get __tag(){return"Group"}get resizeable(){return!1}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.__setBranch()}__setBranch(){this.isBranch=!0,this.children||(this.children=[])}set(t){if(t.children){const{children:e}=t;let s;delete t.children,this.children?this.removeAll(!0):this.__setBranch(),super.set(t),e.forEach((t=>{s=st.get(t.tag,t),this.add(s)})),t.children=e}else super.set(t)}toJSON(){const t=super.toJSON();return t.children=this.children.map((t=>t.toJSON())),t}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){}};gt([_r(ia)],ya.prototype,"__",void 0),ya=gt([Br(an),Cr()],ya);let ma=class extends fa{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};gt([_r(oa)],ma.prototype,"__",void 0),ma=gt([Br(pa),Cr()],ma);const va=ma.prototype,wa=ya.prototype,xa={},{copy:ba,add:Ba}=X;let Ca=class extends ya{get __tag(){return"Box"}get resizeable(){return!0}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;ba(xa,t),super.__updateRenderBounds(),Ba(t,xa)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};gt([_r(ra)],Ca.prototype,"__",void 0),gt([or("show")],Ca.prototype,"overflow",void 0),gt([wr(va.__updateStrokeSpread)],Ca.prototype,"__updateStrokeSpread",null),gt([wr(va.__updateRenderSpread)],Ca.prototype,"__updateRectRenderSpread",null),gt([wr(va.__updateBoxBounds)],Ca.prototype,"__updateBoxBounds",null),gt([wr(va.__updateStrokeBounds)],Ca.prototype,"__updateStrokeBounds",null),gt([wr(va.__updateRenderBounds)],Ca.prototype,"__updateRectRenderBounds",null),gt([wr(va.__updateChange)],Ca.prototype,"__updateRectChange",null),gt([wr(va.__drawPathByData)],Ca.prototype,"__drawPathByData",null),gt([wr(va.__render)],Ca.prototype,"__renderRect",null),gt([wr(wa.__render)],Ca.prototype,"__renderGroup",null),Ca=gt([xr(),Cr()],Ca);let ka=class extends Ca{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};gt([_r(class extends ra{})],ka.prototype,"__",void 0),gt([or("hide")],ka.prototype,"overflow",void 0),ka=gt([Cr()],ka);const{moveTo:Ra,closePath:Ea,ellipse:Ta}=cs;let Oa=class extends fa{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=e/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&Ta(h,n,a,n*i,a*i,0,r,o,!1),Ta(h,n,a,n,a,0,o,r,!0),i<1&&Ea(h)):(i<1&&(Ta(h,n,a,n*i,a*i),Ra(h,e,a)),Ta(h,n,a,n,a,0,360,0,!0)),"node"===t.name&&(this.__.path=Ge.toCanvasData(h,!0))):r||o?(Ra(h,n,a),Ta(h,n,a,n,a,0,r,o,!1),Ea(h)):Ta(h,n,a,n,a)}};gt([_r(class extends ea{get __boxStroke(){return!0}})],Oa.prototype,"__",void 0),gt([sr(0)],Oa.prototype,"innerRadius",void 0),gt([sr(0)],Oa.prototype,"startAngle",void 0),gt([sr(0)],Oa.prototype,"endAngle",void 0),Oa=gt([Cr()],Oa);const{sin:Sa,cos:Pa,PI:La}=Math,{moveTo:Da,lineTo:Ma,closePath:Aa,drawPoints:Ia}=cs,{toBounds:Wa}=xi;let Fa=class extends fa{get __tag(){return"Polygon"}get resizeable(){return!this.points}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Ia(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,r=e/2,o=s/2;Da(t,r,0);for(let e=1;e<i;e++)Ma(t,r+r*Sa(2*e*La/i),o-o*Pa(2*e*La/i))}Aa(t)}__updateRenderPath(){this.__.points&&this.__.curve?Ia(this.__.__pathForRender=[],this.__.points,this.__.curve,!0):super.__updateRenderPath()}__updateBoxBounds(){this.__.points?(Wa(this.__.__pathForRender,this.__layout.boxBounds),this.__updateNaturalSize()):super.__updateBoxBounds()}};gt([_r(class extends ea{})],Fa.prototype,"__",void 0),gt([sr(3)],Fa.prototype,"sides",void 0),gt([sr()],Fa.prototype,"points",void 0),gt([sr(0)],Fa.prototype,"curve",void 0),Fa=gt([Cr()],Fa);const{sin:Na,cos:za,PI:Ya}=Math,{moveTo:Xa,lineTo:Ua,closePath:ja}=cs;let Va=class extends fa{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Xa(n,r,0);for(let t=1;t<2*s;t++)Ua(n,r+(t%2==0?r:r*i)*Na(t*Ya/s),o-(t%2==0?o:o*i)*za(t*Ya/s));ja(n)}};gt([_r(class extends ea{})],Va.prototype,"__",void 0),gt([sr(5)],Va.prototype,"corners",void 0),gt([sr(.382)],Va.prototype,"innerRadius",void 0),Va=gt([Cr()],Va);const{moveTo:Ha,lineTo:Ga,drawPoints:Ka}=cs,{rotate:qa,getAngle:Za,getDistance:Qa,defaultPoint:$a}=k,{toBounds:Ja}=xi;let th=class extends fa{get __tag(){return"Line"}get resizeable(){return!this.points}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&qa(s,e),s}set toPoint(t){this.width=Qa($a,t),this.rotation=Za($a,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];this.__.points?Ka(t,this.__.points,!1):(Ha(t,0,0),Ga(t,this.width,0))}__updateRenderPath(){this.__.points&&this.__.curve?Ka(this.__.__pathForRender=[],this.__.points,this.__.curve,!1):super.__updateRenderPath()}__updateBoxBounds(){this.points?(Ja(this.__.__pathForRender,this.__layout.boxBounds),this.__updateNaturalSize()):super.__updateBoxBounds()}};gt([_r(class extends ea{})],th.prototype,"__",void 0),gt([ir("center")],th.prototype,"strokeAlign",void 0),gt([er(0)],th.prototype,"height",void 0),gt([sr()],th.prototype,"points",void 0),gt([sr(0)],th.prototype,"curve",void 0),th=gt([Cr()],th);let eh=class extends ma{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(Ii.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};gt([_r(ha)],eh.prototype,"__",void 0),gt([er("")],eh.prototype,"url",void 0),eh=gt([Cr()],eh);let sh=class extends ma{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new T(t.__world);r.invert();const o=new T;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.preMultiply(o),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};gt([_r(ha)],sh.prototype,"__",void 0),gt([da(100)],sh.prototype,"width",void 0),gt([da(100)],sh.prototype,"height",void 0),gt([da(t.devicePixelRatio)],sh.prototype,"pixelRatio",void 0),gt([da(!0)],sh.prototype,"smooth",void 0),gt([cr("all")],sh.prototype,"hitFill",void 0),sh=gt([Cr()],sh);const{copyAndSpread:ih,includes:rh,spread:oh}=X;let nh=class extends fa{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),this.__.__letterSpacing<0?this.__drawPathByData(t):i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;t.rect(s,i,r,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Zn.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{lineHeight:s,letterSpacing:i,fontFamily:r,fontSize:o,fontWeight:n,italic:a,textCase:h}=t;t.__lineHeight=sa.number(s,o),t.__letterSpacing=sa.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==n?n+" ":""}${o}px ${r}`,this.__updateTextDrawData();const{bounds:l}=t.__textDrawData,d=e.boxBounds;t.__lineHeight<o&&oh(l,o/2);const c=t.__getInput("width"),u=t.__getInput("height");c&&u?super.__updateBoxBounds():(d.x=c?0:l.x,d.y=u?0:l.y,d.width=c||l.width,d.height=u||l.height,this.__updateNaturalSize());const _=rh(d,l)?d:l;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){ih(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};gt([_r(class extends ea{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=aa[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],nh.prototype,"__",void 0),gt([er(0)],nh.prototype,"width",void 0),gt([er(0)],nh.prototype,"height",void 0),gt([er(0)],nh.prototype,"padding",void 0),gt([ir("outside")],nh.prototype,"strokeAlign",void 0),gt([er("")],nh.prototype,"text",void 0),gt([er("L")],nh.prototype,"fontFamily",void 0),gt([er(12)],nh.prototype,"fontSize",void 0),gt([er("normal")],nh.prototype,"fontWeight",void 0),gt([er(!1)],nh.prototype,"italic",void 0),gt([er("none")],nh.prototype,"textCase",void 0),gt([er("none")],nh.prototype,"textDecoration",void 0),gt([er(0)],nh.prototype,"letterSpacing",void 0),gt([er({type:"percent",value:150})],nh.prototype,"lineHeight",void 0),gt([er(0)],nh.prototype,"paraIndent",void 0),gt([er(0)],nh.prototype,"paraSpacing",void 0),gt([er("left")],nh.prototype,"textAlign",void 0),gt([er("top")],nh.prototype,"verticalAlign",void 0),gt([er("show")],nh.prototype,"textOverflow",void 0),nh=gt([Cr()],nh);const{toBounds:ah}=xi;let hh=class extends fa{get __tag(){return"Path"}get resizeable(){return!1}constructor(t){super(t)}__updateBoxBounds(){ah(this.__.path,this.__layout.boxBounds),this.__updateNaturalSize()}};gt([_r(class extends ea{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=na(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],hh.prototype,"__",void 0),gt([sr()],hh.prototype,"path",void 0),gt([sr()],hh.prototype,"windingRule",void 0),gt([ir("center")],hh.prototype,"strokeAlign",void 0),hh=gt([Cr()],hh);let lh=class extends ya{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new hh(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}paint(){this.pathElement.forceUpdate("path")}clear(){this.removeAll(!0)}};gt([_r(class extends ia{})],lh.prototype,"__",void 0),lh=gt([Br(Ts,["beginPath"]),Cr()],lh);const dh=Z.get("Leafer");let ch=class extends ya{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}constructor(t,e){super(e),this.zoomLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{holdSpaceKey:!0,dragOut:!0,autoDistance:2}},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)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:r}=this;Vn.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new at,this.hitCanvasManager=new dt,i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),ln.onLeafer(this)}set(t){this.children?super.set(t):setTimeout((()=>{super.set(t)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(Xi.RESTART):this.emitLeafer(Xi.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(Xi.STOP))}resize(t){const e=ct.copyAttrs({},t,kt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}updateCursor(){this.interaction&&this.interaction.updateCursor()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new Wi(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,kt),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.isLeafer=!!t,this.__level=1}setZoomLayer(t){this.zoomLayer=t}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(kt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&kt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,kt);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onCreated(){this.created=!0}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(Xi.BEFORE_READY),this.emitLeafer(Xi.READY),this.emitLeafer(Xi.AFTER_READY),Jr.run(this.__readyWait))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Xi.VIEW_READY),Jr.run(this.__viewReadyWait))}__onRenderEnd(t){this.viewReady||this.__onViewReady();const e=this.__checkViewCompleted();e&&this.__onViewCompleted(),this.viewCompleted=e,Jr.run(this.__nextRenderWait)}__checkViewCompleted(){return this.viewReady&&!this.watcher.changed&&Ti.isComplete}__onViewCompleted(){this.viewCompleted||(this.emitLeafer(Xi.VIEW_COMPLETED),Jr.run(this.__viewCompletedWait))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitReady(t){this.ready?t():this.__readyWait.push(t)}waitViewReady(t){this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t){this.viewCompleted?t():(this.__viewCompletedWait.push(t),this.running||this.start())}nextRender(t){this.watcher&&!this.watcher.changed?t():this.__nextRenderWait.push(t)}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new Xi(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(Xi.START,(()=>J.end(t))),this.once(Ni.END,(()=>this.__onReady())),this.once(Yi.START,(()=>this.__onCreated())),this.__eventIds.push(this.on_(Fi.DATA,this.__onWatchData,this),this.on_(Yi.END,this.__onRenderEnd,this),this.on_(Ni.CHECK_UPDATE,this.__checkUpdateLayout,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){setTimeout((()=>{if(!this.destroyed)try{this.stop(),this.emitEvent(new Xi(Xi.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{Ti.clearRecycled()}),100)}catch(t){dh.error(t)}}))}};gt([_r(class extends ia{})],ch.prototype,"__",void 0),gt([er()],ch.prototype,"pixelRatio",void 0),ch=gt([Cr()],ch);let uh=class extends ch{get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(Ai.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new ch(t);return this.add(e),e}add(t){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t),this.__listenChildEvents(t)}__onPropertyChange(){Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("surface")}))}__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()}__checkViewCompleted(){return this.children.every((t=>t.viewCompleted))}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(Ni.END,(()=>this.__onReady())),t.once(Yi.START,(()=>this.__onCreated())),t.once(Yi.END,(t=>this.__onRenderEnd(t))),this.realCanvas&&this.__eventIds.push(t.on_(Yi.END,this.__onChildRenderEnd,this))}};uh=gt([Cr()],uh);const{get:_h,rotateOfOuter:ph,translate:gh,scaleOfOuter:fh,scale:yh,rotate:mh}=f;const{get:vh,translate:wh}=f;function xh(t,e,s,i){let{width:r,height:o}=e;const{opacity:n,mode:a,offset:h,scale:l,rotation:d,blendMode:c}=s,u=i.width===r&&i.height===o;c&&(t.blendMode=c);const _=t.data={mode:a};switch(a){case"strench":u||(r=i.width,o=i.height),(i.x||i.y)&&(_.transform=vh(),wh(_.transform,i.x,i.y));break;case"clip":(h||l||d)&&function(t,e,s,i,r){const o=_h();gh(o,e.x,e.y),s&&gh(o,s.x,s.y),i&&("number"==typeof i?yh(o,i):yh(o,i.x,i.y),t.scaleX=o.a,t.scaleY=o.d),r&&mh(o,r),t.transform=o}(_,i,h,l,d);break;case"repeat":(!u||l||d)&&function(t,e,s,i,r,o){const n=_h();if(o)switch(mh(n,o),o){case 90:gh(n,i,0);break;case 180:gh(n,s,i);break;case 270:gh(n,0,s)}gh(n,e.x,e.y),r&&(fh(n,e,r),t.scaleX=t.scaleY=r),t.transform=n}(_,i,r,o,l,d);break;default:u&&!d||function(t,e,s,i,r,o){const n=_h(),a=o&&180!==o,h=s.width/(a?r:i),l=s.height/(a?i:r),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-i*d)/2,u=s.y+(s.height-r*d)/2;gh(n,c,u),yh(n,d),o&&ph(n,{x:s.x+s.width/2,y:s.y+s.height/2},o),t.scaleX=t.scaleY=d,t.transform=n}(_,a,i,r,o,d)}_.width=r,_.height=o,n&&(_.opacity=n)}function bh(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function Bh(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new Ii(t,e))}const{get:Ch,scale:kh,copy:Rh}=f;function Eh(e,s,i){let{scaleX:r,scaleY:o}=e.__world;const n=r+"-"+o;if(s.patternId===n||e.destroyed)return!1;{s.patternId=n,r=Math.abs(r),o=Math.abs(o);const{image:e,data:a}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:u,height:_,scaleX:p,scaleY:g,opacity:f,transform:y,mode:m}=a;p&&(c=Ch(),Rh(c,y),kh(c,1/p,1/g),r*=p,o*=g),r*=i,o*=i,u*=r,_*=o,(u>h||_>l)&&(d=Math.max(u/h,_/l)),d&&(r/=d,o/=d,u/=d,_/=d),p&&(r/=p,o/=g),(y||1!==r||1!==o)&&(c||(c=Ch(),y&&Rh(c,y)),kh(c,1/r,1/o));const v=t.canvas.createPattern(e.getCanvas(u<1?1:u,_<1?1:_,f),"repeat"===m?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform&&(s.transform=null),c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}}function Th(t,e,s,i){const{scaleX:r,scaleY:o}=t.__world;if(s.data&&s.patternId!==r+"-"+o){if(i)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=r*e.pixelRatio,n*=o*e.pixelRatio,i=t>4096||n>4096}else i=!1;if(i){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?s.patternTask||(s.patternTask=Ti.patternTasker.add((()=>ft(this,void 0,void 0,(function*(){s.patternTask=null,e.bounds.hit(t.__world)&&Eh(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300)):Eh(t,s,e.pixelRatio),!1}return!1}function Oh(t,e){const s="fill"===t?e._fill:e._stroke;if(s instanceof Array){let i,r,o,n;for(let a=0,h=s.length;a<h;a++)i=s[a].image,n=i&&i.url,n&&(r||(r={}),r[n]=!0,Ti.recycle(i),i.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),i.unload(s[a].loadId,!o.some((t=>t.url===n)))));return r}return null}function Sh(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,o)}function Ph(t,e,s,i){const{strokeAlign:r}=e.__,o="string"!=typeof t;switch(r){case"center":s.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?Mh(t,!0,e,s):Dh(e,s);break;case"inside":Lh("inside",t,o,e,s,i);break;case"outside":Lh("outside",t,o,e,s,i)}}function Lh(t,e,s,i,r,o){const{strokeWidth:n,__font:a}=i.__,h=r.getSameCanvas(!0);h.setStroke(s?void 0:e,2*n,i.__),h.font=a,s?Mh(e,!0,i,h):Dh(i,h),h.blendMode="outside"===t?"destination-out":"destination-in",Sh(i,h),h.blendMode="normal",i.__hasMirror||o.matrix?r.copyWorldByReset(h):r.copyWorldToInner(h,i.__world,i.__layout.renderBounds),h.recycle()}function Dh(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[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)})),r&&e.strokeRect(s.x,s.y+r,s.width,o)}function Mh(t,e,s,i){let r;for(let o=0,n=t.length;o<n;o++)r=t[o],r.image&&Th(s,i,r,!1)||r.style&&(i.strokeStyle=r.style,r.blendMode?(i.saveBlendMode(r.blendMode),e?Dh(s,i):i.stroke(),i.restoreBlendMode()):e?Dh(s,i):i.stroke())}const{getSpread:Ah,getOuterOf:Ih,getByMove:Wh,getIntersectData:Fh}=X;const Nh={x:.5,y:0},zh={x:.5,y:1};function Yh(t,e,s){let i;for(let r=0,o=e.length;r<o;r++)i=e[r],t.addColorStop(i.offset,Qn.string(i.color,s))}const{set:Xh,getAngle:Uh,getDistance:jh}=k,{get:Vh,rotateOfOuter:Hh,scaleOfOuter:Gh}=f,Kh={x:.5,y:.5},qh={x:.5,y:1},Zh={},Qh={};const{set:$h,getAngle:Jh,getDistance:tl}=k,{get:el,rotateOfOuter:sl,scaleOfOuter:il}=f,rl={x:.5,y:.5},ol={x:.5,y:1},nl={},al={};let hl;function ll(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=i.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:Qn.string(a,h)};case"image":return function(t,e,s,i,r){const o={type:s.type},n=o.image=Ti.get(s),a=(r||n.loading)&&{target:t,image:n,attrName:e,attrValue:s};return n.ready?(bh(t,e,n)&&xh(o,n,s,i),r&&(Bh(Ii.LOAD,a),Bh(Ii.LOADED,a))):n.error?r&&(t.forceUpdate("surface"),a.error=n.error,Bh(Ii.ERROR,a)):(r&&Bh(Ii.LOAD,a),o.loadId=n.load((()=>{t.destroyed||(bh(t,e,n)&&(xh(o,n,s,i),t.forceUpdate("surface")),Bh(Ii.LOADED,a))}),(e=>{t.forceUpdate("surface"),a.error=e,Bh(Ii.ERROR,a)}))),o}(i,e,s,r,!hl||!hl[s.url]);case"linear":return function(e,s){let{from:i,to:r,type:o,blendMode:n,opacity:a}=e;i||(i=Nh),r||(r=zh);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);Yh(h,e.stops,a);const l={type:o,style:h};return n&&(l.blendMode=n),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=Kh),r||(r=qh);const{x:l,y:d,width:c,height:u}=s;let _;Xh(Zh,l+i.x*c,d+i.y*u),Xh(Qh,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=Vh(),Gh(_,Zh,c/u*(h||1),1),Hh(_,Zh,Uh(Zh,Qh)+90));const p=t.canvas.createRadialGradient(Zh.x,Zh.y,0,Zh.x,Zh.y,jh(Zh,Qh));Yh(p,e.stops,n);const g={type:o,style:p,transform:_};return a&&(g.blendMode=a),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=rl),r||(r=ol);const{x:l,y:d,width:c,height:u}=s;$h(nl,l+i.x*c,d+i.y*u),$h(al,l+r.x*c,d+r.y*u);const _=el(),p=Jh(nl,al);t.conicGradientRotate90?(il(_,nl,c/u*(h||1),1),sl(_,nl,p+90)):(il(_,nl,1,c/u*(h||1)),sl(_,nl,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,nl.x,nl.y):t.canvas.createRadialGradient(nl.x,nl.y,0,nl.x,nl.y,tl(nl,al));Yh(g,e.stops,n);const f={type:o,style:g,transform:_};return a&&(f.blendMode=a),f}(s,r);default:return s.r?{type:"solid",style:Qn.string(s)}:void 0}}var dl=Object.freeze({__proto__:null,compute:function(t,e){const s=[],i=e.__;let r,o,n=i.__input[t];n instanceof Array||(n=[n]),hl=Oh(t,i);for(let i=0,o=n.length;i<o;i++)r=ll(t,n[i],e),r&&s.push(r);if(i["_"+t]=s.length?s:void 0,1===n.length){const t=n[0];"image"===t.type&&(o=Ti.isPixel(t))}"fill"===t?i.__pixelFill=o:i.__pixelStroke=o},drawTextStroke:Dh,fill:function(t,e,s){s.fillStyle=t,e.__.__font?Sh(e,s):e.__.windingRule?s.fill(e.__.windingRule):s.fill()},fillText:Sh,fills:function(t,e,s){let i;const{windingRule:r,__font:o}=e.__;for(let n=0,a=t.length;n<a;n++)i=t[n],i.image&&Th(e,s,i,!o)||i.style&&(s.fillStyle=i.style,i.transform?(s.save(),s.transform(i.transform),i.blendMode&&(s.blendMode=i.blendMode),o?Sh(e,s):r?s.fill(r):s.fill(),s.restore()):i.blendMode?(s.saveBlendMode(i.blendMode),o?Sh(e,s):r?s.fill(r):s.fill(),s.restoreBlendMode()):o?Sh(e,s):r?s.fill(r):s.fill())},recycleImage:Oh,shape:function(t,e,s){const i=e.getSameCanvas();let r,o,n,a;const{__world:h}=t;let{scaleX:l,scaleY:d}=h;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=n=Ih(h,s.matrix)):r=n=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=Fh(i?Ah(e.bounds,i*l,i*d):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=Ih(h,o),r=Wh(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(i,s),{canvas:i,matrix:o,bounds:r,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s,i){const r=e.__,{strokeWidth:o,strokeAlign:n,__font:a}=r;if(o)if(a)Ph(t,e,s,i);else switch(n){case"center":s.setStroke(t,o,r),s.stroke();break;case"inside":s.save(),s.setStroke(t,2*o,r),r.windingRule?s.clip(r.windingRule):s.clip(),s.stroke(),s.restore();break;case"outside":const n=s.getSameCanvas(!0);n.setStroke(t,2*o,e.__),e.__drawRenderPath(n),n.stroke(),r.windingRule?n.clip(r.windingRule):n.clip(),n.clearWorld(e.__layout.renderBounds),e.__hasMirror||i.matrix?s.copyWorldByReset(n):s.copyWorldToInner(n,e.__world,e.__layout.renderBounds),n.recycle()}},strokeText:Ph,strokes:function(t,e,s,i){const r=e.__,{strokeWidth:o,strokeAlign:n,__font:a}=r;if(o)if(a)Ph(t,e,s,i);else switch(n){case"center":s.setStroke(void 0,o,r),Mh(t,!1,e,s);break;case"inside":s.save(),s.setStroke(void 0,2*o,r),r.windingRule?s.clip(r.windingRule):s.clip(),Mh(t,!1,e,s),s.restore();break;case"outside":const{renderBounds:n}=e.__layout,a=s.getSameCanvas(!0);e.__drawRenderPath(a),a.setStroke(void 0,2*o,e.__),Mh(t,!1,e,a),r.windingRule?a.clip(r.windingRule):a.clip(),a.clearWorld(n),e.__hasMirror||i.matrix?s.copyWorldByReset(a):s.copyWorldToInner(a,e.__world,n),a.recycle()}}});const{copy:cl,toOffsetOutBounds:ul}=X,_l={},pl={};function gl(e,s,i,r){const{bounds:o,shapeBounds:n}=r;if(t.fullImageShadow){if(cl(_l,e.bounds),_l.x+=s.x-n.x,_l.y+=s.y-n.y,i){const{matrix:t}=r;_l.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),_l.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),_l.width*=i,_l.height*=i}e.copyWorld(r.canvas,e.bounds,_l)}else i&&(cl(_l,s),_l.x-=s.width/2*(i-1),_l.y-=s.height/2*(i-1),_l.width*=i,_l.height*=i),e.copyWorld(r.canvas,n,i?_l:s)}const{toOffsetOutBounds:fl}=X,yl={};var ml=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;fl(d,yl),h.forEach(((h,f)=>{p.save(),p.setWorldShadow(yl.offsetX+h.x*u,yl.offsetY+h.y*_,h.blur*u),o=h.spread?1-2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,gl(p,yl,o,s),p.restore(),l?(p.copyWorld(p,d,n,"copy"),p.copyWorld(l,n,n,"source-out"),r=n):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,h.color,"source-in"),t.__hasMirror||i.matrix?e.copyWorldByReset(p,r,n,h.blendMode):e.copyWorldToInner(p,r,a.renderBounds,h.blendMode),g&&f<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;ul(d,pl),h.forEach(((h,f)=>{p.setWorldShadow(pl.offsetX+h.x*u,pl.offsetY+h.y*_,h.blur*u,h.color),o=h.spread?1+2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,gl(p,pl,o,s),r=d,h.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,n,"copy"),r=n),l?p.copyWorld(l,n,n,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),t.__hasMirror||i.matrix?e.copyWorldByReset(p,r,n,h.blendMode):e.copyWorldToInner(p,r,a.renderBounds,h.blendMode),g&&f<g&&p.clear()})),p.recycle()}});const vl=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",wl=vl+"_#~&*+\\=|≮≯≈≠=…",xl=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 bl(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Bl=bl("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Cl=bl("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),kl=bl(vl),Rl=bl(wl),El=bl("- —/~|┆·");var Tl;!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"}(Tl||(Tl={}));const{Letter:Ol,Single:Sl,Before:Pl,After:Ll,Symbol:Dl,Break:Ml}=Tl;function Al(t){return Bl[t]?Ol:El[t]?Ml:Cl[t]?Pl:kl[t]?Ll:Rl[t]?Dl:xl.test(t)?Sl:Ol}const Il={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Wl(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Fl}=Il,{Letter:Nl,Single:zl,Before:Yl,After:Xl,Symbol:Ul,Break:jl}=Tl;let Vl,Hl,Gl,Kl,ql,Zl,Ql,$l,Jl,td,ed,sd,id,rd,od,nd,ad=[];function hd(t,e){Jl&&!$l&&($l=Jl),Vl.data.push({char:t,width:e}),Gl+=e}function ld(){Kl+=Gl,Vl.width=Gl,Hl.words.push(Vl),Vl={data:[]},Gl=0}function dd(){rd&&(od.paraNumber++,Hl.paraStart=!0,rd=!1),Jl&&(Hl.startCharSize=$l,Hl.endCharSize=Jl,$l=0),Hl.width=Kl,nd.width&&Fl(Hl),ad.push(Hl),Hl={words:[]},Kl=0}const cd={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,o=0,n=s.__getInput("width")||0,a=s.__getInput("height")||0;const{textDecoration:h,textOverflow:l,__font:d,padding:c}=s;if(c){const[t,e,s,h]=r.fourNumber(c);n&&(i=h,n-=e+h),a&&(o=t,a-=t+s)}const u={bounds:{x:i,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=d};return function(e,s,i){od=e,ad=e.rows,nd=e.bounds;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=t,{width:h,height:l}=nd;if(h||l||r||"none"!==n){rd=!0,ed=null,$l=Ql=Jl=Gl=Kl=0,Vl={data:[]},Hl={words:[]};for(let t=0,e=s.length;t<e;t++)Zl=s[t],"\n"===Zl?(Gl&&ld(),Hl.paraEnd=!0,dd(),rd=!0):(td=Al(Zl),td===Nl&&"none"!==n&&(Zl=Wl(Zl,n,!Gl)),Ql=a.measureText(Zl).width,r&&(r<0&&(Jl=Ql),Ql+=r),sd=td===zl&&(ed===zl||ed===Nl)||ed===zl&&td!==Xl,id=!(td!==Yl&&td!==zl||ed!==Ul&&ed!==Xl),ql=rd&&o?h-o:h,h&&Kl+Gl+Ql>ql&&(id||(id=td===Nl&&ed==Xl),sd||id||td===jl||td===Yl||td===zl||Gl+Ql>ql?(Gl&&ld(),dd()):dd())," "===Zl&&!0!==rd&&Kl+Gl===0||(td===jl?(" "===Zl&&Gl&&ld(),hd(Zl,Ql),ld()):sd||id?(Gl&&ld(),hd(Zl,Ql)):hd(Zl,Ql)),ed=td);Gl&&ld(),Kl&&dd(),ad.length>0&&(ad[ad.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{od.paraNumber++,ad.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:o,__letterSpacing:n,textAlign:a,verticalAlign:h,paraSpacing:l,textOverflow:d}=e;let c,u,_,{x:p,y:g,width:f,height:y}=i,m=r*s.length+(l?l*(t.paraNumber-1):0),v=o;if("show"!==d&&m>y)m=Math.max(y,r),t.overflow=s.length;else switch(h){case"middle":g+=(y-m)/2;break;case"bottom":g+=y-m}v+=g;for(let o=0,h=s.length;o<h;o++){switch(c=s[o],c.x=p,a){case"center":c.x+=(f-c.width)/2;break;case"right":c.x+=f-c.width}c.paraStart&&l&&o>0&&(v+=l),c.y=v,v+=r,t.overflow>o&&v>m&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,_=c.width,n<0&&(c.width<0?(_=-c.width+e.fontSize+n,u-=_,_+=e.fontSize):_-=n),u<i.x&&(i.x=u),_>i.width&&(i.width=_)}i.y=g,i.height=m}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?0:l>.01?1:2,2===c?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,n),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=i[r-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<u));t--){if(h<u&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(u,l),"none"!==h&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},ud={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},_d={export(t,e,s){return function(t){pd||(pd=new Ei);return new Promise((e=>{pd.add((()=>ft(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((r=>{const{leafer:o}=t;o?o.waitViewCompleted((()=>ft(this,void 0,void 0,(function*(){let t,n,a,{canvas:h}=o,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}a=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):yield h.toDataURL(e,t),i({data:a}),r(),l&&h.recycle()})))):(i({data:!1}),r())}))))}};let pd;Object.assign(Kn,dl),Object.assign(Gn,ml),Object.assign(Zn,cd),Object.assign(Qn,ud),Object.assign($n,_d),Yn();export{qn as Animate,zi as AnimateEvent,uh as App,G as AutoBounds,te as BezierHelper,H as Bounds,X as BoundsHelper,Ca as Box,an as Branch,Zr as BranchHelper,zo as BranchRender,sh as Canvas,at as CanvasManager,Mi as ChildEvent,Qn as ColorConvert,e as Creator,mo as Cursor,ct as DataHelper,Z as Debug,Tr as DragEvent,Or as DropEvent,Gn as Effect,Oa as Ellipse,le as EllipseHelper,Di as Event,ot as EventCreator,$n as Export,pt as FileHelper,ka as Frame,ya as Group,dt as HitCanvasManager,eh as Image,Ii as ImageEvent,Ti as ImageManager,s as IncrementId,Fn as Interaction,yo as InteractionBase,to as InteractionHelper,Mr as KeyEvent,ji as Keyboard,Ni as LayoutEvent,Cn as Layouter,Qo as Leaf,Lo as LeafBounds,qr as LeafBoundsHelper,_t as LeafData,Co as LeafDataProxy,bo as LeafEventer,Xr as LeafHelper,Wo as LeafHit,wo as LeafLayout,lt as LeafLevelList,ht as LeafList,No as LeafMask,Oo as LeafMatrix,Fo as LeafRender,ch as Leafer,Pn as LeaferCanvas,Rt as LeaferCanvasBase,Xi as LeaferEvent,Li as LeaferImage,Vn as LeaferTypeCreator,th as Line,r as MathHelper,T as Matrix,f as MatrixHelper,Sr as MoveEvent,uo as MultiTouchHelper,Pt as NeedConvertToCanvasCommandMap,o as OneRadian,n as PI2,a as PI_2,Kn as Paint,hh as Path,xi as PathBounds,cs as PathCommandDataHelper,Ot as PathCommandMap,Ge as PathConvert,bi as PathCorner,Ts as PathCreator,Us as PathDrawer,Et as PathHelper,At as PathNumberCommandLengthMap,Mt as PathNumberCommandMap,lh as Pen,t as Platform,ln as PluginManager,E as Point,k as PointHelper,Vi as PointerButton,Rr as PointerEvent,Fa as Polygon,Ai as PropertyEvent,ma as Rect,It as RectHelper,pa as RectRender,Yi as RenderEvent,Rn as Renderer,Wi as ResizeEvent,Pr as RotateEvent,J as Run,On as Selector,Va as Star,q as StringNumberMap,Lr as SwipeEvent,Ri as TaskItem,Ei as TaskProcessor,nh as Text,Zn as TextConvert,K as TwoPointBounds,O as TwoPointBoundsHelper,fa as UI,ca as UIBounds,st as UICreator,Hi as UIEvent,ua as UIHit,_a as UIRender,Jr as WaitHelper,Fi as WatchEvent,cn as Watcher,Dr as ZoomEvent,or as affectRenderBoundsType,ir as affectStrokeBoundsType,qi as aliasType,er as boundsType,Ci as canvasPatch,kt as canvasSizeAttrs,ur as cursorType,_r as dataProcessor,Qi as dataType,fr as defineDataProcessor,Gi as defineKey,Zi as defineLeafAttr,la as effectType,dr as eraserType,Ki as getDescriptor,cr as hitType,pr as layoutProcessor,lr as maskType,ar as opacityType,sr as pathType,$i as positionType,Cr as registerUI,kr as registerUIEvent,da as resizeType,wr as rewrite,xr as rewriteAble,tr as rotationType,Ji as scaleType,gr as setDefaultValue,hr as sortType,rr as strokeType,nr as surfaceType,Yn as useCanvas,Br as useModule,dn as usePlugin};
1
+ const t={image:{maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf"}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,{round:r,pow:o,PI:n}=Math,a={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=t;break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),t),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=e?o(10,e):1e12;return-0===(t=r(t*s)/s)?0:t}},h=n/180,l=2*n,d=n/2,{sin:c,cos:u,acos:_,sqrt:p}=Math,{float:g}=a,f={};function y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function m(){return 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 v={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:m(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:y,getWorld:m,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,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){w.toInnerPoint(t,e,f),w.scaleOfInner(t,f,s,i)},scaleOfInner(t,e,s,i=s){w.translateInner(t,e.x,e.y),w.scale(t,s,i),w.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=u(e*=h),a=c(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){w.toInnerPoint(t,e,f),w.rotateOfInner(t,f,s)},rotateOfInner(t,e,s){w.translateInner(t,e.x,e.y),w.rotate(t,s),w.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=h,t.a=i+o*s,t.b=r+n*s),e&&(e*=h,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){w.toInnerPoint(t,e,f),w.skewOfInner(t,f,s,i)},skewOfInner(t,e,s,i=0){w.translateInner(t,e.x,e.y),w.skew(t,s,i),w.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:o,f:n}=t;if(s||(s=t),void 0===i&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&w.multiplyParentLayout(s,e,r)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&w.multiplyParentLayout(s,e);s.e=o*e.a+n*e.c+e.e,s.f=o*e.b+n*e.d+e.f},multiplyParentLayout(t,e,s){s?(t.scaleX=e.scaleX*s.scaleX,t.scaleY=e.scaleY*s.scaleY,t.rotation=e.rotation+s.rotation,t.skewX=e.skewX+s.skewX,t.skewY=e.skewY+s.skewY):(t.scaleX=e.scaleX,t.scaleY=e.scaleY,t.rotation=e.rotation,t.skewX=e.skewX,t.skewY=e.skewY)},divide(t,e){w.multiply(t,w.tempInvert(e))},divideParent(t,e){w.multiplyParent(t,w.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=w;return w.copy(e,t),w.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i){const{x:r,y:o,scaleX:n,scaleY:a}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:i,skewY:r}=e,o=s*h,l=u(o),d=c(o);if(i||r){const e=i*h,s=r*h;t.a=(l+s*-d)*n,t.b=(d+s*l)*n,t.c=(e*l-d)*a,t.d=(l+e*d)*a}else t.a=l*n,t.b=d*n,t.c=-d*a,t.d=l*a}else t.a=n,t.b=0,t.c=0,t.d=a;t.e=r,t.f=o,s&&w.translateInner(t,-s.x,-s.y)},getLayout(t,e,s){const{a:i,b:r,c:o,d:n,e:a,f:l}=t;let f,y,m,v,w,x=a,b=l;if(r||o){const t=i*n-r*o;if(o&&!s){f=p(i*i+r*r),y=t/f;const e=i/f;m=r>0?_(e):-_(e)}else{y=p(o*o+n*n),f=t/y;const e=o/y;m=d-(n>0?_(-e):-_(e))}const e=u(m),a=c(m);f=g(f),y=g(y),v=g((o/y+a)/e/h),w=g((r/f-a)/e/h),m=g(m/h)}else f=i,y=n,m=v=w=0;return e&&(x+=e.x*i+e.y*o,b+=e.x*r+e.y*n),{x:x,y:b,scaleX:f,scaleY:y,rotation:m,skewX:v,skewY:w}},reset(t){w.set(t)}},w=v,{toInnerPoint:x,toOuterPoint:b}=v,{sin:B,cos:k,abs:C,sqrt:R,atan2:E,min:T,PI:O}=Math,P={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=L.defaultPoint);const i=k(e*=h),r=B(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=L;return L.copy(s,t),x(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=L;return L.copy(s,t),b(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=L;return L.copy(s,t),L.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),x(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){x(e,t,s)},toOuterOf(t,e,s){b(e,t,s)},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)=>L.getDistanceFrom(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=C(s-t),o=C(i-e);return R(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>T(L.getDistanceFrom(t,e,s,i),L.getDistanceFrom(s,i,r,o)),getAngle:(t,e)=>L.getAtan2(t,e)/h,getRotation:(t,e,s,i)=>(i||(i=e),L.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/h),getRadianFrom(t,e,s,i,r,o,n,a){void 0===n&&(n=s,a=i);let h=E(e-i,t-s);const d=E(o-a,r-n)-h;return d<-O?d+l:d},getAtan2:(t,e)=>E(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=L.getAtan2(t,e);return{x:t.x+k(i)*s,y:t.y+B(i)*s}},reset(t){L.reset(t)}},L=P;class S{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?P.copy(this,t):P.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new S(this)}rotate(t,e){return P.rotate(this,t,e),this}rotateOf(t,e){return P.rotate(this,e,t),this}getRotation(t,e,s){return P.getRotation(this,t,e,s)}toInnerOf(t,e){return P.toInnerOf(this,t,e),this}toOuterOf(t,e){return P.toOuterOf(this,t,e),this}getCenter(t){return new S(P.getCenter(this,t))}getDistance(t){return P.getDistance(this,t)}getDistancePoint(t,e){return new S(P.getDistancePoint(this,t,e))}getAngle(t){return P.getAngle(this,t)}getAtan2(t){return P.getAtan2(this,t)}reset(){return P.reset(this),this}}class D{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return"object"==typeof t?v.copy(this,t):v.set(this,t,e,s,i,r,o),this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new D(this)}translate(t,e){return v.translate(this,t,e),this}translateInner(t,e){return v.translateInner(this,t,e),this}scale(t,e){return v.scale(this,t,e),this}scaleOfOuter(t,e,s){return v.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return v.scaleOfInner(this,t,e,s),this}rotate(t){return v.rotate(this,t),this}rotateOfOuter(t,e){return v.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return v.rotateOfInner(this,t,e),this}skew(t,e){return v.skew(this,t,e),this}skewOfOuter(t,e,s){return v.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return v.skewOfInner(this,t,e,s),this}multiply(t){return v.multiply(this,t),this}multiplyParent(t){return v.multiplyParent(this,t),this}divide(t){return v.divide(this,t),this}divideParent(t){return v.divideParent(this,t),this}invert(){return v.invert(this),this}toOuterPoint(t,e,s){v.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){v.toInnerPoint(this,t,e,s)}setLayout(t,e){return v.setLayout(this,t,e),this}getLayout(t,e){return v.getLayout(this,t,e)}reset(){v.reset(this)}}const M={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){A(t,e,s),A(t,e+i,s+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:A}=M,{tempPointBounds:I,setPoint:W,addPoint:F,toBounds:Y}=M,{toOuterPoint:N}=v;let z,X,j,U;const V={},H={},G={tempBounds:{},set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,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,s,i){i||(i=s),K.set(t,e.x-s,e.y-i,e.width+2*s,e.height+2*i)},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,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),K.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Z(e,t):e=t,s?(e.offsetX=-(K.maxX(s)-t.x),e.offsetY=-(K.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),K.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s),t.width*=e,t.height*=s},scaleOf(t,e,s,i){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(K.copy(K.tempBounds,t),K.toOuterOf(K.tempBounds,e),K.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),K.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else V.x=t.x,V.y=t.y,N(e,V,H),W(I,H.x,H.y),V.x=t.x+t.width,N(e,V,H),F(I,H.x,H.y),V.y=t.y+t.height,N(e,V,H),F(I,H.x,H.y),V.x=t.x,N(e,V,H),F(I,H.x,H.y),Y(I,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new D(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const i={};return K.copyAndSpread(i,t,e,s),i},spread(t,e,s=e){K.copyAndSpread(t,t,e,s)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(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)},add(t,e){z=t.x+t.width,X=t.y+t.height,j=e.x+e.width,U=e.y+e.height,z=z>j?z:j,X=X>U?X:U,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=z-t.x,t.height=X-t.y},addList(t,e){K.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){K.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){K.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Z(t,r)):q(t,r));o&&K.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?W(I,t.x,t.y):F(I,t.x,t.y))),Y(I,t)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=P.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=P.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=K.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=K.tempToOuterOf(e,s)),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,s){s&&(e=K.tempToOuterOf(e,s));let{x:i,y:r,width:o,height:n}=e;return z=i+o,X=r+n,j=t.x+t.width,U=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,z=z<j?z:j,X=X<U?X:U,o=z-i,n=X-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){K.copy(t,K.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){K.set(t)}},K=G,{add:q,copy:Z}=K;class Q{get minX(){return G.minX(this)}get minY(){return G.minY(this)}get maxX(){return G.maxX(this)}get maxY(){return G.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return"object"==typeof t?G.copy(this,t):G.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Q(this)}scale(t,e){return G.scale(this,t,e),this}scaleOf(t,e,s){return G.scaleOf(this,t,e,s),this}toOuterOf(t,e){return G.toOuterOf(this,t,e),this}getFitMatrix(t){return G.getFitMatrix(this,t)}spread(t,e){return G.spread(this,t,e),this}ceil(){return G.ceil(this),this}unsign(){return G.unsign(this),this}add(t){return G.add(this,t),this}addList(t){return G.setList(this,t,!0),this}setList(t){return G.setList(this,t),this}addListWithFn(t,e){return G.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return G.setListWithFn(this,t,e),this}setPoints(t){return G.setPoints(this,t),this}getPoints(){return G.getPoints(this)}hitPoint(t,e){return G.hitPoint(this,t,e)}hitRadiusPoint(t,e){return G.hitRadiusPoint(this,t,e)}hit(t,e){return G.hit(this,t,e)}includes(t,e){return G.includes(this,t,e)}intersect(t,e){return G.intersect(this,t,e),this}getIntersect(t,e){return new Q(G.getIntersectData(this,t,e))}isSame(t){return G.isSame(this,t)}isEmpty(){return G.isEmpty(this)}reset(){G.reset(this)}}class ${constructor(t,e,s,i,r,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Q(r,e,o||t.width-r-s,n||t.height-e-i)}}const J={x:.5,y:.5},tt={center:J,tempPoint:{},toPoint(t,e,s,i){if(s||(s={}),"center"===t)t=J;s.x=t.x*e.width,s.y=t.y*e.height,i||(s.x+=e.x,s.y+=e.y)}},et={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};class st{constructor(t){this.repeatMap={},this.name=t}static get(t){return new st(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(it.enable){if(it.filterList.length&&it.filterList.every((t=>t!==this.name)))return;if(it.excludeList.length&&it.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){it.enable&&console.warn(this.name,...t)}warn(...t){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)}}}st.filterList=[],st.excludeList=[];const it=st,rt=st.get("RunTime"),ot={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return nt.currentId=nt.idMap[i]=e?performance.now():Date.now(),nt.currentName=nt.nameMap[i]=t,nt.nameToIdMap[t]=i,i},end(t,e){const s=nt.idMap[t],i=nt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;nt.idMap[t]=nt.nameMap[t]=nt.nameToIdMap[i]=void 0,rt.log(i,r,"ms")},endOfName(t,e){const s=nt.nameToIdMap[t];void 0!==s&&nt.end(s,e)}},nt=ot,at=st.get("UICreator"),ht={list:{},register(t){const{__tag:e}=t.prototype;lt[e]?at.repeat(e):lt[e]=t},get(t,e,s,i,r,o){const n=new lt[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),o&&(n.height=o)),n}},{list:lt}=ht,dt=st.get("EventCreator"),ct={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(ut[e]?dt.repeat(e):ut[e]=t)}))},changeName(t,e){const s=ut[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,ut[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ut[t](...e)},{nameList:ut}=ct;class _t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class pt{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new pt;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class gt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===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:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class ft extends _t{constructor(){super(...arguments),this.pathTypeList=new pt,this.imageTypeList=new pt}getImageType(t,s){return this.imageTypeList.add(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.add(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const yt={default:(t,e)=>(mt(e,t),mt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?mt(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:mt}=yt;class vt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=void 0===s?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,i;for(let r in this)"_"!==r[0]&&(s=this["_"+r],void 0!==s&&(i=e?e[r]:void 0,t[r]=void 0===i?s:i));return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=null}}const wt={opacityTypes:["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]}};function xt(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function bt(t,e,s,i){return new(s||(s=Promise))((function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}function Bt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}wt.opacityTypes.forEach((t=>wt.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const kt=[];function Ct(){return(t,e)=>{kt.push(e)}}const Rt=[];let Et=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||Rt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;kt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};xt([Bt("imageSmoothingEnabled")],Et.prototype,"smooth",void 0),xt([Bt("imageSmoothingQuality")],Et.prototype,"smoothLevel",void 0),xt([Bt("globalAlpha")],Et.prototype,"opacity",void 0),xt([Bt()],Et.prototype,"fillStyle",void 0),xt([Bt()],Et.prototype,"strokeStyle",void 0),xt([Bt("lineWidth")],Et.prototype,"strokeWidth",void 0),xt([Bt("lineCap")],Et.prototype,"strokeCap",void 0),xt([Bt("lineJoin")],Et.prototype,"strokeJoin",void 0),xt([Bt("lineDashOffset")],Et.prototype,"dashOffset",void 0),xt([Bt()],Et.prototype,"miterLimit",void 0),xt([Bt()],Et.prototype,"shadowBlur",void 0),xt([Bt()],Et.prototype,"shadowColor",void 0),xt([Bt()],Et.prototype,"shadowOffsetX",void 0),xt([Bt()],Et.prototype,"shadowOffsetY",void 0),xt([Bt()],Et.prototype,"filter",void 0),xt([Bt()],Et.prototype,"font",void 0),xt([Bt()],Et.prototype,"fontKerning",void 0),xt([Bt()],Et.prototype,"fontStretch",void 0),xt([Bt()],Et.prototype,"fontVariantCaps",void 0),xt([Bt()],Et.prototype,"textAlign",void 0),xt([Bt()],Et.prototype,"textBaseline",void 0),xt([Bt()],Et.prototype,"textRendering",void 0),xt([Bt()],Et.prototype,"wordSpacing",void 0),xt([Bt()],Et.prototype,"letterSpacing",void 0),xt([Bt()],Et.prototype,"direction",void 0),xt([Ct()],Et.prototype,"setTransform",null),xt([Ct()],Et.prototype,"resetTransform",null),xt([Ct()],Et.prototype,"getTransform",null),xt([Ct()],Et.prototype,"save",null),xt([Ct()],Et.prototype,"restore",null),xt([Ct()],Et.prototype,"translate",null),xt([Ct()],Et.prototype,"scale",null),xt([Ct()],Et.prototype,"rotate",null),xt([Ct()],Et.prototype,"fill",null),xt([Ct()],Et.prototype,"stroke",null),xt([Ct()],Et.prototype,"clip",null),xt([Ct()],Et.prototype,"fillRect",null),xt([Ct()],Et.prototype,"strokeRect",null),xt([Ct()],Et.prototype,"clearRect",null),xt([Ct()],Et.prototype,"beginPath",null),xt([Ct()],Et.prototype,"moveTo",null),xt([Ct()],Et.prototype,"lineTo",null),xt([Ct()],Et.prototype,"bezierCurveTo",null),xt([Ct()],Et.prototype,"quadraticCurveTo",null),xt([Ct()],Et.prototype,"closePath",null),xt([Ct()],Et.prototype,"arc",null),xt([Ct()],Et.prototype,"arcTo",null),xt([Ct()],Et.prototype,"ellipse",null),xt([Ct()],Et.prototype,"rect",null),xt([Ct()],Et.prototype,"roundRect",null),xt([Ct()],Et.prototype,"createConicGradient",null),xt([Ct()],Et.prototype,"createLinearGradient",null),xt([Ct()],Et.prototype,"createPattern",null),xt([Ct()],Et.prototype,"createRadialGradient",null),xt([Ct()],Et.prototype,"fillText",null),xt([Ct()],Et.prototype,"measureText",null),xt([Ct()],Et.prototype,"strokeText",null);const Tt=new Q,Ot={width:1,height:1,pixelRatio:1},Pt=st.get("LeaferCanvasBase"),Lt=["width","height","pixelRatio"];class St extends Et{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.worldTransform={},e||(e=Ot),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=e;this.autoLayout=!r||!o,this.pixelRatio=n,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Pt.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(wt.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Pt.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),yt.copyAttrs(this,t,Lt),this.bounds=new Q(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*o+t.b*a)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*o+t.d*a)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*o+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}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,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,G.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,i){this.resetTransform(),this.copyWorld(t,e,s,i),this.useWorldTransform()}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Tt.set(t).scale(this.pixelRatio),this.fillRect(Tt.x,Tt.y,Tt.width,Tt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Tt.set(t).scale(this.pixelRatio),this.strokeRect(Tt.x,Tt.y,Tt.width,Tt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Tt.set(t).scale(this.pixelRatio),e&&Tt.ceil(),this.clearRect(Tt.x,Tt.y,Tt.width,Tt.height)}clipWorld(t,e){this.beginPath(),Tt.set(t).scale(this.pixelRatio),e&&Tt.ceil(),this.rect(Tt.x,Tt.y,Tt.width,Tt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const{width:i,height:r,pixelRatio:o}=this,n={width:i,height:r,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),t&&a.useWorldTransform(Object.assign({},this.worldTransform)),s&&(a.smooth=this.smooth),a}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:o}=this;t&&(i+=t),s&&(r+=s);const n={width:i,height:r,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.recycled||(this.restore(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Dt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Mt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},At=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},Mt),It={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},Wt={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},Ft=Object.assign(Object.assign({},Wt),Mt),Yt=At,Nt={};for(let t in Yt)Nt[Yt[t]]=t;const zt={};for(let t in Yt)zt[Yt[t]]=It[t];const Xt={drawRoundRect(t,e,s,i,r,o){const n=a.fourNumber(o,Math.min(i/2,r/2)),h=e+i,l=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:jt,cos:Ut,atan2:Vt,ceil:Ht,abs:Gt,PI:Kt,sqrt:qt,pow:Zt}=Math,{setPoint:Qt,addPoint:$t}=M,{set:Jt}=P,{M:te,L:ee,C:se,Q:ie,Z:re}=At,oe={},ne={points(t,e,s,i){if(t.push(te,e[0],e[1]),s&&e.length>5){let r,o,n,a,h,l,d,c,u,_,p,g,f,y=e.length;const m=!0===s?.5:s;i&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)r=e[s-2],o=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=qt(Zt(n-r,2)+Zt(a-o,2)),g=qt(Zt(h-n,2)+Zt(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=r,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(ie,d,c,n,a):t.push(se,u,_,d,c,n,a),u=n+g*h,_=a+g*l;i||t.push(ie,u,_,e[y-2],e[y-1])}else for(let s=2,i=e.length;s<i;s+=2)t.push(ee,e[s],e[s+1]);i&&t.push(re)},rect(t,e,s,i,r){Dt.creator.path=t,Dt.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Dt.creator.path=[],Xt.drawRoundRect(Dt.creator,e,s,i,r,o),t.push(...Dt.convertToCanvasData(Dt.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,c,u,_){const p=i-e,g=r-s,f=o-i,y=n-r;let m=Vt(g,p),v=Vt(y,f),w=v-m;if(w<0&&(w+=l),w===Kt||Gt(p+g)<1e-12||Gt(f+y)<1e-12)return t&&t.push(ee,i,r),c&&(Qt(c,e,s),$t(c,i,r)),_&&Jt(_,e,s),void(u&&Jt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=a/Ut(w/2),k=i+B*Ut(m+w/2+d*b),C=r+B*jt(m+w/2+d*b);return m-=d*b,v-=d*b,le(t,k,C,a,a,0,m/h,v/h,x,c,u,_)},arc:(t,e,s,i,r,o,n,a,h,l)=>le(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,c,u,_,p){const g=o*h,f=jt(g),y=Ut(g);let m=n*h,v=a*h;m>Kt&&(m-=l),v<0&&(v+=l);let w=v-m;w<0?w+=l:w>l&&(w-=l),c&&(w-=l);const x=Ht(Gt(w/d)),b=w/x,B=jt(b/4),k=8/3*B*B/jt(b/2);v=m+b;let C,R,E,T,O,P,L,S,D=Ut(m),M=jt(m),A=E=y*i*D-f*r*M,I=T=f*i*D+y*r*M,W=e+E,F=s+T;t&&t.push(ee,W,F),u&&Qt(u,W,F),p&&Jt(p,W,F);for(let o=0;o<x;o++)C=Ut(v),R=jt(v),E=y*i*C-f*r*R,T=f*i*C+y*r*R,O=e+A-k*(y*i*M+f*r*D),P=s+I-k*(f*i*M-y*r*D),L=e+E+k*(y*i*R+f*r*C),S=s+T+k*(f*i*R-y*r*C),t&&t.push(se,O,P,L,S,e+E,s+T),u&&he(e+A,s+I,O,P,L,S,e+E,s+T,u,!0),A=E,I=T,D=C,M=R,m=v,v+=b;_&&Jt(_,e+E,s+T)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(se,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){he(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,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?$t(h,t,e):Qt(h,t,e),$t(h,n,a);for(let l=0,c=d.length;l<c;l++)ae(d[l],t,e,s,i,r,o,n,a,oe),$t(h,oe.x,oe.y)},getPointAndSet(t,e,s,i,r,o,n,a,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*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return ae(t,e,s,i,r,o,n,a,h,l),l}},{getPointAndSet:ae,toTwoPointBounds:he,ellipse:le}=ne,{sin:de,cos:ce,sqrt:ue,atan2:_e}=Math,{ellipse:pe}=ne,ge={ellipticalArc(e,s,i,r,o,n,a,d,c,u,_){const p=(c-s)/2,g=(u-i)/2,f=n*h,y=de(f),m=ce(f),v=-m*p-y*g,w=-m*g+y*p,x=r*r,b=o*o,B=w*w,k=v*v,C=x*b-x*B-b*k;let R=0;if(C<0){const t=ue(1-C/(x*b));r*=t,o*=t}else R=(a===d?-1:1)*ue(C/(x*B+b*k));const E=R*r*w/o,T=-R*o*v/r,O=_e((w-T)/o,(v-E)/r),P=_e((-w-T)/o,(-v-E)/r);let L=P-O;0===d&&L>0?L-=l:1===d&&L<0&&(L+=l);const S=s+p+m*E-y*T,D=i+g+y*E+m*T,M=L<0?1:0;_||t.ellipseToCurve?pe(e,S,D,r,o,n,O/h,P/h,M):r!==o||n?e.push(At.G,S,D,r,o,n,O/h,P/h,M):e.push(At.O,S,D,r,O/h,P/h,M)}},{M:fe,m:ye,L:me,l:ve,H:we,h:xe,V:be,v:Be,C:ke,c:Ce,S:Re,s:Ee,Q:Te,q:Oe,T:Pe,t:Le,A:Se,a:De,Z:Me,z:Ae,N:Ie,D:We,X:Fe,G:Ye,F:Ne,O:ze,P:Xe,U:je}=At,{rect:Ue,roundRect:Ve,arcTo:He,arc:Ge,ellipse:Ke,quadraticCurveTo:qe}=ne,{ellipticalArc:Ze}=ge,Qe=st.get("PathConvert"),$e={},Je={current:{dot:0},stringify(t){let e,s,i,r=0,o=t.length,n="";for(;r<o;){s=t[r],e=zt[s],n+=s===i?" ":Nt[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,o="";const n=[],a=e?Ft:Wt;for(let e=0,h=t.length;e<h;e++)i=t[e],et[i]?("."===i&&(ts.dot++,ts.dot>1&&(es(n,o),o="")),o+=i):At[i]?(o&&(es(n,o),o=""),ts.name=At[i],ts.length=It[i],ts.index=0,es(n,ts.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&es(n,o),o=i):o&&(es(n,o),o=""),r=i;return o&&es(n,o),s?Je.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ye:t[c+1]+=a,t[c+2]+=h;case fe:a=t[c+1],h=t[c+2],_.push(fe,a,h),c+=3;break;case xe:t[c+1]+=a;case we:a=t[c+1],_.push(me,a,h),c+=2;break;case Be:t[c+1]+=h;case be:h=t[c+1],_.push(me,a,h),c+=2;break;case ve:t[c+1]+=a,t[c+2]+=h;case me:a=t[c+1],h=t[c+2],_.push(me,a,h),c+=3;break;case Ee:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Re;case Re:n=o===ke||o===Re,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(ke,l,d,s,i,a,h),c+=5;break;case Ce:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=ke;case ke:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ke,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Le:t[c+1]+=a,t[c+2]+=h,r=Pe;case Pe:n=o===Te||o===Pe,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?qe(_,a,h,s,i,t[c+1],t[c+2]):_.push(Te,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Te;case Te:s=t[c+1],i=t[c+2],e?qe(_,a,h,s,i,t[c+3],t[c+4]):_.push(Te,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case De:t[c+6]+=a,t[c+7]+=h;case Se:Ze(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ae:case Me:_.push(Me),c++;break;case Ie:a=t[c+1],h=t[c+2],e?Ue(_,a,h,t[c+3],t[c+4]):ss(_,t,c,5),c+=5;break;case We:a=t[c+1],h=t[c+2],e?Ve(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(_,t,c,9),c+=9;break;case Fe:a=t[c+1],h=t[c+2],e?Ve(_,a,h,t[c+3],t[c+4],t[c+5]):ss(_,t,c,6),c+=6;break;case Ye:Ke(e?_:ss(_,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,$e),a=$e.x,h=$e.y,c+=9;break;case Ne:e?Ke(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ze:Ge(e?_:ss(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$e),a=$e.x,h=$e.y,c+=7;break;case Xe:e?Ge(_,t[c+1],t[c+2],t[c+3],0,360,!1):ss(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case je:He(e?_:ss(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$e),a=$e.x,h=$e.y,c+=6;break;default:return Qe.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:ss}=Je,{M:is,L:rs,C:os,Q:ns,Z:as,N:hs,D:ls,X:ds,G:cs,F:us,O:_s,P:ps,U:gs}=At,{getMinDistanceFrom:fs,getRadianFrom:ys}=P,{tan:ms,min:vs,abs:ws}=Math,xs={},bs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(is,e,s)},lineTo(t,e,s){t.push(rs,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(os,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(ns,e,s,i,r)},closePath(t){t.push(as)},rect(t,e,s,i,r){t.push(hs,e,s,i,r)},roundRect(t,e,s,i,r,o){if("number"==typeof o)t.push(ds,e,s,i,r,o);else{const n=a.fourNumber(o);n?t.push(ls,e,s,i,r,...n):t.push(hs,e,s,i,r)}},ellipse(t,e,s,i,r,o,n,a,h){void 0===o?t.push(us,e,s,i,r):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(cs,e,s,i,r,o,n,a,h?1:0))},arc(t,e,s,i,r,o,n){void 0===r?t.push(ps,e,s,i):(void 0===o&&(o=360),t.push(_s,e,s,i,r,o,n?1:0))},arcTo(t,e,s,i,r,o,n,a){if(void 0!==n){const h=ms(ys(n,a,e,s,i,r)/2)*(fs(n,a,e,s,i,r)/2);t.push(gs,e,s,i,r,vs(o,ws(h)))}else t.push(gs,e,s,i,r,o)},drawEllipse(t,e,s,i,r,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),ne.ellipse(null,e,s,i,r,o,n,a,h,null,null,xs),t.push(is,xs.x,xs.y),Bs(t,e,s,i,r,o,n,a,h)},drawArc(t,e,s,i,r,o,n){void 0===r&&(r=0),void 0===o&&(o=360),ne.arc(null,e,s,i,r,o,n,null,null,xs),t.push(is,xs.x,xs.y),ks(t,e,s,i,r,o,n)},drawPoints(t,e,s,i){ne.points(t,e,s,i)}},{ellipse:Bs,arc:ks}=bs,{moveTo:Cs,lineTo:Rs,quadraticCurveTo:Es,bezierCurveTo:Ts,closePath:Os,beginPath:Ps,rect:Ls,roundRect:Ss,ellipse:Ds,arc:Ms,arcTo:As,drawEllipse:Is,drawArc:Ws,drawPoints:Fs}=bs;class Ys{constructor(t){this.path=t?"string"==typeof t?Dt.parse(t):t:[]}beginPath(){return Ps(this.path),this}moveTo(t,e){return Cs(this.path,t,e),this}lineTo(t,e){return Rs(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,o){return Ts(this.path,t,e,s,i,r,o),this}quadraticCurveTo(t,e,s,i){return Es(this.path,t,e,s,i),this}closePath(){return Os(this.path),this}rect(t,e,s,i){return Ls(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return Ss(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,o,n,a){return Ds(this.path,t,e,s,i,r,o,n,a),this}arc(t,e,s,i,r,o){return Ms(this.path,t,e,s,i,r,o),this}arcTo(t,e,s,i,r){return As(this.path,t,e,s,i,r),this}drawEllipse(t,e,s,i,r,o,n,a){return Is(this.path,t,e,s,i,r,o,n,a),this}drawArc(t,e,s,i,r,o){return Ws(this.path,t,e,s,i,r,o),this}drawPoints(t,e,s){return Fs(this.path,t,e,s),this}}const{M:Ns,L:zs,C:Xs,Q:js,Z:Us,N:Vs,D:Hs,X:Gs,G:Ks,F:qs,O:Zs,P:Qs,U:$s}=At,Js=st.get("PathDrawer"),ti={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Ns:t.moveTo(e[i+1],e[i+2]),i+=3;break;case zs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Xs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case js:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Us:t.closePath(),i+=1;break;case Vs:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Hs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Gs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ks:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*h,e[i+6]*h,e[i+7]*h,e[i+8]),i+=9;break;case qs:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,l,!1),i+=5;break;case Zs:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*h,e[i+5]*h,e[i+6]),i+=7;break;case Qs:t.arc(e[i+1],e[i+2],e[i+3],0,l,!1),i+=4;break;case $s:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Js.error(`command: ${s} [index:${i}]`,e)}}},{M:ei,L:si,C:ii,Q:ri,Z:oi,N:ni,D:ai,X:hi,G:li,F:di,O:ci,P:ui,U:_i}=At,pi={scale(t,e,s){if(!t)return;let i,r=0,o=t.length;for(;r<o;)switch(i=t[r],i){case ei:case si:gi(t,e,s,r,1),r+=3;break;case ii:gi(t,e,s,r,3),r+=7;break;case ri:gi(t,e,s,r,2),r+=5;break;case oi:r+=1;break;case ni:gi(t,e,s,r,2),r+=5;break;case ai:gi(t,e,s,r,2),r+=9;break;case hi:gi(t,e,s,r,2),r+=6;break;case li:gi(t,e,s,r,2),console.log("G"),r+=9;break;case di:gi(t,e,s,r,2),r+=5;break;case ci:t[r]=li,t.splice(r+4,0,t[r+3],0),gi(t,e,s,r,2),r+=9,o+=2;break;case ui:t[r]=di,t.splice(r+4,0,t[r+3]),gi(t,e,s,r,2),r+=5,o+=1;break;case _i:gi(t,e,s,r,2),r+=6}},scalePoints(t,e,s,i,r){for(let o=r?i+1:0,n=r?o+2*r:t.length;o<n;o+=2)t[o]*=e,t[o+1]*=s}},{scalePoints:gi}=pi,{M:fi,L:yi,C:mi,Q:vi,Z:wi,N:xi,D:bi,X:Bi,G:ki,F:Ci,O:Ri,P:Ei,U:Ti}=At,{toTwoPointBounds:Oi,toTwoPointBoundsByQuadraticCurve:Pi,arcTo:Li,arc:Si,ellipse:Di}=ne,{addPointBounds:Mi,copy:Ai,addPoint:Ii,setPoint:Wi,addBounds:Fi,toBounds:Yi}=M,Ni=st.get("PathBounds");let zi,Xi,ji;const Ui={},Vi={},Hi={},Gi={toBounds(t,e){Gi.toTwoPointBounds(t,Vi),Yi(Vi,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Wi(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===wi||s===mi||s===vi?Wi(e,h,l):Wi(e,t[a+1],t[a+2])),s){case fi:case yi:h=t[a+1],l=t[a+2],Ii(e,h,l),a+=3;break;case mi:o=t[a+5],n=t[a+6],Oi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Ui),Mi(e,Ui),h=o,l=n,a+=7;break;case vi:i=t[a+1],r=t[a+2],o=t[a+3],n=t[a+4],Pi(h,l,i,r,o,n,Ui),Mi(e,Ui),h=o,l=n,a+=5;break;case wi:a+=1;break;case xi:h=t[a+1],l=t[a+2],Fi(e,h,l,t[a+3],t[a+4]),a+=5;break;case bi:case Bi:h=t[a+1],l=t[a+2],Fi(e,h,l,t[a+3],t[a+4]),a+=s===bi?9:6;break;case ki:Di(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Ui,Hi),0===a?Ai(e,Ui):Mi(e,Ui),h=Hi.x,l=Hi.y,a+=9;break;case Ci:h=t[a+1],l=t[a+2],Xi=t[a+3],ji=t[a+4],Fi(e,h-Xi,l-ji,2*Xi,2*ji),h+=Xi,a+=5;break;case Ri:Si(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Ui,Hi),0===a?Ai(e,Ui):Mi(e,Ui),h=Hi.x,l=Hi.y,a+=7;break;case Ei:h=t[a+1],l=t[a+2],zi=t[a+3],Fi(e,h-zi,l-zi,2*zi,2*zi),h+=zi,a+=4;break;case Ti:Li(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Ui,Hi),0===a?Ai(e,Ui):Mi(e,Ui),h=Hi.x,l=Hi.y,a+=6;break;default:return void Ni.error(`command: ${s} [index:${a}]`,t)}}},{M:Ki,L:qi,C:Zi,Z:Qi}=At,{getCenterX:$i,getCenterY:Ji}=P,{arcTo:tr}=bs,er={smooth(t,e,s){let i,r=0,o=0,n=0,a=0,h=0,l=0,d=0,c=0,u=0;const _=t.length,p=[];for(;r<_;)switch(i=t[r],i){case Ki:a=c=t[r+1],h=u=t[r+2],r+=3,t[r]===qi?(l=t[r+1],d=t[r+2],p.push(Ki,$i(a,l),Ji(h,d))):p.push(Ki,a,h);break;case qi:switch(o=t[r+1],n=t[r+2],r+=3,t[r]){case qi:tr(p,o,n,t[r+1],t[r+2],e,c,u);break;case Qi:tr(p,o,n,a,h,e,c,u);break;default:p.push(qi,o,n)}c=o,u=n;break;case Zi:p.push(Zi,t[r+1],t[r+2],t[r+3],t[r+4],t[r+5],t[r+6]),r+=7;break;case Qi:tr(p,a,h,l,d,e,c,u),p.push(Qi),r+=1}return i!==Qi&&(p[1]=a,p[2]=h),p}};Dt.creator=new Ys,Dt.parse=Je.parse,Dt.convertToCanvasData=Je.toCanvasData;const{drawRoundRect:sr}=Xt;function ir(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){sr(this,t,e,s,i,r)})}(t)}const rr=st.get("TaskProcessor");class or{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return bt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){rr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class nr{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,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&yt.assign(this.config,t),this.empty()}add(t,e){let s,i,r,o;const n=new or(t);return n.parent=this,"number"==typeof e?o=e:e&&(i=e.parallel,s=e.start,r=e.time,o=e.delay),r&&(n.time=r),!1===i&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):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;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 ar={map:{},recycledList:[],tasker:new nr,patternTasker:new nr,get isComplete(){return hr.tasker.isComplete},get(t){let s=hr.map[t.url];return s||(s=e.image(t),hr.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||hr.recycledList.push(t)}))},clearRecycled(){const t=hr.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete hr.map[t.url],t.destroy())})),t.length=0)},isPixel:t=>wt.opacityTypes.some((e=>hr.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+wt.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+wt.upperCaseTypeMap[t]))return!0;return!1},destroy(){hr.map={}}},hr=ar,{IMAGE:lr,create:dr}=s;class cr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=dr(lr),this.config=t||{url:""},this.isSVG=ar.isFormat("svg",t)}load(e,s){return this.loading||(this.loading=!0,ar.tasker.add((()=>bt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return i&&(n.globalAlpha=i),n.drawImage(this.view,0,0,e,s),o}destroy(){this.config={url:""},this.waitComplete.length=0}}class ur{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 _r extends ur{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}_r.ADD="child.add",_r.REMOVE="child.remove";class pr extends ur{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}pr.CHANGE="property.change";class gr extends ur{constructor(t,e){super(t),Object.assign(this,e)}}gr.LOAD="image.load",gr.LOADED="image.loaded",gr.ERROR="image.error";class fr extends ur{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){"object"==typeof t?(super(fr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}fr.RESIZE="resize";class yr extends ur{constructor(t,e){super(t),this.data=e}}yr.REQUEST="watch.request",yr.DATA="watch.data";class mr extends ur{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}mr.CHECK_UPDATE="layout.check_update",mr.REQUEST="layout.request",mr.START="layout.start",mr.BEFORE="layout.before",mr.LAYOUT="layout.layout",mr.AFTER="layout.after",mr.AGAIN="layout.again",mr.END="layout.end";class vr extends ur{}vr.FRAME="animate.frame";class wr extends ur{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}wr.REQUEST="render.request",wr.START="render.start",wr.BEFORE="render.before",wr.RENDER="render",wr.AFTER="render.after",wr.AGAIN="render.again",wr.END="render.end";class xr extends ur{}xr.START="leafer.start",xr.BEFORE_READY="leafer.before_ready",xr.READY="leafer.ready",xr.AFTER_READY="leafer.after_ready",xr.VIEW_READY="leafer.view_ready",xr.VIEW_COMPLETED="leafer.view_completed",xr.STOP="leafer.stop",xr.RESTART="leafer.restart",xr.END="leafer.end";const br={},Br={isHoldSpaceKey:()=>Br.isHold("Space"),isHold:t=>br[t],setDownCode(t){br[t]||(br[t]=!0)},setUpCode(t){br[t]=!1}},kr={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 Cr extends ur{get spaceKey(){return Br.isHoldSpaceKey()}get left(){return kr.left(this)}get right(){return kr.right(this)}get middle(){return kr.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.getInnerPoint(this)}getLocal(t){return t||(t=this.current),t.getLocalPoint(this)}static changeName(t,e){ct.changeName(t,e)}}function Rr(t,e,s){Object.defineProperty(t,e,s)}function Er(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Tr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Rr(t,e,Object.assign(r,i||{})),Kr(t,e,s)}function Or(t){return(e,s)=>{Tr(e,s,t)}}function Pr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}}function Lr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!t}})}}function Sr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Dr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Mr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__hasAutoLayout&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const Ar=Mr;function Ir(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Wr=Ir;function Fr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Yr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Nr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function zr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Xr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function jr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ur(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),st.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}}function Vr(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}}function Hr(t){return(e,s)=>{Rr(e,"__DataProcessor",{get:()=>t})}}function Gr(t){return(e,s)=>{Rr(e,"__LayoutProcessor",{get:()=>t})}}function Kr(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[r]}:"width"===e?n.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});let a,h=i;for(;!a&&h;)a=Er(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),i[o]&&(n.set=i[o],delete i[o]),Object.defineProperty(i,e,n)}const qr=new st("rewrite"),Zr=[],Qr=["destroy","constructor"];function $r(t){return(e,s)=>{Zr.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Jr(){return t=>{to()}}function to(t){Zr.length&&(Zr.forEach((e=>{t&&qr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Zr.length=0)}function eo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Qr.includes(i)||e&&e.includes(i)))if(t.prototype){Er(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function so(){return t=>{ht.register(t)}}function io(){return t=>{ct.register(t)}}setTimeout((()=>to(!0)));let ro=class extends Cr{};ro.POINTER="pointer",ro.BEFORE_DOWN="pointer.before_down",ro.BEFORE_MOVE="pointer.before_move",ro.BEFORE_UP="pointer.before_up",ro.DOWN="pointer.down",ro.MOVE="pointer.move",ro.UP="pointer.up",ro.OVER="pointer.over",ro.OUT="pointer.out",ro.ENTER="pointer.enter",ro.LEAVE="pointer.leave",ro.TAP="tap",ro.DOUBLE_TAP="double_tap",ro.CLICK="click",ro.DOUBLE_CLICK="double_click",ro.LONG_PRESS="long_press",ro.LONG_TAP="long_tap",ro.MENU="pointer.menu",ro=xt([io()],ro);const oo={};let no=class extends ro{static setList(t){this.list=t instanceof pt?t:new pt(t)}static setData(t){this.data=t}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(oo,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(oo,null,!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}assignMove(t){oo.x=t?this.totalX:this.moveX,oo.y=t?this.totalY:this.moveY}};no.BEFORE_DRAG="drag.before_drag",no.START="drag.start",no.DRAG="drag",no.END="drag.end",no.OVER="drag.over",no.OUT="drag.out",no.ENTER="drag.enter",no.LEAVE="drag.leave",no=xt([io()],no);let ao=class extends ro{static setList(t){no.setList(t)}static setData(t){no.setData(t)}};ao.DROP="drop",ao=xt([io()],ao);let ho=class extends no{};ho.BEFORE_MOVE="move.before_move",ho.START="move.start",ho.MOVE="move",ho.END="move.end",ho=xt([io()],ho);let lo=class extends Cr{};lo.BEFORE_ROTATE="rotate.before_rotate",lo.START="rotate.start",lo.ROTATE="rotate",lo.END="rotate.end",lo=xt([io()],lo);let co=class extends no{};co.SWIPE="swipe",co.LEFT="swipe.left",co.RIGHT="swipe.right",co.UP="swipe.up",co.DOWN="swipe.down",co=xt([io()],co);let uo=class extends Cr{};uo.BEFORE_ZOOM="zoom.before_zoom",uo.START="zoom.start",uo.ZOOM="zoom",uo.END="zoom.end",uo=xt([io()],uo);let _o=class extends Cr{};_o.DOWN="key.down",_o.HOLD="key.hold",_o.UP="key.up",_o=xt([io()],_o);class po{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(ho.START,this.moveData)}t.path=this.moveData.path,e.emit(ho.BEFORE_MOVE,t),e.emit(ho.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(uo.START,this.zoomData)}t.path=this.zoomData.path,e.emit(uo.BEFORE_ZOOM,t),e.emit(uo.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(lo.START,this.rotateData)}t.path=this.rotateData.path,e.emit(lo.BEFORE_ROTATE,t),e.emit(lo.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd()}moveEnd(){this.moveData&&(this.interaction.emit(ho.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(uo.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(lo.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const{copy:go,toInnerPoint:fo,scaleOfOuter:yo,rotateOfOuter:mo,skewOfOuter:vo,multiplyParent:wo,divideParent:xo,getLayout:bo}=v,Bo={},ko={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Eo(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Ro(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.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,s=e.length;t<s;t++)To(e[t])}},updateAllChange(t){if(To(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Oo(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const i={x:e,y:s};t.parent&&fo(t.parent.worldTransform,i,i,!0),Co.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i,r){this.zoomOfLocal(t,Lo(t,e),s,i,r)},zoomOfLocal(t,e,s,i=s,r){go(Bo,t.__localMatrix),yo(Bo,e,s,i),Po(t,Bo),t.scaleResize(s,i,!0!==r)},rotateOfWorld(t,e,s){this.rotateOfLocal(t,Lo(t,e),s)},rotateOfLocal(t,e,s){go(Bo,t.__localMatrix),mo(Bo,e,s),Po(t,Bo),t.rotation=a.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,i,r){this.skewOfLocal(t,Lo(t,e),s,i,r)},skewOfLocal(t,e,s,i=0,r){go(Bo,t.__localMatrix),vo(Bo,e,s,i),Co.setTransform(t,Bo,r)},transform(t,e,s){go(Bo,t.localTransform),wo(Bo,e),Co.setTransform(t,Bo,s)},setTransform(t,e,s){const i=bo(e);s&&(t.scaleResize(i.scaleX/t.scaleX,i.scaleY/t.scaleY,!0!==s),delete i.scaleX,delete i.scaleY),t.set(i)},drop(t,e,s,i){go(Bo,t.worldTransform),xo(Bo,e.worldTransform),t.setTransform(Bo,i),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},Co=ko,{updateAllMatrix:Ro,updateMatrix:Eo,updateAllWorldOpacity:To,updateAllChange:Oo}=Co;function Po(t,e){const{e:s,f:i}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-i}function Lo(t,e){return t.__layout.update(),t.parent?P.tempToInnerOf(e,t.parent.__world):e}const So={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local||t.__,localStrokeBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__localBounds:null,maskLocalStrokeBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},{updateBounds:Do}=ko,Mo={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:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Ao(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Io(e[t],e)},updateBounds(t,e){const s=[t];Io(t,s),Wo(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)Do(i[t]);e&&e===s||Do(s)}}},{pushAllChildBranch:Ao,pushAllBranchStack:Io,updateBoundsByBranchStack:Wo}=Mo,Fo={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},Yo={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?co.UP:t>45&&t<135?co.DOWN:t<=45&&t>=-45?co.RIGHT:co.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:No.getSwipeDirection(P.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new pt,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.add(i[t]);return s}},No=Yo,zo=new pt,{getDragEventData:Xo,getDropEventData:jo,getSwipeEventData:Uo}=Yo;class Vo{constructor(t){this.interaction=t}setDragData(t){this.dragData=Xo(t,t,t)}getList(){const{proxy:t}=this.interaction.selector;return!this.dragging||t&&t.list.length?zo:no.list||this.dragableList||zo}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!kr.middle(t)&&!kr.left(t))return void s.pointerCancel();const{dragData:r}=this;this.moving||(this.moving=(kr.middle(t)||s.moveMode)&&e,this.moving&&s.emit(ho.START,r)),this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=i;this.dragData=Xo(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(s.emit(ho.BEFORE_MOVE,this.dragData),s.emit(ho.MOVE,this.dragData)):this.dragging&&(this.realDrag(),s.emit(no.BEFORE_DRAG,this.dragData),s.emit(no.DRAG,this.dragData))}dragStart(t,e){this.dragging||(this.dragging=kr.left(t)&&e,this.dragging&&(this.interaction.emit(no.START,this.dragData),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],(e.__.draggable||e.__.editable)&&e.__.hitSelf){this.dragableList=new pt(e);break}}realDrag(){const{running:t}=this.interaction,e=this.getList();if(e.length&&t){const{moveX:t,moveY:s}=this.dragData;e.forEach((e=>ko.moveWorld(e,t,s)))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(no.OUT,t,s),e.emit(no.OVER,t,i)):e.emit(no.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(no.LEAVE,t,s,i),e.emit(no.ENTER,t,i,s),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,o=Xo(s,t,t);r&&(o.throughPath=r),o.path=i,this.moving&&e.emit(ho.END,o),this.dragging&&(e.emit(no.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(P.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Uo(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=jo(t,this.getList(),no.data);e.path=this.dragEnterPath,this.interaction.emit(ao.DROP,e),this.interaction.emit(no.LEAVE,t,this.dragEnterPath)}dragReset(){no.list=no.data=this.dragableList=this.dragData=this.dragOverPath=this.dragEnterPath=null,this.dragging=this.moving=!1}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=G.maxX(o),l=G.maxY(o),d=t.x<n?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,P.move(s,d,c),P.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const Ho=st.get("emit");const Go=["move","zoom","rotate","key"];function Ko(t,e,s,i,r){if(Go.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Zo(t,r)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&qo(o,e,s,i,r)}}function qo(t,e,s,i,r){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!Zo(t,r)){s.phase=i?1:t===s.target?2:3;const r=ct.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Zo(t,e){return e&&e.has(t)}const Qo={getData(t){const e=t[0],s=t[1],i=P.getCenter(e.from,s.from),r=P.getCenter(e.to,s.to),o={x:r.x-i.x,y:r.y-i.y},n=P.getDistance(e.from,s.from);return{move:o,scale:P.getDistance(e.to,s.to)/n,angle:P.getRotation(e.from,s.from,e.to,s.to),center:r}}},$o={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1},cursor:{}},{pathHasEventType:Jo,getMoveEventData:tn,getZoomEventData:en,getRotateEventData:sn}=Yo;class rn{get dragging(){return this.dragger.dragging}get isDragEmpty(){return this.config.move.dragEmpty&&this.hoverData&&this.hoverData.path.list[0].isLeafer&&(!this.downData||this.downData.path.list[0].isLeafer)}get moveMode(){return this.config.move.drag||this.config.move.holdSpaceKey&&Br.isHoldSpaceKey()||this.downData&&kr.middle(this.downData)||this.isDragEmpty}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config=$o,this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new pt(t),this.transformer=new po(this),this.dragger=new Vo(this),i&&(this.config=yt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(kr.defaultLeft(t),this.updateDownData(t),e&&(t.path=this.defaultPath),this.emit(ro.BEFORE_DOWN,t),this.emit(ro.DOWN,t),this.downTime=Date.now(),this.dragger.setDragData(t),kr.left(t)&&(this.tapWait(),this.longPressWait(t)),this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;this.downData&&kr.defaultLeft(t);const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&kr.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(ro.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=P.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),kr.right(this.downData)||this.dragger.checkDrag(t,e)}this.dragger.moving||this.config.pointer.ignoreMove||(this.updateHoverData(t),this.emit(ro.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t)),this.updateCursor(t))}pointerUp(t){t||(t=this.downData),this.downData&&(kr.defaultLeft(t),this.findPath(t),this.emit(ro.BEFORE_UP,t),this.emit(ro.UP,t),this.emit(ro.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null,this.updateCursor(t))}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:o}=Qo.getData(e);this.rotate(sn(o,i,t)),this.zoom(en(o,r,t)),this.move(tn(o,s,t))}menu(t){this.findPath(t),this.emit(ro.MENU,t)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}keyDown(t){const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Br.setDownCode(e),this.emit(_o.HOLD,t,this.defaultPath),this.moveMode&&this.updateCursor()),this.emit(_o.DOWN,t,this.defaultPath)}keyUp(t){const{code:e}=t;this.downKeyMap[e]=!1,Br.setUpCode(e),this.emit(_o.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(ro.OUT,t,this.overPath),this.emit(ro.OVER,t,e)):this.emit(ro.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(ro.LEAVE,t,this.enterPath,e),this.emit(ro.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ro.LEAVE,t),this.dragger.dragging&&this.emit(ao.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[ro.DOUBLE_TAP,ro.DOUBLE_CLICK].some((e=>Jo(t.path,e)));i<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:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,e||{through:i});return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isDrag(t){return this.dragger.getList().has(t)}updateDownData(t){t||(t=this.downData),t&&(this.findPath(t),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(),name:ro.MOVE}),this.hoverData=t)}updateCursor(t){if(this.config.cursor.stop)return;if(t||(this.updateHoverData(),t=this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.moveMode)return this.setCursor(this.downData?"grabbing":"grab");if(!t||this.dragger.dragging)return;let e,s;const{path:i}=t;for(let t=0,r=i.length;t<r&&(e=i.list[t],s=e.cursor,!s);t++);this.setCursor(s)}setCursor(t){this.cursor=t,this.canvas.setCursor(t)}emitTap(t){this.emit(ro.TAP,t),this.emit(ro.CLICK,t)}emitDoubleTap(t){this.emit(ro.DOUBLE_TAP,t),this.emit(ro.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(ro.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ro.LONG_TAP,t),Jo(t.path,ro.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new Q(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(fr.RESIZE,this.__onResize,this)],t.once(xr.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);try{for(let o=s.length-1;o>-1;o--){if(r=s.list[o],qo(r,t,e,!0,i))return;r.isApp&&Ko(r,t,e,!0,i)}for(let o=0,n=s.length;o<n;o++)if(r=s.list[o],r.isApp&&Ko(r,t,e,!1,i),qo(r,t,e,!1,i))return}catch(t){Ho.error(t)}}(t,e,s,i)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class on{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}on.custom={};const{toOuterOf:nn,getPoints:an}=G;class hn{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}constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},t.__local&&(this.localRenderBounds=this.localStrokeBounds=t.__local),this.boxChange(),this.matrixChange()}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}getTransform(t="world"){switch(this.update(),t){case"world":return this.leaf.__world;case"local":return this.leaf.__localMatrix;case"inner":return v.defaultMatrix;default:return new D(this.leaf.__world).divideParent(t.__world)}}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);default:return new Q(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"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":if(this.localRenderBounds)return this.localRenderBounds;case"stroke":if(this.localStrokeBounds)return this.localStrokeBounds;case"margin":case"content":case"box":return this.leaf.__localBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(n),o=i.__world;break;case"local":r=i.getLocalPointByInner(n),o=i.__;break;case"inner":r=n,o=v.defaultWorld;break;default:r=i.getWorldPoint(n,e),o=i.__world}let{scaleX:a,scaleY:h,rotation:l,skewX:d,skewY:c}=o,{width:u,height:_}=n;if("object"==typeof e){const t=e.__world;a/=t.scaleX,h/=t.scaleY,l-=t.rotation,d-=t.skewX,c-=t.skewY}if(s){const t=a<0?-a:a,e=h<0?-h:h;a/=t,h/=e,u*=t,_*=e}return{x:r.x,y:r.y,scaleX:a,scaleY:h,rotation:l,skewX:d,skewY:c,width:u,height:_}}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=an(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;default:r=e}return void 0!==r&&i.forEach((t=>s.innerToWorld(t,null,!1,r))),i}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),nn(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),nn(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),nn(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__localBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const ln={},dn={on(t,e,s){let i,r,o;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=cn(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let i,r,o;s&&(i="boolean"==typeof s?s:s.capture);const n=cn(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(o=r.findIndex((t=>t.listener===e)),o>-1&&r.splice(o,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,current:this,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&ct.has(t)&&(e=ct.get(t,{type:t,target:this,current:this}));const i=cn(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&(r=i[o],r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function cn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ln)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ln)}}const un={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:i}=pr,r=new pr(i,this,t,s,e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}}else this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e)},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:_n,multiplyParent:pn,translateInner:gn,defaultWorld:fn}=v,{toPoint:yn,tempPoint:mn}=tt,vn={__updateWorldMatrix(){pn(this.__local||this.__layout,this.parent?this.parent.__world:fn,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(_n(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(yn(s.around,t.boxBounds,mn),gn(e,-mn.x,-mn.y))}this.__layout.matrixChanged=!1}},{updateMatrix:wn,updateAllMatrix:xn,hasParentAutoLayout:bn}=ko,{updateBounds:Bn}=Mo,{toOuterOf:kn,copyAndSpread:Cn}=G,Rn={__updateWorldBounds(){kn(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.boxChanged=!1,t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),kn(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){kn(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){kn(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),bn(this)?wn(this):(xn(this),Bn(this,this))):wn(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){Cn(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Cn(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:En,copy:Tn,setRadius:On}=P,Pn={},Ln={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),this.__.hitRadius&&(Tn(Pn,t),On(t=Pn,this.__.hitRadius)),En(t,this.__world,Pn),!(!this.__.hitBox||!G.hitRadiusPoint(this.__layout.boxBounds,Pn))||this.__hit(Pn)},__drawHitPath(t){this.__drawRenderPath(t)}},Sn={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorldByReset(s,null,null,i):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},Dn={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s,i){e.opacity=1,e.resetTransform(),e.useMask(s),t.opacity=this.__worldOpacity,t.resetTransform(),t.copyWorld(e),i?(e.recycle(),s.recycle()):(e.clear(),s.clear())},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},Mn={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r;const o=t.getSameCanvas(!1,!0),n=t.getSameCanvas(!1,!0);for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?this.__renderMask(t,n,o):r=!0,s.__render(o,e)):s.__render(r?n:t,e);this.__renderMask(t,n,o,!0)}else{const{bounds:r,hideBounds:o}=e;for(let n=0,a=i.length;n<a;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{LEAF:An,create:In}=s,{toInnerPoint:Wn,toOuterPoint:Fn}=v,{tempToOuterOf:Yn,copy:Nn}=P,{moveLocal:zn,zoomOfLocal:Xn,rotateOfLocal:jn,skewOfLocal:Un,transform:Vn,setTransform:Hn,drop:Gn}=ko;let Kn=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 vt}get __LayoutProcessor(){return hn}get __localMatrix(){return this.__local||this.__layout}get __localBounds(){return this.__local||this.__}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),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}constructor(t){this.innerId=In(An),this.reset(t)}reset(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,rotation:0,skewX:0,skewY:0},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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t){this.leafer?this.leafer.nextRender(t):this.waitLeafer((()=>this.leafer.nextRender(t)))}__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.__leaferWait&&Fo.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s,i){}__removeMask(t){}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.__world[t]}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Nn(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Nn(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Wn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){Fn(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}setTransform(t,e){Hn(this,t,e)}transform(t,e){Vn(this,t,e)}move(t,e){zn(this,t,e)}scaleOf(t,e,s,i){Xn(this,Yn(t,this.localTransform),e,s,i)}rotateOf(t,e){jn(this,Yn(t,this.localTransform),e)}skewOf(t,e,s,i){Un(this,Yn(t,this.localTransform),e,s,i)}scaleResize(t,e=t,s){const i=this;s?(i.scaleX*=t,i.scaleY*=e):(t<0&&(i.scaleX*=-1,t=-t),e<0&&(i.scaleY*=-1,e=-e),this.__scaleResize(t,e))}__scaleResize(t,e){1!==t&&(this.width*=t),1!==e&&(this.height*=e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Gn(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e){Kr(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Mr),s(e)(this.prototype,t)}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};Kn=xt([eo(un),eo(vn),eo(Rn),eo(Ln),eo(dn),eo(Sn)],Kn);const{setListWithFn:qn}=G,{sort:Zn}=Mo,{localBoxBounds:Qn,localStrokeBounds:$n,localRenderBounds:Jn,maskLocalBoxBounds:ta,maskLocalStrokeBounds:ea,maskLocalRenderBounds:sa}=So;let ia=class extends Kn{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){qn(this.__layout.boxBounds,this.children,this.__hasMask?ta:Qn)}__updateStrokeBounds(){qn(this.__layout.strokeBounds,this.children,this.__hasMask?ea:$n)}__updateRenderBounds(){qn(this.__layout.renderBounds,this.children,this.__hasMask?sa:Jn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Zn),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&Fo.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(_r.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===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()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(_r.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new _r(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ia=xt([eo(Mn),eo(Dn)],ia);const ra=st.get("plugin"),oa={power:{},list:[],onLeafer(t){oa.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function na(t,e){const s={},{power:i,list:r}=oa;if(i||ra.error("need add PluginManager.power = LeaferUI"),r.includes(t))ra.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:ra.error(t+" non-existent")})):ra.warn("no import");try{t.run(s,e)}catch(t){ra.error(t)}}}class aa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new pt;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 pt,this.target=t,e&&(this.config=yt.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(wr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===_r.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,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new yr(yr.DATA,{updatedList:this.updatedList})),this.__updatedList=new pt,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(pr.CHANGE,this.__onAttrChange,this),t.on_([_r.ADD,_r.REMOVE],this.__onChildEvent,this),t.on_(yr.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:ha,updateBounds:la,updateAllWorldOpacity:da}=ko,{pushAllChildBranch:ca,pushAllParent:ua}=Mo;const{worldBounds:_a}=So,pa={x:0,y:0,width:1e5,height:1e5};class ga{constructor(t){this.updatedBounds=new Q,this.beforeBounds=new Q,this.afterBounds=new Q,t instanceof Array&&(t=new pt(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,_a)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(pa):this.afterBounds.setListWithFn(t,_a),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:fa,updateAllChange:ya}=ko,ma=st.get("Layouter");class va{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new gt,this.target=t,e&&(this.config=yt.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.running)return;const{target:t}=this;this.times=0;try{t.emit(mr.START),this.layoutOnce(),t.emitEvent(new mr(mr.END,this.layoutedBlocks,this.times))}catch(t){ma.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ma.warn("layouting"):this.times>3?ma.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(yr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ot.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=mr,a=this.getBlocks(i);a.forEach((t=>t.setBefore())),s.emitEvent(new mr(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(ha(t,!0),e.add(t),t.isBranch&&ca(t,e),ua(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ua(t,e)))}))}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||la(i[t])}la(s)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&da(t),t.__updateChange()}))}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),s.emitEvent(new mr(o,a,this.times)),s.emitEvent(new mr(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ot.end(e)}fullLayout(){const t=ot.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=mr,o=this.getBlocks(new pt(e));e.emitEvent(new mr(s,o,this.times)),va.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new mr(i,o,this.times)),e.emitEvent(new mr(r,o,this.times)),this.addBlocks(o),ot.end(t)}static fullLayout(t){fa(t,!0),t.isBranch?Mo.updateBounds(t):ko.updateBounds(t),ya(t)}addExtra(t){const e=this.extraBlock||(this.extraBlock=new ga([]));e.updatedList.add(t),e.beforeBounds.add(t.__world)}createBlock(t){return new ga(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(){const{target:t}=this;this.__eventIds=[t.on_(mr.REQUEST,this.layout,this),t.on_(mr.AGAIN,this.layoutAgain,this),t.on_(yr.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const wa=st.get("Renderer");class xa{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=yt.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(mr.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new Q,wa.log(e.innerName,"---\x3e");try{this.emitRender(wr.START),this.renderOnce(t),this.emitRender(wr.END,this.totalBounds),ar.clearRecycled()}catch(t){this.rendering=!1,wa.error(t)}wa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?wa.warn("rendering"):this.times>3?wa.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Q,this.renderOptions={},t?(this.emitRender(wr.BEFORE),t()):(this.requestLayout(),this.emitRender(wr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(wr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(wr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return wa.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ot.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),o=new Q(i);s.save(),r&&!st.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,r,o),s.restore(),ot.end(e)}fullRender(){const t=ot.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),ot.end(t)}__render(t,e,s){const i=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),st.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,i),this.renderBounds=s||t,this.renderOptions=i,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),st.showHitView&&this.renderHitView(i),st.showBoundsView&&this.renderBoundsView(i),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Q;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(vr.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new Q(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__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||wa.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new wr(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(wr.REQUEST,this.update,this),t.on_(mr.END,this.__onLayoutEnd,this),t.on_(wr.AGAIN,this.renderAgain,this),t.on_(fr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}var ba;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(ba||(ba={}));const{hitRadiusPoint:Ba}=G;class ka{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],ko.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new pt;for(;t;)e.add(t),t=t.parent;return e.add(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new pt;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.addAt(s,0),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new pt,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,o;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(o=i.list[t],!r||!r.has(o));t++)e.add(o)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let o=t.length-1;o>-1;o--)s=t[o],!s.__.visible||e&&!s.__.isMask||(i=!!s.__.hitRadius||Ba(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:Ca,NoAndSkip:Ra,YesAndSkip:Ea}=ba;class Ta{constructor(t,e){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,e&&(this.config=yt.default(e,this.config)),this.pather=new ka(t,this),this.__listenEvents()}getBy(t,e,s,i){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return s?r:r?[r]:[];case"string":switch(t[0]){case"#":const i=this.getById(t.substring(1),e);return s?i:i?[i]:[];case".":return this.getByMethod(this.methods.className,e,s,t.substring(1));default:return this.getByMethod(this.methods.tag,e,s,t)}case"function":return this.getByMethod(t,e,s,i)}}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(mr.CHECK_UPDATE),this.pather.getByPoint(e,s,i)}getByInnerId(t,e){const s=this.innerIdMap[t];return s||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const s=this.idMap[t];return s&&ko.hasParent(s,e||this.target)?s:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,s,i){const r=s?null:[];return this.eachFind(this.toChildren(e),t,r,i),r||this.findLeaf}eachFind(t,e,s,i){let r,o;for(let n=0,a=t.length;n<a;n++){if(r=t[n],o=e(r,i),o===Ca||o===Ea){if(!s)return void(this.findLeaf=r);s.push(r)}r.isBranch&&o<Ra&&this.eachFind(r.children,e,s,i)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:s}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[s]&&delete this.innerIdMap[s]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(_r.REMOVE,this.__onRemoveChild,this),this.target.on_(pr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(e,{watcher:(t,e)=>new aa(t,e),layouter:(t,e)=>new va(t,e),renderer:(t,e,s)=>new xa(t,e,s),selector:(t,e)=>new Ta(t,e)}),t.layout=va.fullLayout;const Oa=st.get("LeaferCanvas");class Pa extends St{init(){const{view:e}=this.config;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;s.display||(s.display="block"),this.parentView=this.view.parentElement,t.syncDomFont&&!this.parentView&&(this.view.style.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}setCursor(t){const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,e,s=0){if(s++,t instanceof Array)t.forEach((t=>this.eachCursor(t,e,s)));else{const i="string"==typeof t&&on.get(t);i&&s<2?this.eachCursor(i,e,s):e.push(t)}}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;if(t.hasChildNodes()){const{style:e}=s;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(s)}else Oa.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;i.width=t+"px",i.height=e+"px",this.view.width=t*s,this.view.height=e*s}updateClientBounds(){this.clientBounds=this.view.getBoundingClientRect()}startAutoLayout(t,e){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||o!==this.height){const{style:t}=e,{pixelRatio:n}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:r,height:o,pixelRatio:n},h={};yt.copyAttrs(h,this,Lt),this.resize(a),void 0!==this.width&&this.resizeListener(new fr(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}ir(CanvasRenderingContext2D.prototype),ir(Path2D.prototype);const La={convert(t,e){const s=Yo.getBase(t),i=Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===i.pointerType&&(i.tangentialPressure=t.tangentialPressure,i.tiltX=t.tiltX,i.tiltY=t.tiltY,i.twist=t.twist),i},convertMouse(t,e){const s=Yo.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const s=La.getTouch(t),i=Yo.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Sa={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:r}=t;return t.shiftKey&&!i&&(i=r,r=0),i>50&&(i=Math.max(50,i/3)),r>50&&(r=Math.max(50,r/3)),{x:-i*s*2,y:-r*s*2}},getScale(e,s){let i,r=1,{zoomMode:o,zoomSpeed:n}=s;const h=e.deltaY||e.deltaX;if(o?(i="mouse"===o||!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(i=!0)):i=!e.shiftKey&&(e.metaKey||e.ctrlKey),i){n=a.within(n,0,1);r=1-h/(25*(e.deltaY?s.delta.y:s.delta.x)*(1-n)+10),r<.5&&(r=.5),r>=1.5&&(r=1.5)}return r}},Da={convert(t){const e=Yo.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{getMoveEventData:Ma,getZoomEventData:Aa,getRotateEventData:Ia}=Yo;class Wa extends rn{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t,e){e&&this.canvas.updateClientBounds();const{clientBounds:s}=this.canvas;return{x:t.clientX-s.x,y:t.clientY-s.y}}getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(Da.convert(t))}onKeyUp(t){this.keyUp(Da.convert(t))}onContextMenu(t){this.menu(La.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.pointerDown(La.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerMove(La.convert(t,this.getLocal(t,!0)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(La.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(La.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(La.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(La.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.multiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=La.getTouch(t);this.pointerDown(La.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=La.getTouch(t);this.pointerMove(La.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=La.getTouch(t);this.pointerUp(La.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),s=this.getKeepTouchList(this.touches,e);s.length>1&&(this.multiTouch(Yo.getBase(t),s),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let s;const i=[];return t.forEach((t=>{s=e.find((e=>e.identifier===t.identifier)),s&&i.push({from:this.getLocal(t),to:this.getLocal(s)})})),i}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):Sa.getScale(t,e),i=this.getLocal(t),r=Yo.getBase(t);1!==s?this.zoom(Aa(i,s,r)):this.move(Ma(i,e.getMove?e.getMove(t,e):Sa.getMove(t,e),r))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=Yo.getBase(t),i=t.scale/this.lastGestureScale,r=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=a.within(o,0,1),this.zoom(Aa(e,i*i,s)),this.rotate(Ia(e,r/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}const{mineType:Fa,fileType:Ya}=wt;function Na(s,i){t.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(Fa(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,Fa(e),s))),canvasSaveAs:(t,e,s)=>new Promise((i=>{let r=document.createElement("a");r.href=t.toDataURL(Fa(Ya(e)),s),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),i()})),loadImage:e=>new Promise(((s,i)=>{const r=new Image;r.setAttribute("crossOrigin","anonymous"),r.crossOrigin="anonymous",r.onload=()=>{s(r)},r.onerror=t=>{i(t)},!e.startsWith("data:")&&t.image.suffix&&(e+=(e.includes("?")?"&":"?")+t.image.suffix),r.src=e}))},t.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Pa(t,e),image:t=>new cr(t),hitCanvas:(t,e)=>new Pa(t,e),interaction:(t,e,s,i)=>new Wa(t,e,s,i)}),t.name="web",t.isMobile="ontouchstart"in window,t.requestRender=function(t){window.requestAnimationFrame(t)},t.devicePixelRatio=Math.max(1,devicePixelRatio);const{userAgent:za}=navigator;function Xa(t){const{config:e}=t;e.move.dragOut=!1}za.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0,t.syncDomFont=!0):za.indexOf("Safari")>-1&&-1===za.indexOf("Chrome")&&(t.fullImageShadow=!0),za.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):za.indexOf("Mac")>-1?t.os="Mac":za.indexOf("Linux")>-1&&(t.os="Linux");const ja=st.get("LeaferTypeCreator"),Ua={list:{},register(t,e){Va[t]?ja.repeat(t):Va[t]=e},run(t,e){const s=Ua.list[t];s?s(e):ja.error("no",t)}},{list:Va}=Ua;Ua.register("draw",Xa),Ua.register("user",Xa),Ua.register("design",(function(t){t.isApp||t.__eventIds.push(t.on_(ho.BEFORE_MOVE,(e=>{ko.moveWorld(t.zoomLayer,e.moveX,e.moveY)})),t.on_(uo.BEFORE_ZOOM,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.app.config.zoom;let{scale:o}=e;o*Math.abs(s)<i?o=i/s:o*Math.abs(s)>r&&(o=r/s),1!==o&&ko.zoomOfWorld(t.zoomLayer,e,o)})))}));const Ha={},Ga={},Ka={},qa={},Za={},Qa={},$a={},Ja=st.get("UIData");class th extends vt{get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoBounds(){return!this._width&&!this._height}setVisible(t){this.__leaf.leafer&&(this.__leaf.leafer.watcher.hasVisible=!0),this._visible=t}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ja.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ja.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=$a)):(this.__isFills&&(this.__removeInput("fill"),Ga.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=$a)):(this.__isStrokes&&(this.__removeInput("stroke"),Ga.recycleImage("stroke",this),this.__isStrokes=!1,this.__pixelStroke&&(this.__pixelStroke=!1)),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const eh={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class sh extends th{}class ih extends sh{get __boxStroke(){return!0}}class rh extends sh{}class oh extends ih{}class nh extends th{}class ah extends th{get __boxStroke(){return!0}}class hh extends th{get __boxStroke(){return!0}}class lh extends th{}class dh extends th{}const{parse:ch}=Je;class uh extends th{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=ch(t)):(this.__input&&this.__removeInput("path"),this._path=t)}}class _h extends sh{}const ph={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class gh extends th{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ph[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}}class fh extends ah{}class yh extends ah{}function mh(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function vh(t){return(e,s)=>{Tr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const wh={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:o}=this.__;if((s||"all"===i)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*h/2)*Math.sqrt(o)-t:0,r="none"===s?0:o;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(o=Math.max(o,r)),this.__layout.renderShapeSpread=o,t}},xh={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:o}=this.__,n=i&&"path"===r||"all"===r,a=s.hitFill(e,o);if(n&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!n&&a&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!n){if(!a&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},bh={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&Ga.fill(s,this,t),r&&this.__drawAfterFill(t,e),i&&Ga.stroke(i,this,t,e)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=Ga.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&Ha.shadow(this,t,o,e),s&&(this.__.__isFills?Ga.fills(s,this,t):Ga.fill(s,this,t)),r&&this.__drawAfterFill(t,e),a&&Ha.innerShadow(this,t,o,e),i&&(this.__.__isStrokes?Ga.strokes(i,this,t,e):Ga.stroke(i,this,t,e)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?Ga.fills(s,this,t):Ga.fill(s,this,t)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Ga.strokes(i,this,t,e):Ga.stroke(i,this,t,e))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&(this.__.__pixelFill?Ga.fills(s,this,t):Ga.fill("#000000",this,t)),i&&(this.__.__pixelStroke?Ga.strokes(i,this,t,e):Ga.stroke("#000000",this,t,e))}},Bh={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:o,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(o,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};var kh;let Ch=kh=class extends Kn{get app(){return this.leafer&&this.leafer.app}set scale(t){"number"==typeof t?this.scaleX=this.scaleY=t:(this.scaleX=t.x,this.scaleY=t.y)}get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}constructor(t){super(t)}reset(t){}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}createProxyData(){}find(t,e){return this.leafer?this.leafer.selector.getBy(t,this,!1,e):[]}findOne(t,e){return this.leafer?this.leafer.selector.getBy(t,this,!0,e):null}getPath(t){const{path:e}=this.__;return e?t?Je.toCanvasData(e,!0):e:[]}getPathString(t){return Je.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Ga.compute("fill",this),e&&Ga.compute("stroke",this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?er.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;this.__.cornerRadius?t.roundRect(e,s,i,r,this.__.cornerRadius):t.rect(e,s,i,r)}export(t,e){return Qa.export(this,t,e)}clone(){return kh.one(this.toJSON())}static one(t,e,s,i,r){return ht.get(t.tag||this.prototype.__tag,t,e,s,i,r)}destroy(){this.fill=this.stroke=null,super.destroy()}};xt([Hr(th)],Ch.prototype,"__",void 0),xt([Or("")],Ch.prototype,"id",void 0),xt([Or("")],Ch.prototype,"name",void 0),xt([Or("")],Ch.prototype,"className",void 0),xt([Yr("pass-through")],Ch.prototype,"blendMode",void 0),xt([Nr(1)],Ch.prototype,"opacity",void 0),xt([Nr(!0)],Ch.prototype,"visible",void 0),xt([Xr(!1)],Ch.prototype,"isMask",void 0),xt([jr(!1)],Ch.prototype,"isEraser",void 0),xt([Or(!1)],Ch.prototype,"locked",void 0),xt([zr(0)],Ch.prototype,"zIndex",void 0),xt([Pr(0)],Ch.prototype,"x",void 0),xt([Pr(0)],Ch.prototype,"y",void 0),xt([Mr(100)],Ch.prototype,"width",void 0),xt([Mr(100)],Ch.prototype,"height",void 0),xt([Sr(1)],Ch.prototype,"scaleX",void 0),xt([Sr(1)],Ch.prototype,"scaleY",void 0),xt([Dr(0)],Ch.prototype,"rotation",void 0),xt([Dr(0)],Ch.prototype,"skewX",void 0),xt([Dr(0)],Ch.prototype,"skewY",void 0),xt([Lr()],Ch.prototype,"around",void 0),xt([Or(!1)],Ch.prototype,"draggable",void 0),xt([Or(!1)],Ch.prototype,"editable",void 0),xt([Or("size")],Ch.prototype,"editSize",void 0),xt([Ur(!0)],Ch.prototype,"hittable",void 0),xt([Ur("path")],Ch.prototype,"hitFill",void 0),xt([Wr("path")],Ch.prototype,"hitStroke",void 0),xt([Ur(!1)],Ch.prototype,"hitBox",void 0),xt([Ur(!0)],Ch.prototype,"hitChildren",void 0),xt([Ur(!0)],Ch.prototype,"hitSelf",void 0),xt([Ur()],Ch.prototype,"hitRadius",void 0),xt([Vr("")],Ch.prototype,"cursor",void 0),xt([Yr()],Ch.prototype,"fill",void 0),xt([Wr()],Ch.prototype,"stroke",void 0),xt([Wr("inside")],Ch.prototype,"strokeAlign",void 0),xt([Wr(1)],Ch.prototype,"strokeWidth",void 0),xt([Wr("none")],Ch.prototype,"strokeCap",void 0),xt([Wr("miter")],Ch.prototype,"strokeJoin",void 0),xt([Wr()],Ch.prototype,"dashPattern",void 0),xt([Wr()],Ch.prototype,"dashOffset",void 0),xt([Wr(10)],Ch.prototype,"miterLimit",void 0),xt([Ar(0)],Ch.prototype,"cornerRadius",void 0),xt([Ar()],Ch.prototype,"cornerSmoothing",void 0),xt([mh()],Ch.prototype,"shadow",void 0),xt([mh()],Ch.prototype,"innerShadow",void 0),xt([mh()],Ch.prototype,"blur",void 0),xt([mh()],Ch.prototype,"backgroundBlur",void 0),xt([mh()],Ch.prototype,"grayscale",void 0),xt([$r(Kn.prototype.reset)],Ch.prototype,"reset",null),xt([$r(ti.drawPathByData)],Ch.prototype,"__drawPathByData",null),Ch=kh=xt([eo(wh),eo(xh),eo(bh),Jr()],Ch);const Rh=v.get();let Eh=class extends Ch{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.__setBranch()}__setBranch(){this.isBranch=!0,this.children||(this.children=[])}set(t){if(t.children){const{children:e}=t;let s;delete t.children,this.children?this.removeAll(!0):this.__setBranch(),super.set(t),e.forEach((t=>{s=ht.get(t.tag,t),this.add(s)})),t.children=e}else super.set(t)}toJSON(){const t=super.toJSON();return t.children=this.children.map((t=>t.toJSON())),t}__scaleResize(t,e){const{children:s}=this;for(let i=0;i<s.length;i++)Rh.a=t,Rh.d=e,s[i].transform(Rh,!0)}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){}};xt([Hr(sh)],Eh.prototype,"__",void 0),Eh=xt([eo(ia),so()],Eh);let Th=class extends Ch{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){}};xt([Hr(ah)],Th.prototype,"__",void 0),xt([$r(Ch.prototype.__drawPathByBox)],Th.prototype,"__drawPathByData",null),Th=xt([eo(Bh),Jr(),so()],Th);const Oh=Th.prototype,Ph=Eh.prototype,Lh={},{copy:Sh,add:Dh}=G;let Mh=class extends Eh{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__scaleResize(t,e){this.__.__autoBounds&&this.children.length?super.__scaleResize(t,e):(this.width*=t,this.height*=e)}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateRectBoxBounds(){}__updateBoxBounds(){this.__.__autoBounds&&this.children.length?super.__updateBoxBounds():this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;Sh(Lh,t),super.__updateRenderBounds(),Dh(t,Lh)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};xt([Hr(ih)],Mh.prototype,"__",void 0),xt([Fr("show")],Mh.prototype,"overflow",void 0),xt([$r(Oh.__updateStrokeSpread)],Mh.prototype,"__updateStrokeSpread",null),xt([$r(Oh.__updateRenderSpread)],Mh.prototype,"__updateRectRenderSpread",null),xt([$r(Oh.__updateBoxBounds)],Mh.prototype,"__updateRectBoxBounds",null),xt([$r(Oh.__updateStrokeBounds)],Mh.prototype,"__updateStrokeBounds",null),xt([$r(Oh.__updateRenderBounds)],Mh.prototype,"__updateRectRenderBounds",null),xt([$r(Oh.__updateChange)],Mh.prototype,"__updateRectChange",null),xt([$r(Oh.__drawPathByData)],Mh.prototype,"__drawPathByData",null),xt([$r(Oh.__render)],Mh.prototype,"__renderRect",null),xt([$r(Ph.__render)],Mh.prototype,"__renderGroup",null),Mh=xt([Jr(),so()],Mh);let Ah=class extends Mh{get __tag(){return"Frame"}constructor(t){super(t),this.isFrame=!0,this.__.fill||(this.__.fill="#FFFFFF")}};xt([Hr(oh)],Ah.prototype,"__",void 0),xt([Fr("hide")],Ah.prototype,"overflow",void 0),Ah=xt([so()],Ah);const{moveTo:Ih,closePath:Wh,ellipse:Fh}=bs;let Yh=class extends Ch{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=e/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&Fh(h,n,a,n*i,a*i,0,r,o,!1),Fh(h,n,a,n,a,0,o,r,!0),i<1&&Wh(h)):(i<1&&(Fh(h,n,a,n*i,a*i),Ih(h,e,a)),Fh(h,n,a,n,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(Ih(h,n,a),Fh(h,n,a,n,a,0,r,o,!1),Wh(h)):Fh(h,n,a,n,a)}};xt([Hr(hh)],Yh.prototype,"__",void 0),xt([Ar(0)],Yh.prototype,"innerRadius",void 0),xt([Ar(0)],Yh.prototype,"startAngle",void 0),xt([Ar(0)],Yh.prototype,"endAngle",void 0),Yh=xt([so()],Yh);const{moveTo:Nh,lineTo:zh,drawPoints:Xh}=bs,{rotate:jh,getAngle:Uh,getDistance:Vh,defaultPoint:Hh}=P,{toBounds:Gh}=Gi;let Kh=class extends Ch{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&jh(s,e),s}set toPoint(t){this.width=Vh(Hh,t),this.rotation=Uh(Hh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];this.__.points?Xh(t,this.__.points,!1):(Nh(t,0,0),zh(t,this.width,0))}__updateRenderPath(){this.__.points&&this.__.curve?Xh(this.__.__pathForRender=[],this.__.points,this.__.curve,"Line"!==this.__tag):super.__updateRenderPath()}__updateBoxBounds(){this.points?Gh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}__scaleResize(t,e){if(this.points)pi.scalePoints(this.__.points,t,e),this.points=this.__.points;else if("Line"===this.__tag){const s=this.toPoint;s.x*=t,s.y*=e,this.toPoint=s}else super.__scaleResize(t,e)}};xt([Hr(nh)],Kh.prototype,"__",void 0),xt([Ir("center")],Kh.prototype,"strokeAlign",void 0),xt([Mr(0)],Kh.prototype,"height",void 0),xt([Ar()],Kh.prototype,"points",void 0),xt([Ar(0)],Kh.prototype,"curve",void 0),Kh=xt([so()],Kh);const{sin:qh,cos:Zh,PI:Qh}=Math,{moveTo:$h,lineTo:Jh,closePath:tl,drawPoints:el}=bs,sl=Kh.prototype;let il=class extends Ch{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)el(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,r=e/2,o=s/2;$h(t,r,0);for(let e=1;e<i;e++)Jh(t,r+r*qh(2*e*Qh/i),o-o*Zh(2*e*Qh/i))}tl(t)}__updateRenderPath(){}__updateBoxBounds(){}__scaleResize(t,e){}};xt([Hr(lh)],il.prototype,"__",void 0),xt([Ar(3)],il.prototype,"sides",void 0),xt([Ar()],il.prototype,"points",void 0),xt([Ar(0)],il.prototype,"curve",void 0),xt([$r(sl.__updateRenderPath)],il.prototype,"__updateRenderPath",null),xt([$r(sl.__updateBoxBounds)],il.prototype,"__updateBoxBounds",null),xt([$r(sl.__scaleResize)],il.prototype,"__scaleResize",null),il=xt([Jr(),so()],il);const{sin:rl,cos:ol,PI:nl}=Math,{moveTo:al,lineTo:hl,closePath:ll}=bs;let dl=class extends Ch{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];al(n,r,0);for(let t=1;t<2*s;t++)hl(n,r+(t%2==0?r:r*i)*rl(t*nl/s),o-(t%2==0?o:o*i)*ol(t*nl/s));ll(n)}};xt([Hr(dh)],dl.prototype,"__",void 0),xt([Ar(5)],dl.prototype,"corners",void 0),xt([Ar(.382)],dl.prototype,"innerRadius",void 0),dl=xt([so()],dl);let cl=class extends Th{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(gr.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};xt([Hr(fh)],cl.prototype,"__",void 0),xt([Mr("")],cl.prototype,"url",void 0),cl=xt([so()],cl);let ul=class extends Th{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.update();const r=new D(t.__world);r.invert();const o=new D;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};xt([Hr(fh)],ul.prototype,"__",void 0),xt([vh(100)],ul.prototype,"width",void 0),xt([vh(100)],ul.prototype,"height",void 0),xt([vh(t.devicePixelRatio)],ul.prototype,"pixelRatio",void 0),xt([vh(!0)],ul.prototype,"smooth",void 0),xt([Ur("all")],ul.prototype,"hitFill",void 0),ul=xt([so()],ul);const{copyAndSpread:_l,includes:pl,spread:gl,setList:fl}=G;let yl=class extends Ch{get __tag(){return"Text"}get textDrawData(){return this.__layout.update(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),this.__.__letterSpacing<0?this.__drawPathByData(t):i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;t.rect(s,i,r,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=qa.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{lineHeight:s,letterSpacing:i,fontFamily:r,fontSize:o,fontWeight:n,italic:h,textCase:l,textOverflow:d}=t,c=t.__autoWidth,u=t.__autoHeight;t.__lineHeight=eh.number(s,o),t.__letterSpacing=eh.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${h?"italic ":""}${"small-caps"===l?"small-caps ":""}${"normal"!==n?n+" ":""}${o}px ${r}`,t.__clipText="show"!==d&&!t.__autoBounds,this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,p=e.boxBounds;if(t.__lineHeight<o&&gl(_,o/2),c||u){p.x=c?_.x:0,p.y=u?_.y:0,p.width=c?_.width:t.width,p.height=u?_.height:t.height;const{padding:e}=t;if(e){const[t,s,i,r]=a.fourNumber(e);c&&(p.x-=r,p.width+=s+r),u&&(p.y-=t,p.height+=i+t)}this.__updateNaturalSize()}else super.__updateBoxBounds();const g=pl(p,_)?p:_;g!==e.contentBounds?(e.contentBounds=g,e.renderChanged=!0,fl(t.__textBoxBounds={},[p,_])):t.__textBoxBounds=g}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){_l(this.__layout.renderBounds,this.__.__textBoxBounds,this.__layout.renderSpread)}};xt([Hr(gh)],yl.prototype,"__",void 0),xt([Mr(0)],yl.prototype,"width",void 0),xt([Mr(0)],yl.prototype,"height",void 0),xt([Mr(0)],yl.prototype,"padding",void 0),xt([Yr("#000000")],yl.prototype,"fill",void 0),xt([Ir("outside")],yl.prototype,"strokeAlign",void 0),xt([Ur("all")],yl.prototype,"hitFill",void 0),xt([Mr("")],yl.prototype,"text",void 0),xt([Mr("L")],yl.prototype,"fontFamily",void 0),xt([Mr(12)],yl.prototype,"fontSize",void 0),xt([Mr("normal")],yl.prototype,"fontWeight",void 0),xt([Mr(!1)],yl.prototype,"italic",void 0),xt([Mr("none")],yl.prototype,"textCase",void 0),xt([Mr("none")],yl.prototype,"textDecoration",void 0),xt([Mr(0)],yl.prototype,"letterSpacing",void 0),xt([Mr({type:"percent",value:150})],yl.prototype,"lineHeight",void 0),xt([Mr(0)],yl.prototype,"paraIndent",void 0),xt([Mr(0)],yl.prototype,"paraSpacing",void 0),xt([Mr("left")],yl.prototype,"textAlign",void 0),xt([Mr("top")],yl.prototype,"verticalAlign",void 0),xt([Mr("normal")],yl.prototype,"textWrap",void 0),xt([Mr("show")],yl.prototype,"textOverflow",void 0),yl=xt([so()],yl);const{toBounds:ml}=Gi;let vl=class extends Ch{get __tag(){return"Path"}constructor(t){super(t)}__scaleResize(t,e){pi.scale(this.__.path,t,e),this.path=this.__.path}__updateBoxBounds(){ml(this.__.path,this.__layout.boxBounds)}};xt([Hr(uh)],vl.prototype,"__",void 0),xt([Ar()],vl.prototype,"path",void 0),xt([Ar()],vl.prototype,"windingRule",void 0),xt([Ir("center")],vl.prototype,"strokeAlign",void 0),vl=xt([so()],vl);let wl=class extends Eh{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new vl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}paint(){this.pathElement.forceUpdate("path")}clear(){this.removeAll(!0)}};xt([Hr(_h)],wl.prototype,"__",void 0),wl=xt([eo(Ys,["beginPath"]),so()],wl);const xl=st.get("Leafer");let bl=class extends Eh{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get layoutLocked(){return!this.layouter.running}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}constructor(t,e){super(e),this.zoomLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{holdSpaceKey:!0,dragOut:!0,autoDistance:2}},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)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&yt.assign(this.config,t);const{config:r}=this;Ua.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new _t,this.hitCanvasManager=new ft,i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),oa.onLeafer(this)}set(t){this.children?super.set(t):setTimeout((()=>{super.set(t)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(xr.RESTART):this.emitLeafer(xr.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(xr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=yt.copyAttrs({},t,Lt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}updateCursor(){this.interaction&&this.interaction.updateCursor()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=yt.copyAttrs({},this.canvas,Lt);this.canvas.resize(t),this.__onResize(new fr(t,e))}__onResize(t){this.emitEvent(t),yt.copyAttrs(this.__,t,Lt),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.isLeafer=!!t,this.__level=1}setZoomLayer(t){this.zoomLayer=t}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new $(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(Lt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Lt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=yt.copyAttrs({},this.canvas,Lt);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onCreated(){this.created=!0}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(xr.BEFORE_READY),this.emitLeafer(xr.READY),this.emitLeafer(xr.AFTER_READY),Fo.run(this.__readyWait))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(xr.VIEW_READY),Fo.run(this.__viewReadyWait))}__onRenderEnd(t){this.viewReady||this.__onViewReady();const e=this.__checkViewCompleted();e&&this.__onViewCompleted(),this.viewCompleted=e,Fo.run(this.__nextRenderWait)}__checkViewCompleted(){return this.viewReady&&!this.watcher.changed&&ar.isComplete}__onViewCompleted(){this.viewCompleted||(this.emitLeafer(xr.VIEW_COMPLETED),Fo.run(this.__viewCompletedWait))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitReady(t){this.ready?t():this.__readyWait.push(t)}waitViewReady(t){this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t){this.viewCompleted?t():(this.__viewCompletedWait.push(t),this.running||this.start())}nextRender(t){this.watcher&&!this.watcher.changed?t():this.__nextRenderWait.push(t)}__checkUpdateLayout(){this.__layout.update()}emitLeafer(t){this.emitEvent(new xr(t,this))}__listenEvents(){const t=ot.start("FirstCreate "+this.innerName);this.once(xr.START,(()=>ot.end(t))),this.once(mr.END,(()=>this.__onReady())),this.once(wr.START,(()=>this.__onCreated())),this.__eventIds.push(this.on_(yr.DATA,this.__onWatchData,this),this.on_(wr.END,this.__onRenderEnd,this),this.on_(mr.CHECK_UPDATE,this.__checkUpdateLayout,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){setTimeout((()=>{if(!this.destroyed)try{this.stop(),this.emitEvent(new xr(xr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{ar.clearRecycled()}),100)}catch(t){xl.error(t)}}))}};xt([Hr(rh)],bl.prototype,"__",void 0),xt([Mr()],bl.prototype,"pixelRatio",void 0),bl=xt([so()],bl);let Bl=class extends bl{get __tag(){return"App"}get isApp(){return!0}constructor(t,s){if(super(t,s),t){const{ground:s,tree:i,sky:r,editor:o}=t;s&&(this.ground=this.addLeafer(s)),(i||o)&&(this.tree=this.addLeafer(i)),(r||o)&&(this.sky=this.addLeafer(r||{type:"draw",usePartRender:!1})),o&&(this.editor=e.editor(o),this.sky.add(this.editor))}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(pr.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>t.start()))}stop(){this.children.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.children.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.children.forEach((t=>t.lockLayout()))}addLeafer(t){const e=new bl(t);return this.add(e),e}add(t){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t),this.__listenChildEvents(t)}__onPropertyChange(){st.showHitView&&this.children.forEach((t=>t.forceUpdate("surface")))}__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()}__checkViewCompleted(){return this.children.every((t=>t.viewCompleted))}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>t.copyWorld(e.canvas)))}__onResize(t){this.children.forEach((e=>e.resize(t))),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>t.__layout.update()))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&yt.assign(e,t),this.autoLayout&&yt.copyAttrs(e,this,Lt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(mr.END,(()=>this.__onReady())),t.once(wr.START,(()=>this.__onCreated())),t.once(wr.END,(t=>this.__onRenderEnd(t))),this.realCanvas&&this.__eventIds.push(t.on_(wr.END,this.__onChildRenderEnd,this))}};Bl=xt([so()],Bl);const{get:kl,rotateOfOuter:Cl,translate:Rl,scaleOfOuter:El,scale:Tl,rotate:Ol}=v;const{get:Pl,translate:Ll}=v;function Sl(t,e,s,i){let{width:r,height:o}=e;const{opacity:n,mode:a,offset:h,scale:l,rotation:d,blendMode:c}=s,u=i.width===r&&i.height===o;c&&(t.blendMode=c);const _=t.data={mode:a};switch(a){case"strench":u||(r=i.width,o=i.height),(i.x||i.y)&&(_.transform=Pl(),Ll(_.transform,i.x,i.y));break;case"clip":(h||l||d)&&function(t,e,s,i,r){const o=kl();Rl(o,e.x,e.y),s&&Rl(o,s.x,s.y),i&&("number"==typeof i?Tl(o,i):Tl(o,i.x,i.y),t.scaleX=o.a,t.scaleY=o.d),r&&Ol(o,r),t.transform=o}(_,i,h,l,d);break;case"repeat":(!u||l||d)&&function(t,e,s,i,r,o){const n=kl();if(o)switch(Ol(n,o),o){case 90:Rl(n,i,0);break;case 180:Rl(n,s,i);break;case 270:Rl(n,0,s)}Rl(n,e.x,e.y),r&&(El(n,e,r),t.scaleX=t.scaleY=r),t.transform=n}(_,i,r,o,l,d);break;default:u&&!d||function(t,e,s,i,r,o){const n=kl(),a=o&&180!==o,h=s.width/(a?r:i),l=s.height/(a?i:r),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-i*d)/2,u=s.y+(s.height-r*d)/2;Rl(n,c,u),Tl(n,d),o&&Cl(n,{x:s.x+s.width/2,y:s.y+s.height/2},o),t.scaleX=t.scaleY=d,t.transform=n}(_,a,i,r,o,d)}_.width=r,_.height=o,n&&(_.opacity=n)}function Dl(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.__proxyData&&(t.setProxyAttr("width",t.__.width),t.setProxyAttr("height",t.__.height)),t.forceUpdate("width"),!1}return!0}function Ml(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new gr(t,e))}const{get:Al,scale:Il,copy:Wl}=v;function Fl(e,s,i){let{scaleX:r,scaleY:o}=e.__world;const n=r+"-"+o;if(s.patternId===n||e.destroyed)return!1;{r=Math.abs(r),o=Math.abs(o);const{image:e,data:a}=s;let h,l,{width:d,height:c,scaleX:u,scaleY:_,opacity:p,transform:g,mode:f}=a;u&&(l=Al(),Wl(l,g),Il(l,1/u,1/_),r*=u,o*=_),r*=i,o*=i,d*=r,c*=o;const y=d*c;if("repeat"!==s.data.mode&&y>t.image.maxCacheSize)return!1;let m=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}y>m&&(h=Math.sqrt(y/m)),h&&(r/=h,o/=h,d/=h,c/=h),u&&(r/=u,o/=_),(g||1!==r||1!==o)&&(l||(l=Al(),g&&Wl(l,g)),Il(l,1/r,1/o));const v=t.canvas.createPattern(e.getCanvas(d<1?1:d,c<1?1:c,p),"repeat"===f?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform&&(s.transform=null),l&&(v.setTransform?v.setTransform(l):s.transform=l)}catch(t){s.transform=l}return s.style=v,s.patternId=n,!0}}const{abs:Yl}=Math;function Nl(e,s,i,r){const{scaleX:o,scaleY:n}=e.__world;if(i.data&&i.patternId!==o+"-"+n){const{data:a}=i;if(r)if("repeat"!==a.mode){let{width:e,height:i}=a;e*=Yl(o)*s.pixelRatio,i*=Yl(n)*s.pixelRatio,a.scaleX&&(e*=a.scaleX,i*=a.scaleY),r=e*i>t.image.maxCacheSize}else r=!1;return r?(s.save(),s.clip(),i.blendMode&&(s.blendMode=i.blendMode),a.opacity&&(s.opacity*=a.opacity),a.transform&&s.transform(a.transform),s.drawImage(i.image.view,0,0,a.width,a.height),s.restore(),!0):(!i.style||Qa.running?Fl(e,i,s.pixelRatio):i.patternTask||(i.patternTask=ar.patternTasker.add((()=>bt(this,void 0,void 0,(function*(){i.patternTask=null,s.bounds.hit(e.__world)&&Fl(e,i,s.pixelRatio),e.forceUpdate("surface")}))),300)),!1)}return!1}function zl(t,e){const s=e["_"+t];if(s instanceof Array){let i,r,o,n;for(let a=0,h=s.length;a<h;a++)i=s[a].image,n=i&&i.url,n&&(r||(r={}),r[n]=!0,ar.recycle(i),i.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),i.unload(s[a].loadId,!o.some((t=>t.url===n)))));return r}return null}function Xl(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,o)}function jl(t,e,s,i){const{strokeAlign:r}=e.__,o="string"!=typeof t;switch(r){case"center":s.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?Hl(t,!0,e,s):Vl(e,s);break;case"inside":Ul("inside",t,o,e,s,i);break;case"outside":Ul("outside",t,o,e,s,i)}}function Ul(t,e,s,i,r,o){const{strokeWidth:n,__font:a}=i.__,h=r.getSameCanvas(!0);h.setStroke(s?void 0:e,2*n,i.__),h.font=a,s?Hl(e,!0,i,h):Vl(i,h),h.blendMode="outside"===t?"destination-out":"destination-in",Xl(i,h),h.blendMode="normal",i.__worldFlipped||o.matrix?r.copyWorldByReset(h):r.copyWorldToInner(h,i.__world,i.__layout.renderBounds),h.recycle()}function Vl(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[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)})),r&&e.strokeRect(s.x,s.y+r,s.width,o)}function Hl(t,e,s,i){let r;for(let o=0,n=t.length;o<n;o++)r=t[o],r.image&&Nl(s,i,r,!1)||r.style&&(i.strokeStyle=r.style,r.blendMode?(i.saveBlendMode(r.blendMode),e?Vl(s,i):i.stroke(),i.restoreBlendMode()):e?Vl(s,i):i.stroke())}const{getSpread:Gl,getOuterOf:Kl,getByMove:ql,getIntersectData:Zl}=G;const Ql={x:.5,y:0},$l={x:.5,y:1};function Jl(t,e,s){let i;for(let r=0,o=e.length;r<o;r++)i=e[r],t.addColorStop(i.offset,Za.string(i.color,s))}const{set:td,getAngle:ed,getDistance:sd}=P,{get:id,rotateOfOuter:rd,scaleOfOuter:od}=v,nd={x:.5,y:.5},ad={x:.5,y:1},hd={},ld={};const{set:dd,getAngle:cd,getDistance:ud}=P,{get:_d,rotateOfOuter:pd,scaleOfOuter:gd}=v,fd={x:.5,y:.5},yd={x:.5,y:1},md={},vd={};let wd;function xd(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=i.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:Za.string(a,h)};case"image":return function(t,e,s,i,r){const o={type:s.type},n=o.image=ar.get(s),a=(r||n.loading)&&{target:t,image:n,attrName:e,attrValue:s};return n.ready?(Dl(t,e,n)&&Sl(o,n,s,i),r&&(Ml(gr.LOAD,a),Ml(gr.LOADED,a))):n.error?r&&(t.forceUpdate("surface"),a.error=n.error,Ml(gr.ERROR,a)):(r&&Ml(gr.LOAD,a),o.loadId=n.load((()=>{t.destroyed||(Dl(t,e,n)&&(Sl(o,n,s,i),t.forceUpdate("surface")),Ml(gr.LOADED,a))}),(e=>{t.forceUpdate("surface"),a.error=e,Ml(gr.ERROR,a)}))),o}(i,e,s,r,!wd||!wd[s.url]);case"linear":return function(e,s){let{from:i,to:r,type:o,blendMode:n,opacity:a}=e;i||(i=Ql),r||(r=$l);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);Jl(h,e.stops,a);const l={type:o,style:h};return n&&(l.blendMode=n),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=nd),r||(r=ad);const{x:l,y:d,width:c,height:u}=s;let _;td(hd,l+i.x*c,d+i.y*u),td(ld,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=id(),od(_,hd,c/u*(h||1),1),rd(_,hd,ed(hd,ld)+90));const p=t.canvas.createRadialGradient(hd.x,hd.y,0,hd.x,hd.y,sd(hd,ld));Jl(p,e.stops,n);const g={type:o,style:p,transform:_};return a&&(g.blendMode=a),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=fd),r||(r=yd);const{x:l,y:d,width:c,height:u}=s;dd(md,l+i.x*c,d+i.y*u),dd(vd,l+r.x*c,d+r.y*u);const _=_d(),p=cd(md,vd);t.conicGradientRotate90?(gd(_,md,c/u*(h||1),1),pd(_,md,p+90)):(gd(_,md,1,c/u*(h||1)),pd(_,md,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,md.x,md.y):t.canvas.createRadialGradient(md.x,md.y,0,md.x,md.y,ud(md,vd));Jl(g,e.stops,n);const f={type:o,style:g,transform:_};return a&&(f.blendMode=a),f}(s,r);default:return s.r?{type:"solid",style:Za.string(s)}:void 0}}var bd=Object.freeze({__proto__:null,compute:function(t,e){const s=[],i=e.__;let r,o,n=i.__input[t];n instanceof Array||(n=[n]),wd=zl(t,i);for(let i=0,o=n.length;i<o;i++)r=xd(t,n[i],e),r&&s.push(r);if(i["_"+t]=s.length?s:void 0,1===n.length){const t=n[0];"image"===t.type&&(o=ar.isPixel(t))}"fill"===t?i.__pixelFill=o:i.__pixelStroke=o},drawTextStroke:Vl,fill:function(t,e,s){s.fillStyle=t,e.__.__font?Xl(e,s):e.__.windingRule?s.fill(e.__.windingRule):s.fill()},fillText:Xl,fills:function(t,e,s){let i;const{windingRule:r,__font:o}=e.__;for(let n=0,a=t.length;n<a;n++)i=t[n],i.image&&Nl(e,s,i,!o)||i.style&&(s.fillStyle=i.style,i.transform?(s.save(),s.transform(i.transform),i.blendMode&&(s.blendMode=i.blendMode),o?Xl(e,s):r?s.fill(r):s.fill(),s.restore()):i.blendMode?(s.saveBlendMode(i.blendMode),o?Xl(e,s):r?s.fill(r):s.fill(),s.restoreBlendMode()):o?Xl(e,s):r?s.fill(r):s.fill())},recycleImage:zl,shape:function(t,e,s){const i=e.getSameCanvas();let r,o,n,a;const{__world:h}=t;let{scaleX:l,scaleY:d}=h;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=n=Kl(h,s.matrix)):r=n=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=Zl(i?Gl(e.bounds,i*l,i*d):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=Kl(h,o),r=ql(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(i,s),{canvas:i,matrix:o,bounds:r,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s,i){const r=e.__,{strokeWidth:o,strokeAlign:n,__font:a}=r;if(o)if(a)jl(t,e,s,i);else switch(n){case"center":s.setStroke(t,o,r),s.stroke();break;case"inside":s.save(),s.setStroke(t,2*o,r),r.windingRule?s.clip(r.windingRule):s.clip(),s.stroke(),s.restore();break;case"outside":const n=s.getSameCanvas(!0);n.setStroke(t,2*o,e.__),e.__drawRenderPath(n),n.stroke(),r.windingRule?n.clip(r.windingRule):n.clip(),n.clearWorld(e.__layout.renderBounds),e.__worldFlipped||i.matrix?s.copyWorldByReset(n):s.copyWorldToInner(n,e.__world,e.__layout.renderBounds),n.recycle()}},strokeText:jl,strokes:function(t,e,s,i){const r=e.__,{strokeWidth:o,strokeAlign:n,__font:a}=r;if(o)if(a)jl(t,e,s,i);else switch(n){case"center":s.setStroke(void 0,o,r),Hl(t,!1,e,s);break;case"inside":s.save(),s.setStroke(void 0,2*o,r),r.windingRule?s.clip(r.windingRule):s.clip(),Hl(t,!1,e,s),s.restore();break;case"outside":const{renderBounds:n}=e.__layout,a=s.getSameCanvas(!0);e.__drawRenderPath(a),a.setStroke(void 0,2*o,e.__),Hl(t,!1,e,a),r.windingRule?a.clip(r.windingRule):a.clip(),a.clearWorld(n),e.__worldFlipped||i.matrix?s.copyWorldByReset(a):s.copyWorldToInner(a,e.__world,n),a.recycle()}}});const{copy:Bd,toOffsetOutBounds:kd}=G,Cd={},Rd={};function Ed(e,s,i,r){const{bounds:o,shapeBounds:n}=r;if(t.fullImageShadow){if(Bd(Cd,e.bounds),Cd.x+=s.x-n.x,Cd.y+=s.y-n.y,i){const{matrix:t}=r;Cd.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Cd.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Cd.width*=i,Cd.height*=i}e.copyWorld(r.canvas,e.bounds,Cd)}else i&&(Bd(Cd,s),Cd.x-=s.width/2*(i-1),Cd.y-=s.height/2*(i-1),Cd.width*=i,Cd.height*=i),e.copyWorld(r.canvas,n,i?Cd:s)}const{toOffsetOutBounds:Td}=G,Od={};var Pd=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;Td(d,Od),h.forEach(((h,f)=>{p.save(),p.setWorldShadow(Od.offsetX+h.x*u,Od.offsetY+h.y*_,h.blur*u),o=h.spread?1-2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Ed(p,Od,o,s),p.restore(),l?(p.copyWorld(p,d,n,"copy"),p.copyWorld(l,n,n,"source-out"),r=n):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,h.color,"source-in"),t.__worldFlipped||i.matrix?e.copyWorldByReset(p,r,n,h.blendMode):e.copyWorldToInner(p,r,a.renderBounds,h.blendMode),g&&f<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;kd(d,Rd),h.forEach(((h,f)=>{p.setWorldShadow(Rd.offsetX+h.x*u,Rd.offsetY+h.y*_,h.blur*u,h.color),o=h.spread?1+2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Ed(p,Rd,o,s),r=d,h.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,n,"copy"),r=n),l?p.copyWorld(l,n,n,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),t.__worldFlipped||i.matrix?e.copyWorldByReset(p,r,n,h.blendMode):e.copyWorldToInner(p,r,a.renderBounds,h.blendMode),g&&f<g&&p.clear()})),p.recycle()}});const Ld=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Sd=Ld+"_#~&*+\\=|≮≯≈≠=…",Dd=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 Md(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ad=Md("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Id=Md("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Wd=Md(Ld),Fd=Md(Sd),Yd=Md("- —/~|┆·");var Nd;!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"}(Nd||(Nd={}));const{Letter:zd,Single:Xd,Before:jd,After:Ud,Symbol:Vd,Break:Hd}=Nd;function Gd(t){return Ad[t]?zd:Yd[t]?Hd:Id[t]?jd:Wd[t]?Ud:Fd[t]?Vd:Dd.test(t)?Xd:zd}const Kd={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function qd(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Zd}=Kd,{Letter:Qd,Single:$d,Before:Jd,After:tc,Symbol:ec,Break:sc}=Nd;let ic,rc,oc,nc,ac,hc,lc,dc,cc,uc,_c,pc,gc,fc,yc,mc,vc=[];function wc(t,e){cc&&!dc&&(dc=cc),ic.data.push({char:t,width:e}),oc+=e}function xc(){nc+=oc,ic.width=oc,rc.words.push(ic),ic={data:[]},oc=0}function bc(){fc&&(yc.paraNumber++,rc.paraStart=!0,fc=!1),cc&&(rc.startCharSize=dc,rc.endCharSize=cc,dc=0),rc.width=nc,mc.width&&Zd(rc),vc.push(rc),rc={words:[]},nc=0}const Bc={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,r=0,o=s.__getInput("width")||0,n=s.__getInput("height")||0;const{textDecoration:h,__font:l,padding:d}=s;if(d){const[t,e,s,h]=a.fourNumber(d);o&&(i=h,o-=e+h),n&&(r=t,n-=t+s)}const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,s,i){yc=e,vc=e.rows,mc=e.bounds;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=t,{width:h,height:l}=mc;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;fc=!0,_c=null,dc=lc=cc=oc=nc=0,ic={data:[]},rc={words:[]};for(let i=0,l=s.length;i<l;i++)hc=s[i],"\n"===hc?(oc&&xc(),rc.paraEnd=!0,bc(),fc=!0):(uc=Gd(hc),uc===Qd&&"none"!==n&&(hc=qd(hc,n,!oc)),lc=a.measureText(hc).width,r&&(r<0&&(cc=lc),lc+=r),pc=uc===$d&&(_c===$d||_c===Qd)||_c===$d&&uc!==tc,gc=!(uc!==Jd&&uc!==$d||_c!==ec&&_c!==tc),ac=fc&&o?h-o:h,t&&h&&nc+oc+lc>ac&&(e?(oc&&xc(),bc()):(gc||(gc=uc===Qd&&_c==tc),pc||gc||uc===sc||uc===Jd||uc===$d||oc+lc>ac?(oc&&xc(),bc()):bc()))," "===hc&&!0!==fc&&nc+oc===0||(uc===sc?(" "===hc&&oc&&xc(),wc(hc,lc),xc()):pc||gc?(oc&&xc(),wc(hc,lc)):wc(hc,lc)),_c=uc);oc&&xc(),nc&&bc(),vc.length>0&&(vc[vc.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{yc.paraNumber++,vc.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(c,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:o,__letterSpacing:n,__clipText:a,textAlign:h,verticalAlign:l,paraSpacing:d}=e;let c,u,_,{x:p,y:g,width:f,height:y}=i,m=r*s.length+(d?d*(t.paraNumber-1):0),v=o;if(a&&m>y)m=Math.max(y,r),t.overflow=s.length;else switch(l){case"middle":g+=(y-m)/2;break;case"bottom":g+=y-m}v+=g;for(let o=0,l=s.length;o<l;o++){switch(c=s[o],c.x=p,h){case"center":c.x+=(f-c.width)/2;break;case"right":c.x+=f-c.width}c.paraStart&&d&&o>0&&(v+=d),c.y=v,v+=r,t.overflow>o&&v>m&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,_=c.width,n<0&&(c.width<0?(_=-c.width+e.fontSize+n,u-=_,_+=e.fontSize):_-=n),u<i.x&&(i.x=u),_>i.width&&(i.width=_),a&&f&&f<_&&(c.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=g,i.height=m}(c,s),function(t,e,s,i){const{rows:r}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===c?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(c,s,o),c.overflow&&function(e,s){const{rows:i,overflow:r}=e;let{textOverflow:o}=s;if(i.splice(r),"hide"!==o){let e,n;"ellipsis"===o&&(o="...");const a=t.canvas.measureText(o).width,h=s.x+s.width-a;("none"===s.textWrap?i:[i[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let s=t.data.length-1;for(let i=s;i>-1&&(e=t.data[i],n=e.x+e.width,!(i===s&&n<h));i--){if(n<h&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=a,t.data.push({char:o,x:n}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,s),"none"!==h&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(c,s),c}},kc={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},Cc={export(t,e,s){return Cc.running=!0,function(t){Rc||(Rc=new nr);return new Promise((e=>{Rc.add((()=>bt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((r=>{const{leafer:o}=t;o?o.waitViewCompleted((()=>bt(this,void 0,void 0,(function*(){let t,n,a,{canvas:h}=o,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}a=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):yield h.toDataURL(e,t),i({data:a}),r(),Cc.running=!1,l&&h.recycle()})))):(i({data:!1}),r(),Cc.running=!1)}))))}};let Rc;Object.assign(Ga,bd),Object.assign(Ha,Pd),Object.assign(qa,Bc),Object.assign(Za,kc),Object.assign(Qa,Cc),Na();export{Ka as Animate,vr as AnimateEvent,Bl as App,tt as AroundHelper,$ as AutoBounds,ne as BezierHelper,Q as Bounds,G as BoundsHelper,Mh as Box,ih as BoxData,ia as Branch,Mo as BranchHelper,Mn as BranchRender,ul as Canvas,yh as CanvasData,_t as CanvasManager,_r as ChildEvent,Za as ColorConvert,e as Creator,on as Cursor,yt as DataHelper,st as Debug,no as DragEvent,ao as DropEvent,Ha as Effect,Yh as Ellipse,hh as EllipseData,ge as EllipseHelper,ur as Event,ct as EventCreator,Qa as Export,wt as FileHelper,Ah as Frame,oh as FrameData,Eh as Group,sh as GroupData,ft as HitCanvasManager,cl as Image,fh as ImageData,gr as ImageEvent,ar as ImageManager,s as IncrementId,Wa as Interaction,rn as InteractionBase,Yo as InteractionHelper,_o as KeyEvent,Br as Keyboard,mr as LayoutEvent,va as Layouter,Kn as Leaf,Rn as LeafBounds,So as LeafBoundsHelper,vt as LeafData,un as LeafDataProxy,dn as LeafEventer,ko as LeafHelper,Ln as LeafHit,hn as LeafLayout,gt as LeafLevelList,pt as LeafList,Dn as LeafMask,vn as LeafMatrix,Sn as LeafRender,bl as Leafer,Pa as LeaferCanvas,St as LeaferCanvasBase,rh as LeaferData,xr as LeaferEvent,cr as LeaferImage,Ua as LeaferTypeCreator,Kh as Line,nh as LineData,a as MathHelper,D as Matrix,v as MatrixHelper,ho as MoveEvent,Qo as MultiTouchHelper,Wt as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,Ga as Paint,vl as Path,Gi as PathBounds,bs as PathCommandDataHelper,At as PathCommandMap,Je as PathConvert,er as PathCorner,Ys as PathCreator,uh as PathData,ti as PathDrawer,Dt as PathHelper,zt as PathNumberCommandLengthMap,Nt as PathNumberCommandMap,pi as PathScaler,wl as Pen,_h as PenData,t as Platform,oa as PluginManager,S as Point,P as PointHelper,kr as PointerButton,ro as PointerEvent,il as Polygon,lh as PolygonData,pr as PropertyEvent,Th as Rect,ah as RectData,Xt as RectHelper,Bh as RectRender,wr as RenderEvent,xa as Renderer,fr as ResizeEvent,lo as RotateEvent,ot as Run,Ta as Selector,dl as Star,dh as StarData,et as StringNumberMap,co as SwipeEvent,or as TaskItem,nr as TaskProcessor,yl as Text,qa as TextConvert,gh as TextData,M as TwoPointBoundsHelper,Ch as UI,wh as UIBounds,ht as UICreator,th as UIData,Cr as UIEvent,xh as UIHit,bh as UIRender,eh as UnitConvert,Fo as WaitHelper,yr as WatchEvent,aa as Watcher,uo as ZoomEvent,Fr as affectRenderBoundsType,Ir as affectStrokeBoundsType,Lr as autoLayoutType,Mr as boundsType,ir as canvasPatch,Lt as canvasSizeAttrs,Vr as cursorType,Hr as dataProcessor,Or as dataType,Kr as defineDataProcessor,Rr as defineKey,Tr as defineLeafAttr,mh as effectType,jr as eraserType,Er as getDescriptor,Ur as hitType,Gr as layoutProcessor,Xr as maskType,Nr as opacityType,Ar as pathType,Pr as positionType,so as registerUI,io as registerUIEvent,vh as resizeType,$r as rewrite,Jr as rewriteAble,Dr as rotationType,Sr as scaleType,zr as sortType,Wr as strokeType,Yr as surfaceType,Na as useCanvas,eo as useModule,na as usePlugin};