leafer-ui 1.0.0-beta.3 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- class t{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class e extends t{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}e.ADD="child.add",e.REMOVE="child.remove";class s extends t{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}s.CHANGE="property.change";class i extends t{constructor(t,e,s,i,r,n){super(t,e),this.image=s,this.attrName=i,this.attrValue=r,n&&(this.error=n)}}i.LOADED="image.loaded",i.ERROR="image.error";class r extends t{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){const s="object"==typeof t;super(s?r.RESIZE:t),s&&Object.assign(this,t),this.old=e}}r.RESIZE="resize";class n extends t{constructor(t,e){super(t),e&&Object.assign(this,e)}}n.START="transform.start",n.CHANGE="transform.change",n.END="transform.end",n.BEFORE_START="transform.before_start",n.BEFORE_CHANGE="transform.before_change",n.BEFORE_END="transform.before_end";class o extends t{constructor(t,e){super(t),this.data=e}}o.REQUEST="watch.request",o.DATA="watch.data";class a extends t{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}a.CHECK_UPDATE="layout.check_update",a.REQUEST="layout.request",a.START="layout.start",a.BEFORE="layout.before",a.LAYOUT="layout.layout",a.AFTER="layout.after",a.AGAIN="layout.again",a.END="layout.end";class h extends t{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}h.REQUEST="render.request",h.START="render.start",h.BEFORE="render.before",h.RENDER="render",h.AFTER="render.after",h.AGAIN="render.again",h.END="render.end";class l extends t{}l.START="leafer.start",l.BEFORE_READY="leafer.before_ready",l.READY="leafer.ready",l.AFTER_READY="leafer.after_ready",l.VIEW_READY="leafer.view_ready",l.STOP="leafer.stop",l.RESTART="leafer.restart",l.END="leafer.end";class d{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return 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 d;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class c{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}}const u={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=_;return e[t]?e[t]++:(e[t]=1,0)}},_=u,p={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]}},g=Math.PI/180,f=2*Math.PI,y=Math.PI/2,{sin:m,cos:v,acos:w,atan:x,sqrt:b,PI:B}=Math,k={};function E(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const T={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:E,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.d*=s,t.c*=e,t.b*=s},scaleOf(t,e,s,i=s){C.toInnerPoint(t,e,k),C.scaleOfInner(t,k,s,i)},scaleOfInner(t,e,s,i=s){C.translateInner(t,e.x,e.y),C.scale(t,s,i),C.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=v(e*=g),i=m(e),{a:r,b:n,c:o,d:a}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=o*s-a*i,t.d=o*i+a*s},rotateOf(t,e,s){C.toInnerPoint(t,e,k),C.rotateOfInner(t,k,s)},rotateOfInner(t,e,s){C.translateInner(t,e.x,e.y),C.rotate(t,s),C.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=g,t.a=i+n*s,t.b=r+o*s),e&&(e*=g,t.c=n+i*e,t.d=o+r*e)},skewOf(t,e,s,i){C.toInnerPoint(t,e,k),C.skewOfInner(t,k,s,i)},skewOfInner(t,e,s,i){C.translateInner(t,e.x,e.y),C.skew(t,s,i),C.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},preMultiply(t,e){const{a:s,b:i,c:r,d:n,e:o,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+n*e.c,t.d=r*e.b+n*e.d),t.e=o*e.a+a*e.c+e.e,t.f=o*e.b+a*e.d+e.f},divide(t,e){C.multiply(t,C.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=C;return C.copy(e,t),C.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=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=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:n}=e,{a:o,b:a,c:h,d:l}=t,d=1/(o*l-a*h);if(s||(s=e),s.x=(r*l-n*h)*d,s.y=(n*o-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*o-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,o=r,a=0,h=0,l=0;if(s||i){const t=e*r-s*i,d=e*i+s*r;if(s){const i=e*e+s*s;n=b(i),o=t/n;const r=e/n;a=s>0?w(r):-w(r),h=x(d/i)/g}else{const e=i*i+r*r;o=b(e),n=t/o;const s=i/o;a=B/2-(r>0?w(-s):-w(s)),l=x(d/e)/g}a/=g}return{x:t.e,y:t.f,scaleX:n,scaleY:o,rotation:a,skewX:h,skewY:l}},reset(t){C.set(t)}},C=T,{toInnerPoint:R,toOuterPoint:P}=T,{sin:L,cos:O,abs:S,sqrt:M,atan2:D}=Math,A={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},rotate(t,e,s){s||(s=I.defaultPoint);const i=O(e*g),r=L(e*g),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r-o*i},tempToInnerOf(t,e){const{tempPoint:s}=I;return I.copy(s,t),R(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return I.copy(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),R(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){R(e,t,s)},toOuterOf(t,e,s){P(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=S(e.x-t.x),i=S(e.y-t.y);return M(s*s+i*i)},getAngle:(t,e)=>I.getAtan2(t,e)/g,getAtan2:(t,e)=>D(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=I.getAtan2(t,e);return{x:t.x+O(i)*s,y:t.y+L(i)*s}},reset(t){I.reset(t)}},I=A;class W{constructor(t,e){"object"==typeof t?A.copy(this,t):A.set(this,t,e)}set(t,e){A.set(this,t,e)}copy(t){return A.copy(this,t),this}clone(){return new W(this)}rotate(t,e){return A.rotate(this,t,e),this}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return A.getCenter(this,t)}getDistance(t){return A.getDistance(this,t)}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){A.reset(this)}}class N{constructor(t,e,s,i,r,n){"object"==typeof t?T.copy(this,t):T.set(this,t,e,s,i,r,n)}set(t,e,s,i,r,n){T.set(this,t,e,s,i,r,n)}copy(t){return T.copy(this,t),this}clone(){return new N(this)}translate(t,e){return T.translate(this,t,e),this}translateInner(t,e){return T.translateInner(this,t,e),this}scale(t,e){return T.scale(this,t,e),this}scaleOf(t,e,s){return T.scaleOf(this,t,e,s),this}scaleOfInner(t,e,s){return T.scaleOfInner(this,t,e,s),this}rotate(t){return T.rotate(this,t),this}rotateOf(t,e){return T.rotateOf(this,t,e),this}rotateOfInner(t,e){return T.rotateOfInner(this,t,e),this}skew(t,e){return T.skew(this,t,e),this}skewOf(t,e,s){return T.skewOf(this,t,e,s),this}skewOfInner(t,e,s){return T.skewOfInner(this,t,e,s),this}multiply(t){return T.multiply(this,t),this}preMultiply(t){return T.preMultiply(this,t),this}divide(t){return T.divide(this,t),this}invert(){return T.invert(this),this}toOuterPoint(t,e){T.toOuterPoint(this,t,e)}toInnerPoint(t,e){T.toInnerPoint(this,t,e)}decompose(){return T.decompose(this)}reset(){T.reset(this)}}const F={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){z(t,e,s),z(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:z}=F,{tempPointBounds:H,setPoint:U,addPoint:Y,toBounds:j}=F,{toOuterPoint:X}=T;let V,G,K,q;const Q={},Z={},$={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){J.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},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),J.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?et(e,t):e=t,s?(e.offsetX=-(J.right(s)-t.x),e.offsetY=-(J.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),J.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(J.copy(J.tempBounds,t),J.toOuterOf(J.tempBounds,e),J.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),J.toOuterOf(t,e),t),toOuterOf(t,e,s){s||(s=t),0===e.b&&0===e.c?(s.x=e.e+t.x*e.a,s.y=e.f+t.y*e.d,s.width=t.width*e.a,s.height=t.height*e.d):(Q.x=t.x,Q.y=t.y,X(e,Q,Z),U(H,Z.x,Z.y),Q.x=t.x+t.width,X(e,Q,Z),Y(H,Z.x,Z.y),Q.y=t.y+t.height,X(e,Q,Z),Y(H,Z.x,Z.y),Q.x=t.x,X(e,Q,Z),Y(H,Z.x,Z.y),j(H,s))},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new N(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return J.copyAndSpread(s,t,e),s},spread(t,e){J.copyAndSpread(t,t,e)},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)},add(t,e){V=t.x+t.width,G=t.y+t.height,K=e.x+e.width,q=e.y+e.height,V=V>K?V:K,G=G>q?G:q,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=V-t.x,t.height=G-t.y},addList(t,e){J.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){J.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){J.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o]):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||et(t,r)):tt(t,r));n&&J.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?U(H,t.x,t.y):Y(H,t.x,t.y)})),j(H,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=A.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=A.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=J.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=J.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=J.tempToOuterOf(e,s));let{x:i,y:r,width:n,height:o}=e;return V=i+n,G=r+o,K=t.x+t.width,q=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,V=V<K?V:K,G=G<q?G:q,n=V-i,o=G-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){J.copy(t,J.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){J.set(t)}},J=$,{add:tt,copy:et}=J;class st{constructor(t,e,s,i){"object"==typeof t?$.copy(this,t):$.set(this,t,e,s,i)}set(t,e,s,i){$.set(this,t,e,s,i)}copy(t){return $.copy(this,t),this}clone(){return new st(this)}scale(t){return $.scale(this,t),this}toOuterOf(t,e){return $.toOuterOf(this,t,e),this}getFitMatrix(t){return $.getFitMatrix(this,t)}spread(t){return $.spread(this,t),this}ceil(){return $.ceil(this),this}add(t){return $.add(this,t),this}addList(t){return $.setByList(this,t,!0),this}setByList(t,e){return $.setByList(this,t,e),this}addListWithHandle(t,e){return $.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return $.setByListWithHandle(this,t,e,s),this}setByPoints(t){return $.setByPoints(this,t),this}hitPoint(t,e){return $.hitPoint(this,t,e)}hitRadiusPoint(t,e){return $.hitRadiusPoint(this,t,e)}hit(t,e){return $.hit(this,t,e)}includes(t,e){return $.includes(this,t,e)}intersect(t,e){return $.intersect(this,t,e),this}getIntersect(t,e){return new st($.getIntersectData(this,t,e))}isSame(t){return $.isSame(this,t)}isEmpty(){return $.isEmpty(this)}reset(){$.reset(this)}}class it{constructor(t,e,s,i,r,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new st(r,e,n||t.width-r-s,o||t.height-e-i)}}class rt{constructor(t,e){F.setPoint(this,t,e)}addPoint(t,e){F.addPoint(this,t,e)}addBounds(t,e,s,i){F.addBounds(this,t,e,s,i)}add(t){F.add(this,t)}}const nt={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},ot={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ht(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},updateAllChange(t){if(lt(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)dt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),at.moveLocal(t,i.x,i.y)},moveLocal(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOf(t,e,s,i,r){const n=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,n,s,i,r)},zoomOfLocal(t,e,s,i,r){i||(i=s),r||(r=t);const{x:n,y:o}=r.__,a=(new N).translate(n,o).scaleOf(e,s,i);r.x=a.e,r.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOf(t,e,s,i){const r=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:r,y:n}=i.__,o=(new N).translate(r,n).rotateOf(e,s);i.x=o.e,i.y=o.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},at=ot,{updateAllWorldMatrix:ht,updateAllWorldOpacity:lt,updateAllChange:dt}=at,ct={worldBounds:t=>t.__world,localBoxBounds:t=>t.__local,localEventBounds:t=>t.__layout.localStrokeBounds,localRenderBounds:t=>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},ut={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),_t(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++)pt(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:_t,pushAllBranchStack:pt}=ut,gt={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},ft={default:(t,e)=>(yt(e,t),yt(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?yt(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:yt}=ft;class mt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]: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];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__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]}destroy(){this.__leaf=null}}class vt{constructor(t){this.name=t}static get(t){return new vt(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(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}vt.filterList=[],vt.excludeList=[];const wt=vt,xt=vt.get("RunTime");class bt{static start(t,e){const s=u.create(u.RUNTIME);return Bt.currentId=Bt.idMap[s]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[s]=t,Bt.nameToIdMap[t]=s,s}static end(t,e){const s=Bt.idMap[t],i=Bt.nameMap[t];Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[i]=void 0,e?xt.log(i,performance.now()-s,"µs"):xt.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}}bt.idMap={},bt.nameMap={},bt.nameToIdMap={};const Bt=bt,{updateAllWorldMatrix:kt,updateAllWorldOpacity:Et}=ot,{pushAllChildBranch:Tt,pushAllParent:Ct}=ut;const{worldBounds:Rt}=ct,{setByListWithHandle:Pt}=$;class Lt{constructor(t){this.updatedBounds=new st,this.beforeBounds=new st,this.afterBounds=new st,t instanceof Array&&(t=new d(t)),this.updatedList=t}setBefore(){Pt(this.beforeBounds,this.updatedList.list,Rt)}setAfter(){Pt(this.afterBounds,this.updatedList.list,Rt),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:Ot,updateAllChange:St}=ot,{pushAllBranchStack:Mt,updateWorldBoundsByBranchStack:Dt}=ut,At=vt.get("Layouter");class It{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,e&&(this.config=ft.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(a.START),this.layoutOnce(),t.emitEvent(new a(a.END,this.layoutedBlocks,this.times))}catch(t){At.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?At.warn("layouting"):this.times>3?At.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(o.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.__updateList)||void 0===t?void 0:t.length))return;const e=bt.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=a,h=this.getBlocks(i);h.forEach((t=>{t.setBefore()})),s.emitEvent(new a(r,h,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(kt(t),e.push(t),t.isBranch&&Tt(t,e),Ct(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Ct(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&&Et(t),t.__updateChange()}))}(i),h.forEach((t=>t.setAfter())),s.emitEvent(new a(n,h,this.times)),s.emitEvent(new a(o,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updateList=null,bt.end(e)}fullLayout(){const t=bt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=a,n=this.getBlocks(new d(e));e.emitEvent(new a(s,n,this.times)),It.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new a(i,n,this.times)),e.emitEvent(new a(r,n,this.times)),this.addBlocks(n),bt.end(t)}static fullLayout(t){if(Ot(t),t.isBranch){const e=[t];Mt(t,e),Dt(e)}else t.__updateWorldBounds();St(t)}createBlock(t){return new Lt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(a.REQUEST,this.layout,this),t.on_(a.AGAIN,this.layoutAgain,this),t.on_(o.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Wt={layout:It.fullLayout},Nt={},Ft=vt.get("UICreator"),zt={list:{},register(t){const{__tag:e}=t.prototype;Ht[e]?Ft.error("repeat:",e):Ht[e]=t},get(t,e,s,i,r,n){const o=new Ht[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:Ht}=zt,Ut=vt.get("EventCreator"),Yt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(jt[e]?Ut.error("repeat: ",e):jt[e]=t)}))},changeName(t,e){const s=jt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,jt[e]=s)}},get:(t,...e)=>new jt[t](...e)},{nameList:jt}=Yt;class Xt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Nt.canvas(t);return this.add(i),i}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}destory(){this.clear()}}class Vt extends Xt{constructor(){super(...arguments),this.pathTypeList=new d,this.imageTypeList=new d}get(t){}getImageType(t,e){return this.imageTypeList.push(t),Nt.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),Nt.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}function Gt(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function Kt(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(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(o,a)}h((i=i.apply(t,e||[])).next())}))}function qt(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)}}const Qt=[];function Zt(){return(t,e)=>{Qt.push(e)}}const $t=[];let Jt=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||$t)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){}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,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,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,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,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,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};Gt([qt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Gt([qt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Gt([qt("globalAlpha")],Jt.prototype,"opacity",void 0),Gt([qt()],Jt.prototype,"fillStyle",void 0),Gt([qt()],Jt.prototype,"strokeStyle",void 0),Gt([qt("lineWidth")],Jt.prototype,"strokeWidth",void 0),Gt([qt("lineCap")],Jt.prototype,"strokeCap",void 0),Gt([qt("lineJoin")],Jt.prototype,"strokeJoin",void 0),Gt([qt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Gt([qt()],Jt.prototype,"miterLimit",void 0),Gt([qt()],Jt.prototype,"shadowBlur",void 0),Gt([qt()],Jt.prototype,"shadowColor",void 0),Gt([qt()],Jt.prototype,"shadowOffsetX",void 0),Gt([qt()],Jt.prototype,"shadowOffsetY",void 0),Gt([qt()],Jt.prototype,"filter",void 0),Gt([qt()],Jt.prototype,"font",void 0),Gt([qt()],Jt.prototype,"fontKerning",void 0),Gt([qt()],Jt.prototype,"fontStretch",void 0),Gt([qt()],Jt.prototype,"fontVariantCaps",void 0),Gt([qt()],Jt.prototype,"textAlign",void 0),Gt([qt()],Jt.prototype,"textBaseline",void 0),Gt([qt()],Jt.prototype,"textRendering",void 0),Gt([qt()],Jt.prototype,"wordSpacing",void 0),Gt([qt()],Jt.prototype,"letterSpacing",void 0),Gt([qt()],Jt.prototype,"direction",void 0),Gt([Zt()],Jt.prototype,"setTransform",null),Gt([Zt()],Jt.prototype,"resetTransform",null),Gt([Zt()],Jt.prototype,"getTransform",null),Gt([Zt()],Jt.prototype,"save",null),Gt([Zt()],Jt.prototype,"restore",null),Gt([Zt()],Jt.prototype,"transform",null),Gt([Zt()],Jt.prototype,"translate",null),Gt([Zt()],Jt.prototype,"scale",null),Gt([Zt()],Jt.prototype,"rotate",null),Gt([Zt()],Jt.prototype,"fill",null),Gt([Zt()],Jt.prototype,"stroke",null),Gt([Zt()],Jt.prototype,"clip",null),Gt([Zt()],Jt.prototype,"fillRect",null),Gt([Zt()],Jt.prototype,"strokeRect",null),Gt([Zt()],Jt.prototype,"clearRect",null),Gt([Zt()],Jt.prototype,"beginPath",null),Gt([Zt()],Jt.prototype,"moveTo",null),Gt([Zt()],Jt.prototype,"lineTo",null),Gt([Zt()],Jt.prototype,"bezierCurveTo",null),Gt([Zt()],Jt.prototype,"quadraticCurveTo",null),Gt([Zt()],Jt.prototype,"closePath",null),Gt([Zt()],Jt.prototype,"arc",null),Gt([Zt()],Jt.prototype,"arcTo",null),Gt([Zt()],Jt.prototype,"ellipse",null),Gt([Zt()],Jt.prototype,"rect",null),Gt([Zt()],Jt.prototype,"roundRect",null),Gt([Zt()],Jt.prototype,"createConicGradient",null),Gt([Zt()],Jt.prototype,"createLinearGradient",null),Gt([Zt()],Jt.prototype,"createPattern",null),Gt([Zt()],Jt.prototype,"createRadialGradient",null),Gt([Zt()],Jt.prototype,"fillText",null),Gt([Zt()],Jt.prototype,"measureText",null),Gt([Zt()],Jt.prototype,"strokeText",null);const te=new st,ee={width:1,height:1,pixelRatio:1},se=["width","height","pixelRatio"];class ie extends Jt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(t,e){super(),this.worldTransform={},t||(t=ee),t.pixelRatio||(t.pixelRatio=Wt.devicePixelRatio),this.manager=e,this.innerId=u.create(u.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.pixelRatio=r,this.offscreen=Wt.isWorker||t.offscreen,this.config=t,this.init(),this.textBaseline="alphabetic"}init(){}setBackgroundColor(t){}setHittable(t){}resize(t){if(this.isSameSize(t))return;const{width:e,height:s}=t;let i;this.context&&!this.unreal&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this)),ft.copyAttrs(this,t,se),this.bounds=new st(0,0,e,s),this.unreal||(this.setViewSize(t),this.smooth=this.config.smooth),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}setViewSize(t){}startAutoLayout(t,e){}stopAutoLayout(){}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:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*o)*i,r.b=(t.a*n+t.b*a)*i,r.c=(t.c*s+t.d*o)*i,r.d=(t.c*n+t.d*a)*i,r.e=(t.e*s+t.f*o+h)*i,r.f=(t.e*n+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)}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 this.context.isPointInPath(t.x,t.y,e)}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,$.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")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,te.copy(t).scale(this.pixelRatio),this.fillRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,te.copy(t).scale(this.pixelRatio),this.strokeRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}clearWorld(t,e){te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.clearRect(te.x,te.y,te.width,te.height)}clipWorld(t,e){this.beginPath(),te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.rect(te.x,te.y,te.width,te.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:e,height:s,pixelRatio:i}=this,r={width:e,height:s,pixelRatio:i},n=this.manager?this.manager.get(r):Nt.canvas(r);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:r}=this;t&&(s+=t),e&&(i+=e);const n={width:s,height:i,pixelRatio:r},o=this.manager?this.manager.get(n):Nt.canvas(n);return o.save(),o}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function re(t,e,s){Object.defineProperty(t,e,s)}function ne(t,e){return Object.getOwnPropertyDescriptor(t,e)}function oe(t){return(e,s)=>{re(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function ae(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};re(t,e,Object.assign(r,i||{})),Ee(t,e,s)}function he(t){return(e,s)=>{ae(e,s,t)}}function le(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function de(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function ce(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function ue(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const ge=pe;function fe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ye(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function me(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function ve(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function we(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.parent?this.parent.__updateMask(t):this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function xe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),vt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function be(t){return(e,s)=>{re(e,"__DataProcessor",{get:()=>t})}}function Be(t){return(e,s)=>{re(e,"__LayoutProcessor",{get:()=>t})}}function ke(t,e,s){Ee(t.prototype,e,s)}function Ee(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s&&(o.get=function(){return this[r]});const a=ne(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const Te=new vt("rewrite"),Ce=[],Re=["destroy","constructor"];function Pe(t){return(e,s)=>{Ce.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Le(){return t=>{Oe()}}function Oe(t){Ce.length&&(Ce.forEach((e=>{t&&Te.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ce.length=0)}function Se(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Re.includes(i)||e&&e.includes(i)))if(t.prototype){ne(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Me(){return t=>{zt.register(t)}}function De(){return t=>{Yt.register(t)}}setTimeout((()=>Oe(!0)));const{toOuterOf:Ae}=$;class Ie{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()}checkUpdate(){const{leafer:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():(t.start(),t.layouter.layout());else{let t=this.leaf;for(;t.parent;)t=t.parent;Wt.layout(t)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),T.decompose("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={}),Ae(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ae(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Ae(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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const We={},Ne={on(t,e,s){let i,r,n;if(s){const t="boolean"==typeof s;i=t?s:s.capture,r=!t&&s.once}const o=Fe(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))},off(t,e,s){let i,r,n;s&&(i="boolean"==typeof s?s:s.capture);const o=Fe(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=o[t],r&&(n=r.findIndex((t=>t.listener===e)),n>-1&&r.splice(n,1),r.length||delete o[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){const i=Fe(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&(r=i[n],r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),!e||!e.isStopNow);n++);}},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 Fe(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:We)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:We)}}const ze={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:i}=s,r=new s(i,this,t,this.__.__get(t),e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:He}=T,{sin:Ue,cos:Ye}=Math,je={__updateWorldMatrix(){const t=this.parent?this.parent.__world:He,e=this.__local,s=this.__world;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):(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)},__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:o}=this.__;r||n||o?(r*=g,n&&(n*=g),o&&(o*=g),t.a=s*Ye(r+o),t.b=s*Ue(r+o),t.c=i*-Ue(r-n),t.d=i*Ye(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)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:Xe,copyAndSpread:Ve}=$,Ge={__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,Xe(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Xe(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Xe(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Xe(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Xe(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){Ve(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ve(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Ke}=A,qe={},Qe={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Ke(t,this.__world,qe),this.__hit(qe)},__drawHitPath(t){this.__drawRenderPath(t)}},Ze={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,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)}},$e={__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),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--)}}},{LEAF:Je,create:ts}=u;let es=class{get tag(){return this.__tag}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return mt}get __LayoutProcessor(){return Ie}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}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 __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return this.__hasMask&&this.__.hitChildren}constructor(t){this.innerId=ts(Je),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={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),t&&Object.assign(this,t)}waitParent(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&gt.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(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateMask(){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?T.toInnerPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}localToWorld(t,e,s){this.parent?T.toOuterPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}worldToInner(t,e,s){T.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){T.toOuterPoint(this.worldTransform,t,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){this.parent&&this.parent.remove(this)}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.__&&(this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null,this.children&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};es=Gt([Se(ze),Se(je),Se(Ge),Se(Qe),Se(Ne),Se(Ze)],es);const{setByListWithHandle:ss}=$,{sort:is}=ut,{localBoxBounds:rs,localEventBounds:ns,localRenderBounds:os,maskLocalBoxBounds:as,maskLocalEventBounds:hs,maskLocalRenderBounds:ls}=ct;let ds=class extends es{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(){ss(this.__layout.boxBounds,this.children,this.__hasMask?as:rs)}__updateStrokeBounds(){ss(this.__layout.strokeBounds,this.children,this.__hasMask?hs:ns)}__updateRenderBounds(){ss(this.__layout.renderBounds,this.children,this.__hasMask?ls:os)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(is)}}__render(t,e){if(this.__worldOpacity){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,n=t.getSameCanvas(),o=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,o,n),n.clear(),o.clear()):r=!0,s.__render(n,e)):s.__render(o,e);this.__renderMask(t,o,n),n.recycle(),o.recycle()}else{const{bounds:r,hideBounds:n}=e;for(let o=0,a=i.length;o<a;o++)s=i[o],r&&!r.hit(s.__world,e.matrix)||n&&n.includes(s.__world,e.matrix)||s.__render(t,e)}}}add(t,s){if(t.parent&&t.parent.remove(t),t.parent=this,void 0===s?this.children.push(t):this.children.splice(s,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&gt.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready)){const{ADD:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}remove(t){if(t){const s=this.children.indexOf(t);if(s>-1&&(this.children.splice(s,1),this.__hasMask&&this.__updateMask(),this.__layout.boxChange(),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready))){const{REMOVE:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}else super.remove()}};ds=Gt([Se($e)],ds);const cs={};class us{static isHoldSpaceKey(){return us.hasDownCode("Space")}static setDownCode(t){cs[t]||(cs[t]=!0)}static setUpCode(t){cs[t]=!1}static hasDownCode(t){return cs[t]}}class _s{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class ps extends t{get spaceKey(){return us.isHoldSpaceKey()}get left(){return _s.left(this)}get right(){return _s.right(this)}get middle(){return _s.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){Yt.changeName(t,e)}}let gs=class extends ps{};gs.POINTER="pointer",gs.BEFORE_DOWN="pointer.before_down",gs.BEFORE_MOVE="pointer.before_move",gs.BEFORE_UP="pointer.before_up",gs.DOWN="pointer.down",gs.MOVE="pointer.move",gs.UP="pointer.up",gs.OVER="pointer.over",gs.OUT="pointer.out",gs.ENTER="pointer.enter",gs.LEAVE="pointer.leave",gs.TAP="tap",gs.DOUBLE_TAP="double_tap",gs.CLICK="click",gs.DOUBLE_CLICK="double_click",gs.LONG_PRESS="long_press",gs.LONG_TAP="long_tap",gs=Gt([De()],gs);let fs=class extends gs{};var ys;fs.DRAG="drag",fs.START="drag.start",fs.END="drag.end",fs.OVER="drag.over",fs.OUT="drag.out",fs.ENTER="drag.enter",fs.LEAVE="drag.leave",fs=Gt([De()],fs);let ms=ys=class extends gs{static setList(t){ys.dragList=t instanceof d?t:new d(t)}static setData(t){this.dragData=t}};ms.DROP="drop",ms=ys=Gt([De()],ms);let vs=class extends fs{};vs.MOVE="move",vs.START="move.start",vs.END="move.end",vs=Gt([De()],vs);let ws=class extends ps{};ws.ROTATE="rotate",ws.START="rotate.start",ws.END="rotate.end",ws=Gt([De()],ws);let xs=class extends fs{};xs.SWIPE="swipe",xs.LEFT="swipe.left",xs.RIGHT="swipe.right",xs.UP="swipe.up",xs.DOWN="swipe.down",xs=Gt([De()],xs);let bs=class extends ps{};bs.ZOOM="zoom",bs.START="zoom.start",bs.END="zoom.end",bs=Gt([De()],bs);let Bs=class extends ps{};Bs.DOWN="key.down",Bs.PRESS="key.press",Bs.UP="key.up",Bs=Gt([De()],Bs);class ks{constructor(t,e){this.map={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Nt.image(t),this.map[t.url]=e),e}destory(){this.leafer=null,this.map=null}}const Es={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ts={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Cs=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},Ts),Rs={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},Ps={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},Ls=Object.assign(Object.assign({},Ps),Ts),Os=Cs,Ss={};for(let t in Os)Ss[Os[t]]=t;const Ms={};for(let t in Os)Ms[Os[t]]=Rs[t];const Ds={drawRoundRect(t,e,s,i,r,n){let[o,a,h,l]=p.fourNumber(n);const d=Math.min(i/2,r/2);o>d&&(o=d),a>d&&(a=d),h>d&&(h=d),l>d&&(l=d),o?t.moveTo(e+o,s):t.moveTo(e,s),a?t.arcTo(e+i,s,e+i,s+r,a):t.lineTo(e+i,s),h?t.arcTo(e+i,s+r,e,s+r,h):t.lineTo(e+i,s+r),l?t.arcTo(e,s+r,e,s,l):t.lineTo(e,s+r),o?t.arcTo(e,s,e+i,s,o):t.lineTo(e,s)}},{sin:As,cos:Is,atan2:Ws,ceil:Ns,abs:Fs,PI:zs}=Math,{setPoint:Hs,addPoint:Us}=F,{set:Ys}=A,js={},Xs={rect(t,e,s,i,r){Es.creator.path=t,Es.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,n){Es.creator.path=[],Ds.drawRoundRect(Es.creator,e,s,i,r,n),t.push(...Es.convertToCanvasData(Es.creator.path,!0))},arcTo(t,e,s,i,r,n,o,a,h,l,d){const c=i-e,u=r-s,_=n-i,p=o-r;let m=Ws(u,c),v=Ws(p,_),w=v-m;if(w<0&&(w+=f),w===zs||Fs(c+u)<1e-12||Fs(_+p)<1e-12)return t&&t.push(Cs.L,i,r),h&&(Hs(h,e,s),Us(h,i,r)),d&&Ys(d,e,s),void(l&&Ys(l,i,r));const x=c*p-_*u<0,b=x?-1:1,B=a/Is(w/2),k=i+B*Is(m+w/2+y*b),E=r+B*As(m+w/2+y*b);return m-=y*b,v-=y*b,Ks(t,k,E,a,a,0,m/g,v/g,x,h,l,d)},arc:(t,e,s,i,r,n,o,a,h,l)=>Ks(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,n,o,a,h,l,d,c){const u=n*g,_=As(u),p=Is(u);let m=o*g,v=a*g;m>zs&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Ns(Fs(w/y)),b=w/x,B=As(b/4),k=8/3*B*B/As(b/2);v=m+b;let E,T,C,R,P,L,O,S,M=Is(m),D=As(m),A=C=p*i*M-_*r*D,I=R=_*i*M+p*r*D,W=e+C,N=s+R;t&&t.push(Cs.L,W,N),l&&Hs(l,W,N),c&&Ys(c,W,N);for(let n=0;n<x;n++)E=Is(v),T=As(v),C=p*i*E-_*r*T,R=_*i*E+p*r*T,P=e+A-k*(p*i*D+_*r*M),L=s+I-k*(_*i*D-p*r*M),O=e+C+k*(p*i*T+_*r*E),S=s+R+k*(_*i*T-p*r*E),t&&t.push(Cs.C,P,L,O,S,e+C,s+R),l&&Gs(e+A,s+I,P,L,O,S,e+C,s+R,l,!0),A=C,I=R,M=E,D=T,m=v,v+=b;d&&Ys(d,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Cs.C,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){Gs(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=n,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?Us(h,t,e):Hs(h,t,e),Us(h,o,a);for(let l=0,c=d.length;l<c;l++)Vs(d[l],t,e,s,i,r,n,o,a,js),Us(h,js.x,js.y)},getPointAndSet(t,e,s,i,r,n,o,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+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return Vs(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Vs,toTwoPointBounds:Gs,ellipse:Ks}=Xs,{sin:qs,cos:Qs,sqrt:Zs,atan2:$s}=Math,{ellipse:Js}=Xs,ti={ellipticalArc(t,e,s,i,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*g,p=qs(_),y=Qs(_),m=-y*c-p*u,v=-y*u+p*c,w=i*i,x=r*r,b=v*v,B=m*m,k=w*x-w*b-x*B;let E=0;if(k<0){const t=Zs(1-k/(w*x));i*=t,r*=t}else E=(o===a?-1:1)*Zs(k/(w*b+x*B));const T=E*i*v/r,C=-E*r*m/i,R=$s((v-C)/r,(m-T)/i),P=$s((-v-C)/r,(-m-T)/i);let L=P-R;0===a&&L>0?L-=f:1===a&&L<0&&(L+=f);const O=e+c+y*T-p*C,S=s+u+p*T+y*C,M=L<0?1:0;d?Js(t,O,S,i,r,n,R/g,P/g,M):i!==r||n?t.push(Cs.G,O,S,i,r,n,R/g,P/g,M):t.push(Cs.O,O,S,i,R/g,P/g,M)}},{M:ei,m:si,L:ii,l:ri,H:ni,h:oi,V:ai,v:hi,C:li,c:di,S:ci,s:ui,Q:_i,q:pi,T:gi,t:fi,A:yi,a:mi,Z:vi,z:wi,N:xi,D:bi,X:Bi,G:ki,F:Ei,O:Ti,P:Ci,U:Ri}=Cs,{rect:Pi,roundRect:Li,arcTo:Oi,arc:Si,ellipse:Mi,quadraticCurveTo:Di}=Xs,{ellipticalArc:Ai}=ti,Ii=vt.get("PathConvert"),Wi={},Ni={current:{},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=Ms[s],o+=s===i?" ":Ss[s];for(let s=1;s<e;s++)o+=t[r+s],s===e-1||(o+=" ");i=s,r+=e}return o},parse(t,e){let s,i,r,n="";const o=[],a=e?Ls:Ps;for(let e=0,h=t.length;e<h;e++)i=t[e],nt[i]?n+=i:Cs[i]?(n&&(zi(o,Number(n)),n=""),Fi.name=Cs[i],Fi.length=Rs[i],Fi.index=0,zi(o,Fi.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&zi(o,Number(n)),n=i):n&&(zi(o,Number(n)),n=""),r=i;return n&&zi(o,Number(n)),s?Ni.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case si:t[c+1]+=a,t[c+2]+=h;case ei:a=t[c+1],h=t[c+2],_.push(ei,a,h),c+=3;break;case oi:t[c+1]+=a;case ni:a=t[c+1],_.push(ii,a,h),c+=2;break;case hi:t[c+1]+=h;case ai:h=t[c+1],_.push(ii,a,h),c+=2;break;case ri:t[c+1]+=a,t[c+2]+=h;case ii:a=t[c+1],h=t[c+2],_.push(ii,a,h),c+=3;break;case ui:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ci;case ci:o=n===li||n===ci,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(li,l,d,s,i,a,h),c+=5;break;case di: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=li;case li:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(li,t[c+1],t[c+2],s,i,a,h),c+=7;break;case fi:t[c+1]+=a,t[c+2]+=h,r=gi;case gi:o=n===_i||n===gi,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Di(_,a,h,s,i,t[c+1],t[c+2]):_.push(_i,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=_i;case _i:s=t[c+1],i=t[c+2],e?Di(_,a,h,s,i,t[c+3],t[c+4]):_.push(_i,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case mi:t[c+6]+=a,t[c+7]+=h;case yi:Ai(_,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 wi:case vi:_.push(vi),c++;break;case xi:a=t[c+1],h=t[c+2],e?Pi(_,a,h,t[c+3],t[c+4]):Hi(_,t,c,5),c+=5;break;case bi:a=t[c+1],h=t[c+2],e?Li(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Hi(_,t,c,9),c+=9;break;case Bi:a=t[c+1],h=t[c+2],e?Li(_,a,h,t[c+3],t[c+4],t[c+5]):Hi(_,t,c,6),c+=6;break;case ki:Mi(e?_:Hi(_,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,Wi),a=Wi.x,h=Wi.y,c+=9;break;case Ei:e?Mi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Hi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ti:Si(e?_:Hi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Wi),a=Wi.x,h=Wi.y,c+=7;break;case Ci:e?Si(_,t[c+1],t[c+2],t[c+3],0,360,!1):Hi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ri:Oi(e?_:Hi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Wi),a=Wi.x,h=Wi.y,c+=6;break;default:return Ii.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){Fi.index===Fi.length&&(Fi.index=1,t.push(Fi.name)),t.push(e),Fi.index++}},{current:Fi,pushData:zi,copyData:Hi}=Ni,{M:Ui,L:Yi,C:ji,Q:Xi,Z:Vi,N:Gi,D:Ki,X:qi,G:Qi,F:Zi,O:$i,P:Ji,U:tr}=Cs,er={},sr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ui,e,s)},lineTo(t,e,s){t.push(Yi,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(ji,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Xi,e,s,i,r)},closePath(t){t.push(Vi)},rect(t,e,s,i,r){t.push(Gi,e,s,i,r)},roundRect(t,e,s,i,r,n){if("number"==typeof n)t.push(qi,e,s,i,r,n);else{const o=p.fourNumber(n);o?t.push(Ki,e,s,i,r,...o):t.push(Gi,e,s,i,r)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Zi,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Qi,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(Ji,e,s,i):(void 0===n&&(n=360),t.push($i,e,s,i,r,n,o?1:0))},moveToEllipse(t,e,s,i,r,n,o,a,h){void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=360),Xs.ellipse(null,e,s,i,r,n,o,a,h,null,null,er),t.push(Ui,er.x,er.y),ir(t,e,s,i,r,n,o,a,h)},moveToArc(t,e,s,i,r,n,o){void 0===r&&(r=0),void 0===n&&(n=360),Xs.arc(null,e,s,i,r,n,o,null,null,er),t.push(Ui,er.x,er.y),rr(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(tr,e,s,i,r,n)}},{ellipse:ir,arc:rr}=sr,{moveTo:nr,lineTo:or,quadraticCurveTo:ar,bezierCurveTo:hr,closePath:lr,beginPath:dr,rect:cr,roundRect:ur,ellipse:_r,arc:pr,arcTo:gr,moveToEllipse:fr,moveToArc:yr}=sr;class mr{constructor(t){this.path=t?"string"==typeof t?Es.parse(t):t:[]}beginPath(){return dr(this.path),this}moveTo(t,e){return nr(this.path,t,e),this}lineTo(t,e){return or(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return hr(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return ar(this.path,t,e,s,i),this}closePath(){return lr(this.path),this}rect(t,e,s,i){return cr(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return ur(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return _r(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return pr(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return gr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return fr(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return yr(this.path,t,e,s,i,r,n),this}}const{M:vr,L:wr,C:xr,Q:br,Z:Br,N:kr,D:Er,X:Tr,G:Cr,F:Rr,O:Pr,P:Lr,U:Or}=Cs,Sr=vt.get("PathDrawer"),Mr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case vr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case wr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case xr:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case br:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Br:t.closePath(),i+=1;break;case kr:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Er: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 Tr:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Cr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*g,e[i+6]*g,e[i+7]*g,e[i+8]),i+=9;break;case Rr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Pr:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*g,e[i+5]*g,e[i+6]),i+=7;break;case Lr:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Or:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Sr.error(`command: ${s} [index:${i}]`,e)}}},{M:Dr,L:Ar,C:Ir,Q:Wr,Z:Nr,N:Fr,D:zr,X:Hr,G:Ur,F:Yr,O:jr,P:Xr,U:Vr}=Cs,{toTwoPointBounds:Gr,toTwoPointBoundsByQuadraticCurve:Kr,arcTo:qr,arc:Qr,ellipse:Zr}=Xs,{add:$r,copy:Jr,addPoint:tn,setPoint:en,addBounds:sn,toBounds:rn}=F,nn=vt.get("PathBounds");let on,an,hn;const ln={},dn={},cn={},un={toBounds(t,e){un.toTwoPointBounds(t,dn),rn(dn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return en(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Nr||s===Ir||s===Wr?en(e,h,l):en(e,t[a+1],t[a+2])),s){case Dr:case Ar:h=t[a+1],l=t[a+2],tn(e,h,l),a+=3;break;case Ir:n=t[a+5],o=t[a+6],Gr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,ln),$r(e,ln),h=n,l=o,a+=7;break;case Wr:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],Kr(h,l,i,r,n,o,ln),$r(e,ln),h=n,l=o,a+=5;break;case Nr:a+=1;break;case Fr:h=t[a+1],l=t[a+2],sn(e,h,l,t[a+3],t[a+4]),a+=5;break;case zr:case Hr:h=t[a+1],l=t[a+2],sn(e,h,l,t[a+3],t[a+4]),a+=s===zr?9:6;break;case Ur:Zr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],ln,cn),0===a?Jr(e,ln):$r(e,ln),h=cn.x,l=cn.y,a+=9;break;case Yr:h=t[a+1],l=t[a+2],an=t[a+3],hn=t[a+4],sn(e,h-an,l-hn,2*an,2*hn),h+=an,a+=5;break;case jr:Qr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ln,cn),0===a?Jr(e,ln):$r(e,ln),h=cn.x,l=cn.y,a+=7;break;case Xr:h=t[a+1],l=t[a+2],on=t[a+3],sn(e,h-on,l-on,2*on,2*on),h+=on,a+=4;break;case Vr:qr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ln,cn),0===a?Jr(e,ln):$r(e,ln),h=cn.x,l=cn.y,a+=6;break;default:return void nn.error(`command: ${s} [index:${a}]`,t)}}},_n={smooth:(t,e,s)=>t};Es.creator=new mr,Es.parse=Ni.parse,Es.convertToCanvasData=Ni.toCanvasData;const pn=vt.get("plugin"),gn={powers:{},list:[]};function fn(t){if(gn.list.push(t),t.dependencies){const e={};t.dependencies.forEach((t=>{gn.powers[t]?e[t]=gn.powers[t]:pn.error(t+" non-existent")})),t.run(e)}else pn.error("no dependencies")}class yn{constructor(t){this.taskTime=1,this.id=u.create(u.TASK),this.task=t}run(){return Kt(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const mn=vt.get("TaskProcessor");class vn{get isComplete(){return this._isComplete}get running(){return this._running}constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get percent(){const t=this.list.length;let e=0,s=0;for(let i=0;i<t;i++)i<=this.index?(s+=this.list[i].taskTime,i===this.index&&(e=s)):e+=this.list[i].taskTime;let i=this._isComplete?1:s/e;return Number.isNaN(i)&&(i=0),i}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new yn(t),e)}addParallel(t,e){const s=new yn(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new yn(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.runTask())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.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.index+this.parallelSuccessNumber+s;if(e.length){if(!this._running)return;i<this.list.length&&(t=this.list[i],t.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){mn.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class wn{constructor(t,e){this.updatedList=new d,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=ft.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(h.REQUEST)}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===e.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new o(o.DATA,{updatedList:this.updatedList})),this.updatedList=new d,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(s.CHANGE,this.__onAttrChange,this),t.on_([e.ADD,e.REMOVE],this.__onChildEvent,this),t.on_(o.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const xn=vt.get("Renderer");class bn{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=ft.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed||this.__requestRender(),this.changed=!0}requestLayout(){this.target.emit(a.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new st,xn.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){xn.error(t)}xn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?xn.warn("rendering"):this.times>3?xn.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new st,this.renderOptions={},t?(this.emitRender(h.BEFORE),t()):(this.requestLayout(),this.emitRender(h.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(h.RENDER,this.renderBounds,this.renderOptions),this.emitRender(h.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 xn.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=bt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new st).copy(i);s.save(),r&&!vt.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,n),s.restore(),bt.end(e)}fullRender(){const t=bt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),bt.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),vt.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),vt.showHitView&&this.renderHitView(s),vt.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new st;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();Wt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new st(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&&(xn.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new h(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(h.REQUEST,this.update,this),t.on_(a.END,this.__onLayoutEnd,this),t.on_(h.AGAIN,this.renderAgain,this),t.on_(r.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:Bn}=$;class kn{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 n=this.findList,o=this.getBestMatchLeaf(),a=r?this.getPath(o):this.getHitablePath(o);return this.clear(),i?{path:a,leaf:o,throughPath:n.length?this.getThroughPath(n):a}:{path:a,leaf:o}}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],this.hitChild(e,r),this.findList.length)return this.findList[0]}return t[0]}getPath(t){const e=new d;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 d;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 d,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,n;for(let t=0,o=s.length;t<o;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(n=i.list[t],!r||!r.has(n));t++)e.push(n)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let n=t.length-1;n>-1;n--)s=t[n],e&&!s.isMask||(i=Bn(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.target=null,this.selector=null}}class En{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ft.default(e,this.config)),this.findPath=new kn(t,this),this.__listenEvents()}getByPoint(t,e,s){return this.target.emit(a.CHECK_UPDATE),this.findPath.getByPoint(t,e,s)}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_(e.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(Nt,{watcher:(t,e)=>new wn(t,e),layouter:(t,e)=>new It(t,e),renderer:(t,e,s)=>new bn(t,e,s),selector:(t,e)=>new En(t,e)});const Tn=vt.get("LeaferCanvas");class Cn extends ie{init(){const{view:t}=this.config;if(this.offscreen)t?this.view=t:this.__createView();else{t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;this.autoLayout&&(e.display||(e.display="block")),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}setBackgroundColor(t){this.view.style.backgroundColor=t}setHittable(t){this.view.style.pointerEvents=t?"auto":"none"}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){Tn.error(t)}this.view=document.createElement("canvas")}__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 Tn.error(`no id: ${t}`),this.__createView()}setViewSize(t){const{width:e,height:s,pixelRatio:i}=t;if(!this.offscreen){const{style:t}=this.view;t.width=e+"px",t.height=s+"px"}this.view.width=e*i,this.view.height=s*i}startAutoLayout(t,e){if(!this.offscreen){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{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()),window.requestAnimationFrame(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:n,height:o}=this.autoBounds.getBoundsFrom(t);if(n!==this.width||o!==this.height){const{style:t}=e,{pixelRatio:a}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const h={width:n,height:o,pixelRatio:a},l={};ft.copyAttrs(l,this,se),this.resize(h),void 0!==this.width&&this.resizeListener(new r(h,l))}}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&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}const{drawRoundRect:Rn}=Ds;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){Rn(this,t,e,s,i,r)})}();class Pn{constructor(t){this.options=t}load(t,e){let s=this.options.url;const i=this.view=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>{this.ready=!0,this.width=i.naturalWidth,this.height=i.naturalHeight,t&&t(this)},i.onerror=t=>{e&&e(t)},s.startsWith("data:")||s.includes("?"),i.src=s}getCanvas(t,e,s,i){const r=document.createElement("canvas");t||(t=this.width),e||(e=this.height),r.width=t,r.height=e;const n=r.getContext("2d");return s&&(n.globalAlpha=s),n.drawImage(this.view,0,0,t,e),r}destory(){this.view=null,this.options=null}}class Ln{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(vs.START,this.moveData)}t.path=this.moveData.path,e.emit(vs.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(bs.START,this.zoomData)}t.path=this.zoomData.path,e.emit(bs.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(ws.START,this.rotateData)}t.path=this.rotateData.path,e.emit(ws.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(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(vs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(bs.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(ws.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const On={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?xs.UP:t>45&&t<135?xs.DOWN:t<=45&&t>=-45?xs.RIGHT:xs.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:Sn.getSwipeDirection(A.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 d,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Sn=On,{getDragEventData:Mn,getDropEventData:Dn,getSwipeEventData:An,filterPathByEventType:In}=On;class Wn{constructor(t){this.interaction=t}setDragData(t){this.dragData=Mn(t,t,t)}getDragList(){return this.dragging?ms.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!_s.middle(t)&&!_s.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(_s.middle(t)||us.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(vs.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Mn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(vs.MOVE,this.dragData):this.dragging&&(s.emit(fs.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=_s.left(t)&&e,this.dragging&&(this.interaction.emit(fs.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=In(this.dragData.path,fs.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}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=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{ot.move(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(fs.OUT,t,s),e.emit(fs.OVER,t,i)):e.emit(fs.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(fs.ENTER,t,i,s),e.emit(fs.LEAVE,t,s,i),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,n=Mn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(vs.END,n),this.dragging&&(e.emit(fs.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(A.getDistance(i,t)>s.config.pointer.swipeDistance){const t=An(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Dn(t,this.getDragList(),ms.dragData);e.path=this.dragEnterPath,this.interaction.emit(ms.DROP,e),this.interaction.emit(fs.LEAVE,t,this.dragEnterPath)}dragReset(){ms.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}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 n=e.shrinkCanvasBounds,{x:o,y:a}=n,h=$.right(n),l=$.bottom(n),d=t.x<o?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,$.move(s,d,c),$.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.interaction=null,this.dragableList=null}}const Nn=["move","zoom","rotate"];function Fn(t,e,s,i,r){if(Nn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Hn(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!s.path.has(n)&&n.__.hittable&&zn(n,e,s,i,r)}}function zn(t,e,s,i,r){if(t.__.hitSelf&&t.hasEvent(e,i)&&!Hn(t,r)){s.phase=i?1:t===s.target?2:3;const r=Yt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Hn(t,e){return e&&e.has(t)}const{pathHasEventType:Un}=On;class Yn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{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}},this.tapCount=0,this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new d(t),this.transformer=new Ln(this),this.dragger=new Wn(this),i&&(this.config=ft.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(gs.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getByPoint(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(gs.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),_s.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(gs.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:gs.MOVE});t.path=e.path,this.emit(gs.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(gs.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(gs.UP,t),this.emit(gs.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}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(gs.OUT,t,this.overPath),this.emit(gs.OVER,t,e)):this.emit(gs.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(gs.ENTER,t,e,this.enterPath),this.emit(gs.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(gs.LEAVE,t),this.dragger.dragging&&this.emit(ms.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=[gs.DOUBLE_TAP,gs.DOUBLE_CLICK].some((e=>Un(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))}emitTap(t){this.emit(gs.TAP,t),this.emit(gs.CLICK,t)}emitDoubleTap(t){this.emit(gs.DOUBLE_TAP,t),this.emit(gs.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(gs.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(gs.LONG_TAP,t),Un(t.path,gs.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new st(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(r.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}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 n=s.length-1;n>-1;n--){if(r=s.list[n],zn(r,t,e,!0,i))return;r.isApp&&Fn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&Fn(r,t,e,!1,i),zn(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=null,this.target=null,this.selector=null,this.canvas=null,this.dragger=null,this.transformer=null)}}const jn={convert(t,e){const s=On.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=On.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=jn.getTouch(t),i=On.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]},Xn={getData(t,e){const s=A.getCenter(t[0],t[1]),i=A.getCenter(e[0],e[1]),r={x:i.x-s.x,y:i.y-s.y},n=A.getDistance(t[0],t[1]),o=A.getDistance(e[0],e[1])/n,a=A.getAngle(t[0],t[1]),h=A.getAngle(e[0],e[1]);return{move:r,scale:o,angle:this.getChangedAngle(a,h),center:i}},getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},Vn={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:r,zoomSpeed:n}=e;const o=t.deltaY||t.deltaX;if(r){const e=Wt.intWheelDeltaY&&Math.abs(t.deltaY)>17;s=(Math.floor(t.deltaY)!==t.deltaY||e)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){n=p.within(n,0,1);i=1-o/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-n)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Gn,getZoomEventData:Kn,getRotateEventData:qn}=On;class Qn extends Yn{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,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};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){const e=this.view.getBoundingClientRect();return{x:t.clientX-e.x,y:t.clientY-e.y}}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}onKeyDown(t){us.setDownCode(t.code)}onKeyUp(t){us.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(jn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(jn.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(jn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(jn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(jn.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(jn.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=jn.getTouch(t);this.pointerDown(jn.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=jn.getTouch(t);this.pointerMove(jn.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=jn.getTouch(t);this.pointerUp(jn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Xn.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Xn.getTouches(t.touches),s=e.find((t=>t.identifier===this.touches[0].identifier)),i=e.find((t=>t.identifier===this.touches[1].identifier));if(s&&i){const r=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(s),this.getLocal(i)],{move:o,angle:a,scale:h,center:l}=Xn.getData(r,n),d=On.getBase(t);this.rotate(qn(l,a,d)),this.zoom(Kn(l,h,d)),this.move(Gn(l,o,d)),this.touches=e}}}mutiTouchEnd(){this.touches=null,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):Vn.getScale(t,e),i=this.getLocal(t),r=On.getBase(t);1!==s?this.zoom(Kn(i,s,r)):this.move(Gn(i,e.getMove?e.getMove(t,e):Vn.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=On.getBase(t),i=t.scale/this.lastGestureScale,r=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=p.within(n,0,1),this.zoom(Kn(e,i*i,s)),this.rotate(qn(e,r/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)}}Object.assign(Nt,{canvas:(t,e)=>new Cn(t,e),image:t=>new Pn(t),hitCanvas:(t,e)=>new Cn(t,e),interaction:(t,e,s,i)=>new Qn(t,e,s,i)}),Wt.requestRender=function(t){window.requestAnimationFrame(t)},Wt.canvas=Nt.canvas(),Wt.devicePixelRatio=devicePixelRatio,Wt.conicGradientSupport=!!Wt.canvas.context.createConicGradient;const{userAgent:Zn}=navigator;Zn.indexOf("Firefox")>-1?(Wt.conicGradientRotate90=!0,Wt.intWheelDeltaY=!0):Zn.indexOf("Safari")>-1&&-1===Zn.indexOf("Chrome")&&(Wt.fullImageShadow=!0);const $n={},Jn={},to={},eo={},{copy:so,toOffsetOutBounds:io}=$,ro={},no={};function oo(t,e,s,i){const{bounds:r,shapeBounds:n}=i;if(Wt.fullImageShadow){if(so(ro,t.bounds),ro.x+=e.x-n.x,ro.y+=e.y-n.y,s){const{matrix:t}=i;ro.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),ro.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),ro.width*=s,ro.height*=s}t.copyWorld(i.canvas,t.bounds,ro)}else s&&(so(ro,e),ro.x-=e.width/2*(s-1),ro.y-=e.height/2*(s-1),ro.width*=s,ro.height*=s),t.copyWorld(i.canvas,n,s?ro:e)}const{toOffsetOutBounds:ao}=$,ho={};var lo=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){let i,r;const{__world:n,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;ao(l,ho),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(ho.offsetX+t.x*c,ho.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,oo(_,ho,r,s),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()},shadow:function(t,e,s){let i,r;const{__world:n,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;io(l,no),a.forEach(((t,a)=>{_.setWorldShadow(no.offsetX+t.x*c,no.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,oo(_,no,r,s),i=l,t.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),i=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()}});function co(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;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,n)}function uo(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),fo(t,e);break;case"inside":_o(t,e,s,"inside");break;case"outside":_o(t,e,s,"outside")}}function _o(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,fo(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",co(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function po(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),go(t,s,e);break;case"inside":_o(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(void 0,2*r,t.__),o.font=n,go(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",co(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function go(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),fo(t,s),s.restoreBlendMode()):fo(t,s)}))}function fo(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;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,n)}function yo(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:mo,getOuterOf:vo,getByMove:wo,getIntersectData:xo}=$;const bo={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+")"}},{get:Bo,rotateOf:ko,translate:Eo,scaleOf:To,scale:Co,rotate:Ro}=T;function Po(t,e,s,r){let{type:n,blendMode:o}=s,a={type:n,blendMode:o,style:"rgba(255,255,255,0)"};const h=t.leafer.imageManager.get(s);if(h.ready){let t,{opacity:e,mode:i,offset:n,scale:o,rotation:l}=s,{width:d,height:c}=h;const u=r.width===d&&r.height===c;switch(i){case"strench":u||(d=r.width,c=r.height),(r.x||r.y)&&(t=Bo(),Eo(t,r.x,r.y));break;case"clip":(n||o||l)&&(t=function(t,e,s,i){const r=Bo();Eo(r,t.x,t.y),e&&Eo(r,e.x,e.y);s&&("number"==typeof s?Co(r,s):Co(r,s.x,s.y));i&&Ro(r,i);return r}(r,n,o,l));break;case"repeat":(!u||o||l)&&(t=function(t,e,s,i,r){const n=Bo();if(r)switch(Ro(n,r),r){case 90:Eo(n,s,0);break;case 180:Eo(n,e,s);break;case 270:Eo(n,0,e)}Eo(n,t.x,t.y),i&&To(n,t,i);return n}(r,d,c,o,l));break;default:u&&!l||(t=function(t,e,s,i,r){const n=Bo(),o=r&&180!==r,a=e.width/(o?i:s),h=e.height/(o?s:i),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-i*l)/2;Eo(n,d,c),Co(n,l),r&&ko(n,{x:e.x+e.width/2,y:e.y+e.height/2},r);return n}(i,r,d,c,l))}a.style=function(t,e,s){let i=Wt.canvas.createPattern(t,s?"repeat":"no-repeat");if(e){const{a:t,b:s,c:r,d:n,e:o,f:a}=e;i.setTransform(new DOMMatrix([t,s,r,n,o,a]))}return i}(h.getCanvas(d,c,e),t,"repeat"===i)}else h.load((()=>{t.__.__getInput("width")||(t.width=h.width),t.__.__getInput("height")||(t.height=h.height),t.forceUpdate("width"),t.emitEvent(new i(i.LOADED,t,h,e,s))}),(r=>{t.emitEvent(new i(i.ERROR,t,h,e,s,r))}));return a}const Lo={x:.5,y:0},Oo={x:.5,y:1};function So(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,bo.string(i.color,s))}const{set:Mo,getAngle:Do,getDistance:Ao}=A,{get:Io,rotateOf:Wo,scaleOf:No}=T,Fo={x:.5,y:.5},zo={x:.5,y:1},Ho={},Uo={};const{set:Yo,getAngle:jo,getDistance:Xo}=A,{get:Vo,rotateOf:Go,scaleOf:Ko}=T,qo={x:.5,y:.5},Qo={x:.5,y:1},Zo={},$o={};function Jo(t,e){let s,i=t.__.__input[e];const r=[];i instanceof Array||(i=[i]);for(let n=0,o=i.length;n<o;n++)s=ta(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function ta(t,e,s){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:i}=t.__layout;switch(e.type){case"solid":let{type:r,blendMode:n,color:o,opacity:a}=e;return{type:r,blendMode:n,style:bo.string(o,a)};case"image":return Po(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:r,blendMode:n,opacity:o}=t;s||(s=Lo),i||(i=Oo);const a=Wt.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+i.x*e.width,e.y+i.y*e.height);return So(a,t.stops,o),{type:r,blendMode:n,style:a}}(e,i);case"radial":return function(t,e){let{from:s,to:i,type:r,opacity:n,blendMode:o,stretch:a}=t;s||(s=Fo),i||(i=zo);const{x:h,y:l,width:d,height:c}=e;let u;Mo(Ho,h+s.x*d,l+s.y*c),Mo(Uo,h+i.x*d,l+i.y*c),(d!==c||a)&&(u=Io(),No(u,Ho,d/c*(a||1),1),Wo(u,Ho,Do(Ho,Uo)+90));const _=Wt.canvas.createRadialGradient(Ho.x,Ho.y,0,Ho.x,Ho.y,Ao(Ho,Uo));return So(_,t.stops,n),{type:r,blendMode:o,style:_,transform:u}}(e,i);case"angular":return function(t,e){let{from:s,to:i,type:r,opacity:n,blendMode:o,stretch:a}=t;s||(s=qo),i||(i=Qo);const{x:h,y:l,width:d,height:c}=e;Yo(Zo,h+s.x*d,l+s.y*c),Yo($o,h+i.x*d,l+i.y*c);const u=Vo(),_=jo(Zo,$o);Wt.conicGradientRotate90?(Ko(u,Zo,d/c*(a||1),1),Go(u,Zo,_+90)):(Ko(u,Zo,1,d/c*(a||1)),Go(u,Zo,_));const p=Wt.conicGradientSupport?Wt.canvas.createConicGradient(0,Zo.x,Zo.y):Wt.canvas.createRadialGradient(Zo.x,Zo.y,0,Zo.x,Zo.y,Xo(Zo,$o));return So(p,t.stops,n),{type:r,blendMode:o,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:bo.string(e)}:void 0}}var ea=Object.freeze({__proto__:null,computeFill:function(t){Jo(t,"fill")},computeStroke:function(t){Jo(t,"stroke")},drawText:co,drawTextStroke:fo,fill:function(t,e,s){e.fillStyle=s,t.__.__font?co(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:r,__font:n}=t.__;for(let o=0,a=s.length;o<a;o++)if(i=s[o],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:o,c:a,d:h,e:l,f:d}=i.transform;e.transform(s,o,a,h,l,d),i.blendMode&&(e.blendMode=i.blendMode),n?co(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?co(t,e):e.fill(r),e.restoreBlendMode()):n?co(t,e):e.fill(r)},shape:function(t,e,s){const i=e.getSameCanvas();let r,n,o,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))r=o=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=xo(i?mo(e.bounds,i*l):e.bounds,h,s.matrix);n=e.bounds.getFitMatrix(c),n.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=n.a,d*=n.d),o=vo(h,n),r=wo(o,-n.e,-n.f),s.matrix&&n.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:n})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:r,worldCanvas:a,shapeBounds:o,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)uo(t,e,s);else switch(n){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);n.setStroke(s,2*r,t.__),t.__drawRenderPath(n),n.stroke(),n.clip(i.windingRule),n.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokeText:uo,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)po(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),yo(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),yo(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*r,t.__),yo(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:po});Object.assign($n,lo),Object.assign(Jn,ea);class sa extends mt{setBlendMode(t){this._blendMode=t,"pass-through"!==t&&t?this.__blendLayer=!0:this.__blendLayer&&(this.__blendLayer=!1)}setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:Jn.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:Jn.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}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 ia={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class ra extends sa{}class na extends ra{get __boxStroke(){return!0}}class oa extends sa{get __boxStroke(){return!0}}const{parse:aa}=Ni;const ha={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class la extends oa{}function da(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ca(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ua={__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*g/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 n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(n=Math.max(n,r)),this.__layout.renderShapeSpread=n,t}},_a={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawHitPath(this.__hitCanvas),this.__hitCanvas.setStrokeOptions(this.__)},__hit(t){const{__hitCanvas:e}=this,{fill:s,hitFill:i,windingRule:r}=this.__,n=s&&"path"===i||"all"===i;if(n&&e.hitFill(t,r))return!0;const{stroke:o,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=o&&"path"===a||"all"===a,c=2*t.radiusX;let u=2*(d?"center"===l?h/2:h:0)+c;if(!u)return!1;switch(l){case"inside":if(!n&&e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c;break;case"outside":if(!n){if(!e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c}}return!!u&&e.hitStroke(t,u)}},pa={__updateChange(){let t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect||t.blendMode&&"pass-through"!==t.blendMode?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&Jn.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&Jn.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r,__blendLayer:n}=this.__;let o;if(n&&(o=t,t=t.getSameCanvas(!0)),this.__drawRenderPath(t),this.__.__useEffect){const n=Jn.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&$n.shadow(this,t,n),s&&(this.__.__isFills?Jn.fills(this,t,s):Jn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&$n.innerShadow(this,t,n),i&&(this.__.__isStrokes?Jn.strokes(this,t,i):Jn.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?Jn.fills(this,t,s):Jn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Jn.strokes(this,t,i):Jn.stroke(this,t,i));o&&(o.copyWorldToInner(t,this.__world,this.__layout.renderBounds,this.__.blendMode),t.recycle())}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&&Jn.fill(this,t,"#000000"),i&&Jn.stroke(this,t,"#000000")}},ga={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:n,__drawAfterFill:o}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),o&&this.__drawAfterFill(t,e),n){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(n,r,this.__);const o=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(o,o,s-r,i-r);break;case"outside":t.strokeRect(-o,-o,s+r,i+r)}}}};let fa=class extends es{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Ni.toCanvasData(e,!0):e:[]}getPathString(t){return Ni.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Jn.computeFill(this),e&&Jn.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?_n.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){}static one(t,e,s,i,r){return zt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};Gt([be(sa)],fa.prototype,"__",void 0),Gt([he("")],fa.prototype,"id",void 0),Gt([he("")],fa.prototype,"name",void 0),Gt([he("")],fa.prototype,"className",void 0),Gt([ye("pass-through")],fa.prototype,"blendMode",void 0),Gt([me(1)],fa.prototype,"opacity",void 0),Gt([me(!0)],fa.prototype,"visible",void 0),Gt([we(!1)],fa.prototype,"isMask",void 0),Gt([ve(0)],fa.prototype,"zIndex",void 0),Gt([he()],fa.prototype,"locked",void 0),Gt([le(0)],fa.prototype,"x",void 0),Gt([le(0)],fa.prototype,"y",void 0),Gt([ue(100)],fa.prototype,"width",void 0),Gt([ue(100)],fa.prototype,"height",void 0),Gt([de(1)],fa.prototype,"scaleX",void 0),Gt([de(1)],fa.prototype,"scaleY",void 0),Gt([ce(0)],fa.prototype,"rotation",void 0),Gt([ce(0)],fa.prototype,"skewX",void 0),Gt([ce(0)],fa.prototype,"skewY",void 0),Gt([he(!1)],fa.prototype,"draggable",void 0),Gt([xe(!0)],fa.prototype,"hittable",void 0),Gt([xe("path")],fa.prototype,"hitFill",void 0),Gt([ge("path")],fa.prototype,"hitStroke",void 0),Gt([xe(!0)],fa.prototype,"hitChildren",void 0),Gt([xe(!0)],fa.prototype,"hitSelf",void 0),Gt([ye()],fa.prototype,"fill",void 0),Gt([ge()],fa.prototype,"stroke",void 0),Gt([ge("inside")],fa.prototype,"strokeAlign",void 0),Gt([ge(1)],fa.prototype,"strokeWidth",void 0),Gt([ge("none")],fa.prototype,"strokeCap",void 0),Gt([ge("miter")],fa.prototype,"strokeJoin",void 0),Gt([ge()],fa.prototype,"dashPattern",void 0),Gt([ge()],fa.prototype,"dashOffset",void 0),Gt([ge(10)],fa.prototype,"miterLimit",void 0),Gt([_e()],fa.prototype,"cornerRadius",void 0),Gt([_e()],fa.prototype,"cornerSmoothing",void 0),Gt([da()],fa.prototype,"shadow",void 0),Gt([da()],fa.prototype,"innerShadow",void 0),Gt([da()],fa.prototype,"blur",void 0),Gt([da()],fa.prototype,"backgroundBlur",void 0),Gt([da()],fa.prototype,"grayscale",void 0),Gt([Pe(Mr.drawPathByData)],fa.prototype,"__drawPathByData",null),fa=Gt([Se(ua),Se(_a),Se(pa),Le()],fa);let ya=class extends fa{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.isBranch=!0,this.children=[]}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){}remove(t){}};Gt([be(ra)],ya.prototype,"__",void 0),ya=Gt([Se(ds),Me()],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([be(oa)],ma.prototype,"__",void 0),ma=Gt([Se(ga),Me()],ma);const va=ma.prototype,wa=ya.prototype,xa={},{copy:ba,add:Ba}=$;let ka=class extends ya{get __tag(){return"Box"}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([be(na)],ka.prototype,"__",void 0),Gt([fe("show")],ka.prototype,"overflow",void 0),Gt([Pe(va.__updateStrokeSpread)],ka.prototype,"__updateStrokeSpread",null),Gt([Pe(va.__updateRenderSpread)],ka.prototype,"__updateRectRenderSpread",null),Gt([Pe(va.__updateBoxBounds)],ka.prototype,"__updateBoxBounds",null),Gt([Pe(va.__updateStrokeBounds)],ka.prototype,"__updateStrokeBounds",null),Gt([Pe(va.__updateRenderBounds)],ka.prototype,"__updateRectRenderBounds",null),Gt([Pe(va.__updateChange)],ka.prototype,"__updateRectChange",null),Gt([Pe(va.__drawPathByData)],ka.prototype,"__drawPathByData",null),Gt([Pe(va.__render)],ka.prototype,"__renderRect",null),Gt([Pe(wa.__render)],ka.prototype,"__renderGroup",null),ka=Gt([Le(),Me()],ka);let Ea=class extends ka{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Gt([be(class extends na{})],Ea.prototype,"__",void 0),Gt([fe("hide")],Ea.prototype,"overflow",void 0),Ea=Gt([Me()],Ea);const{moveTo:Ta,closePath:Ca,ellipse:Ra}=sr;let Pa=class extends fa{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];s?i||r?(s<1&&Ra(a,n,o,n*s,o*s,0,i,r,!1),Ra(a,n,o,n,o,0,r,i,!0),s<1&&Ca(a)):(s<1&&(Ra(a,n,o,n*s,o*s),Ta(a,t,o)),Ra(a,n,o,n,o,0,0,360,!0)):i||r?(Ta(a,n,o),Ra(a,n,o,n,o,0,i,r,!1),Ca(a)):Ra(a,n,o,n,o)}};Gt([be(class extends sa{get __boxStroke(){return!0}})],Pa.prototype,"__",void 0),Gt([_e(0)],Pa.prototype,"innerRadius",void 0),Gt([_e(0)],Pa.prototype,"startAngle",void 0),Gt([_e(0)],Pa.prototype,"endAngle",void 0),Pa=Gt([Me()],Pa);const{sin:La,cos:Oa,PI:Sa}=Math,{moveTo:Ma,lineTo:Da,closePath:Aa}=sr;let Ia=class extends fa{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,n=this.__.path=[];Ma(n,i,0);for(let t=1;t<s;t++)Da(n,i+i*La(2*t*Sa/s),r-r*Oa(2*t*Sa/s));Aa(n)}};Gt([be(class extends sa{})],Ia.prototype,"__",void 0),Gt([_e(3)],Ia.prototype,"sides",void 0),Ia=Gt([Me()],Ia);const{sin:Wa,cos:Na,PI:Fa}=Math,{moveTo:za,lineTo:Ha,closePath:Ua}=sr;let Ya=class extends fa{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];za(o,r,0);for(let t=1;t<2*s;t++)Ha(o,r+(t%2==0?r:r*i)*Wa(t*Fa/s),n-(t%2==0?n:n*i)*Na(t*Fa/s));Ua(o)}};Gt([be(class extends sa{})],Ya.prototype,"__",void 0),Gt([_e(5)],Ya.prototype,"points",void 0),Gt([_e(.382)],Ya.prototype,"innerRadius",void 0),Ya=Gt([Me()],Ya);const{moveTo:ja,lineTo:Xa}=sr,{rotate:Va,getAngle:Ga,getDistance:Ka,defaultPoint:qa}=A,{setPoint:Qa,addPoint:Za,toBounds:$a}=F,Ja={};let th=class extends fa{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Va(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Ka(qa,t),this.rotation=Ga(qa,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];ja(t,0,0);const e=this.toPoint;Xa(t,e.x,e.y)}__updateBoxBounds(){Qa(Ja,0,0),Za(Ja,this.__toPoint.x,this.__toPoint.y),$a(Ja,this.__layout.boxBounds)}};Gt([be(class extends sa{})],th.prototype,"__",void 0),Gt([ue()],th.prototype,"rotation",void 0),Gt([pe("center")],th.prototype,"strokeAlign",void 0),th=Gt([Me()],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={type:"image",mode:"strench",url:e},this.once(i.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};Gt([be(la)],eh.prototype,"__",void 0),Gt([ue("")],eh.prototype,"url",void 0),eh=Gt([Me()],eh);let sh=class extends ma{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Nt.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new N(t.__world);r.invert();const n=new N;e&&n.translate(e.x,e.y),s&&("number"==typeof s?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.preMultiply(n),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([be(la)],sh.prototype,"__",void 0),Gt([ca(100)],sh.prototype,"width",void 0),Gt([ca(100)],sh.prototype,"height",void 0),Gt([ca(Wt.devicePixelRatio)],sh.prototype,"pixelRatio",void 0),Gt([ca(!0)],sh.prototype,"smooth",void 0),Gt([xe("all")],sh.prototype,"hitFill",void 0),sh=Gt([Me()],sh);const ih=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",rh=ih+"_#~&*+\\=|≮≯≈≠=…";function nh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const oh=nh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ah=nh("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),hh=nh(ih),lh=nh(rh),dh=nh("- —/~|┆·");var ch;!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"}(ch||(ch={}));const{Letter:uh,Single:_h,Before:ph,After:gh,Symbol:fh,Break:yh}=ch;function mh(t){return oh[t]?uh:dh[t]?yh:/[\u3400-\u9FBF]/.test(t)?_h:ah[t]?ph:hh[t]?gh:lh[t]?fh:uh}const vh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function wh(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:xh}=vh,{Letter:bh,Single:Bh,Before:kh,After:Eh,Symbol:Th,Break:Ch}=ch;let Rh,Ph,Lh,Oh,Sh,Mh,Dh,Ah,Ih,Wh,Nh,Fh,zh,Hh,Uh=[];function Yh(t,e){Rh.data.push({char:t,width:e}),Lh+=e}function jh(){Oh+=Lh,Rh.width=Lh,Ph.words.push(Rh),Rh={data:[]},Lh=0}function Xh(){Fh&&(zh.paraNumber++,Ph.paraStart=!0,Fh=!1),Ph.width=Oh,xh(Ph),Uh.push(Ph),Ph.width>Hh.width&&(Hh.width=Ph.width),Ph={words:[]},Oh=0}const Vh=0,Gh=1,Kh=2;const qh={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let s=0,i=0,{width:r,height:n,padding:o}=e;const{textDecoration:a,textOverflow:h,__font:l}=e;if(r||(r=0),o){const[t,e,a,h]=p.fourNumber(o);r&&(s=h,r-=e+h),n&&(i=t,n-=t+a)}const d={bounds:{x:s,y:i,width:r,height:n},rows:[],paraNumber:0,font:Wt.canvas.font=l};return function(t,e,s){zh=t,Uh=t.rows,Hh=t.bounds;const{__letterSpacing:i,paraIndent:r,textCase:n}=s,{canvas:o}=Wt,{width:a,height:h}=Hh;if(a||h||i||n){Fh=!0,Ih=null,Lh=Oh=0,Rh={data:[]},Ph={words:[]};for(let t=0,s=e.length;t<s;t++)Mh=e[t],"\n"===Mh?(Lh&&jh(),Ph.paraEnd=!0,Xh(),Fh=!0):(Ah=mh(Mh),Ah===bh&&"none"!==n&&(Mh=wh(Mh,n,!Lh)),Dh=o.measureText(Mh).width,i&&(Dh+=i),Wh=Ah===Bh&&(Ih===Bh||Ih===bh)||Ih===Bh&&Ah!==Eh,Nh=!(Ah!==kh&&Ah!==Bh||Ih!==Th&&Ih!==Eh),Sh=Fh&&r?a-r:a,a&&Oh+Lh+Dh>Sh&&(Nh||(Nh=Ah===bh&&Ih==Eh),Wh||Nh||Ah===Ch||Ah===kh||Ah===Bh||Lh+Dh>Sh?(Lh&&jh(),Xh()):Xh())," "===Mh&&Oh+Lh===0||(Ah===Ch?(" "===Mh&&Lh&&jh(),Yh(Mh,Dh),jh()):Wh||Nh?(Lh&&jh(),Yh(Mh,Dh)):Yh(Mh,Dh)),Ih=Ah);Lh&&jh(),Oh&&Xh(),Uh[Uh.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{zh.paraNumber++,Uh.push({x:r||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(d,t,e),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:n,textAlign:o,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=n;if(p){if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(a){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u}for(let e=0,i=s.length;e<i;e++){switch(d=s[e],d.x=c,o){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1)}i.y=u,i.height=g}(d,e),function(t,e,s,i){const{rows:r}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=o&&t.paraStart?o:0,l=s&&"justify"===n&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?Vh:l>.01?Gh:Kh,c===Kh?(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=>{c===Gh?(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)}))}(d,e,r),d.overflow&&function(t,e){const{rows:s,overflow:i}=t;if(s.splice(i),"hide"!==e){"ellipsis"===e&&(e="...");const r=Wt.canvas.measureText(e).width,n=s[i-1];let o,a,h=n.data.length-1;const{x:l,width:d}=t.bounds,c=l+d-r;for(let t=h;t>-1&&(o=n.data[t],a=o.x+o.width,!(t===h&&a<c));t--){if(a<c&&" "!==o.char){n.data.splice(t+1),n.width-=o.width;break}n.width-=o.width}n.width+=r,n.data.push({char:e,x:a})}}(d,h),"none"!==a&&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}}(d,e),d}},{copyAndSpread:Qh,includes:Zh,spread:$h}=$;let Jh=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(),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:n}=this.__layout.boxBounds;t.rect(s,i,r,n)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=qh.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:n,fontFamily:o,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=ia.number(r,a),t.__letterSpacing=ia.number(n,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${o}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&$h(c,a/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=Zh(u,c)?u:c;_!==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(){Qh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};Gt([be(class extends sa{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ha[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Jh.prototype,"__",void 0),Gt([ue(0)],Jh.prototype,"width",void 0),Gt([ue(0)],Jh.prototype,"height",void 0),Gt([ue(0)],Jh.prototype,"padding",void 0),Gt([pe("outside")],Jh.prototype,"strokeAlign",void 0),Gt([ue("")],Jh.prototype,"text",void 0),Gt([ue("L")],Jh.prototype,"fontFamily",void 0),Gt([ue(12)],Jh.prototype,"fontSize",void 0),Gt([ue("normal")],Jh.prototype,"fontWeight",void 0),Gt([ue(!1)],Jh.prototype,"italic",void 0),Gt([ue("none")],Jh.prototype,"textCase",void 0),Gt([ue("none")],Jh.prototype,"textDecoration",void 0),Gt([ue(0)],Jh.prototype,"letterSpacing",void 0),Gt([ue({type:"percent",value:150})],Jh.prototype,"lineHeight",void 0),Gt([ue(0)],Jh.prototype,"paraIndent",void 0),Gt([ue(0)],Jh.prototype,"paraSpacing",void 0),Gt([ue("left")],Jh.prototype,"textAlign",void 0),Gt([ue("top")],Jh.prototype,"verticalAlign",void 0),Gt([ue("show")],Jh.prototype,"textOverflow",void 0),Jh=Gt([Me()],Jh);const{toBounds:tl}=un;let el=class extends fa{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){tl(this.__.path,this.__layout.boxBounds)}};Gt([be(class extends sa{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=aa(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],el.prototype,"__",void 0),Gt([_e()],el.prototype,"path",void 0),Gt([_e()],el.prototype,"windingRule",void 0),Gt([pe("center")],el.prototype,"strokeAlign",void 0),el=Gt([Me()],el);let sl=class extends ya{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new el(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,n){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,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,n,o,a){return this}moveToArc(t,e,s,i,r,n){return this}paint(){this.pathElement.forceUpdate("path")}};Gt([be(class extends ra{})],sl.prototype,"__",void 0),sl=Gt([Se(mr,["beginPath"]),Me()],sl);const il=vt.get("LeaferType"),rl={list:{},register(t,e){nl[t]?il.error("repeat:",t):nl[t]=e},run(t,e){const s=rl.list[t];s?s(e):il.error("no",t)}},{list:nl}=rl;rl.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),rl.register("design",(function(t){const{MOVE:e}=vs,{ZOOM:s}=bs;t.__eventIds.push(t.on_(e,(e=>{ot.move(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:n}=e;n*s<i?n=i/s:n*s>r&&(n=r/s),1!==n&&ot.zoomOf(t.zoomLayer,e,n)})))}));const ol=vt.get("Leafer");let al=class extends ya{get __tag(){return"Leafer"}get isApp(){return!1}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,(null==t?void 0:t.view)&&this.init(t)}init(t,e){if(this.canvas)return;let s;this.__setLeafer(this),t&&ft.assign(this.config,t);const{config:i}=this;rl.run(i.type,this),this.canvas=Nt.canvas(i),this.__controllers.push(this.renderer=Nt.renderer(this,this.canvas,i),this.watcher=Nt.watcher(this,i),this.layouter=Nt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Nt.selector(this),this.__controllers.unshift(this.interaction=Nt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new Xt,this.hitCanvasManager=new Vt,this.imageManager=new ks(this,i),s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(l.RESTART):this.emitLeafer(l.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(l.STOP))}resize(t){const e=ft.copyAttrs({},t,se);Object.keys(e).forEach((t=>this[t]=e[t]))}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ft.copyAttrs({},this.canvas,se);this.canvas.resize(t),this.__onResize(new r(t,e))}__onResize(t){this.emitEvent(t),ft.copyAttrs(this.__,t,se),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new it(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&this.canvas.setHittable(e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ft.copyAttrs({},this.canvas,se);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.setBackgroundColor(t):this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(l.BEFORE_READY),this.emitLeafer(l.READY),this.emitLeafer(l.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(l.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new l(t,this))}__listenEvents(){const t=bt.start("FirstCreate "+this.innerName);this.once(l.START,(()=>bt.end(t))),this.once(a.END,(()=>this.__onReady())),this.once(h.END,(()=>this.__onViewReady())),this.on(a.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new l(l.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>t.destroy())),this.__controllers.length=0,this.selector.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory(),this.canvas.destroy(),this.canvas=null,this.config=this.userConfig=this.view=null,super.destroy()}catch(t){ol.error(t)}}};Gt([be(class extends ra{})],al.prototype,"__",void 0),Gt([ue()],al.prototype,"pixelRatio",void 0),al=Gt([Me()],al);let hl=class extends al{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(s.CHANGE,(()=>{vt.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new al(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(a.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(h.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(h.END,this.__onChildRenderEnd,this))}__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 t&&ft.assign(e,t),e.view=this.realCanvas?void 0:this.view,e.fill=e.hittable=e.realCanvas=void 0,this.autoLayout&&ft.copyAttrs(e,this,se),e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};hl=Gt([Me()],hl);var ll=Object.freeze({__proto__:null,Animate:to,get App(){return hl},AutoBounds:it,BezierHelper:Xs,Bounds:st,BoundsHelper:$,get Box(){return ka},get Branch(){return ds},BranchHelper:ut,get Canvas(){return sh},CanvasManager:Xt,ChildEvent:e,Creator:Nt,DataHelper:ft,Debug:vt,get DragEvent(){return fs},get DropEvent(){return ms},Effect:$n,get Ellipse(){return Pa},EllipseHelper:ti,Event:t,EventCreator:Yt,Export:eo,get Frame(){return Ea},get Group(){return ya},HitCanvasManager:Vt,get Image(){return eh},ImageEvent:i,ImageManager:ks,IncrementId:u,Interaction:Qn,get KeyEvent(){return Bs},Keyboard:us,LayoutEvent:a,Layouter:It,get Leaf(){return es},LeafBounds:Ge,LeafBoundsHelper:ct,LeafData:mt,LeafDataProxy:ze,LeafEventer:Ne,LeafHelper:ot,LeafHit:Qe,LeafLevelList:c,LeafList:d,LeafMask:$e,LeafMatrix:je,LeafRender:Ze,get Leafer(){return al},LeaferCanvas:Cn,LeaferCanvasBase:ie,LeaferEvent:l,LeaferImage:Pn,LeaferType:rl,get Line(){return th},MathHelper:p,Matrix:N,MatrixHelper:T,get MoveEvent(){return vs},NeedConvertToCanvasCommandMap:Ps,OneRadian:g,PI2:f,PI_2:y,Paint:Jn,get Path(){return el},PathBounds:un,PathCommandDataHelper:sr,PathCommandMap:Cs,PathConvert:Ni,PathCorner:_n,PathCreator:mr,PathDrawer:Mr,PathHelper:Es,PathNumberCommandLengthMap:Ms,PathNumberCommandMap:Ss,get Pen(){return sl},Platform:Wt,Plugin:gn,Point:W,PointHelper:A,PointerButton:_s,get PointerEvent(){return gs},get Polygon(){return Ia},PropertyEvent:s,get Rect(){return ma},RectHelper:Ds,RectRender:ga,RenderEvent:h,Renderer:bn,ResizeEvent:r,get RotateEvent(){return ws},Run:bt,Selector:En,get Star(){return Ya},StringNumberMap:nt,get SwipeEvent(){return xs},TaskItem:yn,TaskProcessor:vn,get Text(){return Jh},TransformEvent:n,TwoPointBounds:rt,TwoPointBoundsHelper:F,get UI(){return fa},UIBounds:ua,UICreator:zt,UIEvent:ps,UIHit:_a,UIRender:pa,WaitHelper:gt,WatchEvent:o,Watcher:wn,get ZoomEvent(){return bs},affectRenderBoundsType:fe,affectStrokeBoundsType:pe,aliasType:oe,boundsType:ue,canvasSizeAttrs:se,dataProcessor:be,dataType:he,defineDataProcessor:Ee,defineKey:re,defineLeafAttr:ae,effectType:da,getDescriptor:ne,hitType:xe,layoutProcessor:Be,maskType:we,opacityType:me,pathType:_e,positionType:le,registerUI:Me,registerUIEvent:De,resizeType:ca,rewrite:Pe,rewriteAble:Le,rotationType:ce,scaleType:de,setDefaultValue:ke,sortType:ve,strokeType:ge,surfaceType:ye,useModule:Se,usePlugin:fn});window.LeaferUI=gn.powers=ll;export{to as Animate,hl as App,it as AutoBounds,Xs as BezierHelper,st as Bounds,$ as BoundsHelper,ka as Box,ds as Branch,ut as BranchHelper,sh as Canvas,Xt as CanvasManager,e as ChildEvent,Nt as Creator,ft as DataHelper,vt as Debug,fs as DragEvent,ms as DropEvent,$n as Effect,Pa as Ellipse,ti as EllipseHelper,t as Event,Yt as EventCreator,eo as Export,Ea as Frame,ya as Group,Vt as HitCanvasManager,eh as Image,i as ImageEvent,ks as ImageManager,u as IncrementId,Qn as Interaction,Bs as KeyEvent,us as Keyboard,a as LayoutEvent,It as Layouter,es as Leaf,Ge as LeafBounds,ct as LeafBoundsHelper,mt as LeafData,ze as LeafDataProxy,Ne as LeafEventer,ot as LeafHelper,Qe as LeafHit,c as LeafLevelList,d as LeafList,$e as LeafMask,je as LeafMatrix,Ze as LeafRender,al as Leafer,Cn as LeaferCanvas,ie as LeaferCanvasBase,l as LeaferEvent,Pn as LeaferImage,rl as LeaferType,th as Line,p as MathHelper,N as Matrix,T as MatrixHelper,vs as MoveEvent,Ps as NeedConvertToCanvasCommandMap,g as OneRadian,f as PI2,y as PI_2,Jn as Paint,el as Path,un as PathBounds,sr as PathCommandDataHelper,Cs as PathCommandMap,Ni as PathConvert,_n as PathCorner,mr as PathCreator,Mr as PathDrawer,Es as PathHelper,Ms as PathNumberCommandLengthMap,Ss as PathNumberCommandMap,sl as Pen,Wt as Platform,gn as Plugin,W as Point,A as PointHelper,_s as PointerButton,gs as PointerEvent,Ia as Polygon,s as PropertyEvent,ma as Rect,Ds as RectHelper,ga as RectRender,h as RenderEvent,bn as Renderer,r as ResizeEvent,ws as RotateEvent,bt as Run,En as Selector,Ya as Star,nt as StringNumberMap,xs as SwipeEvent,yn as TaskItem,vn as TaskProcessor,Jh as Text,n as TransformEvent,rt as TwoPointBounds,F as TwoPointBoundsHelper,fa as UI,ua as UIBounds,zt as UICreator,ps as UIEvent,_a as UIHit,pa as UIRender,gt as WaitHelper,o as WatchEvent,wn as Watcher,bs as ZoomEvent,fe as affectRenderBoundsType,pe as affectStrokeBoundsType,oe as aliasType,ue as boundsType,se as canvasSizeAttrs,be as dataProcessor,he as dataType,Ee as defineDataProcessor,re as defineKey,ae as defineLeafAttr,da as effectType,ne as getDescriptor,xe as hitType,Be as layoutProcessor,we as maskType,me as opacityType,_e as pathType,le as positionType,Me as registerUI,De as registerUIEvent,ca as resizeType,Pe as rewrite,Le as rewriteAble,ce as rotationType,de as scaleType,ke as setDefaultValue,ve as sortType,ge as strokeType,ye as surfaceType,Se as useModule,fn as usePlugin};
1
+ class t{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class e extends t{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}e.ADD="child.add",e.REMOVE="child.remove";class s extends t{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}s.CHANGE="property.change";class i extends t{constructor(t,e,s,i,r,n){super(t,e),this.image=s,this.attrName=i,this.attrValue=r,n&&(this.error=n)}}i.LOADED="image.loaded",i.ERROR="image.error";class r extends t{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){const s="object"==typeof t;super(s?r.RESIZE:t),s&&Object.assign(this,t),this.old=e}}r.RESIZE="resize";class n extends t{constructor(t,e){super(t),e&&Object.assign(this,e)}}n.START="transform.start",n.CHANGE="transform.change",n.END="transform.end",n.BEFORE_START="transform.before_start",n.BEFORE_CHANGE="transform.before_change",n.BEFORE_END="transform.before_end";class o extends t{constructor(t,e){super(t),this.data=e}}o.REQUEST="watch.request",o.DATA="watch.data";class a extends t{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}a.CHECK_UPDATE="layout.check_update",a.REQUEST="layout.request",a.START="layout.start",a.BEFORE="layout.before",a.LAYOUT="layout.layout",a.AFTER="layout.after",a.AGAIN="layout.again",a.END="layout.end";class h extends t{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}h.REQUEST="render.request",h.START="render.start",h.BEFORE="render.before",h.RENDER="render",h.AFTER="render.after",h.AGAIN="render.again",h.END="render.end";class l extends t{}l.START="leafer.start",l.BEFORE_READY="leafer.before_ready",l.READY="leafer.ready",l.AFTER_READY="leafer.after_ready",l.VIEW_READY="leafer.view_ready",l.STOP="leafer.stop",l.RESTART="leafer.restart",l.END="leafer.end";class d{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return 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 d;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class c{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}}const u={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=_;return e[t]?e[t]++:(e[t]=1,0)}},_=u,p={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]}},g=Math.PI/180,f=2*Math.PI,y=Math.PI/2,{sin:m,cos:v,acos:w,atan:x,sqrt:b,PI:B}=Math,k={};function E(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const T={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:E,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.d*=s,t.c*=e,t.b*=s},scaleOf(t,e,s,i=s){C.toInnerPoint(t,e,k),C.scaleOfInner(t,k,s,i)},scaleOfInner(t,e,s,i=s){C.translateInner(t,e.x,e.y),C.scale(t,s,i),C.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=v(e*=g),i=m(e),{a:r,b:n,c:o,d:a}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=o*s-a*i,t.d=o*i+a*s},rotateOf(t,e,s){C.toInnerPoint(t,e,k),C.rotateOfInner(t,k,s)},rotateOfInner(t,e,s){C.translateInner(t,e.x,e.y),C.rotate(t,s),C.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=g,t.a=i+n*s,t.b=r+o*s),e&&(e*=g,t.c=n+i*e,t.d=o+r*e)},skewOf(t,e,s,i){C.toInnerPoint(t,e,k),C.skewOfInner(t,k,s,i)},skewOfInner(t,e,s,i){C.translateInner(t,e.x,e.y),C.skew(t,s,i),C.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},preMultiply(t,e){const{a:s,b:i,c:r,d:n,e:o,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+n*e.c,t.d=r*e.b+n*e.d),t.e=o*e.a+a*e.c+e.e,t.f=o*e.b+a*e.d+e.f},divide(t,e){C.multiply(t,C.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=C;return C.copy(e,t),C.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=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=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:n}=e,{a:o,b:a,c:h,d:l}=t,d=1/(o*l-a*h);if(s||(s=e),s.x=(r*l-n*h)*d,s.y=(n*o-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*o-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,o=r,a=0,h=0,l=0;if(s||i){const t=e*r-s*i,d=e*i+s*r;if(s){const i=e*e+s*s;n=b(i),o=t/n;const r=e/n;a=s>0?w(r):-w(r),h=x(d/i)/g}else{const e=i*i+r*r;o=b(e),n=t/o;const s=i/o;a=B/2-(r>0?w(-s):-w(s)),l=x(d/e)/g}a/=g}return{x:t.e,y:t.f,scaleX:n,scaleY:o,rotation:a,skewX:h,skewY:l}},reset(t){C.set(t)}},C=T,{toInnerPoint:R,toOuterPoint:P}=T,{sin:L,cos:O,abs:S,sqrt:M,atan2:D}=Math,A={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},rotate(t,e,s){s||(s=I.defaultPoint);const i=O(e*g),r=L(e*g),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r-o*i},tempToInnerOf(t,e){const{tempPoint:s}=I;return I.copy(s,t),R(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=I;return I.copy(s,t),I.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),R(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){R(e,t,s)},toOuterOf(t,e,s){P(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=S(e.x-t.x),i=S(e.y-t.y);return M(s*s+i*i)},getAngle:(t,e)=>I.getAtan2(t,e)/g,getAtan2:(t,e)=>D(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=I.getAtan2(t,e);return{x:t.x+O(i)*s,y:t.y+L(i)*s}},reset(t){I.reset(t)}},I=A;class W{constructor(t,e){"object"==typeof t?A.copy(this,t):A.set(this,t,e)}set(t,e){A.set(this,t,e)}copy(t){return A.copy(this,t),this}clone(){return new W(this)}rotate(t,e){return A.rotate(this,t,e),this}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return A.getCenter(this,t)}getDistance(t){return A.getDistance(this,t)}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){A.reset(this)}}class N{constructor(t,e,s,i,r,n){"object"==typeof t?T.copy(this,t):T.set(this,t,e,s,i,r,n)}set(t,e,s,i,r,n){T.set(this,t,e,s,i,r,n)}copy(t){return T.copy(this,t),this}clone(){return new N(this)}translate(t,e){return T.translate(this,t,e),this}translateInner(t,e){return T.translateInner(this,t,e),this}scale(t,e){return T.scale(this,t,e),this}scaleOf(t,e,s){return T.scaleOf(this,t,e,s),this}scaleOfInner(t,e,s){return T.scaleOfInner(this,t,e,s),this}rotate(t){return T.rotate(this,t),this}rotateOf(t,e){return T.rotateOf(this,t,e),this}rotateOfInner(t,e){return T.rotateOfInner(this,t,e),this}skew(t,e){return T.skew(this,t,e),this}skewOf(t,e,s){return T.skewOf(this,t,e,s),this}skewOfInner(t,e,s){return T.skewOfInner(this,t,e,s),this}multiply(t){return T.multiply(this,t),this}preMultiply(t){return T.preMultiply(this,t),this}divide(t){return T.divide(this,t),this}invert(){return T.invert(this),this}toOuterPoint(t,e){T.toOuterPoint(this,t,e)}toInnerPoint(t,e){T.toInnerPoint(this,t,e)}decompose(){return T.decompose(this)}reset(){T.reset(this)}}const F={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){z(t,e,s),z(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:z}=F,{tempPointBounds:H,setPoint:U,addPoint:Y,toBounds:j}=F,{toOuterPoint:X}=T;let V,G,K,q;const Q={},Z={},$={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){J.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},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),J.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?et(e,t):e=t,s?(e.offsetX=-(J.right(s)-t.x),e.offsetY=-(J.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),J.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(J.copy(J.tempBounds,t),J.toOuterOf(J.tempBounds,e),J.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),J.toOuterOf(t,e),t),toOuterOf(t,e,s){s||(s=t),0===e.b&&0===e.c?(s.x=e.e+t.x*e.a,s.y=e.f+t.y*e.d,s.width=t.width*e.a,s.height=t.height*e.d):(Q.x=t.x,Q.y=t.y,X(e,Q,Z),U(H,Z.x,Z.y),Q.x=t.x+t.width,X(e,Q,Z),Y(H,Z.x,Z.y),Q.y=t.y+t.height,X(e,Q,Z),Y(H,Z.x,Z.y),Q.x=t.x,X(e,Q,Z),Y(H,Z.x,Z.y),j(H,s))},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new N(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return J.copyAndSpread(s,t,e),s},spread(t,e){J.copyAndSpread(t,t,e)},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)},add(t,e){V=t.x+t.width,G=t.y+t.height,K=e.x+e.width,q=e.y+e.height,V=V>K?V:K,G=G>q?G:q,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=V-t.x,t.height=G-t.y},addList(t,e){J.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){J.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){J.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o]):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||et(t,r)):tt(t,r));n&&J.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?U(H,t.x,t.y):Y(H,t.x,t.y)})),j(H,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=A.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=A.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=J.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=J.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=J.tempToOuterOf(e,s));let{x:i,y:r,width:n,height:o}=e;return V=i+n,G=r+o,K=t.x+t.width,q=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,V=V<K?V:K,G=G<q?G:q,n=V-i,o=G-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){J.copy(t,J.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){J.set(t)}},J=$,{add:tt,copy:et}=J;class st{constructor(t,e,s,i){"object"==typeof t?$.copy(this,t):$.set(this,t,e,s,i)}set(t,e,s,i){$.set(this,t,e,s,i)}copy(t){return $.copy(this,t),this}clone(){return new st(this)}scale(t){return $.scale(this,t),this}toOuterOf(t,e){return $.toOuterOf(this,t,e),this}getFitMatrix(t){return $.getFitMatrix(this,t)}spread(t){return $.spread(this,t),this}ceil(){return $.ceil(this),this}add(t){return $.add(this,t),this}addList(t){return $.setByList(this,t,!0),this}setByList(t,e){return $.setByList(this,t,e),this}addListWithHandle(t,e){return $.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return $.setByListWithHandle(this,t,e,s),this}setByPoints(t){return $.setByPoints(this,t),this}hitPoint(t,e){return $.hitPoint(this,t,e)}hitRadiusPoint(t,e){return $.hitRadiusPoint(this,t,e)}hit(t,e){return $.hit(this,t,e)}includes(t,e){return $.includes(this,t,e)}intersect(t,e){return $.intersect(this,t,e),this}getIntersect(t,e){return new st($.getIntersectData(this,t,e))}isSame(t){return $.isSame(this,t)}isEmpty(){return $.isEmpty(this)}reset(){$.reset(this)}}class it{constructor(t,e,s,i,r,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new st(r,e,n||t.width-r-s,o||t.height-e-i)}}class rt{constructor(t,e){F.setPoint(this,t,e)}addPoint(t,e){F.addPoint(this,t,e)}addBounds(t,e,s,i){F.addBounds(this,t,e,s,i)}add(t){F.add(this,t)}}const nt={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},ot={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ht(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},updateAllChange(t){if(lt(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)dt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),at.moveLocal(t,i.x,i.y)},moveLocal(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOf(t,e,s,i,r){const n=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,n,s,i,r)},zoomOfLocal(t,e,s,i,r){i||(i=s),r||(r=t);const{x:n,y:o}=r.__,a=(new N).translate(n,o).scaleOf(e,s,i);r.x=a.e,r.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOf(t,e,s,i){const r=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:r,y:n}=i.__,o=(new N).translate(r,n).rotateOf(e,s);i.x=o.e,i.y=o.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},at=ot,{updateAllWorldMatrix:ht,updateAllWorldOpacity:lt,updateAllChange:dt}=at,ct={worldBounds:t=>t.__world,localBoxBounds:t=>t.__local,localEventBounds:t=>t.__layout.localStrokeBounds,localRenderBounds:t=>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},ut={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),_t(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++)pt(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:_t,pushAllBranchStack:pt}=ut,gt={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},ft={default:(t,e)=>(yt(e,t),yt(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?yt(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:yt}=ft;class mt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]: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];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__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]}destroy(){this.__leaf=null}}class vt{constructor(t){this.name=t}static get(t){return new vt(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(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}vt.filterList=[],vt.excludeList=[];const wt=vt,xt=vt.get("RunTime");class bt{static start(t,e){const s=u.create(u.RUNTIME);return Bt.currentId=Bt.idMap[s]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[s]=t,Bt.nameToIdMap[t]=s,s}static end(t,e){const s=Bt.idMap[t],i=Bt.nameMap[t];Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[i]=void 0,e?xt.log(i,performance.now()-s,"µs"):xt.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}}bt.idMap={},bt.nameMap={},bt.nameToIdMap={};const Bt=bt,{updateAllWorldMatrix:kt,updateAllWorldOpacity:Et}=ot,{pushAllChildBranch:Tt,pushAllParent:Ct}=ut;const{worldBounds:Rt}=ct,{setByListWithHandle:Pt}=$;class Lt{constructor(t){this.updatedBounds=new st,this.beforeBounds=new st,this.afterBounds=new st,t instanceof Array&&(t=new d(t)),this.updatedList=t}setBefore(){Pt(this.beforeBounds,this.updatedList.list,Rt)}setAfter(){Pt(this.afterBounds,this.updatedList.list,Rt),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:Ot,updateAllChange:St}=ot,{pushAllBranchStack:Mt,updateWorldBoundsByBranchStack:Dt}=ut,At=vt.get("Layouter");class It{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,e&&(this.config=ft.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(a.START),this.layoutOnce(),t.emitEvent(new a(a.END,this.layoutedBlocks,this.times))}catch(t){At.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?At.warn("layouting"):this.times>3?At.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(o.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.__updateList)||void 0===t?void 0:t.length))return;const e=bt.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=a,h=this.getBlocks(i);h.forEach((t=>{t.setBefore()})),s.emitEvent(new a(r,h,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(kt(t),e.push(t),t.isBranch&&Tt(t,e),Ct(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Ct(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&&Et(t),t.__updateChange()}))}(i),h.forEach((t=>t.setAfter())),s.emitEvent(new a(n,h,this.times)),s.emitEvent(new a(o,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updateList=null,bt.end(e)}fullLayout(){const t=bt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=a,n=this.getBlocks(new d(e));e.emitEvent(new a(s,n,this.times)),It.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new a(i,n,this.times)),e.emitEvent(new a(r,n,this.times)),this.addBlocks(n),bt.end(t)}static fullLayout(t){if(Ot(t),t.isBranch){const e=[t];Mt(t,e),Dt(e)}else t.__updateWorldBounds();St(t)}createBlock(t){return new Lt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(a.REQUEST,this.layout,this),t.on_(a.AGAIN,this.layoutAgain,this),t.on_(o.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Wt={layout:It.fullLayout},Nt={},Ft=vt.get("UICreator"),zt={list:{},register(t){const{__tag:e}=t.prototype;Ht[e]?Ft.error("repeat:",e):Ht[e]=t},get(t,e,s,i,r,n){const o=new Ht[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:Ht}=zt,Ut=vt.get("EventCreator"),Yt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(jt[e]?Ut.error("repeat: ",e):jt[e]=t)}))},changeName(t,e){const s=jt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,jt[e]=s)}},get:(t,...e)=>new jt[t](...e)},{nameList:jt}=Yt;class Xt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Nt.canvas(t);return this.add(i),i}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}destory(){this.clear()}}class Vt extends Xt{constructor(){super(...arguments),this.pathTypeList=new d,this.imageTypeList=new d}get(t){}getImageType(t,e){return this.imageTypeList.push(t),Nt.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),Nt.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}function Gt(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function Kt(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(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(o,a)}h((i=i.apply(t,e||[])).next())}))}function qt(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)}}const Qt=[];function Zt(){return(t,e)=>{Qt.push(e)}}const $t=[];let Jt=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||$t)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){}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,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,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,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,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,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};Gt([qt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Gt([qt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Gt([qt("globalAlpha")],Jt.prototype,"opacity",void 0),Gt([qt()],Jt.prototype,"fillStyle",void 0),Gt([qt()],Jt.prototype,"strokeStyle",void 0),Gt([qt("lineWidth")],Jt.prototype,"strokeWidth",void 0),Gt([qt("lineCap")],Jt.prototype,"strokeCap",void 0),Gt([qt("lineJoin")],Jt.prototype,"strokeJoin",void 0),Gt([qt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Gt([qt()],Jt.prototype,"miterLimit",void 0),Gt([qt()],Jt.prototype,"shadowBlur",void 0),Gt([qt()],Jt.prototype,"shadowColor",void 0),Gt([qt()],Jt.prototype,"shadowOffsetX",void 0),Gt([qt()],Jt.prototype,"shadowOffsetY",void 0),Gt([qt()],Jt.prototype,"filter",void 0),Gt([qt()],Jt.prototype,"font",void 0),Gt([qt()],Jt.prototype,"fontKerning",void 0),Gt([qt()],Jt.prototype,"fontStretch",void 0),Gt([qt()],Jt.prototype,"fontVariantCaps",void 0),Gt([qt()],Jt.prototype,"textAlign",void 0),Gt([qt()],Jt.prototype,"textBaseline",void 0),Gt([qt()],Jt.prototype,"textRendering",void 0),Gt([qt()],Jt.prototype,"wordSpacing",void 0),Gt([qt()],Jt.prototype,"letterSpacing",void 0),Gt([qt()],Jt.prototype,"direction",void 0),Gt([Zt()],Jt.prototype,"setTransform",null),Gt([Zt()],Jt.prototype,"resetTransform",null),Gt([Zt()],Jt.prototype,"getTransform",null),Gt([Zt()],Jt.prototype,"save",null),Gt([Zt()],Jt.prototype,"restore",null),Gt([Zt()],Jt.prototype,"transform",null),Gt([Zt()],Jt.prototype,"translate",null),Gt([Zt()],Jt.prototype,"scale",null),Gt([Zt()],Jt.prototype,"rotate",null),Gt([Zt()],Jt.prototype,"fill",null),Gt([Zt()],Jt.prototype,"stroke",null),Gt([Zt()],Jt.prototype,"clip",null),Gt([Zt()],Jt.prototype,"fillRect",null),Gt([Zt()],Jt.prototype,"strokeRect",null),Gt([Zt()],Jt.prototype,"clearRect",null),Gt([Zt()],Jt.prototype,"beginPath",null),Gt([Zt()],Jt.prototype,"moveTo",null),Gt([Zt()],Jt.prototype,"lineTo",null),Gt([Zt()],Jt.prototype,"bezierCurveTo",null),Gt([Zt()],Jt.prototype,"quadraticCurveTo",null),Gt([Zt()],Jt.prototype,"closePath",null),Gt([Zt()],Jt.prototype,"arc",null),Gt([Zt()],Jt.prototype,"arcTo",null),Gt([Zt()],Jt.prototype,"ellipse",null),Gt([Zt()],Jt.prototype,"rect",null),Gt([Zt()],Jt.prototype,"roundRect",null),Gt([Zt()],Jt.prototype,"createConicGradient",null),Gt([Zt()],Jt.prototype,"createLinearGradient",null),Gt([Zt()],Jt.prototype,"createPattern",null),Gt([Zt()],Jt.prototype,"createRadialGradient",null),Gt([Zt()],Jt.prototype,"fillText",null),Gt([Zt()],Jt.prototype,"measureText",null),Gt([Zt()],Jt.prototype,"strokeText",null);const te=new st,ee={width:1,height:1,pixelRatio:1},se=["width","height","pixelRatio"];class ie extends Jt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(t,e){super(),this.worldTransform={},t||(t=ee),t.pixelRatio||(t.pixelRatio=Wt.devicePixelRatio),this.manager=e,this.innerId=u.create(u.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.pixelRatio=r,this.offscreen=Wt.isWorker||t.offscreen,this.config=t,this.init(),this.textBaseline="alphabetic"}init(){}setBackgroundColor(t){}setHittable(t){}resize(t){if(this.isSameSize(t))return;const{width:e,height:s}=t;let i;this.context&&!this.unreal&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this)),ft.copyAttrs(this,t,se),this.bounds=new st(0,0,e,s),this.unreal||(this.setViewSize(t),this.smooth=this.config.smooth),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}setViewSize(t){}startAutoLayout(t,e){}stopAutoLayout(){}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:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*o)*i,r.b=(t.a*n+t.b*a)*i,r.c=(t.c*s+t.d*o)*i,r.d=(t.c*n+t.d*a)*i,r.e=(t.e*s+t.f*o+h)*i,r.f=(t.e*n+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)}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 this.context.isPointInPath(t.x,t.y,e)}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,$.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")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,te.copy(t).scale(this.pixelRatio),this.fillRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,te.copy(t).scale(this.pixelRatio),this.strokeRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}clearWorld(t,e){te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.clearRect(te.x,te.y,te.width,te.height)}clipWorld(t,e){this.beginPath(),te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.rect(te.x,te.y,te.width,te.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:e,height:s,pixelRatio:i}=this,r={width:e,height:s,pixelRatio:i},n=this.manager?this.manager.get(r):Nt.canvas(r);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:r}=this;t&&(s+=t),e&&(i+=e);const n={width:s,height:i,pixelRatio:r},o=this.manager?this.manager.get(n):Nt.canvas(n);return o.save(),o}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function re(t,e,s){Object.defineProperty(t,e,s)}function ne(t,e){return Object.getOwnPropertyDescriptor(t,e)}function oe(t){return(e,s)=>{re(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function ae(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};re(t,e,Object.assign(r,i||{})),Ee(t,e,s)}function he(t){return(e,s)=>{ae(e,s,t)}}function le(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function de(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function ce(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function ue(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const ge=pe;function fe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ye(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function me(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function ve(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function we(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.parent?this.parent.__updateMask(t):this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function xe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),vt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function be(t){return(e,s)=>{re(e,"__DataProcessor",{get:()=>t})}}function Be(t){return(e,s)=>{re(e,"__LayoutProcessor",{get:()=>t})}}function ke(t,e,s){Ee(t.prototype,e,s)}function Ee(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s&&(o.get=function(){return this[r]});const a=ne(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const Te=new vt("rewrite"),Ce=[],Re=["destroy","constructor"];function Pe(t){return(e,s)=>{Ce.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Le(){return t=>{Oe()}}function Oe(t){Ce.length&&(Ce.forEach((e=>{t&&Te.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ce.length=0)}function Se(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Re.includes(i)||e&&e.includes(i)))if(t.prototype){ne(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Me(){return t=>{zt.register(t)}}function De(){return t=>{Yt.register(t)}}setTimeout((()=>Oe(!0)));const{toOuterOf:Ae}=$;class Ie{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()}checkUpdate(){const{leafer:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():(t.start(),t.layouter.layout());else{let t=this.leaf;for(;t.parent;)t=t.parent;Wt.layout(t)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),T.decompose("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={}),Ae(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ae(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Ae(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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const We={},Ne={on(t,e,s){let i,r,n;if(s){const t="boolean"==typeof s;i=t?s:s.capture,r=!t&&s.once}const o=Fe(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))},off(t,e,s){let i,r,n;s&&(i="boolean"==typeof s?s:s.capture);const o=Fe(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=o[t],r&&(n=r.findIndex((t=>t.listener===e)),n>-1&&r.splice(n,1),r.length||delete o[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){const i=Fe(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&(r=i[n],r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),!e||!e.isStopNow);n++);}},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 Fe(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:We)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:We)}}const ze={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:i}=s,r=new s(i,this,t,this.__.__get(t),e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:He}=T,{sin:Ue,cos:Ye}=Math,je={__updateWorldMatrix(){const t=this.parent?this.parent.__world:He,e=this.__local,s=this.__world;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):(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)},__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:o}=this.__;r||n||o?(r*=g,n&&(n*=g),o&&(o*=g),t.a=s*Ye(r+o),t.b=s*Ue(r+o),t.c=i*-Ue(r-n),t.d=i*Ye(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)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:Xe,copyAndSpread:Ve}=$,Ge={__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,Xe(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Xe(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Xe(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Xe(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Xe(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){Ve(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ve(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Ke}=A,qe={},Qe={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Ke(t,this.__world,qe),this.__hit(qe)},__drawHitPath(t){this.__drawRenderPath(t)}},Ze={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,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)}},$e={__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),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--)}}},{LEAF:Je,create:ts}=u;let es=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 mt}get __LayoutProcessor(){return Ie}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}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 __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return this.__hasMask&&this.__.hitChildren}constructor(t){this.innerId=ts(Je),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={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),t&&Object.assign(this,t)}waitParent(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&gt.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(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateMask(){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?T.toInnerPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}localToWorld(t,e,s){this.parent?T.toOuterPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}worldToInner(t,e,s){T.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){T.toOuterPoint(this.worldTransform,t,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){this.parent&&this.parent.remove(this)}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.__&&(this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null,this.children&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};es=Gt([Se(ze),Se(je),Se(Ge),Se(Qe),Se(Ne),Se(Ze)],es);const{setByListWithHandle:ss}=$,{sort:is}=ut,{localBoxBounds:rs,localEventBounds:ns,localRenderBounds:os,maskLocalBoxBounds:as,maskLocalEventBounds:hs,maskLocalRenderBounds:ls}=ct;let ds=class extends es{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(){ss(this.__layout.boxBounds,this.children,this.__hasMask?as:rs)}__updateStrokeBounds(){ss(this.__layout.strokeBounds,this.children,this.__hasMask?hs:ns)}__updateRenderBounds(){ss(this.__layout.renderBounds,this.children,this.__hasMask?ls:os)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(is)}}__render(t,e){if(this.__worldOpacity){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,n=t.getSameCanvas(),o=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,o,n),n.clear(),o.clear()):r=!0,s.__render(n,e)):s.__render(o,e);this.__renderMask(t,o,n),n.recycle(),o.recycle()}else{const{bounds:r,hideBounds:n}=e;for(let o=0,a=i.length;o<a;o++)s=i[o],r&&!r.hit(s.__world,e.matrix)||n&&n.includes(s.__world,e.matrix)||s.__render(t,e)}}}add(t,s){if(t.parent&&t.parent.remove(t),t.parent=this,void 0===s?this.children.push(t):this.children.splice(s,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&gt.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready)){const{ADD:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}remove(t){if(t){const s=this.children.indexOf(t);if(s>-1&&(this.children.splice(s,1),this.__hasMask&&this.__updateMask(),this.__layout.boxChange(),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready))){const{REMOVE:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}else super.remove()}};ds=Gt([Se($e)],ds);const cs={};class us{static isHoldSpaceKey(){return us.hasDownCode("Space")}static setDownCode(t){cs[t]||(cs[t]=!0)}static setUpCode(t){cs[t]=!1}static hasDownCode(t){return cs[t]}}class _s{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class ps extends t{get spaceKey(){return us.isHoldSpaceKey()}get left(){return _s.left(this)}get right(){return _s.right(this)}get middle(){return _s.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){Yt.changeName(t,e)}}let gs=class extends ps{};gs.POINTER="pointer",gs.BEFORE_DOWN="pointer.before_down",gs.BEFORE_MOVE="pointer.before_move",gs.BEFORE_UP="pointer.before_up",gs.DOWN="pointer.down",gs.MOVE="pointer.move",gs.UP="pointer.up",gs.OVER="pointer.over",gs.OUT="pointer.out",gs.ENTER="pointer.enter",gs.LEAVE="pointer.leave",gs.TAP="tap",gs.DOUBLE_TAP="double_tap",gs.CLICK="click",gs.DOUBLE_CLICK="double_click",gs.LONG_PRESS="long_press",gs.LONG_TAP="long_tap",gs=Gt([De()],gs);let fs=class extends gs{};var ys;fs.DRAG="drag",fs.START="drag.start",fs.END="drag.end",fs.OVER="drag.over",fs.OUT="drag.out",fs.ENTER="drag.enter",fs.LEAVE="drag.leave",fs=Gt([De()],fs);let ms=ys=class extends gs{static setList(t){ys.dragList=t instanceof d?t:new d(t)}static setData(t){this.dragData=t}};ms.DROP="drop",ms=ys=Gt([De()],ms);let vs=class extends fs{};vs.MOVE="move",vs.START="move.start",vs.END="move.end",vs=Gt([De()],vs);let ws=class extends ps{};ws.ROTATE="rotate",ws.START="rotate.start",ws.END="rotate.end",ws=Gt([De()],ws);let xs=class extends fs{};xs.SWIPE="swipe",xs.LEFT="swipe.left",xs.RIGHT="swipe.right",xs.UP="swipe.up",xs.DOWN="swipe.down",xs=Gt([De()],xs);let bs=class extends ps{};bs.ZOOM="zoom",bs.START="zoom.start",bs.END="zoom.end",bs=Gt([De()],bs);let Bs=class extends ps{};Bs.DOWN="key.down",Bs.PRESS="key.press",Bs.UP="key.up",Bs=Gt([De()],Bs);class ks{constructor(t){this.options=t}load(t,e){Wt.origin.loadImage(this.options.url).then((e=>{this.ready=!0,this.width=e.naturalWidth||e.width,this.height=e.naturalHeight||e.height,this.view=e,t&&t(this)})).catch((t=>{e&&e(t)}))}getCanvas(t,e,s,i){t||(t=this.width),e||(e=this.height);const r=Wt.origin.createCanvas(t,e),n=r.getContext("2d");return s&&(n.globalAlpha=s),n.drawImage(this.view,0,0,t,e),r}destory(){this.view=null,this.options=null}}class Es{constructor(t,e){this.map={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Nt.image(t),this.map[t.url]=e),e}destory(){this.leafer=null,this.map=null}}const Ts={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Cs={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Rs=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},Cs),Ps={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},Ls={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},Os=Object.assign(Object.assign({},Ls),Cs),Ss=Rs,Ms={};for(let t in Ss)Ms[Ss[t]]=t;const Ds={};for(let t in Ss)Ds[Ss[t]]=Ps[t];const As={drawRoundRect(t,e,s,i,r,n){let[o,a,h,l]=p.fourNumber(n);const d=Math.min(i/2,r/2);o>d&&(o=d),a>d&&(a=d),h>d&&(h=d),l>d&&(l=d),o?t.moveTo(e+o,s):t.moveTo(e,s),a?t.arcTo(e+i,s,e+i,s+r,a):t.lineTo(e+i,s),h?t.arcTo(e+i,s+r,e,s+r,h):t.lineTo(e+i,s+r),l?t.arcTo(e,s+r,e,s,l):t.lineTo(e,s+r),o?t.arcTo(e,s,e+i,s,o):t.lineTo(e,s)}},{sin:Is,cos:Ws,atan2:Ns,ceil:Fs,abs:zs,PI:Hs}=Math,{setPoint:Us,addPoint:Ys}=F,{set:js}=A,Xs={},Vs={rect(t,e,s,i,r){Ts.creator.path=t,Ts.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,n){Ts.creator.path=[],As.drawRoundRect(Ts.creator,e,s,i,r,n),t.push(...Ts.convertToCanvasData(Ts.creator.path,!0))},arcTo(t,e,s,i,r,n,o,a,h,l,d){const c=i-e,u=r-s,_=n-i,p=o-r;let m=Ns(u,c),v=Ns(p,_),w=v-m;if(w<0&&(w+=f),w===Hs||zs(c+u)<1e-12||zs(_+p)<1e-12)return t&&t.push(Rs.L,i,r),h&&(Us(h,e,s),Ys(h,i,r)),d&&js(d,e,s),void(l&&js(l,i,r));const x=c*p-_*u<0,b=x?-1:1,B=a/Ws(w/2),k=i+B*Ws(m+w/2+y*b),E=r+B*Is(m+w/2+y*b);return m-=y*b,v-=y*b,qs(t,k,E,a,a,0,m/g,v/g,x,h,l,d)},arc:(t,e,s,i,r,n,o,a,h,l)=>qs(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,n,o,a,h,l,d,c){const u=n*g,_=Is(u),p=Ws(u);let m=o*g,v=a*g;m>Hs&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Fs(zs(w/y)),b=w/x,B=Is(b/4),k=8/3*B*B/Is(b/2);v=m+b;let E,T,C,R,P,L,O,S,M=Ws(m),D=Is(m),A=C=p*i*M-_*r*D,I=R=_*i*M+p*r*D,W=e+C,N=s+R;t&&t.push(Rs.L,W,N),l&&Us(l,W,N),c&&js(c,W,N);for(let n=0;n<x;n++)E=Ws(v),T=Is(v),C=p*i*E-_*r*T,R=_*i*E+p*r*T,P=e+A-k*(p*i*D+_*r*M),L=s+I-k*(_*i*D-p*r*M),O=e+C+k*(p*i*T+_*r*E),S=s+R+k*(_*i*T-p*r*E),t&&t.push(Rs.C,P,L,O,S,e+C,s+R),l&&Ks(e+A,s+I,P,L,O,S,e+C,s+R,l,!0),A=C,I=R,M=E,D=T,m=v,v+=b;d&&js(d,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Rs.C,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){Ks(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=n,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?Ys(h,t,e):Us(h,t,e),Ys(h,o,a);for(let l=0,c=d.length;l<c;l++)Gs(d[l],t,e,s,i,r,n,o,a,Xs),Ys(h,Xs.x,Xs.y)},getPointAndSet(t,e,s,i,r,n,o,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+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return Gs(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Gs,toTwoPointBounds:Ks,ellipse:qs}=Vs,{sin:Qs,cos:Zs,sqrt:$s,atan2:Js}=Math,{ellipse:ti}=Vs,ei={ellipticalArc(t,e,s,i,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*g,p=Qs(_),y=Zs(_),m=-y*c-p*u,v=-y*u+p*c,w=i*i,x=r*r,b=v*v,B=m*m,k=w*x-w*b-x*B;let E=0;if(k<0){const t=$s(1-k/(w*x));i*=t,r*=t}else E=(o===a?-1:1)*$s(k/(w*b+x*B));const T=E*i*v/r,C=-E*r*m/i,R=Js((v-C)/r,(m-T)/i),P=Js((-v-C)/r,(-m-T)/i);let L=P-R;0===a&&L>0?L-=f:1===a&&L<0&&(L+=f);const O=e+c+y*T-p*C,S=s+u+p*T+y*C,M=L<0?1:0;d?ti(t,O,S,i,r,n,R/g,P/g,M):i!==r||n?t.push(Rs.G,O,S,i,r,n,R/g,P/g,M):t.push(Rs.O,O,S,i,R/g,P/g,M)}},{M:si,m:ii,L:ri,l:ni,H:oi,h:ai,V:hi,v:li,C:di,c:ci,S:ui,s:_i,Q:pi,q:gi,T:fi,t:yi,A:mi,a:vi,Z:wi,z:xi,N:bi,D:Bi,X:ki,G:Ei,F:Ti,O:Ci,P:Ri,U:Pi}=Rs,{rect:Li,roundRect:Oi,arcTo:Si,arc:Mi,ellipse:Di,quadraticCurveTo:Ai}=Vs,{ellipticalArc:Ii}=ei,Wi=vt.get("PathConvert"),Ni={},Fi={current:{},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=Ds[s],o+=s===i?" ":Ms[s];for(let s=1;s<e;s++)o+=t[r+s],s===e-1||(o+=" ");i=s,r+=e}return o},parse(t,e){let s,i,r,n="";const o=[],a=e?Os:Ls;for(let e=0,h=t.length;e<h;e++)i=t[e],nt[i]?n+=i:Rs[i]?(n&&(Hi(o,Number(n)),n=""),zi.name=Rs[i],zi.length=Ps[i],zi.index=0,Hi(o,zi.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Hi(o,Number(n)),n=i):n&&(Hi(o,Number(n)),n=""),r=i;return n&&Hi(o,Number(n)),s?Fi.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ii:t[c+1]+=a,t[c+2]+=h;case si:a=t[c+1],h=t[c+2],_.push(si,a,h),c+=3;break;case ai:t[c+1]+=a;case oi:a=t[c+1],_.push(ri,a,h),c+=2;break;case li:t[c+1]+=h;case hi:h=t[c+1],_.push(ri,a,h),c+=2;break;case ni:t[c+1]+=a,t[c+2]+=h;case ri:a=t[c+1],h=t[c+2],_.push(ri,a,h),c+=3;break;case _i:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ui;case ui:o=n===di||n===ui,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(di,l,d,s,i,a,h),c+=5;break;case ci: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=di;case di:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(di,t[c+1],t[c+2],s,i,a,h),c+=7;break;case yi:t[c+1]+=a,t[c+2]+=h,r=fi;case fi:o=n===pi||n===fi,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Ai(_,a,h,s,i,t[c+1],t[c+2]):_.push(pi,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case gi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=pi;case pi:s=t[c+1],i=t[c+2],e?Ai(_,a,h,s,i,t[c+3],t[c+4]):_.push(pi,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case vi:t[c+6]+=a,t[c+7]+=h;case mi:Ii(_,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 xi:case wi:_.push(wi),c++;break;case bi:a=t[c+1],h=t[c+2],e?Li(_,a,h,t[c+3],t[c+4]):Ui(_,t,c,5),c+=5;break;case Bi:a=t[c+1],h=t[c+2],e?Oi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ui(_,t,c,9),c+=9;break;case ki:a=t[c+1],h=t[c+2],e?Oi(_,a,h,t[c+3],t[c+4],t[c+5]):Ui(_,t,c,6),c+=6;break;case Ei:Di(e?_:Ui(_,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,Ni),a=Ni.x,h=Ni.y,c+=9;break;case Ti:e?Di(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ui(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ci:Mi(e?_:Ui(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ni),a=Ni.x,h=Ni.y,c+=7;break;case Ri:e?Mi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ui(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Pi:Si(e?_:Ui(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ni),a=Ni.x,h=Ni.y,c+=6;break;default:return Wi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){zi.index===zi.length&&(zi.index=1,t.push(zi.name)),t.push(e),zi.index++}},{current:zi,pushData:Hi,copyData:Ui}=Fi,{M:Yi,L:ji,C:Xi,Q:Vi,Z:Gi,N:Ki,D:qi,X:Qi,G:Zi,F:$i,O:Ji,P:tr,U:er}=Rs,sr={},ir={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Yi,e,s)},lineTo(t,e,s){t.push(ji,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(Xi,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Vi,e,s,i,r)},closePath(t){t.push(Gi)},rect(t,e,s,i,r){t.push(Ki,e,s,i,r)},roundRect(t,e,s,i,r,n){if("number"==typeof n)t.push(Qi,e,s,i,r,n);else{const o=p.fourNumber(n);o?t.push(qi,e,s,i,r,...o):t.push(Ki,e,s,i,r)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push($i,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Zi,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(tr,e,s,i):(void 0===n&&(n=360),t.push(Ji,e,s,i,r,n,o?1:0))},moveToEllipse(t,e,s,i,r,n,o,a,h){void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=360),Vs.ellipse(null,e,s,i,r,n,o,a,h,null,null,sr),t.push(Yi,sr.x,sr.y),rr(t,e,s,i,r,n,o,a,h)},moveToArc(t,e,s,i,r,n,o){void 0===r&&(r=0),void 0===n&&(n=360),Vs.arc(null,e,s,i,r,n,o,null,null,sr),t.push(Yi,sr.x,sr.y),nr(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(er,e,s,i,r,n)}},{ellipse:rr,arc:nr}=ir,{moveTo:or,lineTo:ar,quadraticCurveTo:hr,bezierCurveTo:lr,closePath:dr,beginPath:cr,rect:ur,roundRect:_r,ellipse:pr,arc:gr,arcTo:fr,moveToEllipse:yr,moveToArc:mr}=ir;class vr{constructor(t){this.path=t?"string"==typeof t?Ts.parse(t):t:[]}beginPath(){return cr(this.path),this}moveTo(t,e){return or(this.path,t,e),this}lineTo(t,e){return ar(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return lr(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return hr(this.path,t,e,s,i),this}closePath(){return dr(this.path),this}rect(t,e,s,i){return ur(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return _r(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return pr(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return gr(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return fr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return yr(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return mr(this.path,t,e,s,i,r,n),this}}const{M:wr,L:xr,C:br,Q:Br,Z:kr,N:Er,D:Tr,X:Cr,G:Rr,F:Pr,O:Lr,P:Or,U:Sr}=Rs,Mr=vt.get("PathDrawer"),Dr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case wr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case xr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case br:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Br:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case kr:t.closePath(),i+=1;break;case Er:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Tr: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 Cr:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Rr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*g,e[i+6]*g,e[i+7]*g,e[i+8]),i+=9;break;case Pr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Lr:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*g,e[i+5]*g,e[i+6]),i+=7;break;case Or:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Sr:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Mr.error(`command: ${s} [index:${i}]`,e)}}},{M:Ar,L:Ir,C:Wr,Q:Nr,Z:Fr,N:zr,D:Hr,X:Ur,G:Yr,F:jr,O:Xr,P:Vr,U:Gr}=Rs,{toTwoPointBounds:Kr,toTwoPointBoundsByQuadraticCurve:qr,arcTo:Qr,arc:Zr,ellipse:$r}=Vs,{add:Jr,copy:tn,addPoint:en,setPoint:sn,addBounds:rn,toBounds:nn}=F,on=vt.get("PathBounds");let an,hn,ln;const dn={},cn={},un={},_n={toBounds(t,e){_n.toTwoPointBounds(t,cn),nn(cn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return sn(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Fr||s===Wr||s===Nr?sn(e,h,l):sn(e,t[a+1],t[a+2])),s){case Ar:case Ir:h=t[a+1],l=t[a+2],en(e,h,l),a+=3;break;case Wr:n=t[a+5],o=t[a+6],Kr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,dn),Jr(e,dn),h=n,l=o,a+=7;break;case Nr:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],qr(h,l,i,r,n,o,dn),Jr(e,dn),h=n,l=o,a+=5;break;case Fr:a+=1;break;case zr:h=t[a+1],l=t[a+2],rn(e,h,l,t[a+3],t[a+4]),a+=5;break;case Hr:case Ur:h=t[a+1],l=t[a+2],rn(e,h,l,t[a+3],t[a+4]),a+=s===Hr?9:6;break;case Yr:$r(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],dn,un),0===a?tn(e,dn):Jr(e,dn),h=un.x,l=un.y,a+=9;break;case jr:h=t[a+1],l=t[a+2],hn=t[a+3],ln=t[a+4],rn(e,h-hn,l-ln,2*hn,2*ln),h+=hn,a+=5;break;case Xr:Zr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],dn,un),0===a?tn(e,dn):Jr(e,dn),h=un.x,l=un.y,a+=7;break;case Vr:h=t[a+1],l=t[a+2],an=t[a+3],rn(e,h-an,l-an,2*an,2*an),h+=an,a+=4;break;case Gr:Qr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],dn,un),0===a?tn(e,dn):Jr(e,dn),h=un.x,l=un.y,a+=6;break;default:return void on.error(`command: ${s} [index:${a}]`,t)}}},pn={smooth:(t,e,s)=>t};Ts.creator=new vr,Ts.parse=Fi.parse,Ts.convertToCanvasData=Fi.toCanvasData;const gn=vt.get("plugin"),fn={power:{},list:[]};function yn(t,e){e||(e=fn.power),fn.list.push(t);const s={};t.import?t.import.forEach((t=>{e[t]?s[t]=e[t]:gn.error(t+" non-existent")})):gn.warn("no import");try{t.run(s)}catch(t){gn.error(t)}}class mn{constructor(t){this.taskTime=1,this.id=u.create(u.TASK),this.task=t}run(){return Kt(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const vn=vt.get("TaskProcessor");class wn{get isComplete(){return this._isComplete}get running(){return this._running}constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get percent(){const t=this.list.length;let e=0,s=0;for(let i=0;i<t;i++)i<=this.index?(s+=this.list[i].taskTime,i===this.index&&(e=s)):e+=this.list[i].taskTime;let i=this._isComplete?1:s/e;return Number.isNaN(i)&&(i=0),i}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new mn(t),e)}addParallel(t,e){const s=new mn(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new mn(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.runTask())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.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.index+this.parallelSuccessNumber+s;if(e.length){if(!this._running)return;i<this.list.length&&(t=this.list[i],t.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){vn.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class xn{constructor(t,e){this.updatedList=new d,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=ft.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(h.REQUEST)}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===e.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new o(o.DATA,{updatedList:this.updatedList})),this.updatedList=new d,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(s.CHANGE,this.__onAttrChange,this),t.on_([e.ADD,e.REMOVE],this.__onChildEvent,this),t.on_(o.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const bn=vt.get("Renderer");class Bn{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=ft.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed||this.__requestRender(),this.changed=!0}requestLayout(){this.target.emit(a.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new st,bn.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){bn.error(t)}bn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?bn.warn("rendering"):this.times>3?bn.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new st,this.renderOptions={},t?(this.emitRender(h.BEFORE),t()):(this.requestLayout(),this.emitRender(h.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(h.RENDER,this.renderBounds,this.renderOptions),this.emitRender(h.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 bn.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=bt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new st).copy(i);s.save(),r&&!vt.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,n),s.restore(),bt.end(e)}fullRender(){const t=bt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),bt.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),vt.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),vt.showHitView&&this.renderHitView(s),vt.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new st;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();Wt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new st(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&&(bn.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new h(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(h.REQUEST,this.update,this),t.on_(a.END,this.__onLayoutEnd,this),t.on_(h.AGAIN,this.renderAgain,this),t.on_(r.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:kn}=$;class En{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 n=this.findList,o=this.getBestMatchLeaf(),a=r?this.getPath(o):this.getHitablePath(o);return this.clear(),i?{path:a,leaf:o,throughPath:n.length?this.getThroughPath(n):a}:{path:a,leaf:o}}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],this.hitChild(e,r),this.findList.length)return this.findList[0]}return t[0]}getPath(t){const e=new d;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 d;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 d,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,n;for(let t=0,o=s.length;t<o;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(n=i.list[t],!r||!r.has(n));t++)e.push(n)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let n=t.length-1;n>-1;n--)s=t[n],e&&!s.isMask||(i=kn(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.target=null,this.selector=null}}class Tn{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ft.default(e,this.config)),this.findPath=new En(t,this),this.__listenEvents()}getByPoint(t,e,s){return this.target.emit(a.CHECK_UPDATE),this.findPath.getByPoint(t,e,s)}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_(e.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(Nt,{watcher:(t,e)=>new xn(t,e),layouter:(t,e)=>new It(t,e),renderer:(t,e,s)=>new Bn(t,e,s),selector:(t,e)=>new Tn(t,e)});const Cn=vt.get("LeaferCanvas");class Rn extends ie{init(){const{view:t}=this.config;if(this.offscreen)t?this.view=t:this.__createView();else{t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;this.autoLayout&&(e.display||(e.display="block")),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}setBackgroundColor(t){this.view.style.backgroundColor=t}setHittable(t){this.view.style.pointerEvents=t?"auto":"none"}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){Cn.error(t)}this.view=document.createElement("canvas")}__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 Cn.error(`no id: ${t}`),this.__createView()}setViewSize(t){const{width:e,height:s,pixelRatio:i}=t;if(!this.offscreen){const{style:t}=this.view;t.width=e+"px",t.height=s+"px"}this.view.width=e*i,this.view.height=s*i}startAutoLayout(t,e){if(!this.offscreen){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{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()),window.requestAnimationFrame(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:n,height:o}=this.autoBounds.getBoundsFrom(t);if(n!==this.width||o!==this.height){const{style:t}=e,{pixelRatio:a}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const h={width:n,height:o,pixelRatio:a},l={};ft.copyAttrs(l,this,se),this.resize(h),void 0!==this.width&&this.resizeListener(new r(h,l))}}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&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}const{drawRoundRect:Pn}=As;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){Pn(this,t,e,s,i,r)})}();class Ln{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(vs.START,this.moveData)}t.path=this.moveData.path,e.emit(vs.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(bs.START,this.zoomData)}t.path=this.zoomData.path,e.emit(bs.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(ws.START,this.rotateData)}t.path=this.rotateData.path,e.emit(ws.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(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(vs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(bs.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(ws.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const On={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?xs.UP:t>45&&t<135?xs.DOWN:t<=45&&t>=-45?xs.RIGHT:xs.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:Sn.getSwipeDirection(A.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 d,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Sn=On,{getDragEventData:Mn,getDropEventData:Dn,getSwipeEventData:An,filterPathByEventType:In}=On;class Wn{constructor(t){this.interaction=t}setDragData(t){this.dragData=Mn(t,t,t)}getDragList(){return this.dragging?ms.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!_s.middle(t)&&!_s.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(_s.middle(t)||us.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(vs.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Mn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(vs.MOVE,this.dragData):this.dragging&&(s.emit(fs.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=_s.left(t)&&e,this.dragging&&(this.interaction.emit(fs.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=In(this.dragData.path,fs.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}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=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{ot.move(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(fs.OUT,t,s),e.emit(fs.OVER,t,i)):e.emit(fs.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(fs.ENTER,t,i,s),e.emit(fs.LEAVE,t,s,i),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,n=Mn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(vs.END,n),this.dragging&&(e.emit(fs.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(A.getDistance(i,t)>s.config.pointer.swipeDistance){const t=An(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Dn(t,this.getDragList(),ms.dragData);e.path=this.dragEnterPath,this.interaction.emit(ms.DROP,e),this.interaction.emit(fs.LEAVE,t,this.dragEnterPath)}dragReset(){ms.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}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 n=e.shrinkCanvasBounds,{x:o,y:a}=n,h=$.right(n),l=$.bottom(n),d=t.x<o?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,$.move(s,d,c),$.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.interaction=null,this.dragableList=null}}const Nn=["move","zoom","rotate"];function Fn(t,e,s,i,r){if(Nn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Hn(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!s.path.has(n)&&n.__.hittable&&zn(n,e,s,i,r)}}function zn(t,e,s,i,r){if(t.__.hitSelf&&t.hasEvent(e,i)&&!Hn(t,r)){s.phase=i?1:t===s.target?2:3;const r=Yt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Hn(t,e){return e&&e.has(t)}const{pathHasEventType:Un}=On;class Yn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{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}},this.tapCount=0,this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new d(t),this.transformer=new Ln(this),this.dragger=new Wn(this),i&&(this.config=ft.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(gs.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getByPoint(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(gs.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),_s.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(gs.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:gs.MOVE});t.path=e.path,this.emit(gs.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(gs.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(gs.UP,t),this.emit(gs.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}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(gs.OUT,t,this.overPath),this.emit(gs.OVER,t,e)):this.emit(gs.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(gs.ENTER,t,e,this.enterPath),this.emit(gs.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(gs.LEAVE,t),this.dragger.dragging&&this.emit(ms.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=[gs.DOUBLE_TAP,gs.DOUBLE_CLICK].some((e=>Un(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))}emitTap(t){this.emit(gs.TAP,t),this.emit(gs.CLICK,t)}emitDoubleTap(t){this.emit(gs.DOUBLE_TAP,t),this.emit(gs.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(gs.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(gs.LONG_TAP,t),Un(t.path,gs.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new st(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(r.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}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 n=s.length-1;n>-1;n--){if(r=s.list[n],zn(r,t,e,!0,i))return;r.isApp&&Fn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&Fn(r,t,e,!1,i),zn(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=null,this.target=null,this.selector=null,this.canvas=null,this.dragger=null,this.transformer=null)}}const jn={convert(t,e){const s=On.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=On.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=jn.getTouch(t),i=On.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]},Xn={getData(t,e){const s=A.getCenter(t[0],t[1]),i=A.getCenter(e[0],e[1]),r={x:i.x-s.x,y:i.y-s.y},n=A.getDistance(t[0],t[1]),o=A.getDistance(e[0],e[1])/n,a=A.getAngle(t[0],t[1]),h=A.getAngle(e[0],e[1]);return{move:r,scale:o,angle:this.getChangedAngle(a,h),center:i}},getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},Vn={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:r,zoomSpeed:n}=e;const o=t.deltaY||t.deltaX;if(r){const e=Wt.intWheelDeltaY&&Math.abs(t.deltaY)>17;s=(Math.floor(t.deltaY)!==t.deltaY||e)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){n=p.within(n,0,1);i=1-o/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-n)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Gn,getZoomEventData:Kn,getRotateEventData:qn}=On;class Qn extends Yn{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,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};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){const e=this.view.getBoundingClientRect();return{x:t.clientX-e.x,y:t.clientY-e.y}}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}onKeyDown(t){us.setDownCode(t.code)}onKeyUp(t){us.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(jn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(jn.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(jn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(jn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(jn.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(jn.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=jn.getTouch(t);this.pointerDown(jn.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=jn.getTouch(t);this.pointerMove(jn.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=jn.getTouch(t);this.pointerUp(jn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Xn.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Xn.getTouches(t.touches),s=e.find((t=>t.identifier===this.touches[0].identifier)),i=e.find((t=>t.identifier===this.touches[1].identifier));if(s&&i){const r=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(s),this.getLocal(i)],{move:o,angle:a,scale:h,center:l}=Xn.getData(r,n),d=On.getBase(t);this.rotate(qn(l,a,d)),this.zoom(Kn(l,h,d)),this.move(Gn(l,o,d)),this.touches=e}}}mutiTouchEnd(){this.touches=null,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):Vn.getScale(t,e),i=this.getLocal(t),r=On.getBase(t);1!==s?this.zoom(Kn(i,s,r)):this.move(Gn(i,e.getMove?e.getMove(t,e):Vn.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=On.getBase(t),i=t.scale/this.lastGestureScale,r=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=p.within(n,0,1),this.zoom(Kn(e,i*i,s)),this.rotate(qn(e,r/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)}}Object.assign(Nt,{canvas:(t,e)=>new Rn(t,e),image:t=>new ks(t),hitCanvas:(t,e)=>new Rn(t,e),interaction:(t,e,s,i)=>new Qn(t,e,s,i)}),Wt.requestRender=function(t){window.requestAnimationFrame(t)},Wt.devicePixelRatio=devicePixelRatio;const{userAgent:Zn}=navigator;Zn.indexOf("Firefox")>-1?(Wt.conicGradientRotate90=!0,Wt.intWheelDeltaY=!0):Zn.indexOf("Safari")>-1&&-1===Zn.indexOf("Chrome")&&(Wt.fullImageShadow=!0),Wt.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},loadImage:t=>new Promise(((e,s)=>{const i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>{e(i)},i.onerror=t=>{s(t)},t.startsWith("data:")||t.includes("?"),i.src=t}))},Wt.canvas=Nt.canvas(),Wt.conicGradientSupport=!!Wt.canvas.context.createConicGradient;const $n=vt.get("LeaferTypeCreator"),Jn={list:{},register(t,e){to[t]?$n.error("repeat:",t):to[t]=e},run(t,e){const s=Jn.list[t];s?s(e):$n.error("no",t)}},{list:to}=Jn;Jn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),Jn.register("design",(function(t){const{MOVE:e}=vs,{ZOOM:s}=bs;t.__eventIds.push(t.on_(e,(e=>{ot.move(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:n}=e;n*s<i?n=i/s:n*s>r&&(n=r/s),1!==n&&ot.zoomOf(t.zoomLayer,e,n)})))}));const eo={},so={},io={},ro={},{copy:no,toOffsetOutBounds:oo}=$,ao={},ho={};function lo(t,e,s,i){const{bounds:r,shapeBounds:n}=i;if(Wt.fullImageShadow){if(no(ao,t.bounds),ao.x+=e.x-n.x,ao.y+=e.y-n.y,s){const{matrix:t}=i;ao.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),ao.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),ao.width*=s,ao.height*=s}t.copyWorld(i.canvas,t.bounds,ao)}else s&&(no(ao,e),ao.x-=e.width/2*(s-1),ao.y-=e.height/2*(s-1),ao.width*=s,ao.height*=s),t.copyWorld(i.canvas,n,s?ao:e)}const{toOffsetOutBounds:co}=$,uo={};var _o=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){let i,r;const{__world:n,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;co(l,uo),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(uo.offsetX+t.x*c,uo.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,lo(_,uo,r,s),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()},shadow:function(t,e,s){let i,r;const{__world:n,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;oo(l,ho),a.forEach(((t,a)=>{_.setWorldShadow(ho.offsetX+t.x*c,ho.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,lo(_,ho,r,s),i=l,t.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),i=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()}});function po(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;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,n)}function go(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),vo(t,e);break;case"inside":fo(t,e,s,"inside");break;case"outside":fo(t,e,s,"outside")}}function fo(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,vo(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",po(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function yo(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),mo(t,s,e);break;case"inside":fo(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(void 0,2*r,t.__),o.font=n,mo(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",po(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function mo(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),vo(t,s),s.restoreBlendMode()):vo(t,s)}))}function vo(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;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,n)}function wo(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:xo,getOuterOf:bo,getByMove:Bo,getIntersectData:ko}=$;const Eo={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+")"}},{get:To,rotateOf:Co,translate:Ro,scaleOf:Po,scale:Lo,rotate:Oo}=T;function So(t,e,s,r){let{type:n,blendMode:o}=s,a={type:n,blendMode:o,style:"rgba(255,255,255,0)"};const h=t.leafer.imageManager.get(s);if(h.ready){let t,{opacity:e,mode:i,offset:n,scale:o,rotation:l}=s,{width:d,height:c}=h;const u=r.width===d&&r.height===c;switch(i){case"strench":u||(d=r.width,c=r.height),(r.x||r.y)&&(t=To(),Ro(t,r.x,r.y));break;case"clip":(n||o||l)&&(t=function(t,e,s,i){const r=To();Ro(r,t.x,t.y),e&&Ro(r,e.x,e.y);s&&("number"==typeof s?Lo(r,s):Lo(r,s.x,s.y));i&&Oo(r,i);return r}(r,n,o,l));break;case"repeat":(!u||o||l)&&(t=function(t,e,s,i,r){const n=To();if(r)switch(Oo(n,r),r){case 90:Ro(n,s,0);break;case 180:Ro(n,e,s);break;case 270:Ro(n,0,e)}Ro(n,t.x,t.y),i&&Po(n,t,i);return n}(r,d,c,o,l));break;default:u&&!l||(t=function(t,e,s,i,r){const n=To(),o=r&&180!==r,a=e.width/(o?i:s),h=e.height/(o?s:i),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-i*l)/2;Ro(n,d,c),Lo(n,l),r&&Co(n,{x:e.x+e.width/2,y:e.y+e.height/2},r);return n}(i,r,d,c,l))}a.style=function(t,e,s){let i=Wt.canvas.createPattern(t,s?"repeat":"no-repeat");if(e){const{a:t,b:s,c:r,d:n,e:o,f:a}=e;i.setTransform(new DOMMatrix([t,s,r,n,o,a]))}return i}(h.getCanvas(d,c,e),t,"repeat"===i)}else h.load((()=>{t.__.__getInput("width")||(t.width=h.width),t.__.__getInput("height")||(t.height=h.height),t.forceUpdate("width"),t.emitEvent(new i(i.LOADED,t,h,e,s))}),(r=>{t.emitEvent(new i(i.ERROR,t,h,e,s,r))}));return a}const Mo={x:.5,y:0},Do={x:.5,y:1};function Ao(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,Eo.string(i.color,s))}const{set:Io,getAngle:Wo,getDistance:No}=A,{get:Fo,rotateOf:zo,scaleOf:Ho}=T,Uo={x:.5,y:.5},Yo={x:.5,y:1},jo={},Xo={};const{set:Vo,getAngle:Go,getDistance:Ko}=A,{get:qo,rotateOf:Qo,scaleOf:Zo}=T,$o={x:.5,y:.5},Jo={x:.5,y:1},ta={},ea={};function sa(t,e){let s,i=t.__.__input[e];const r=[];i instanceof Array||(i=[i]);for(let n=0,o=i.length;n<o;n++)s=ia(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function ia(t,e,s){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:i}=t.__layout;switch(e.type){case"solid":let{type:r,blendMode:n,color:o,opacity:a}=e;return{type:r,blendMode:n,style:Eo.string(o,a)};case"image":return So(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:r,blendMode:n,opacity:o}=t;s||(s=Mo),i||(i=Do);const a=Wt.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+i.x*e.width,e.y+i.y*e.height);return Ao(a,t.stops,o),{type:r,blendMode:n,style:a}}(e,i);case"radial":return function(t,e){let{from:s,to:i,type:r,opacity:n,blendMode:o,stretch:a}=t;s||(s=Uo),i||(i=Yo);const{x:h,y:l,width:d,height:c}=e;let u;Io(jo,h+s.x*d,l+s.y*c),Io(Xo,h+i.x*d,l+i.y*c),(d!==c||a)&&(u=Fo(),Ho(u,jo,d/c*(a||1),1),zo(u,jo,Wo(jo,Xo)+90));const _=Wt.canvas.createRadialGradient(jo.x,jo.y,0,jo.x,jo.y,No(jo,Xo));return Ao(_,t.stops,n),{type:r,blendMode:o,style:_,transform:u}}(e,i);case"angular":return function(t,e){let{from:s,to:i,type:r,opacity:n,blendMode:o,stretch:a}=t;s||(s=$o),i||(i=Jo);const{x:h,y:l,width:d,height:c}=e;Vo(ta,h+s.x*d,l+s.y*c),Vo(ea,h+i.x*d,l+i.y*c);const u=qo(),_=Go(ta,ea);Wt.conicGradientRotate90?(Zo(u,ta,d/c*(a||1),1),Qo(u,ta,_+90)):(Zo(u,ta,1,d/c*(a||1)),Qo(u,ta,_));const p=Wt.conicGradientSupport?Wt.canvas.createConicGradient(0,ta.x,ta.y):Wt.canvas.createRadialGradient(ta.x,ta.y,0,ta.x,ta.y,Ko(ta,ea));return Ao(p,t.stops,n),{type:r,blendMode:o,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:Eo.string(e)}:void 0}}var ra=Object.freeze({__proto__:null,computeFill:function(t){sa(t,"fill")},computeStroke:function(t){sa(t,"stroke")},drawText:po,drawTextStroke:vo,fill:function(t,e,s){e.fillStyle=s,t.__.__font?po(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:r,__font:n}=t.__;for(let o=0,a=s.length;o<a;o++)if(i=s[o],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:o,c:a,d:h,e:l,f:d}=i.transform;e.transform(s,o,a,h,l,d),i.blendMode&&(e.blendMode=i.blendMode),n?po(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?po(t,e):e.fill(r),e.restoreBlendMode()):n?po(t,e):e.fill(r)},shape:function(t,e,s){const i=e.getSameCanvas();let r,n,o,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))r=o=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=ko(i?xo(e.bounds,i*l):e.bounds,h,s.matrix);n=e.bounds.getFitMatrix(c),n.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=n.a,d*=n.d),o=bo(h,n),r=Bo(o,-n.e,-n.f),s.matrix&&n.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:n})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:r,worldCanvas:a,shapeBounds:o,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)go(t,e,s);else switch(n){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);n.setStroke(s,2*r,t.__),t.__drawRenderPath(n),n.stroke(),n.clip(i.windingRule),n.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokeText:go,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)yo(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),wo(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),wo(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*r,t.__),wo(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:yo});Object.assign(eo,_o),Object.assign(so,ra);class na extends mt{setBlendMode(t){this._blendMode=t,"pass-through"!==t&&t?this.__blendLayer=!0:this.__blendLayer&&(this.__blendLayer=!1)}setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:so.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:so.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}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 oa={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class aa extends na{}class ha extends aa{get __boxStroke(){return!0}}class la extends na{get __boxStroke(){return!0}}const{parse:da}=Fi;const ca={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ua extends la{}function _a(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function pa(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ga={__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*g/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 n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(n=Math.max(n,r)),this.__layout.renderShapeSpread=n,t}},fa={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawHitPath(this.__hitCanvas),this.__hitCanvas.setStrokeOptions(this.__)},__hit(t){const{__hitCanvas:e}=this,{fill:s,hitFill:i,windingRule:r}=this.__,n=s&&"path"===i||"all"===i;if(n&&e.hitFill(t,r))return!0;const{stroke:o,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=o&&"path"===a||"all"===a,c=2*t.radiusX;let u=2*(d?"center"===l?h/2:h:0)+c;if(!u)return!1;switch(l){case"inside":if(!n&&e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c;break;case"outside":if(!n){if(!e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c}}return!!u&&e.hitStroke(t,u)}},ya={__updateChange(){let t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect||t.blendMode&&"pass-through"!==t.blendMode?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&so.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&so.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r,__blendLayer:n}=this.__;let o;if(n&&(o=t,t=t.getSameCanvas(!0)),this.__drawRenderPath(t),this.__.__useEffect){const n=so.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&eo.shadow(this,t,n),s&&(this.__.__isFills?so.fills(this,t,s):so.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&eo.innerShadow(this,t,n),i&&(this.__.__isStrokes?so.strokes(this,t,i):so.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?so.fills(this,t,s):so.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?so.strokes(this,t,i):so.stroke(this,t,i));o&&(o.copyWorldToInner(t,this.__world,this.__layout.renderBounds,this.__.blendMode),t.recycle())}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&&so.fill(this,t,"#000000"),i&&so.stroke(this,t,"#000000")}},ma={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:n,__drawAfterFill:o}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),o&&this.__drawAfterFill(t,e),n){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(n,r,this.__);const o=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(o,o,s-r,i-r);break;case"outside":t.strokeRect(-o,-o,s+r,i+r)}}}};let va=class extends es{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Fi.toCanvasData(e,!0):e:[]}getPathString(t){return Fi.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&so.computeFill(this),e&&so.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?pn.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){}static one(t,e,s,i,r){return zt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};Gt([be(na)],va.prototype,"__",void 0),Gt([he("")],va.prototype,"id",void 0),Gt([he("")],va.prototype,"name",void 0),Gt([he("")],va.prototype,"className",void 0),Gt([ye("pass-through")],va.prototype,"blendMode",void 0),Gt([me(1)],va.prototype,"opacity",void 0),Gt([me(!0)],va.prototype,"visible",void 0),Gt([we(!1)],va.prototype,"isMask",void 0),Gt([ve(0)],va.prototype,"zIndex",void 0),Gt([he()],va.prototype,"locked",void 0),Gt([le(0)],va.prototype,"x",void 0),Gt([le(0)],va.prototype,"y",void 0),Gt([ue(100)],va.prototype,"width",void 0),Gt([ue(100)],va.prototype,"height",void 0),Gt([de(1)],va.prototype,"scaleX",void 0),Gt([de(1)],va.prototype,"scaleY",void 0),Gt([ce(0)],va.prototype,"rotation",void 0),Gt([ce(0)],va.prototype,"skewX",void 0),Gt([ce(0)],va.prototype,"skewY",void 0),Gt([he(!1)],va.prototype,"draggable",void 0),Gt([xe(!0)],va.prototype,"hittable",void 0),Gt([xe("path")],va.prototype,"hitFill",void 0),Gt([ge("path")],va.prototype,"hitStroke",void 0),Gt([xe(!0)],va.prototype,"hitChildren",void 0),Gt([xe(!0)],va.prototype,"hitSelf",void 0),Gt([ye()],va.prototype,"fill",void 0),Gt([ge()],va.prototype,"stroke",void 0),Gt([ge("inside")],va.prototype,"strokeAlign",void 0),Gt([ge(1)],va.prototype,"strokeWidth",void 0),Gt([ge("none")],va.prototype,"strokeCap",void 0),Gt([ge("miter")],va.prototype,"strokeJoin",void 0),Gt([ge()],va.prototype,"dashPattern",void 0),Gt([ge()],va.prototype,"dashOffset",void 0),Gt([ge(10)],va.prototype,"miterLimit",void 0),Gt([_e()],va.prototype,"cornerRadius",void 0),Gt([_e()],va.prototype,"cornerSmoothing",void 0),Gt([_a()],va.prototype,"shadow",void 0),Gt([_a()],va.prototype,"innerShadow",void 0),Gt([_a()],va.prototype,"blur",void 0),Gt([_a()],va.prototype,"backgroundBlur",void 0),Gt([_a()],va.prototype,"grayscale",void 0),Gt([Pe(Dr.drawPathByData)],va.prototype,"__drawPathByData",null),va=Gt([Se(ga),Se(fa),Se(ya),Le()],va);let wa=class extends va{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.isBranch=!0,this.children=[]}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){}remove(t){}};Gt([be(aa)],wa.prototype,"__",void 0),wa=Gt([Se(ds),Me()],wa);let xa=class extends va{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([be(la)],xa.prototype,"__",void 0),xa=Gt([Se(ma),Me()],xa);const ba=xa.prototype,Ba=wa.prototype,ka={},{copy:Ea,add:Ta}=$;let Ca=class extends wa{get __tag(){return"Box"}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;Ea(ka,t),super.__updateRenderBounds(),Ta(t,ka)}}__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([be(ha)],Ca.prototype,"__",void 0),Gt([fe("show")],Ca.prototype,"overflow",void 0),Gt([Pe(ba.__updateStrokeSpread)],Ca.prototype,"__updateStrokeSpread",null),Gt([Pe(ba.__updateRenderSpread)],Ca.prototype,"__updateRectRenderSpread",null),Gt([Pe(ba.__updateBoxBounds)],Ca.prototype,"__updateBoxBounds",null),Gt([Pe(ba.__updateStrokeBounds)],Ca.prototype,"__updateStrokeBounds",null),Gt([Pe(ba.__updateRenderBounds)],Ca.prototype,"__updateRectRenderBounds",null),Gt([Pe(ba.__updateChange)],Ca.prototype,"__updateRectChange",null),Gt([Pe(ba.__drawPathByData)],Ca.prototype,"__drawPathByData",null),Gt([Pe(ba.__render)],Ca.prototype,"__renderRect",null),Gt([Pe(Ba.__render)],Ca.prototype,"__renderGroup",null),Ca=Gt([Le(),Me()],Ca);let Ra=class extends Ca{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Gt([be(class extends ha{})],Ra.prototype,"__",void 0),Gt([fe("hide")],Ra.prototype,"overflow",void 0),Ra=Gt([Me()],Ra);const{moveTo:Pa,closePath:La,ellipse:Oa}=ir;let Sa=class extends va{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];s?i||r?(s<1&&Oa(a,n,o,n*s,o*s,0,i,r,!1),Oa(a,n,o,n,o,0,r,i,!0),s<1&&La(a)):(s<1&&(Oa(a,n,o,n*s,o*s),Pa(a,t,o)),Oa(a,n,o,n,o,0,0,360,!0)):i||r?(Pa(a,n,o),Oa(a,n,o,n,o,0,i,r,!1),La(a)):Oa(a,n,o,n,o)}};Gt([be(class extends na{get __boxStroke(){return!0}})],Sa.prototype,"__",void 0),Gt([_e(0)],Sa.prototype,"innerRadius",void 0),Gt([_e(0)],Sa.prototype,"startAngle",void 0),Gt([_e(0)],Sa.prototype,"endAngle",void 0),Sa=Gt([Me()],Sa);const{sin:Ma,cos:Da,PI:Aa}=Math,{moveTo:Ia,lineTo:Wa,closePath:Na}=ir;let Fa=class extends va{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,n=this.__.path=[];Ia(n,i,0);for(let t=1;t<s;t++)Wa(n,i+i*Ma(2*t*Aa/s),r-r*Da(2*t*Aa/s));Na(n)}};Gt([be(class extends na{})],Fa.prototype,"__",void 0),Gt([_e(3)],Fa.prototype,"sides",void 0),Fa=Gt([Me()],Fa);const{sin:za,cos:Ha,PI:Ua}=Math,{moveTo:Ya,lineTo:ja,closePath:Xa}=ir;let Va=class extends va{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];Ya(o,r,0);for(let t=1;t<2*s;t++)ja(o,r+(t%2==0?r:r*i)*za(t*Ua/s),n-(t%2==0?n:n*i)*Ha(t*Ua/s));Xa(o)}};Gt([be(class extends na{})],Va.prototype,"__",void 0),Gt([_e(5)],Va.prototype,"points",void 0),Gt([_e(.382)],Va.prototype,"innerRadius",void 0),Va=Gt([Me()],Va);const{moveTo:Ga,lineTo:Ka}=ir,{rotate:qa,getAngle:Qa,getDistance:Za,defaultPoint:$a}=A,{setPoint:Ja,addPoint:th,toBounds:eh}=F,sh={};let ih=class extends va{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&qa(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Za($a,t),this.rotation=Qa($a,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Ga(t,0,0);const e=this.toPoint;Ka(t,e.x,e.y)}__updateBoxBounds(){Ja(sh,0,0),th(sh,this.__toPoint.x,this.__toPoint.y),eh(sh,this.__layout.boxBounds)}};Gt([be(class extends na{})],ih.prototype,"__",void 0),Gt([ue()],ih.prototype,"rotation",void 0),Gt([pe("center")],ih.prototype,"strokeAlign",void 0),ih=Gt([Me()],ih);let rh=class extends xa{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={type:"image",mode:"strench",url:e},this.once(i.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};Gt([be(ua)],rh.prototype,"__",void 0),Gt([ue("")],rh.prototype,"url",void 0),rh=Gt([Me()],rh);let nh=class extends xa{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Nt.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new N(t.__world);r.invert();const n=new N;e&&n.translate(e.x,e.y),s&&("number"==typeof s?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.preMultiply(n),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([be(ua)],nh.prototype,"__",void 0),Gt([pa(100)],nh.prototype,"width",void 0),Gt([pa(100)],nh.prototype,"height",void 0),Gt([pa(Wt.devicePixelRatio)],nh.prototype,"pixelRatio",void 0),Gt([pa(!0)],nh.prototype,"smooth",void 0),Gt([xe("all")],nh.prototype,"hitFill",void 0),nh=Gt([Me()],nh);const oh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",ah=oh+"_#~&*+\\=|≮≯≈≠=…";function hh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const lh=hh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),dh=hh("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),ch=hh(oh),uh=hh(ah),_h=hh("- —/~|┆·");var ph;!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"}(ph||(ph={}));const{Letter:gh,Single:fh,Before:yh,After:mh,Symbol:vh,Break:wh}=ph;function xh(t){return lh[t]?gh:_h[t]?wh:/[\u3400-\u9FBF]/.test(t)?fh:dh[t]?yh:ch[t]?mh:uh[t]?vh:gh}const bh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Bh(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:kh}=bh,{Letter:Eh,Single:Th,Before:Ch,After:Rh,Symbol:Ph,Break:Lh}=ph;let Oh,Sh,Mh,Dh,Ah,Ih,Wh,Nh,Fh,zh,Hh,Uh,Yh,jh,Xh=[];function Vh(t,e){Oh.data.push({char:t,width:e}),Mh+=e}function Gh(){Dh+=Mh,Oh.width=Mh,Sh.words.push(Oh),Oh={data:[]},Mh=0}function Kh(){Uh&&(Yh.paraNumber++,Sh.paraStart=!0,Uh=!1),Sh.width=Dh,kh(Sh),Xh.push(Sh),Sh.width>jh.width&&(jh.width=Sh.width),Sh={words:[]},Dh=0}const qh=0,Qh=1,Zh=2;const $h={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let s=0,i=0,{width:r,height:n,padding:o}=e;const{textDecoration:a,textOverflow:h,__font:l}=e;if(r||(r=0),o){const[t,e,a,h]=p.fourNumber(o);r&&(s=h,r-=e+h),n&&(i=t,n-=t+a)}const d={bounds:{x:s,y:i,width:r,height:n},rows:[],paraNumber:0,font:Wt.canvas.font=l};return function(t,e,s){Yh=t,Xh=t.rows,jh=t.bounds;const{__letterSpacing:i,paraIndent:r,textCase:n}=s,{canvas:o}=Wt,{width:a,height:h}=jh;if(a||h||i||n){Uh=!0,Fh=null,Mh=Dh=0,Oh={data:[]},Sh={words:[]};for(let t=0,s=e.length;t<s;t++)Ih=e[t],"\n"===Ih?(Mh&&Gh(),Sh.paraEnd=!0,Kh(),Uh=!0):(Nh=xh(Ih),Nh===Eh&&"none"!==n&&(Ih=Bh(Ih,n,!Mh)),Wh=o.measureText(Ih).width,i&&(Wh+=i),zh=Nh===Th&&(Fh===Th||Fh===Eh)||Fh===Th&&Nh!==Rh,Hh=!(Nh!==Ch&&Nh!==Th||Fh!==Ph&&Fh!==Rh),Ah=Uh&&r?a-r:a,a&&Dh+Mh+Wh>Ah&&(Hh||(Hh=Nh===Eh&&Fh==Rh),zh||Hh||Nh===Lh||Nh===Ch||Nh===Th||Mh+Wh>Ah?(Mh&&Gh(),Kh()):Kh())," "===Ih&&Dh+Mh===0||(Nh===Lh?(" "===Ih&&Mh&&Gh(),Vh(Ih,Wh),Gh()):zh||Hh?(Mh&&Gh(),Vh(Ih,Wh)):Vh(Ih,Wh)),Fh=Nh);Mh&&Gh(),Dh&&Kh(),Xh[Xh.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{Yh.paraNumber++,Xh.push({x:r||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(d,t,e),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:n,textAlign:o,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=n;if(p){if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(a){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u}for(let e=0,i=s.length;e<i;e++){switch(d=s[e],d.x=c,o){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1)}i.y=u,i.height=g}(d,e),function(t,e,s,i){const{rows:r}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=o&&t.paraStart?o:0,l=s&&"justify"===n&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?qh:l>.01?Qh:Zh,c===Zh?(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=>{c===Qh?(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)}))}(d,e,r),d.overflow&&function(t,e){const{rows:s,overflow:i}=t;if(s.splice(i),"hide"!==e){"ellipsis"===e&&(e="...");const r=Wt.canvas.measureText(e).width,n=s[i-1];let o,a,h=n.data.length-1;const{x:l,width:d}=t.bounds,c=l+d-r;for(let t=h;t>-1&&(o=n.data[t],a=o.x+o.width,!(t===h&&a<c));t--){if(a<c&&" "!==o.char){n.data.splice(t+1),n.width-=o.width;break}n.width-=o.width}n.width+=r,n.data.push({char:e,x:a})}}(d,h),"none"!==a&&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}}(d,e),d}},{copyAndSpread:Jh,includes:tl,spread:el}=$;let sl=class extends va{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(),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:n}=this.__layout.boxBounds;t.rect(s,i,r,n)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=$h.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:n,fontFamily:o,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=oa.number(r,a),t.__letterSpacing=oa.number(n,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${o}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&el(c,a/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=tl(u,c)?u:c;_!==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(){Jh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};Gt([be(class extends na{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ca[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],sl.prototype,"__",void 0),Gt([ue(0)],sl.prototype,"width",void 0),Gt([ue(0)],sl.prototype,"height",void 0),Gt([ue(0)],sl.prototype,"padding",void 0),Gt([pe("outside")],sl.prototype,"strokeAlign",void 0),Gt([ue("")],sl.prototype,"text",void 0),Gt([ue("L")],sl.prototype,"fontFamily",void 0),Gt([ue(12)],sl.prototype,"fontSize",void 0),Gt([ue("normal")],sl.prototype,"fontWeight",void 0),Gt([ue(!1)],sl.prototype,"italic",void 0),Gt([ue("none")],sl.prototype,"textCase",void 0),Gt([ue("none")],sl.prototype,"textDecoration",void 0),Gt([ue(0)],sl.prototype,"letterSpacing",void 0),Gt([ue({type:"percent",value:150})],sl.prototype,"lineHeight",void 0),Gt([ue(0)],sl.prototype,"paraIndent",void 0),Gt([ue(0)],sl.prototype,"paraSpacing",void 0),Gt([ue("left")],sl.prototype,"textAlign",void 0),Gt([ue("top")],sl.prototype,"verticalAlign",void 0),Gt([ue("show")],sl.prototype,"textOverflow",void 0),sl=Gt([Me()],sl);const{toBounds:il}=_n;let rl=class extends va{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){il(this.__.path,this.__layout.boxBounds)}};Gt([be(class extends na{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=da(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],rl.prototype,"__",void 0),Gt([_e()],rl.prototype,"path",void 0),Gt([_e()],rl.prototype,"windingRule",void 0),Gt([pe("center")],rl.prototype,"strokeAlign",void 0),rl=Gt([Me()],rl);let nl=class extends wa{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new rl(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,n){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,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,n,o,a){return this}moveToArc(t,e,s,i,r,n){return this}paint(){this.pathElement.forceUpdate("path")}};Gt([be(class extends aa{})],nl.prototype,"__",void 0),nl=Gt([Se(vr,["beginPath"]),Me()],nl);const ol=vt.get("Leafer");let al=class extends wa{get __tag(){return"Leafer"}get isApp(){return!1}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,(null==t?void 0:t.view)&&this.init(t)}init(t,e){if(this.canvas)return;let s;this.__setLeafer(this),t&&ft.assign(this.config,t);const{config:i}=this;Jn.run(i.type,this),this.canvas=Nt.canvas(i),this.__controllers.push(this.renderer=Nt.renderer(this,this.canvas,i),this.watcher=Nt.watcher(this,i),this.layouter=Nt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Nt.selector(this),this.__controllers.unshift(this.interaction=Nt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new Xt,this.hitCanvasManager=new Vt,this.imageManager=new Es(this,i),s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(l.RESTART):this.emitLeafer(l.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(l.STOP))}resize(t){const e=ft.copyAttrs({},t,se);Object.keys(e).forEach((t=>this[t]=e[t]))}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ft.copyAttrs({},this.canvas,se);this.canvas.resize(t),this.__onResize(new r(t,e))}__onResize(t){this.emitEvent(t),ft.copyAttrs(this.__,t,se),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new it(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&this.canvas.setHittable(e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ft.copyAttrs({},this.canvas,se);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.setBackgroundColor(t):this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(l.BEFORE_READY),this.emitLeafer(l.READY),this.emitLeafer(l.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(l.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new l(t,this))}__listenEvents(){const t=bt.start("FirstCreate "+this.innerName);this.once(l.START,(()=>bt.end(t))),this.once(a.END,(()=>this.__onReady())),this.once(h.END,(()=>this.__onViewReady())),this.on(a.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new l(l.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>t.destroy())),this.__controllers.length=0,this.selector.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory(),this.canvas.destroy(),this.canvas=null,this.config=this.userConfig=this.view=null,super.destroy()}catch(t){ol.error(t)}}};Gt([be(class extends aa{})],al.prototype,"__",void 0),Gt([ue()],al.prototype,"pixelRatio",void 0),al=Gt([Me()],al);let hl=class extends al{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(s.CHANGE,(()=>{vt.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new al(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(a.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(h.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(h.END,this.__onChildRenderEnd,this))}__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 t&&ft.assign(e,t),e.view=this.realCanvas?void 0:this.view,e.fill=e.hittable=e.realCanvas=void 0,this.autoLayout&&ft.copyAttrs(e,this,se),e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};hl=Gt([Me()],hl);var ll=Object.freeze({__proto__:null,Animate:io,get App(){return hl},AutoBounds:it,BezierHelper:Vs,Bounds:st,BoundsHelper:$,get Box(){return Ca},get Branch(){return ds},BranchHelper:ut,get Canvas(){return nh},CanvasManager:Xt,ChildEvent:e,Creator:Nt,DataHelper:ft,Debug:vt,get DragEvent(){return fs},get DropEvent(){return ms},Effect:eo,get Ellipse(){return Sa},EllipseHelper:ei,Event:t,EventCreator:Yt,Export:ro,get Frame(){return Ra},get Group(){return wa},HitCanvasManager:Vt,get Image(){return rh},ImageEvent:i,ImageManager:Es,IncrementId:u,Interaction:Qn,get KeyEvent(){return Bs},Keyboard:us,LayoutEvent:a,Layouter:It,get Leaf(){return es},LeafBounds:Ge,LeafBoundsHelper:ct,LeafData:mt,LeafDataProxy:ze,LeafEventer:Ne,LeafHelper:ot,LeafHit:Qe,LeafLevelList:c,LeafList:d,LeafMask:$e,LeafMatrix:je,LeafRender:Ze,get Leafer(){return al},LeaferCanvas:Rn,LeaferCanvasBase:ie,LeaferEvent:l,LeaferImage:ks,LeaferImageBase:ks,LeaferTypeCreator:Jn,get Line(){return ih},MathHelper:p,Matrix:N,MatrixHelper:T,get MoveEvent(){return vs},NeedConvertToCanvasCommandMap:Ls,OneRadian:g,PI2:f,PI_2:y,Paint:so,get Path(){return rl},PathBounds:_n,PathCommandDataHelper:ir,PathCommandMap:Rs,PathConvert:Fi,PathCorner:pn,PathCreator:vr,PathDrawer:Dr,PathHelper:Ts,PathNumberCommandLengthMap:Ds,PathNumberCommandMap:Ms,get Pen(){return nl},Platform:Wt,PluginManager:fn,Point:W,PointHelper:A,PointerButton:_s,get PointerEvent(){return gs},get Polygon(){return Fa},PropertyEvent:s,get Rect(){return xa},RectHelper:As,RectRender:ma,RenderEvent:h,Renderer:Bn,ResizeEvent:r,get RotateEvent(){return ws},Run:bt,Selector:Tn,get Star(){return Va},StringNumberMap:nt,get SwipeEvent(){return xs},TaskItem:mn,TaskProcessor:wn,get Text(){return sl},TransformEvent:n,TwoPointBounds:rt,TwoPointBoundsHelper:F,get UI(){return va},UIBounds:ga,UICreator:zt,UIEvent:ps,UIHit:fa,UIRender:ya,WaitHelper:gt,WatchEvent:o,Watcher:xn,get ZoomEvent(){return bs},affectRenderBoundsType:fe,affectStrokeBoundsType:pe,aliasType:oe,boundsType:ue,canvasSizeAttrs:se,dataProcessor:be,dataType:he,defineDataProcessor:Ee,defineKey:re,defineLeafAttr:ae,effectType:_a,getDescriptor:ne,hitType:xe,layoutProcessor:Be,maskType:we,opacityType:me,pathType:_e,positionType:le,registerUI:Me,registerUIEvent:De,resizeType:pa,rewrite:Pe,rewriteAble:Le,rotationType:ce,scaleType:de,setDefaultValue:ke,sortType:ve,strokeType:ge,surfaceType:ye,useModule:Se,usePlugin:yn});fn.power=ll;export{io as Animate,hl as App,it as AutoBounds,Vs as BezierHelper,st as Bounds,$ as BoundsHelper,Ca as Box,ds as Branch,ut as BranchHelper,nh as Canvas,Xt as CanvasManager,e as ChildEvent,Nt as Creator,ft as DataHelper,vt as Debug,fs as DragEvent,ms as DropEvent,eo as Effect,Sa as Ellipse,ei as EllipseHelper,t as Event,Yt as EventCreator,ro as Export,Ra as Frame,wa as Group,Vt as HitCanvasManager,rh as Image,i as ImageEvent,Es as ImageManager,u as IncrementId,Qn as Interaction,Bs as KeyEvent,us as Keyboard,a as LayoutEvent,It as Layouter,es as Leaf,Ge as LeafBounds,ct as LeafBoundsHelper,mt as LeafData,ze as LeafDataProxy,Ne as LeafEventer,ot as LeafHelper,Qe as LeafHit,c as LeafLevelList,d as LeafList,$e as LeafMask,je as LeafMatrix,Ze as LeafRender,al as Leafer,Rn as LeaferCanvas,ie as LeaferCanvasBase,l as LeaferEvent,ks as LeaferImage,ks as LeaferImageBase,Jn as LeaferTypeCreator,ih as Line,p as MathHelper,N as Matrix,T as MatrixHelper,vs as MoveEvent,Ls as NeedConvertToCanvasCommandMap,g as OneRadian,f as PI2,y as PI_2,so as Paint,rl as Path,_n as PathBounds,ir as PathCommandDataHelper,Rs as PathCommandMap,Fi as PathConvert,pn as PathCorner,vr as PathCreator,Dr as PathDrawer,Ts as PathHelper,Ds as PathNumberCommandLengthMap,Ms as PathNumberCommandMap,nl as Pen,Wt as Platform,fn as PluginManager,W as Point,A as PointHelper,_s as PointerButton,gs as PointerEvent,Fa as Polygon,s as PropertyEvent,xa as Rect,As as RectHelper,ma as RectRender,h as RenderEvent,Bn as Renderer,r as ResizeEvent,ws as RotateEvent,bt as Run,Tn as Selector,Va as Star,nt as StringNumberMap,xs as SwipeEvent,mn as TaskItem,wn as TaskProcessor,sl as Text,n as TransformEvent,rt as TwoPointBounds,F as TwoPointBoundsHelper,va as UI,ga as UIBounds,zt as UICreator,ps as UIEvent,fa as UIHit,ya as UIRender,gt as WaitHelper,o as WatchEvent,xn as Watcher,bs as ZoomEvent,fe as affectRenderBoundsType,pe as affectStrokeBoundsType,oe as aliasType,ue as boundsType,se as canvasSizeAttrs,be as dataProcessor,he as dataType,Ee as defineDataProcessor,re as defineKey,ae as defineLeafAttr,_a as effectType,ne as getDescriptor,xe as hitType,Be as layoutProcessor,we as maskType,me as opacityType,_e as pathType,le as positionType,Me as registerUI,De as registerUIEvent,pa as resizeType,Pe as rewrite,Le as rewriteAble,ce as rotationType,de as scaleType,ke as setDefaultValue,ve as sortType,ge as strokeType,ye as surfaceType,Se as useModule,yn as usePlugin};