leafer-ui 1.0.0-beta → 1.0.0-beta.2
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/README.md +3 -3
- package/dist/global.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -6
- package/src/global.ts +3 -1
- package/src/index.ts +5 -0
package/dist/global.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)}}const rt={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},nt={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)at(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ht(e[t])}},updateAllChange(t){if(ht(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),ot.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)}},ot=nt,{updateAllWorldMatrix:at,updateAllWorldOpacity:ht,updateAllChange:lt}=ot,dt={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},ct={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),ut(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++)_t(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:ut,pushAllBranchStack:_t}=ct,pt={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},gt={default:(t,e)=>(ft(e,t),ft(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?ft(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:ft}=gt;class yt{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 mt{constructor(t){this.name=t}static get(t){return new mt(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(vt.enable){if(vt.filterList.length&&vt.filterList.every((t=>t!==this.name)))return;if(vt.excludeList.length&&vt.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)}}}mt.filterList=[],mt.excludeList=[];const vt=mt,wt=mt.get("RunTime");class xt{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?wt.log(i,performance.now()-s,"µs"):wt.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=bt.nameToIdMap[t];void 0!==s&&bt.end(s,e)}}xt.idMap={},xt.nameMap={},xt.nameToIdMap={};const bt=xt,{updateAllWorldMatrix:Bt,updateAllWorldOpacity:kt}=nt,{pushAllChildBranch:Et,pushAllParent:Tt}=ct;const{worldBounds:Ct}=dt,{setByListWithHandle:Rt}=$;class Pt{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(){Rt(this.beforeBounds,this.updatedList.list,Ct)}setAfter(){Rt(this.afterBounds,this.updatedList.list,Ct),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:Lt,updateAllChange:Ot}=nt,{pushAllBranchStack:St,updateWorldBoundsByBranchStack:Mt}=ct,Dt=mt.get("Layouter");class At{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,e&&(this.config=gt.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){Dt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Dt.warn("layouting"):this.times>3?Dt.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=xt.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?(Bt(t),e.push(t),t.isBranch&&Et(t,e),Tt(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Tt(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&&kt(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,xt.end(e)}fullLayout(){const t=xt.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)),At.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),xt.end(t)}static fullLayout(t){if(Lt(t),t.isBranch){const e=[t];St(t,e),Mt(e)}else t.__updateWorldBounds();Ot(t)}createBlock(t){return new Pt(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 It={layout:At.fullLayout},Wt={},Nt=mt.get("UICreator"),Ft={list:{},register(t){const{__tag:e}=t.prototype;zt[e]?Nt.error("repeat:",e):zt[e]=t},get(t,e,s,i,r,n){const o=new zt[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:zt}=Ft,Ht=mt.get("EventCreator"),Ut={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Yt[e]?Ht.error("repeat: ",e):Yt[e]=t)}))},changeName(t,e){const s=Yt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,Yt[e]=s)}},get:(t,...e)=>new Yt[t](...e)},{nameList:Yt}=Ut;class jt{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=Wt.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 Xt extends jt{constructor(){super(...arguments),this.pathTypeList=new d,this.imageTypeList=new d}get(t){}getImageType(t,e){return this.imageTypeList.push(t),Wt.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),Wt.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 Vt(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 Gt(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 Kt(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 Qt(){return(t,e)=>{qt.push(e)}}const Zt=[];let $t=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||Zt)}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}};Vt([Kt("imageSmoothingEnabled")],$t.prototype,"smooth",void 0),Vt([Kt("imageSmoothingQuality")],$t.prototype,"smoothLevel",void 0),Vt([Kt("globalAlpha")],$t.prototype,"opacity",void 0),Vt([Kt()],$t.prototype,"fillStyle",void 0),Vt([Kt()],$t.prototype,"strokeStyle",void 0),Vt([Kt("lineWidth")],$t.prototype,"strokeWidth",void 0),Vt([Kt("lineCap")],$t.prototype,"strokeCap",void 0),Vt([Kt("lineJoin")],$t.prototype,"strokeJoin",void 0),Vt([Kt("lineDashOffset")],$t.prototype,"dashOffset",void 0),Vt([Kt()],$t.prototype,"miterLimit",void 0),Vt([Kt()],$t.prototype,"shadowBlur",void 0),Vt([Kt()],$t.prototype,"shadowColor",void 0),Vt([Kt()],$t.prototype,"shadowOffsetX",void 0),Vt([Kt()],$t.prototype,"shadowOffsetY",void 0),Vt([Kt()],$t.prototype,"filter",void 0),Vt([Kt()],$t.prototype,"font",void 0),Vt([Kt()],$t.prototype,"fontKerning",void 0),Vt([Kt()],$t.prototype,"fontStretch",void 0),Vt([Kt()],$t.prototype,"fontVariantCaps",void 0),Vt([Kt()],$t.prototype,"textAlign",void 0),Vt([Kt()],$t.prototype,"textBaseline",void 0),Vt([Kt()],$t.prototype,"textRendering",void 0),Vt([Kt()],$t.prototype,"wordSpacing",void 0),Vt([Kt()],$t.prototype,"letterSpacing",void 0),Vt([Kt()],$t.prototype,"direction",void 0),Vt([Qt()],$t.prototype,"setTransform",null),Vt([Qt()],$t.prototype,"resetTransform",null),Vt([Qt()],$t.prototype,"getTransform",null),Vt([Qt()],$t.prototype,"save",null),Vt([Qt()],$t.prototype,"restore",null),Vt([Qt()],$t.prototype,"transform",null),Vt([Qt()],$t.prototype,"translate",null),Vt([Qt()],$t.prototype,"scale",null),Vt([Qt()],$t.prototype,"rotate",null),Vt([Qt()],$t.prototype,"fill",null),Vt([Qt()],$t.prototype,"stroke",null),Vt([Qt()],$t.prototype,"clip",null),Vt([Qt()],$t.prototype,"fillRect",null),Vt([Qt()],$t.prototype,"strokeRect",null),Vt([Qt()],$t.prototype,"clearRect",null),Vt([Qt()],$t.prototype,"beginPath",null),Vt([Qt()],$t.prototype,"moveTo",null),Vt([Qt()],$t.prototype,"lineTo",null),Vt([Qt()],$t.prototype,"bezierCurveTo",null),Vt([Qt()],$t.prototype,"quadraticCurveTo",null),Vt([Qt()],$t.prototype,"closePath",null),Vt([Qt()],$t.prototype,"arc",null),Vt([Qt()],$t.prototype,"arcTo",null),Vt([Qt()],$t.prototype,"ellipse",null),Vt([Qt()],$t.prototype,"rect",null),Vt([Qt()],$t.prototype,"roundRect",null),Vt([Qt()],$t.prototype,"createConicGradient",null),Vt([Qt()],$t.prototype,"createLinearGradient",null),Vt([Qt()],$t.prototype,"createPattern",null),Vt([Qt()],$t.prototype,"createRadialGradient",null),Vt([Qt()],$t.prototype,"fillText",null),Vt([Qt()],$t.prototype,"measureText",null),Vt([Qt()],$t.prototype,"strokeText",null);const Jt=new st,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class se extends $t{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=te),t.pixelRatio||(t.pixelRatio=It.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=It.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)),gt.copyAttrs(this,t,ee),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,Jt.copy(t).scale(this.pixelRatio),this.fillRect(Jt.x,Jt.y,Jt.width,Jt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Jt.copy(t).scale(this.pixelRatio),this.strokeRect(Jt.x,Jt.y,Jt.width,Jt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Jt.copy(t).scale(this.pixelRatio),e&&Jt.ceil(),this.clearRect(Jt.x,Jt.y,Jt.width,Jt.height)}clipWorld(t,e){this.beginPath(),Jt.copy(t).scale(this.pixelRatio),e&&Jt.ceil(),this.rect(Jt.x,Jt.y,Jt.width,Jt.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):Wt.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):Wt.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 ie(t,e,s){Object.defineProperty(t,e,s)}function re(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ne(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};ie(t,e,Object.assign(r,i||{})),xe(t,e,s)}function oe(t){return(e,s)=>{ne(e,s,t)}}function ae(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function he(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function le(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function de(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const ce=de;function ue(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ge(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function fe(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function ye(t){return(e,s)=>{ne(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 me(t){return(e,s)=>{ne(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 ve(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),mt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function we(t){return(e,s)=>{ie(e,"__DataProcessor",{get:()=>t})}}function xe(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=re(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const be=new mt("rewrite"),Be=[],ke=["destroy","constructor"];function Ee(t){return(e,s)=>{Be.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Te(){return t=>{Ce()}}function Ce(t){Be.length&&(Be.forEach((e=>{t&&be.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Be.length=0)}function Re(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(ke.includes(i)||e&&e.includes(i)))if(t.prototype){re(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Pe(){return t=>{Ft.register(t)}}function Le(){return t=>{Ut.register(t)}}setTimeout((()=>Ce(!0)));const{toOuterOf:Oe}=$;class Se{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;It.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={}),Oe(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Oe(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Oe(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 Me={},De={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=Ae(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=Ae(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=Ae(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 Ae(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Me)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Me)}}const Ie={__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:We}=T,{sin:Ne,cos:Fe}=Math,ze={__updateWorldMatrix(){const t=this.parent?this.parent.__world:We,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*Fe(r+o),t.b=s*Ne(r+o),t.c=i*-Ne(r-n),t.d=i*Fe(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:He,copyAndSpread:Ue}=$,Ye={__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,He(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else He(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){He(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){He(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){He(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(){Ue(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ue(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:je}=A,Xe={},Ve={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),je(t,this.__world,Xe),this.__hit(Xe)},__drawHitPath(t){this.__drawRenderPath(t)}},Ge={__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)}},Ke={__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:qe,create:Qe}=u;let Ze=class{get tag(){return this.__tag}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return yt}get __LayoutProcessor(){return Se}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=Qe(qe),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&&pt.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))}};Ze=Vt([Re(Ie),Re(ze),Re(Ye),Re(Ve),Re(De),Re(Ge)],Ze);const{setByListWithHandle:$e}=$,{sort:Je}=ct,{localBoxBounds:ts,localEventBounds:es,localRenderBounds:ss,maskLocalBoxBounds:is,maskLocalEventBounds:rs,maskLocalRenderBounds:ns}=dt;let os=class extends Ze{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(){$e(this.__layout.boxBounds,this.children,this.__hasMask?is:ts)}__updateStrokeBounds(){$e(this.__layout.strokeBounds,this.children,this.__hasMask?rs:es)}__updateRenderBounds(){$e(this.__layout.renderBounds,this.children,this.__hasMask?ns:ss)}__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(Je)}}__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&&pt.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()}};os=Vt([Re(Ke)],os);const as={};class hs{static isHoldSpaceKey(){return hs.hasDownCode("Space")}static setDownCode(t){as[t]||(as[t]=!0)}static setUpCode(t){as[t]=!1}static hasDownCode(t){return as[t]}}class ls{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class ds extends t{get spaceKey(){return hs.isHoldSpaceKey()}get left(){return ls.left(this)}get right(){return ls.right(this)}get middle(){return ls.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){Ut.changeName(t,e)}}let cs=class extends ds{};cs.POINTER="pointer",cs.BEFORE_DOWN="pointer.before_down",cs.BEFORE_MOVE="pointer.before_move",cs.BEFORE_UP="pointer.before_up",cs.DOWN="pointer.down",cs.MOVE="pointer.move",cs.UP="pointer.up",cs.OVER="pointer.over",cs.OUT="pointer.out",cs.ENTER="pointer.enter",cs.LEAVE="pointer.leave",cs.TAP="tap",cs.DOUBLE_TAP="double_tap",cs.CLICK="click",cs.DOUBLE_CLICK="double_click",cs.LONG_PRESS="long_press",cs.LONG_TAP="long_tap",cs=Vt([Le()],cs);let us=class extends cs{};var _s;us.DRAG="drag",us.START="drag.start",us.END="drag.end",us.OVER="drag.over",us.OUT="drag.out",us.ENTER="drag.enter",us.LEAVE="drag.leave",us=Vt([Le()],us);let ps=_s=class extends cs{static setList(t){_s.dragList=t instanceof d?t:new d(t)}static setData(t){this.dragData=t}};ps.DROP="drop",ps=_s=Vt([Le()],ps);let gs=class extends us{};gs.MOVE="move",gs.START="move.start",gs.END="move.end",gs=Vt([Le()],gs);let fs=class extends ds{};fs.ROTATE="rotate",fs.START="rotate.start",fs.END="rotate.end",fs=Vt([Le()],fs);let ys=class extends us{};ys.SWIPE="swipe",ys.LEFT="swipe.left",ys.RIGHT="swipe.right",ys.UP="swipe.up",ys.DOWN="swipe.down",ys=Vt([Le()],ys);let ms=class extends ds{};ms.ZOOM="zoom",ms.START="zoom.start",ms.END="zoom.end",ms=Vt([Le()],ms);let vs=class extends ds{};vs.DOWN="key.down",vs.PRESS="key.press",vs.UP="key.up",vs=Vt([Le()],vs);class ws{constructor(t,e){this.map={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Wt.image(t),this.map[t.url]=e),e}destory(){this.leafer=null,this.map=null}}const xs={creator:{},parse(t,e){},convertToCanvasData(t,e){}},bs={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Bs=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},bs),ks={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},Es={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},Ts=Object.assign(Object.assign({},Es),bs),Cs=Bs,Rs={};for(let t in Cs)Rs[Cs[t]]=t;const Ps={};for(let t in Cs)Ps[Cs[t]]=ks[t];const Ls={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:Os,cos:Ss,atan2:Ms,ceil:Ds,abs:As,PI:Is}=Math,{setPoint:Ws,addPoint:Ns}=F,{set:Fs}=A,zs={},Hs={rect(t,e,s,i,r){xs.creator.path=t,xs.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){xs.creator.path=[],Ls.drawRoundRect(xs.creator,e,s,i,r,n),t.push(...xs.convertToCanvasData(xs.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=Ms(u,c),v=Ms(p,_),w=v-m;if(w<0&&(w+=f),w===Is||As(c+u)<1e-12||As(_+p)<1e-12)return t&&t.push(Bs.L,i,r),h&&(Ws(h,e,s),Ns(h,i,r)),d&&Fs(d,e,s),void(l&&Fs(l,i,r));const x=c*p-_*u<0,b=x?-1:1,B=a/Ss(w/2),k=i+B*Ss(m+w/2+y*b),E=r+B*Os(m+w/2+y*b);return m-=y*b,v-=y*b,js(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)=>js(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,_=Os(u),p=Ss(u);let m=o*g,v=a*g;m>Is&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Ds(As(w/y)),b=w/x,B=Os(b/4),k=8/3*B*B/Os(b/2);v=m+b;let E,T,C,R,P,L,O,S,M=Ss(m),D=Os(m),A=C=p*i*M-_*r*D,I=R=_*i*M+p*r*D,W=e+C,N=s+R;t&&t.push(Bs.L,W,N),l&&Ws(l,W,N),c&&Fs(c,W,N);for(let n=0;n<x;n++)E=Ss(v),T=Os(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(Bs.C,P,L,O,S,e+C,s+R),l&&Ys(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&&Fs(d,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Bs.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){Ys(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?Ns(h,t,e):Ws(h,t,e),Ns(h,o,a);for(let l=0,c=d.length;l<c;l++)Us(d[l],t,e,s,i,r,n,o,a,zs),Ns(h,zs.x,zs.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 Us(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Us,toTwoPointBounds:Ys,ellipse:js}=Hs,{sin:Xs,cos:Vs,sqrt:Gs,atan2:Ks}=Math,{ellipse:qs}=Hs,Qs={ellipticalArc(t,e,s,i,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*g,p=Xs(_),y=Vs(_),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=Gs(1-k/(w*x));i*=t,r*=t}else E=(o===a?-1:1)*Gs(k/(w*b+x*B));const T=E*i*v/r,C=-E*r*m/i,R=Ks((v-C)/r,(m-T)/i),P=Ks((-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?qs(t,O,S,i,r,n,R/g,P/g,M):i!==r||n?t.push(Bs.G,O,S,i,r,n,R/g,P/g,M):t.push(Bs.O,O,S,i,R/g,P/g,M)}},{M:Zs,m:$s,L:Js,l:ti,H:ei,h:si,V:ii,v:ri,C:ni,c:oi,S:ai,s:hi,Q:li,q:di,T:ci,t:ui,A:_i,a:pi,Z:gi,z:fi,N:yi,D:mi,X:vi,G:wi,F:xi,O:bi,P:Bi,U:ki}=Bs,{rect:Ei,roundRect:Ti,arcTo:Ci,arc:Ri,ellipse:Pi,quadraticCurveTo:Li}=Hs,{ellipticalArc:Oi}=Qs,Si=mt.get("PathConvert"),Mi={},Di={current:{},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=Ps[s],o+=s===i?" ":Rs[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?Ts:Es;for(let e=0,h=t.length;e<h;e++)i=t[e],rt[i]?n+=i:Bs[i]?(n&&(Ii(o,Number(n)),n=""),Ai.name=Bs[i],Ai.length=ks[i],Ai.index=0,Ii(o,Ai.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Ii(o,Number(n)),n=i):n&&(Ii(o,Number(n)),n=""),r=i;return n&&Ii(o,Number(n)),s?Di.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 $s:t[c+1]+=a,t[c+2]+=h;case Zs:a=t[c+1],h=t[c+2],_.push(Zs,a,h),c+=3;break;case si:t[c+1]+=a;case ei:a=t[c+1],_.push(Js,a,h),c+=2;break;case ri:t[c+1]+=h;case ii:h=t[c+1],_.push(Js,a,h),c+=2;break;case ti:t[c+1]+=a,t[c+2]+=h;case Js:a=t[c+1],h=t[c+2],_.push(Js,a,h),c+=3;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ai;case ai:o=n===ni||n===ai,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(ni,l,d,s,i,a,h),c+=5;break;case oi: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=ni;case ni:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ni,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ui:t[c+1]+=a,t[c+2]+=h,r=ci;case ci:o=n===li||n===ci,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Li(_,a,h,s,i,t[c+1],t[c+2]):_.push(li,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=li;case li:s=t[c+1],i=t[c+2],e?Li(_,a,h,s,i,t[c+3],t[c+4]):_.push(li,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case pi:t[c+6]+=a,t[c+7]+=h;case _i:Oi(_,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 fi:case gi:_.push(gi),c++;break;case yi:a=t[c+1],h=t[c+2],e?Ei(_,a,h,t[c+3],t[c+4]):Wi(_,t,c,5),c+=5;break;case mi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Wi(_,t,c,9),c+=9;break;case vi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],t[c+5]):Wi(_,t,c,6),c+=6;break;case wi:Pi(e?_:Wi(_,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,Mi),a=Mi.x,h=Mi.y,c+=9;break;case xi:e?Pi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Wi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bi:Ri(e?_:Wi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Mi),a=Mi.x,h=Mi.y,c+=7;break;case Bi:e?Ri(_,t[c+1],t[c+2],t[c+3],0,360,!1):Wi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ki:Ci(e?_:Wi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Mi),a=Mi.x,h=Mi.y,c+=6;break;default:return Si.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){Ai.index===Ai.length&&(Ai.index=1,t.push(Ai.name)),t.push(e),Ai.index++}},{current:Ai,pushData:Ii,copyData:Wi}=Di,{M:Ni,L:Fi,C:zi,Q:Hi,Z:Ui,N:Yi,D:ji,X:Xi,G:Vi,F:Gi,O:Ki,P:qi,U:Qi}=Bs,Zi={},$i={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ni,e,s)},lineTo(t,e,s){t.push(Fi,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(zi,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Hi,e,s,i,r)},closePath(t){t.push(Ui)},rect(t,e,s,i,r){t.push(Yi,e,s,i,r)},roundRect(t,e,s,i,r,n){if("number"==typeof n)t.push(Xi,e,s,i,r,n);else{const o=p.fourNumber(n);o?t.push(ji,e,s,i,r,...o):t.push(Yi,e,s,i,r)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Gi,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Vi,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(qi,e,s,i):(void 0===n&&(n=360),t.push(Ki,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),Hs.ellipse(null,e,s,i,r,n,o,a,h,null,null,Zi),t.push(Ni,Zi.x,Zi.y),Ji(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),Hs.arc(null,e,s,i,r,n,o,null,null,Zi),t.push(Ni,Zi.x,Zi.y),tr(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(Qi,e,s,i,r,n)}},{ellipse:Ji,arc:tr}=$i,{moveTo:er,lineTo:sr,quadraticCurveTo:ir,bezierCurveTo:rr,closePath:nr,beginPath:or,rect:ar,roundRect:hr,ellipse:lr,arc:dr,arcTo:cr,moveToEllipse:ur,moveToArc:_r}=$i;class pr{constructor(t){this.path=t?"string"==typeof t?xs.parse(t):t:[]}beginPath(){return or(this.path),this}moveTo(t,e){return er(this.path,t,e),this}lineTo(t,e){return sr(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return rr(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return ir(this.path,t,e,s,i),this}closePath(){return nr(this.path),this}rect(t,e,s,i){return ar(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return hr(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return lr(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return dr(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return cr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return ur(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return _r(this.path,t,e,s,i,r,n),this}}const{M:gr,L:fr,C:yr,Q:mr,Z:vr,N:wr,D:xr,X:br,G:Br,F:kr,O:Er,P:Tr,U:Cr}=Bs,Rr=mt.get("PathDrawer"),Pr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case gr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case fr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case yr:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case mr:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case vr:t.closePath(),i+=1;break;case wr:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case xr: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 br:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Br: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 kr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Er: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 Tr:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Cr:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Rr.error(`command: ${s} [index:${i}]`,e)}}},{M:Lr,L:Or,C:Sr,Q:Mr,Z:Dr,N:Ar,D:Ir,X:Wr,G:Nr,F:Fr,O:zr,P:Hr,U:Ur}=Bs,{toTwoPointBounds:Yr,toTwoPointBoundsByQuadraticCurve:jr,arcTo:Xr,arc:Vr,ellipse:Gr}=Hs,{add:Kr,copy:qr,addPoint:Qr,setPoint:Zr,addBounds:$r,toBounds:Jr}=F,tn=mt.get("PathBounds");let en,sn,rn;const nn={},on={},an={},hn={toBounds(t,e){hn.toTwoPointBounds(t,on),Jr(on,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Zr(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===Dr||s===Sr||s===Mr?Zr(e,h,l):Zr(e,t[a+1],t[a+2])),s){case Lr:case Or:h=t[a+1],l=t[a+2],Qr(e,h,l),a+=3;break;case Sr:n=t[a+5],o=t[a+6],Yr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,nn),Kr(e,nn),h=n,l=o,a+=7;break;case Mr:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],jr(h,l,i,r,n,o,nn),Kr(e,nn),h=n,l=o,a+=5;break;case Dr:a+=1;break;case Ar:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ir:case Wr:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=s===Ir?9:6;break;case Nr:Gr(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],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=9;break;case Fr:h=t[a+1],l=t[a+2],sn=t[a+3],rn=t[a+4],$r(e,h-sn,l-rn,2*sn,2*rn),h+=sn,a+=5;break;case zr:Vr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=7;break;case Hr:h=t[a+1],l=t[a+2],en=t[a+3],$r(e,h-en,l-en,2*en,2*en),h+=en,a+=4;break;case Ur:Xr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=6;break;default:return void tn.error(`command: ${s} [index:${a}]`,t)}}},ln={smooth:(t,e,s)=>t};xs.creator=new pr,xs.parse=Di.parse,xs.convertToCanvasData=Di.toCanvasData;const dn=mt.get("plugin"),cn={list:[]};class un{constructor(t){this.taskTime=1,this.id=u.create(u.TASK),this.task=t}run(){return Gt(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 _n=mt.get("TaskProcessor");class pn{constructor(t,e){this.updatedList=new d,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=gt.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 gn=mt.get("Renderer");class fn{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=gt.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,gn.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){gn.error(t)}gn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?gn.warn("rendering"):this.times>3?gn.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 gn.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=xt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new st).copy(i);s.save(),r&&!mt.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(),xt.end(e)}fullRender(){const t=xt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),xt.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),mt.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),mt.showHitView&&this.renderHitView(s),mt.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();It.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&&(gn.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:yn}=$;class mn{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=yn(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 vn{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=gt.default(e,this.config)),this.findPath=new mn(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(Wt,{watcher:(t,e)=>new pn(t,e),layouter:(t,e)=>new At(t,e),renderer:(t,e,s)=>new fn(t,e,s),selector:(t,e)=>new vn(t,e)});const wn=mt.get("LeaferCanvas");class xn extends se{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){wn.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 wn.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={};gt.copyAttrs(l,this,ee),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:bn}=Ls;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){bn(this,t,e,s,i,r)})}();class Bn{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 kn{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(gs.START,this.moveData)}t.path=this.moveData.path,e.emit(gs.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(ms.START,this.zoomData)}t.path=this.zoomData.path,e.emit(ms.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(fs.START,this.rotateData)}t.path=this.rotateData.path,e.emit(fs.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(gs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(ms.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(fs.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const En={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?ys.UP:t>45&&t<135?ys.DOWN:t<=45&&t>=-45?ys.RIGHT:ys.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:Tn.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}},Tn=En,{getDragEventData:Cn,getDropEventData:Rn,getSwipeEventData:Pn,filterPathByEventType:Ln}=En;class On{constructor(t){this.interaction=t}setDragData(t){this.dragData=Cn(t,t,t)}getDragList(){return this.dragging?ps.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ls.middle(t)&&!ls.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ls.middle(t)||hs.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(gs.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Cn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(gs.MOVE,this.dragData):this.dragging&&(s.emit(us.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ls.left(t)&&e,this.dragging&&(this.interaction.emit(us.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Ln(this.dragData.path,us.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=>{nt.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(us.OUT,t,s),e.emit(us.OVER,t,i)):e.emit(us.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(us.ENTER,t,i,s),e.emit(us.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=Cn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(gs.END,n),this.dragging&&(e.emit(us.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=Pn(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Rn(t,this.getDragList(),ps.dragData);e.path=this.dragEnterPath,this.interaction.emit(ps.DROP,e),this.interaction.emit(us.LEAVE,t,this.dragEnterPath)}dragReset(){ps.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 Sn=["move","zoom","rotate"];function Mn(t,e,s,i,r){if(Sn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!An(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&&Dn(n,e,s,i,r)}}function Dn(t,e,s,i,r){if(t.__.hitSelf&&t.hasEvent(e,i)&&!An(t,r)){s.phase=i?1:t===s.target?2:3;const r=Ut.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function An(t,e){return e&&e.has(t)}const{pathHasEventType:In}=En;class Wn{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 kn(this),this.dragger=new On(this),i&&(this.config=gt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(cs.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(cs.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ls.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(cs.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:cs.MOVE});t.path=e.path,this.emit(cs.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(cs.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(cs.UP,t),this.emit(cs.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(cs.OUT,t,this.overPath),this.emit(cs.OVER,t,e)):this.emit(cs.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(cs.ENTER,t,e,this.enterPath),this.emit(cs.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(cs.LEAVE,t),this.dragger.dragging&&this.emit(ps.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=[cs.DOUBLE_TAP,cs.DOUBLE_CLICK].some((e=>In(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(cs.TAP,t),this.emit(cs.CLICK,t)}emitDoubleTap(t){this.emit(cs.DOUBLE_TAP,t),this.emit(cs.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(cs.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(cs.LONG_TAP,t),In(t.path,cs.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],Dn(r,t,e,!0,i))return;r.isApp&&Mn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&Mn(r,t,e,!1,i),Dn(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 Nn={convert(t,e){const s=En.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=En.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=Nn.getTouch(t),i=En.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]},Fn={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}},zn={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=It.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:Hn,getZoomEventData:Un,getRotateEventData:Yn}=En;class jn extends Wn{__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){hs.setDownCode(t.code)}onKeyUp(t){hs.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(Nn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Nn.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(Nn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Nn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Nn.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(Nn.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=Nn.getTouch(t);this.pointerDown(Nn.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Nn.getTouch(t);this.pointerMove(Nn.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=Nn.getTouch(t);this.pointerUp(Nn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Fn.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Fn.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}=Fn.getData(r,n),d=En.getBase(t);this.rotate(Yn(l,a,d)),this.zoom(Un(l,h,d)),this.move(Hn(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):zn.getScale(t,e),i=this.getLocal(t),r=En.getBase(t);1!==s?this.zoom(Un(i,s,r)):this.move(Hn(i,e.getMove?e.getMove(t,e):zn.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=En.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(Un(e,i*i,s)),this.rotate(Yn(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(Wt,{canvas:(t,e)=>new xn(t,e),image:t=>new Bn(t),hitCanvas:(t,e)=>new xn(t,e),interaction:(t,e,s,i)=>new jn(t,e,s,i)}),It.requestRender=function(t){window.requestAnimationFrame(t)},It.canvas=Wt.canvas(),It.devicePixelRatio=devicePixelRatio,It.conicGradientSupport=!!It.canvas.context.createConicGradient;const{userAgent:Xn}=navigator;Xn.indexOf("Firefox")>-1?(It.conicGradientRotate90=!0,It.intWheelDeltaY=!0):Xn.indexOf("Safari")>-1&&-1===Xn.indexOf("Chrome")&&(It.fullImageShadow=!0);const Vn={},Gn={},{copy:Kn,toOffsetOutBounds:qn}=$,Qn={},Zn={};function $n(t,e,s,i){const{bounds:r,shapeBounds:n}=i;if(It.fullImageShadow){if(Kn(Qn,t.bounds),Qn.x+=e.x-n.x,Qn.y+=e.y-n.y,s){const{matrix:t}=i;Qn.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),Qn.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),Qn.width*=s,Qn.height*=s}t.copyWorld(i.canvas,t.bounds,Qn)}else s&&(Kn(Qn,e),Qn.x-=e.width/2*(s-1),Qn.y-=e.height/2*(s-1),Qn.width*=s,Qn.height*=s),t.copyWorld(i.canvas,n,s?Qn:e)}const{toOffsetOutBounds:Jn}=$,to={};var eo=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;Jn(l,to),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(to.offsetX+t.x*c,to.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,$n(_,to,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;qn(l,Zn),a.forEach(((t,a)=>{_.setWorldShadow(Zn.offsetX+t.x*c,Zn.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,$n(_,Zn,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 so(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 io(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),ao(t,e);break;case"inside":ro(t,e,s,"inside");break;case"outside":ro(t,e,s,"outside")}}function ro(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,ao(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",so(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function no(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),oo(t,s,e);break;case"inside":ro(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,oo(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",so(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function oo(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),ao(t,s),s.restoreBlendMode()):ao(t,s)}))}function ao(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 ho(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:lo,getOuterOf:co,getByMove:uo,getIntersectData:_o}=$;const po={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:go,rotateOf:fo,translate:yo,scaleOf:mo,scale:vo,rotate:wo}=T;function xo(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=go(),yo(t,r.x,r.y));break;case"clip":(n||o||l)&&(t=function(t,e,s,i){const r=go();yo(r,t.x,t.y),e&&yo(r,e.x,e.y);s&&("number"==typeof s?vo(r,s):vo(r,s.x,s.y));i&&wo(r,i);return r}(r,n,o,l));break;case"repeat":(!u||o||l)&&(t=function(t,e,s,i,r){const n=go();if(r)switch(wo(n,r),r){case 90:yo(n,s,0);break;case 180:yo(n,e,s);break;case 270:yo(n,0,e)}yo(n,t.x,t.y),i&&mo(n,t,i);return n}(r,d,c,o,l));break;default:u&&!l||(t=function(t,e,s,i,r){const n=go(),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;yo(n,d,c),vo(n,l),r&&fo(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=It.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 bo={x:.5,y:0},Bo={x:.5,y:1};function ko(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,po.string(i.color,s))}const{set:Eo,getAngle:To,getDistance:Co}=A,{get:Ro,rotateOf:Po,scaleOf:Lo}=T,Oo={x:.5,y:.5},So={x:.5,y:1},Mo={},Do={};const{set:Ao,getAngle:Io,getDistance:Wo}=A,{get:No,rotateOf:Fo,scaleOf:zo}=T,Ho={x:.5,y:.5},Uo={x:.5,y:1},Yo={},jo={};function Xo(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=Vo(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function Vo(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:po.string(o,a)};case"image":return xo(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:r,blendMode:n,opacity:o}=t;s||(s=bo),i||(i=Bo);const a=It.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 ko(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=Oo),i||(i=So);const{x:h,y:l,width:d,height:c}=e;let u;Eo(Mo,h+s.x*d,l+s.y*c),Eo(Do,h+i.x*d,l+i.y*c),(d!==c||a)&&(u=Ro(),Lo(u,Mo,d/c*(a||1),1),Po(u,Mo,To(Mo,Do)+90));const _=It.canvas.createRadialGradient(Mo.x,Mo.y,0,Mo.x,Mo.y,Co(Mo,Do));return ko(_,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=Ho),i||(i=Uo);const{x:h,y:l,width:d,height:c}=e;Ao(Yo,h+s.x*d,l+s.y*c),Ao(jo,h+i.x*d,l+i.y*c);const u=No(),_=Io(Yo,jo);It.conicGradientRotate90?(zo(u,Yo,d/c*(a||1),1),Fo(u,Yo,_+90)):(zo(u,Yo,1,d/c*(a||1)),Fo(u,Yo,_));const p=It.conicGradientSupport?It.canvas.createConicGradient(0,Yo.x,Yo.y):It.canvas.createRadialGradient(Yo.x,Yo.y,0,Yo.x,Yo.y,Wo(Yo,jo));return ko(p,t.stops,n),{type:r,blendMode:o,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:po.string(e)}:void 0}}var Go=Object.freeze({__proto__:null,computeFill:function(t){Xo(t,"fill")},computeStroke:function(t){Xo(t,"stroke")},drawText:so,drawTextStroke:ao,fill:function(t,e,s){e.fillStyle=s,t.__.__font?so(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?so(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?so(t,e):e.fill(r),e.restoreBlendMode()):n?so(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=_o(i?lo(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=co(h,n),r=uo(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)io(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:io,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)no(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),ho(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),ho(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.__),ho(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:no});Object.assign(Vn,eo),Object.assign(Gn,Go);class Ko extends yt{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:Gn.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:Gn.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 qo={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Qo extends Ko{}class Zo extends Qo{get __boxStroke(){return!0}}class $o extends Ko{get __boxStroke(){return!0}}const{parse:Jo}=Di;const ta={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ea extends $o{}function sa(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ia(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ra={__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}},na={__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)}},oa={__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&&Gn.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&Gn.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=Gn.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&Vn.shadow(this,t,n),s&&(this.__.__isFills?Gn.fills(this,t,s):Gn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&Vn.innerShadow(this,t,n),i&&(this.__.__isStrokes?Gn.strokes(this,t,i):Gn.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?Gn.fills(this,t,s):Gn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Gn.strokes(this,t,i):Gn.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&&Gn.fill(this,t,"#000000"),i&&Gn.stroke(this,t,"#000000")}},aa={__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 ha=class extends Ze{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Di.toCanvasData(e,!0):e:[]}getPathString(t){return Di.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Gn.computeFill(this),e&&Gn.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?ln.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 Ft.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};Vt([we(Ko)],ha.prototype,"__",void 0),Vt([oe("")],ha.prototype,"id",void 0),Vt([oe("")],ha.prototype,"name",void 0),Vt([oe("")],ha.prototype,"className",void 0),Vt([ge("pass-through")],ha.prototype,"blendMode",void 0),Vt([fe(1)],ha.prototype,"opacity",void 0),Vt([fe(!0)],ha.prototype,"visible",void 0),Vt([me(!1)],ha.prototype,"isMask",void 0),Vt([ye(0)],ha.prototype,"zIndex",void 0),Vt([oe()],ha.prototype,"locked",void 0),Vt([ae(0)],ha.prototype,"x",void 0),Vt([ae(0)],ha.prototype,"y",void 0),Vt([de(100)],ha.prototype,"width",void 0),Vt([de(100)],ha.prototype,"height",void 0),Vt([he(1)],ha.prototype,"scaleX",void 0),Vt([he(1)],ha.prototype,"scaleY",void 0),Vt([le(0)],ha.prototype,"rotation",void 0),Vt([le(0)],ha.prototype,"skewX",void 0),Vt([le(0)],ha.prototype,"skewY",void 0),Vt([oe(!1)],ha.prototype,"draggable",void 0),Vt([ve(!0)],ha.prototype,"hittable",void 0),Vt([ve("path")],ha.prototype,"hitFill",void 0),Vt([_e("path")],ha.prototype,"hitStroke",void 0),Vt([ve(!0)],ha.prototype,"hitChildren",void 0),Vt([ve(!0)],ha.prototype,"hitSelf",void 0),Vt([ge()],ha.prototype,"fill",void 0),Vt([_e()],ha.prototype,"stroke",void 0),Vt([_e("inside")],ha.prototype,"strokeAlign",void 0),Vt([_e(1)],ha.prototype,"strokeWidth",void 0),Vt([_e("none")],ha.prototype,"strokeCap",void 0),Vt([_e("miter")],ha.prototype,"strokeJoin",void 0),Vt([_e()],ha.prototype,"dashPattern",void 0),Vt([_e()],ha.prototype,"dashOffset",void 0),Vt([_e(10)],ha.prototype,"miterLimit",void 0),Vt([ce()],ha.prototype,"cornerRadius",void 0),Vt([ce()],ha.prototype,"cornerSmoothing",void 0),Vt([sa()],ha.prototype,"shadow",void 0),Vt([sa()],ha.prototype,"innerShadow",void 0),Vt([sa()],ha.prototype,"blur",void 0),Vt([sa()],ha.prototype,"backgroundBlur",void 0),Vt([sa()],ha.prototype,"grayscale",void 0),Vt([Ee(Pr.drawPathByData)],ha.prototype,"__drawPathByData",null),ha=Vt([Re(ra),Re(na),Re(oa),Te()],ha);let la=class extends ha{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){}};Vt([we(Qo)],la.prototype,"__",void 0),la=Vt([Re(os),Pe()],la);let da=class extends ha{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)}};Vt([we($o)],da.prototype,"__",void 0),da=Vt([Re(aa),Pe()],da);const ca=da.prototype,ua=la.prototype,_a={},{copy:pa,add:ga}=$;let fa=class extends la{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;pa(_a,t),super.__updateRenderBounds(),ga(t,_a)}}__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)}};Vt([we(Zo)],fa.prototype,"__",void 0),Vt([pe("show")],fa.prototype,"overflow",void 0),Vt([Ee(ca.__updateStrokeSpread)],fa.prototype,"__updateStrokeSpread",null),Vt([Ee(ca.__updateRenderSpread)],fa.prototype,"__updateRectRenderSpread",null),Vt([Ee(ca.__updateBoxBounds)],fa.prototype,"__updateBoxBounds",null),Vt([Ee(ca.__updateStrokeBounds)],fa.prototype,"__updateStrokeBounds",null),Vt([Ee(ca.__updateRenderBounds)],fa.prototype,"__updateRectRenderBounds",null),Vt([Ee(ca.__updateChange)],fa.prototype,"__updateRectChange",null),Vt([Ee(ca.__drawPathByData)],fa.prototype,"__drawPathByData",null),Vt([Ee(ca.__render)],fa.prototype,"__renderRect",null),Vt([Ee(ua.__render)],fa.prototype,"__renderGroup",null),fa=Vt([Te(),Pe()],fa);let ya=class extends fa{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Vt([we(class extends Zo{})],ya.prototype,"__",void 0),Vt([pe("hide")],ya.prototype,"overflow",void 0),ya=Vt([Pe()],ya);const{moveTo:ma,closePath:va,ellipse:wa}=$i;let xa=class extends ha{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&&wa(a,n,o,n*s,o*s,0,i,r,!1),wa(a,n,o,n,o,0,r,i,!0),s<1&&va(a)):(s<1&&(wa(a,n,o,n*s,o*s),ma(a,t,o)),wa(a,n,o,n,o,0,0,360,!0)):i||r?(ma(a,n,o),wa(a,n,o,n,o,0,i,r,!1),va(a)):wa(a,n,o,n,o)}};Vt([we(class extends Ko{get __boxStroke(){return!0}})],xa.prototype,"__",void 0),Vt([ce(0)],xa.prototype,"innerRadius",void 0),Vt([ce(0)],xa.prototype,"startAngle",void 0),Vt([ce(0)],xa.prototype,"endAngle",void 0),xa=Vt([Pe()],xa);const{sin:ba,cos:Ba,PI:ka}=Math,{moveTo:Ea,lineTo:Ta,closePath:Ca}=$i;let Ra=class extends ha{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=[];Ea(n,i,0);for(let t=1;t<s;t++)Ta(n,i+i*ba(2*t*ka/s),r-r*Ba(2*t*ka/s));Ca(n)}};Vt([we(class extends Ko{})],Ra.prototype,"__",void 0),Vt([ce(3)],Ra.prototype,"sides",void 0),Ra=Vt([Pe()],Ra);const{sin:Pa,cos:La,PI:Oa}=Math,{moveTo:Sa,lineTo:Ma,closePath:Da}=$i;let Aa=class extends ha{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=[];Sa(o,r,0);for(let t=1;t<2*s;t++)Ma(o,r+(t%2==0?r:r*i)*Pa(t*Oa/s),n-(t%2==0?n:n*i)*La(t*Oa/s));Da(o)}};Vt([we(class extends Ko{})],Aa.prototype,"__",void 0),Vt([ce(5)],Aa.prototype,"points",void 0),Vt([ce(.382)],Aa.prototype,"innerRadius",void 0),Aa=Vt([Pe()],Aa);const{moveTo:Ia,lineTo:Wa}=$i,{rotate:Na,getAngle:Fa,getDistance:za,defaultPoint:Ha}=A,{setPoint:Ua,addPoint:Ya,toBounds:ja}=F,Xa={};let Va=class extends ha{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&&Na(s,e),this.__toPoint=s,s}set toPoint(t){this.width=za(Ha,t),this.rotation=Fa(Ha,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Ia(t,0,0);const e=this.toPoint;Wa(t,e.x,e.y)}__updateBoxBounds(){Ua(Xa,0,0),Ya(Xa,this.__toPoint.x,this.__toPoint.y),ja(Xa,this.__layout.boxBounds)}};Vt([we(class extends Ko{})],Va.prototype,"__",void 0),Vt([de()],Va.prototype,"rotation",void 0),Vt([ue("center")],Va.prototype,"strokeAlign",void 0),Va=Vt([Pe()],Va);let Ga=class extends da{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()}};Vt([we(ea)],Ga.prototype,"__",void 0),Vt([de("")],Ga.prototype,"url",void 0),Ga=Vt([Pe()],Ga);let Ka=class extends da{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Wt.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()}};Vt([we(ea)],Ka.prototype,"__",void 0),Vt([ia(100)],Ka.prototype,"width",void 0),Vt([ia(100)],Ka.prototype,"height",void 0),Vt([ia(It.devicePixelRatio)],Ka.prototype,"pixelRatio",void 0),Vt([ia(!0)],Ka.prototype,"smooth",void 0),Vt([ve("all")],Ka.prototype,"hitFill",void 0),Ka=Vt([Pe()],Ka);const qa=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",Qa=qa+"_#~&*+\\=|≮≯≈≠=…";function Za(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const $a=Za("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ja=Za("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),th=Za(qa),eh=Za(Qa),sh=Za("- —/~|┆·");var ih;!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"}(ih||(ih={}));const{Letter:rh,Single:nh,Before:oh,After:ah,Symbol:hh,Break:lh}=ih;function dh(t){return $a[t]?rh:sh[t]?lh:/[\u3400-\u9FBF]/.test(t)?nh:Ja[t]?oh:th[t]?ah:eh[t]?hh:rh}const ch={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 uh(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:_h}=ch,{Letter:ph,Single:gh,Before:fh,After:yh,Symbol:mh,Break:vh}=ih;let wh,xh,bh,Bh,kh,Eh,Th,Ch,Rh,Ph,Lh,Oh,Sh,Mh,Dh=[];function Ah(t,e){wh.data.push({char:t,width:e}),bh+=e}function Ih(){Bh+=bh,wh.width=bh,xh.words.push(wh),wh={data:[]},bh=0}function Wh(){Oh&&(Sh.paraNumber++,xh.paraStart=!0,Oh=!1),xh.width=Bh,_h(xh),Dh.push(xh),xh.width>Mh.width&&(Mh.width=xh.width),xh={words:[]},Bh=0}const Nh=0,Fh=1,zh=2;const Hh={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:It.canvas.font=l};return function(t,e,s){Sh=t,Dh=t.rows,Mh=t.bounds;const{__letterSpacing:i,paraIndent:r,textCase:n}=s,{canvas:o}=It,{width:a,height:h}=Mh;if(a||h||i||n){Oh=!0,Rh=null,bh=Bh=0,wh={data:[]},xh={words:[]};for(let t=0,s=e.length;t<s;t++)Eh=e[t],"\n"===Eh?(bh&&Ih(),xh.paraEnd=!0,Wh(),Oh=!0):(Ch=dh(Eh),Ch===ph&&"none"!==n&&(Eh=uh(Eh,n,!bh)),Th=o.measureText(Eh).width,i&&(Th+=i),Ph=Ch===gh&&(Rh===gh||Rh===ph)||Rh===gh&&Ch!==yh,Lh=!(Ch!==fh&&Ch!==gh||Rh!==mh&&Rh!==yh),kh=Oh&&r?a-r:a,a&&Bh+bh+Th>kh&&(Lh||(Lh=Ch===ph&&Rh==yh),Ph||Lh||Ch===vh||Ch===fh||Ch===gh||bh+Th>kh?(bh&&Ih(),Wh()):Wh())," "===Eh&&Bh+bh===0||(Ch===vh?(" "===Eh&&bh&&Ih(),Ah(Eh,Th),Ih()):Ph||Lh?(bh&&Ih(),Ah(Eh,Th)):Ah(Eh,Th)),Rh=Ch);bh&&Ih(),Bh&&Wh(),Dh[Dh.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{Sh.paraNumber++,Dh.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?Nh:l>.01?Fh: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===Fh?(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=It.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:Uh,includes:Yh,spread:jh}=$;let Xh=class extends ha{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=Hh.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=qo.number(r,a),t.__letterSpacing=qo.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&&jh(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 _=Yh(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(){Uh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};Vt([we(class extends Ko{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ta[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Xh.prototype,"__",void 0),Vt([de(0)],Xh.prototype,"width",void 0),Vt([de(0)],Xh.prototype,"height",void 0),Vt([de(0)],Xh.prototype,"padding",void 0),Vt([ue("outside")],Xh.prototype,"strokeAlign",void 0),Vt([de("")],Xh.prototype,"text",void 0),Vt([de("L")],Xh.prototype,"fontFamily",void 0),Vt([de(12)],Xh.prototype,"fontSize",void 0),Vt([de("normal")],Xh.prototype,"fontWeight",void 0),Vt([de(!1)],Xh.prototype,"italic",void 0),Vt([de("none")],Xh.prototype,"textCase",void 0),Vt([de("none")],Xh.prototype,"textDecoration",void 0),Vt([de(0)],Xh.prototype,"letterSpacing",void 0),Vt([de({type:"percent",value:150})],Xh.prototype,"lineHeight",void 0),Vt([de(0)],Xh.prototype,"paraIndent",void 0),Vt([de(0)],Xh.prototype,"paraSpacing",void 0),Vt([de("left")],Xh.prototype,"textAlign",void 0),Vt([de("top")],Xh.prototype,"verticalAlign",void 0),Vt([de("show")],Xh.prototype,"textOverflow",void 0),Xh=Vt([Pe()],Xh);const{toBounds:Vh}=hn;let Gh=class extends ha{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){Vh(this.__.path,this.__layout.boxBounds)}};Vt([we(class extends Ko{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Jo(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],Gh.prototype,"__",void 0),Vt([ce()],Gh.prototype,"path",void 0),Vt([ce()],Gh.prototype,"windingRule",void 0),Vt([ue("center")],Gh.prototype,"strokeAlign",void 0),Gh=Vt([Pe()],Gh);let Kh=class extends la{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Gh(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")}};Vt([we(class extends Qo{})],Kh.prototype,"__",void 0),Kh=Vt([Re(pr,["beginPath"]),Pe()],Kh);const qh=mt.get("LeaferType"),Qh={list:{},register(t,e){Zh[t]?qh.error("repeat:",t):Zh[t]=e},run(t,e){const s=Qh.list[t];s?s(e):qh.error("no",t)}},{list:Zh}=Qh;Qh.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),Qh.register("design",(function(t){const{MOVE:e}=gs,{ZOOM:s}=ms;t.__eventIds.push(t.on_(e,(e=>{nt.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&&nt.zoomOf(t.zoomLayer,e,n)})))}));const $h=mt.get("Leafer");let Jh=class extends la{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&>.assign(this.config,t);const{config:i}=this;Qh.run(i.type,this),this.canvas=Wt.canvas(i),this.__controllers.push(this.renderer=Wt.renderer(this,this.canvas,i),this.watcher=Wt.watcher(this,i),this.layouter=Wt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Wt.selector(this),this.__controllers.unshift(this.interaction=Wt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new jt,this.hitCanvasManager=new Xt,this.imageManager=new ws(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=gt.copyAttrs({},t,ee);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=gt.copyAttrs({},this.canvas,ee);this.canvas.resize(t),this.__onResize(new r(t,e))}__onResize(t){this.emitEvent(t),gt.copyAttrs(this.__,t,ee),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&&(ee.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&&ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=gt.copyAttrs({},this.canvas,ee);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=xt.start("FirstCreate "+this.innerName);this.once(l.START,(()=>xt.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){$h.error(t)}}};Vt([we(class extends Qo{})],Jh.prototype,"__",void 0),Vt([de()],Jh.prototype,"pixelRatio",void 0),Jh=Vt([Pe()],Jh);let tl=class extends Jh{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,(()=>{mt.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 Jh(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&>.assign(e,t),e.view=this.realCanvas?void 0:this.view,e.fill=e.hittable=e.realCanvas=void 0,this.autoLayout&>.copyAttrs(e,this,ee),e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};tl=Vt([Pe()],tl);var el=Object.freeze({__proto__:null,Animate:{},get App(){return tl},AutoBounds:it,BezierHelper:Hs,Bounds:st,BoundsHelper:$,get Box(){return fa},get Branch(){return os},BranchHelper:ct,get Canvas(){return Ka},CanvasManager:jt,ChildEvent:e,Creator:Wt,DataHelper:gt,Debug:mt,get DragEvent(){return us},get DropEvent(){return ps},Effect:Vn,get Ellipse(){return xa},EllipseHelper:Qs,Event:t,EventCreator:Ut,Export:{},get Frame(){return ya},get Group(){return la},HitCanvasManager:Xt,get Image(){return Ga},ImageEvent:i,ImageManager:ws,IncrementId:u,Interaction:jn,get KeyEvent(){return vs},Keyboard:hs,LayoutEvent:a,Layouter:At,get Leaf(){return Ze},LeafBounds:Ye,LeafBoundsHelper:dt,LeafData:yt,LeafDataProxy:Ie,LeafEventer:De,LeafHelper:nt,LeafHit:Ve,LeafLevelList:c,LeafList:d,LeafMask:Ke,LeafMatrix:ze,LeafRender:Ge,get Leafer(){return Jh},LeaferCanvas:xn,LeaferCanvasBase:se,LeaferEvent:l,LeaferImage:Bn,get Line(){return Va},MathHelper:p,Matrix:N,MatrixHelper:T,get MoveEvent(){return gs},NeedConvertToCanvasCommandMap:Es,OneRadian:g,PI2:f,PI_2:y,Paint:Gn,get Path(){return Gh},PathBounds:hn,PathCommandDataHelper:$i,PathCommandMap:Bs,PathConvert:Di,PathCorner:ln,PathCreator:pr,PathDrawer:Pr,PathHelper:xs,PathNumberCommandLengthMap:Ps,PathNumberCommandMap:Rs,get Pen(){return Kh},Platform:It,Plugin:cn,Point:W,PointHelper:A,PointerButton:ls,get PointerEvent(){return cs},get Polygon(){return Ra},PropertyEvent:s,get Rect(){return da},RectHelper:Ls,RectRender:aa,RenderEvent:h,Renderer:fn,ResizeEvent:r,get RotateEvent(){return fs},Run:xt,Selector:vn,get Star(){return Aa},StringNumberMap:rt,get SwipeEvent(){return ys},TaskItem:un,TaskProcessor:class{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 un(t),e)}addParallel(t,e){const s=new un(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new un(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){_n.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)}},get Text(){return Xh},TransformEvent:n,TwoPointBounds:class{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)}},TwoPointBoundsHelper:F,get UI(){return ha},UIBounds:ra,UICreator:Ft,UIEvent:ds,UIHit:na,UIRender:oa,WaitHelper:pt,WatchEvent:o,Watcher:pn,get ZoomEvent(){return ms},affectRenderBoundsType:pe,affectStrokeBoundsType:ue,aliasType:function(t){return(e,s)=>{ie(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}},boundsType:de,canvasSizeAttrs:ee,dataProcessor:we,dataType:oe,defineDataProcessor:xe,defineKey:ie,defineLeafAttr:ne,effectType:sa,getDescriptor:re,hitType:ve,layoutProcessor:function(t){return(e,s)=>{ie(e,"__LayoutProcessor",{get:()=>t})}},maskType:me,opacityType:fe,pathType:ce,positionType:ae,registerUI:Pe,registerUIEvent:Le,resizeType:ia,rewrite:Ee,rewriteAble:Te,rotationType:le,scaleType:he,setDefaultValue:function(t,e,s){xe(t.prototype,e,s)},sortType:ye,strokeType:_e,surfaceType:ge,useModule:Re,usePlugin:function(t,e){if(cn.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:dn.error(t+" non-existent")})),t.run(s)}else dn.error("no dependencies")}});window.LeaferUI=el;
|
|
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)}}const rt={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},nt={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)at(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ht(e[t])}},updateAllChange(t){if(ht(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),ot.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)}},ot=nt,{updateAllWorldMatrix:at,updateAllWorldOpacity:ht,updateAllChange:lt}=ot,dt={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},ct={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),ut(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++)_t(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:ut,pushAllBranchStack:_t}=ct,pt={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},gt={default:(t,e)=>(ft(e,t),ft(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?ft(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:ft}=gt;class yt{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 mt{constructor(t){this.name=t}static get(t){return new mt(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(vt.enable){if(vt.filterList.length&&vt.filterList.every((t=>t!==this.name)))return;if(vt.excludeList.length&&vt.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)}}}mt.filterList=[],mt.excludeList=[];const vt=mt,wt=mt.get("RunTime");class xt{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?wt.log(i,performance.now()-s,"µs"):wt.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=bt.nameToIdMap[t];void 0!==s&&bt.end(s,e)}}xt.idMap={},xt.nameMap={},xt.nameToIdMap={};const bt=xt,{updateAllWorldMatrix:Bt,updateAllWorldOpacity:kt}=nt,{pushAllChildBranch:Et,pushAllParent:Tt}=ct;const{worldBounds:Ct}=dt,{setByListWithHandle:Rt}=$;class Pt{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(){Rt(this.beforeBounds,this.updatedList.list,Ct)}setAfter(){Rt(this.afterBounds,this.updatedList.list,Ct),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:Lt,updateAllChange:Ot}=nt,{pushAllBranchStack:St,updateWorldBoundsByBranchStack:Mt}=ct,Dt=mt.get("Layouter");class At{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,e&&(this.config=gt.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){Dt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Dt.warn("layouting"):this.times>3?Dt.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=xt.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?(Bt(t),e.push(t),t.isBranch&&Et(t,e),Tt(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Tt(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&&kt(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,xt.end(e)}fullLayout(){const t=xt.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)),At.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),xt.end(t)}static fullLayout(t){if(Lt(t),t.isBranch){const e=[t];St(t,e),Mt(e)}else t.__updateWorldBounds();Ot(t)}createBlock(t){return new Pt(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 It={layout:At.fullLayout},Wt={},Nt=mt.get("UICreator"),Ft={list:{},register(t){const{__tag:e}=t.prototype;zt[e]?Nt.error("repeat:",e):zt[e]=t},get(t,e,s,i,r,n){const o=new zt[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:zt}=Ft,Ht=mt.get("EventCreator"),Ut={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Yt[e]?Ht.error("repeat: ",e):Yt[e]=t)}))},changeName(t,e){const s=Yt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,Yt[e]=s)}},get:(t,...e)=>new Yt[t](...e)},{nameList:Yt}=Ut;class jt{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=Wt.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 Xt extends jt{constructor(){super(...arguments),this.pathTypeList=new d,this.imageTypeList=new d}get(t){}getImageType(t,e){return this.imageTypeList.push(t),Wt.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),Wt.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 Vt(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 Gt(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 Kt(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 Qt(){return(t,e)=>{qt.push(e)}}const Zt=[];let $t=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||Zt)}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}};Vt([Kt("imageSmoothingEnabled")],$t.prototype,"smooth",void 0),Vt([Kt("imageSmoothingQuality")],$t.prototype,"smoothLevel",void 0),Vt([Kt("globalAlpha")],$t.prototype,"opacity",void 0),Vt([Kt()],$t.prototype,"fillStyle",void 0),Vt([Kt()],$t.prototype,"strokeStyle",void 0),Vt([Kt("lineWidth")],$t.prototype,"strokeWidth",void 0),Vt([Kt("lineCap")],$t.prototype,"strokeCap",void 0),Vt([Kt("lineJoin")],$t.prototype,"strokeJoin",void 0),Vt([Kt("lineDashOffset")],$t.prototype,"dashOffset",void 0),Vt([Kt()],$t.prototype,"miterLimit",void 0),Vt([Kt()],$t.prototype,"shadowBlur",void 0),Vt([Kt()],$t.prototype,"shadowColor",void 0),Vt([Kt()],$t.prototype,"shadowOffsetX",void 0),Vt([Kt()],$t.prototype,"shadowOffsetY",void 0),Vt([Kt()],$t.prototype,"filter",void 0),Vt([Kt()],$t.prototype,"font",void 0),Vt([Kt()],$t.prototype,"fontKerning",void 0),Vt([Kt()],$t.prototype,"fontStretch",void 0),Vt([Kt()],$t.prototype,"fontVariantCaps",void 0),Vt([Kt()],$t.prototype,"textAlign",void 0),Vt([Kt()],$t.prototype,"textBaseline",void 0),Vt([Kt()],$t.prototype,"textRendering",void 0),Vt([Kt()],$t.prototype,"wordSpacing",void 0),Vt([Kt()],$t.prototype,"letterSpacing",void 0),Vt([Kt()],$t.prototype,"direction",void 0),Vt([Qt()],$t.prototype,"setTransform",null),Vt([Qt()],$t.prototype,"resetTransform",null),Vt([Qt()],$t.prototype,"getTransform",null),Vt([Qt()],$t.prototype,"save",null),Vt([Qt()],$t.prototype,"restore",null),Vt([Qt()],$t.prototype,"transform",null),Vt([Qt()],$t.prototype,"translate",null),Vt([Qt()],$t.prototype,"scale",null),Vt([Qt()],$t.prototype,"rotate",null),Vt([Qt()],$t.prototype,"fill",null),Vt([Qt()],$t.prototype,"stroke",null),Vt([Qt()],$t.prototype,"clip",null),Vt([Qt()],$t.prototype,"fillRect",null),Vt([Qt()],$t.prototype,"strokeRect",null),Vt([Qt()],$t.prototype,"clearRect",null),Vt([Qt()],$t.prototype,"beginPath",null),Vt([Qt()],$t.prototype,"moveTo",null),Vt([Qt()],$t.prototype,"lineTo",null),Vt([Qt()],$t.prototype,"bezierCurveTo",null),Vt([Qt()],$t.prototype,"quadraticCurveTo",null),Vt([Qt()],$t.prototype,"closePath",null),Vt([Qt()],$t.prototype,"arc",null),Vt([Qt()],$t.prototype,"arcTo",null),Vt([Qt()],$t.prototype,"ellipse",null),Vt([Qt()],$t.prototype,"rect",null),Vt([Qt()],$t.prototype,"roundRect",null),Vt([Qt()],$t.prototype,"createConicGradient",null),Vt([Qt()],$t.prototype,"createLinearGradient",null),Vt([Qt()],$t.prototype,"createPattern",null),Vt([Qt()],$t.prototype,"createRadialGradient",null),Vt([Qt()],$t.prototype,"fillText",null),Vt([Qt()],$t.prototype,"measureText",null),Vt([Qt()],$t.prototype,"strokeText",null);const Jt=new st,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class se extends $t{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=te),t.pixelRatio||(t.pixelRatio=It.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=It.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)),gt.copyAttrs(this,t,ee),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,Jt.copy(t).scale(this.pixelRatio),this.fillRect(Jt.x,Jt.y,Jt.width,Jt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Jt.copy(t).scale(this.pixelRatio),this.strokeRect(Jt.x,Jt.y,Jt.width,Jt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Jt.copy(t).scale(this.pixelRatio),e&&Jt.ceil(),this.clearRect(Jt.x,Jt.y,Jt.width,Jt.height)}clipWorld(t,e){this.beginPath(),Jt.copy(t).scale(this.pixelRatio),e&&Jt.ceil(),this.rect(Jt.x,Jt.y,Jt.width,Jt.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):Wt.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):Wt.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 ie(t,e,s){Object.defineProperty(t,e,s)}function re(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ne(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};ie(t,e,Object.assign(r,i||{})),xe(t,e,s)}function oe(t){return(e,s)=>{ne(e,s,t)}}function ae(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function he(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function le(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function de(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const ce=de;function ue(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ge(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function fe(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function ye(t){return(e,s)=>{ne(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 me(t){return(e,s)=>{ne(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 ve(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),mt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function we(t){return(e,s)=>{ie(e,"__DataProcessor",{get:()=>t})}}function xe(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=re(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const be=new mt("rewrite"),Be=[],ke=["destroy","constructor"];function Ee(t){return(e,s)=>{Be.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Te(){return t=>{Ce()}}function Ce(t){Be.length&&(Be.forEach((e=>{t&&be.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Be.length=0)}function Re(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(ke.includes(i)||e&&e.includes(i)))if(t.prototype){re(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Pe(){return t=>{Ft.register(t)}}function Le(){return t=>{Ut.register(t)}}setTimeout((()=>Ce(!0)));const{toOuterOf:Oe}=$;class Se{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;It.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={}),Oe(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Oe(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Oe(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 Me={},De={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=Ae(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=Ae(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=Ae(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 Ae(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Me)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Me)}}const Ie={__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:We}=T,{sin:Ne,cos:Fe}=Math,ze={__updateWorldMatrix(){const t=this.parent?this.parent.__world:We,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*Fe(r+o),t.b=s*Ne(r+o),t.c=i*-Ne(r-n),t.d=i*Fe(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:He,copyAndSpread:Ue}=$,Ye={__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,He(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else He(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){He(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){He(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){He(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(){Ue(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ue(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:je}=A,Xe={},Ve={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),je(t,this.__world,Xe),this.__hit(Xe)},__drawHitPath(t){this.__drawRenderPath(t)}},Ge={__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)}},Ke={__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:qe,create:Qe}=u;let Ze=class{get tag(){return this.__tag}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return yt}get __LayoutProcessor(){return Se}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=Qe(qe),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&&pt.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))}};Ze=Vt([Re(Ie),Re(ze),Re(Ye),Re(Ve),Re(De),Re(Ge)],Ze);const{setByListWithHandle:$e}=$,{sort:Je}=ct,{localBoxBounds:ts,localEventBounds:es,localRenderBounds:ss,maskLocalBoxBounds:is,maskLocalEventBounds:rs,maskLocalRenderBounds:ns}=dt;let os=class extends Ze{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(){$e(this.__layout.boxBounds,this.children,this.__hasMask?is:ts)}__updateStrokeBounds(){$e(this.__layout.strokeBounds,this.children,this.__hasMask?rs:es)}__updateRenderBounds(){$e(this.__layout.renderBounds,this.children,this.__hasMask?ns:ss)}__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(Je)}}__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&&pt.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()}};os=Vt([Re(Ke)],os);const as={};class hs{static isHoldSpaceKey(){return hs.hasDownCode("Space")}static setDownCode(t){as[t]||(as[t]=!0)}static setUpCode(t){as[t]=!1}static hasDownCode(t){return as[t]}}class ls{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class ds extends t{get spaceKey(){return hs.isHoldSpaceKey()}get left(){return ls.left(this)}get right(){return ls.right(this)}get middle(){return ls.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){Ut.changeName(t,e)}}let cs=class extends ds{};cs.POINTER="pointer",cs.BEFORE_DOWN="pointer.before_down",cs.BEFORE_MOVE="pointer.before_move",cs.BEFORE_UP="pointer.before_up",cs.DOWN="pointer.down",cs.MOVE="pointer.move",cs.UP="pointer.up",cs.OVER="pointer.over",cs.OUT="pointer.out",cs.ENTER="pointer.enter",cs.LEAVE="pointer.leave",cs.TAP="tap",cs.DOUBLE_TAP="double_tap",cs.CLICK="click",cs.DOUBLE_CLICK="double_click",cs.LONG_PRESS="long_press",cs.LONG_TAP="long_tap",cs=Vt([Le()],cs);let us=class extends cs{};var _s;us.DRAG="drag",us.START="drag.start",us.END="drag.end",us.OVER="drag.over",us.OUT="drag.out",us.ENTER="drag.enter",us.LEAVE="drag.leave",us=Vt([Le()],us);let ps=_s=class extends cs{static setList(t){_s.dragList=t instanceof d?t:new d(t)}static setData(t){this.dragData=t}};ps.DROP="drop",ps=_s=Vt([Le()],ps);let gs=class extends us{};gs.MOVE="move",gs.START="move.start",gs.END="move.end",gs=Vt([Le()],gs);let fs=class extends ds{};fs.ROTATE="rotate",fs.START="rotate.start",fs.END="rotate.end",fs=Vt([Le()],fs);let ys=class extends us{};ys.SWIPE="swipe",ys.LEFT="swipe.left",ys.RIGHT="swipe.right",ys.UP="swipe.up",ys.DOWN="swipe.down",ys=Vt([Le()],ys);let ms=class extends ds{};ms.ZOOM="zoom",ms.START="zoom.start",ms.END="zoom.end",ms=Vt([Le()],ms);let vs=class extends ds{};vs.DOWN="key.down",vs.PRESS="key.press",vs.UP="key.up",vs=Vt([Le()],vs);class ws{constructor(t,e){this.map={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Wt.image(t),this.map[t.url]=e),e}destory(){this.leafer=null,this.map=null}}const xs={creator:{},parse(t,e){},convertToCanvasData(t,e){}},bs={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Bs=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},bs),ks={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},Es={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},Ts=Object.assign(Object.assign({},Es),bs),Cs=Bs,Rs={};for(let t in Cs)Rs[Cs[t]]=t;const Ps={};for(let t in Cs)Ps[Cs[t]]=ks[t];const Ls={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:Os,cos:Ss,atan2:Ms,ceil:Ds,abs:As,PI:Is}=Math,{setPoint:Ws,addPoint:Ns}=F,{set:Fs}=A,zs={},Hs={rect(t,e,s,i,r){xs.creator.path=t,xs.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){xs.creator.path=[],Ls.drawRoundRect(xs.creator,e,s,i,r,n),t.push(...xs.convertToCanvasData(xs.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=Ms(u,c),v=Ms(p,_),w=v-m;if(w<0&&(w+=f),w===Is||As(c+u)<1e-12||As(_+p)<1e-12)return t&&t.push(Bs.L,i,r),h&&(Ws(h,e,s),Ns(h,i,r)),d&&Fs(d,e,s),void(l&&Fs(l,i,r));const x=c*p-_*u<0,b=x?-1:1,B=a/Ss(w/2),k=i+B*Ss(m+w/2+y*b),E=r+B*Os(m+w/2+y*b);return m-=y*b,v-=y*b,js(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)=>js(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,_=Os(u),p=Ss(u);let m=o*g,v=a*g;m>Is&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Ds(As(w/y)),b=w/x,B=Os(b/4),k=8/3*B*B/Os(b/2);v=m+b;let E,T,C,R,P,L,O,S,M=Ss(m),D=Os(m),A=C=p*i*M-_*r*D,I=R=_*i*M+p*r*D,W=e+C,N=s+R;t&&t.push(Bs.L,W,N),l&&Ws(l,W,N),c&&Fs(c,W,N);for(let n=0;n<x;n++)E=Ss(v),T=Os(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(Bs.C,P,L,O,S,e+C,s+R),l&&Ys(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&&Fs(d,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Bs.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){Ys(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?Ns(h,t,e):Ws(h,t,e),Ns(h,o,a);for(let l=0,c=d.length;l<c;l++)Us(d[l],t,e,s,i,r,n,o,a,zs),Ns(h,zs.x,zs.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 Us(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Us,toTwoPointBounds:Ys,ellipse:js}=Hs,{sin:Xs,cos:Vs,sqrt:Gs,atan2:Ks}=Math,{ellipse:qs}=Hs,Qs={ellipticalArc(t,e,s,i,r,n,o,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=n*g,p=Xs(_),y=Vs(_),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=Gs(1-k/(w*x));i*=t,r*=t}else E=(o===a?-1:1)*Gs(k/(w*b+x*B));const T=E*i*v/r,C=-E*r*m/i,R=Ks((v-C)/r,(m-T)/i),P=Ks((-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?qs(t,O,S,i,r,n,R/g,P/g,M):i!==r||n?t.push(Bs.G,O,S,i,r,n,R/g,P/g,M):t.push(Bs.O,O,S,i,R/g,P/g,M)}},{M:Zs,m:$s,L:Js,l:ti,H:ei,h:si,V:ii,v:ri,C:ni,c:oi,S:ai,s:hi,Q:li,q:di,T:ci,t:ui,A:_i,a:pi,Z:gi,z:fi,N:yi,D:mi,X:vi,G:wi,F:xi,O:bi,P:Bi,U:ki}=Bs,{rect:Ei,roundRect:Ti,arcTo:Ci,arc:Ri,ellipse:Pi,quadraticCurveTo:Li}=Hs,{ellipticalArc:Oi}=Qs,Si=mt.get("PathConvert"),Mi={},Di={current:{},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=Ps[s],o+=s===i?" ":Rs[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?Ts:Es;for(let e=0,h=t.length;e<h;e++)i=t[e],rt[i]?n+=i:Bs[i]?(n&&(Ii(o,Number(n)),n=""),Ai.name=Bs[i],Ai.length=ks[i],Ai.index=0,Ii(o,Ai.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Ii(o,Number(n)),n=i):n&&(Ii(o,Number(n)),n=""),r=i;return n&&Ii(o,Number(n)),s?Di.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 $s:t[c+1]+=a,t[c+2]+=h;case Zs:a=t[c+1],h=t[c+2],_.push(Zs,a,h),c+=3;break;case si:t[c+1]+=a;case ei:a=t[c+1],_.push(Js,a,h),c+=2;break;case ri:t[c+1]+=h;case ii:h=t[c+1],_.push(Js,a,h),c+=2;break;case ti:t[c+1]+=a,t[c+2]+=h;case Js:a=t[c+1],h=t[c+2],_.push(Js,a,h),c+=3;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ai;case ai:o=n===ni||n===ai,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(ni,l,d,s,i,a,h),c+=5;break;case oi: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=ni;case ni:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ni,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ui:t[c+1]+=a,t[c+2]+=h,r=ci;case ci:o=n===li||n===ci,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Li(_,a,h,s,i,t[c+1],t[c+2]):_.push(li,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=li;case li:s=t[c+1],i=t[c+2],e?Li(_,a,h,s,i,t[c+3],t[c+4]):_.push(li,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case pi:t[c+6]+=a,t[c+7]+=h;case _i:Oi(_,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 fi:case gi:_.push(gi),c++;break;case yi:a=t[c+1],h=t[c+2],e?Ei(_,a,h,t[c+3],t[c+4]):Wi(_,t,c,5),c+=5;break;case mi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Wi(_,t,c,9),c+=9;break;case vi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],t[c+5]):Wi(_,t,c,6),c+=6;break;case wi:Pi(e?_:Wi(_,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,Mi),a=Mi.x,h=Mi.y,c+=9;break;case xi:e?Pi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Wi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bi:Ri(e?_:Wi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Mi),a=Mi.x,h=Mi.y,c+=7;break;case Bi:e?Ri(_,t[c+1],t[c+2],t[c+3],0,360,!1):Wi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ki:Ci(e?_:Wi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Mi),a=Mi.x,h=Mi.y,c+=6;break;default:return Si.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){Ai.index===Ai.length&&(Ai.index=1,t.push(Ai.name)),t.push(e),Ai.index++}},{current:Ai,pushData:Ii,copyData:Wi}=Di,{M:Ni,L:Fi,C:zi,Q:Hi,Z:Ui,N:Yi,D:ji,X:Xi,G:Vi,F:Gi,O:Ki,P:qi,U:Qi}=Bs,Zi={},$i={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ni,e,s)},lineTo(t,e,s){t.push(Fi,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(zi,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Hi,e,s,i,r)},closePath(t){t.push(Ui)},rect(t,e,s,i,r){t.push(Yi,e,s,i,r)},roundRect(t,e,s,i,r,n){if("number"==typeof n)t.push(Xi,e,s,i,r,n);else{const o=p.fourNumber(n);o?t.push(ji,e,s,i,r,...o):t.push(Yi,e,s,i,r)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Gi,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Vi,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(qi,e,s,i):(void 0===n&&(n=360),t.push(Ki,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),Hs.ellipse(null,e,s,i,r,n,o,a,h,null,null,Zi),t.push(Ni,Zi.x,Zi.y),Ji(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),Hs.arc(null,e,s,i,r,n,o,null,null,Zi),t.push(Ni,Zi.x,Zi.y),tr(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(Qi,e,s,i,r,n)}},{ellipse:Ji,arc:tr}=$i,{moveTo:er,lineTo:sr,quadraticCurveTo:ir,bezierCurveTo:rr,closePath:nr,beginPath:or,rect:ar,roundRect:hr,ellipse:lr,arc:dr,arcTo:cr,moveToEllipse:ur,moveToArc:_r}=$i;class pr{constructor(t){this.path=t?"string"==typeof t?xs.parse(t):t:[]}beginPath(){return or(this.path),this}moveTo(t,e){return er(this.path,t,e),this}lineTo(t,e){return sr(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return rr(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return ir(this.path,t,e,s,i),this}closePath(){return nr(this.path),this}rect(t,e,s,i){return ar(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return hr(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return lr(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return dr(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return cr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return ur(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return _r(this.path,t,e,s,i,r,n),this}}const{M:gr,L:fr,C:yr,Q:mr,Z:vr,N:wr,D:xr,X:br,G:Br,F:kr,O:Er,P:Tr,U:Cr}=Bs,Rr=mt.get("PathDrawer"),Pr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case gr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case fr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case yr:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case mr:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case vr:t.closePath(),i+=1;break;case wr:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case xr: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 br:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Br: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 kr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Er: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 Tr:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Cr:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Rr.error(`command: ${s} [index:${i}]`,e)}}},{M:Lr,L:Or,C:Sr,Q:Mr,Z:Dr,N:Ar,D:Ir,X:Wr,G:Nr,F:Fr,O:zr,P:Hr,U:Ur}=Bs,{toTwoPointBounds:Yr,toTwoPointBoundsByQuadraticCurve:jr,arcTo:Xr,arc:Vr,ellipse:Gr}=Hs,{add:Kr,copy:qr,addPoint:Qr,setPoint:Zr,addBounds:$r,toBounds:Jr}=F,tn=mt.get("PathBounds");let en,sn,rn;const nn={},on={},an={},hn={toBounds(t,e){hn.toTwoPointBounds(t,on),Jr(on,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Zr(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===Dr||s===Sr||s===Mr?Zr(e,h,l):Zr(e,t[a+1],t[a+2])),s){case Lr:case Or:h=t[a+1],l=t[a+2],Qr(e,h,l),a+=3;break;case Sr:n=t[a+5],o=t[a+6],Yr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,nn),Kr(e,nn),h=n,l=o,a+=7;break;case Mr:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],jr(h,l,i,r,n,o,nn),Kr(e,nn),h=n,l=o,a+=5;break;case Dr:a+=1;break;case Ar:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ir:case Wr:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=s===Ir?9:6;break;case Nr:Gr(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],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=9;break;case Fr:h=t[a+1],l=t[a+2],sn=t[a+3],rn=t[a+4],$r(e,h-sn,l-rn,2*sn,2*rn),h+=sn,a+=5;break;case zr:Vr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=7;break;case Hr:h=t[a+1],l=t[a+2],en=t[a+3],$r(e,h-en,l-en,2*en,2*en),h+=en,a+=4;break;case Ur:Xr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=6;break;default:return void tn.error(`command: ${s} [index:${a}]`,t)}}},ln={smooth:(t,e,s)=>t};xs.creator=new pr,xs.parse=Di.parse,xs.convertToCanvasData=Di.toCanvasData;const dn=mt.get("plugin"),cn={powers:{},list:[]};class un{constructor(t){this.taskTime=1,this.id=u.create(u.TASK),this.task=t}run(){return Gt(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 _n=mt.get("TaskProcessor");class pn{constructor(t,e){this.updatedList=new d,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=gt.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 gn=mt.get("Renderer");class fn{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=gt.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,gn.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){gn.error(t)}gn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?gn.warn("rendering"):this.times>3?gn.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 gn.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=xt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new st).copy(i);s.save(),r&&!mt.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(),xt.end(e)}fullRender(){const t=xt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),xt.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),mt.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),mt.showHitView&&this.renderHitView(s),mt.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();It.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&&(gn.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:yn}=$;class mn{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=yn(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 vn{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=gt.default(e,this.config)),this.findPath=new mn(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(Wt,{watcher:(t,e)=>new pn(t,e),layouter:(t,e)=>new At(t,e),renderer:(t,e,s)=>new fn(t,e,s),selector:(t,e)=>new vn(t,e)});const wn=mt.get("LeaferCanvas");class xn extends se{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){wn.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 wn.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={};gt.copyAttrs(l,this,ee),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:bn}=Ls;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){bn(this,t,e,s,i,r)})}();class Bn{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 kn{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(gs.START,this.moveData)}t.path=this.moveData.path,e.emit(gs.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(ms.START,this.zoomData)}t.path=this.zoomData.path,e.emit(ms.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(fs.START,this.rotateData)}t.path=this.rotateData.path,e.emit(fs.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(gs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(ms.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(fs.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const En={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?ys.UP:t>45&&t<135?ys.DOWN:t<=45&&t>=-45?ys.RIGHT:ys.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:Tn.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}},Tn=En,{getDragEventData:Cn,getDropEventData:Rn,getSwipeEventData:Pn,filterPathByEventType:Ln}=En;class On{constructor(t){this.interaction=t}setDragData(t){this.dragData=Cn(t,t,t)}getDragList(){return this.dragging?ps.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ls.middle(t)&&!ls.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ls.middle(t)||hs.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(gs.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Cn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(gs.MOVE,this.dragData):this.dragging&&(s.emit(us.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ls.left(t)&&e,this.dragging&&(this.interaction.emit(us.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Ln(this.dragData.path,us.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=>{nt.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(us.OUT,t,s),e.emit(us.OVER,t,i)):e.emit(us.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(us.ENTER,t,i,s),e.emit(us.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=Cn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(gs.END,n),this.dragging&&(e.emit(us.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=Pn(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Rn(t,this.getDragList(),ps.dragData);e.path=this.dragEnterPath,this.interaction.emit(ps.DROP,e),this.interaction.emit(us.LEAVE,t,this.dragEnterPath)}dragReset(){ps.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 Sn=["move","zoom","rotate"];function Mn(t,e,s,i,r){if(Sn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!An(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&&Dn(n,e,s,i,r)}}function Dn(t,e,s,i,r){if(t.__.hitSelf&&t.hasEvent(e,i)&&!An(t,r)){s.phase=i?1:t===s.target?2:3;const r=Ut.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function An(t,e){return e&&e.has(t)}const{pathHasEventType:In}=En;class Wn{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 kn(this),this.dragger=new On(this),i&&(this.config=gt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(cs.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(cs.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ls.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(cs.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:cs.MOVE});t.path=e.path,this.emit(cs.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(cs.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(cs.UP,t),this.emit(cs.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(cs.OUT,t,this.overPath),this.emit(cs.OVER,t,e)):this.emit(cs.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(cs.ENTER,t,e,this.enterPath),this.emit(cs.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(cs.LEAVE,t),this.dragger.dragging&&this.emit(ps.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=[cs.DOUBLE_TAP,cs.DOUBLE_CLICK].some((e=>In(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(cs.TAP,t),this.emit(cs.CLICK,t)}emitDoubleTap(t){this.emit(cs.DOUBLE_TAP,t),this.emit(cs.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(cs.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(cs.LONG_TAP,t),In(t.path,cs.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],Dn(r,t,e,!0,i))return;r.isApp&&Mn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&Mn(r,t,e,!1,i),Dn(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 Nn={convert(t,e){const s=En.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=En.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=Nn.getTouch(t),i=En.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]},Fn={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}},zn={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=It.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:Hn,getZoomEventData:Un,getRotateEventData:Yn}=En;class jn extends Wn{__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){hs.setDownCode(t.code)}onKeyUp(t){hs.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(Nn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Nn.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(Nn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Nn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Nn.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(Nn.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=Nn.getTouch(t);this.pointerDown(Nn.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Nn.getTouch(t);this.pointerMove(Nn.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=Nn.getTouch(t);this.pointerUp(Nn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Fn.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Fn.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}=Fn.getData(r,n),d=En.getBase(t);this.rotate(Yn(l,a,d)),this.zoom(Un(l,h,d)),this.move(Hn(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):zn.getScale(t,e),i=this.getLocal(t),r=En.getBase(t);1!==s?this.zoom(Un(i,s,r)):this.move(Hn(i,e.getMove?e.getMove(t,e):zn.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=En.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(Un(e,i*i,s)),this.rotate(Yn(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(Wt,{canvas:(t,e)=>new xn(t,e),image:t=>new Bn(t),hitCanvas:(t,e)=>new xn(t,e),interaction:(t,e,s,i)=>new jn(t,e,s,i)}),It.requestRender=function(t){window.requestAnimationFrame(t)},It.canvas=Wt.canvas(),It.devicePixelRatio=devicePixelRatio,It.conicGradientSupport=!!It.canvas.context.createConicGradient;const{userAgent:Xn}=navigator;Xn.indexOf("Firefox")>-1?(It.conicGradientRotate90=!0,It.intWheelDeltaY=!0):Xn.indexOf("Safari")>-1&&-1===Xn.indexOf("Chrome")&&(It.fullImageShadow=!0);const Vn=mt.get("LeaferTypeCreator"),Gn={list:{},register(t,e){Kn[t]?Vn.error("repeat:",t):Kn[t]=e},run(t,e){const s=Gn.list[t];s?s(e):Vn.error("no",t)}},{list:Kn}=Gn;Gn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),Gn.register("design",(function(t){const{MOVE:e}=gs,{ZOOM:s}=ms;t.__eventIds.push(t.on_(e,(e=>{nt.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&&nt.zoomOf(t.zoomLayer,e,n)})))}));const qn={},Qn={},{copy:Zn,toOffsetOutBounds:$n}=$,Jn={},to={};function eo(t,e,s,i){const{bounds:r,shapeBounds:n}=i;if(It.fullImageShadow){if(Zn(Jn,t.bounds),Jn.x+=e.x-n.x,Jn.y+=e.y-n.y,s){const{matrix:t}=i;Jn.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),Jn.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),Jn.width*=s,Jn.height*=s}t.copyWorld(i.canvas,t.bounds,Jn)}else s&&(Zn(Jn,e),Jn.x-=e.width/2*(s-1),Jn.y-=e.height/2*(s-1),Jn.width*=s,Jn.height*=s),t.copyWorld(i.canvas,n,s?Jn:e)}const{toOffsetOutBounds:so}=$,io={};var ro=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;so(l,io),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(io.offsetX+t.x*c,io.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,eo(_,io,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;$n(l,to),a.forEach(((t,a)=>{_.setWorldShadow(to.offsetX+t.x*c,to.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,eo(_,to,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 no(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 oo(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),co(t,e);break;case"inside":ao(t,e,s,"inside");break;case"outside":ao(t,e,s,"outside")}}function ao(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,co(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",no(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function ho(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),lo(t,s,e);break;case"inside":ao(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,lo(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",no(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function lo(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),co(t,s),s.restoreBlendMode()):co(t,s)}))}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.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 uo(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:_o,getOuterOf:po,getByMove:go,getIntersectData:fo}=$;const yo={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:mo,rotateOf:vo,translate:wo,scaleOf:xo,scale:bo,rotate:Bo}=T;function ko(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=mo(),wo(t,r.x,r.y));break;case"clip":(n||o||l)&&(t=function(t,e,s,i){const r=mo();wo(r,t.x,t.y),e&&wo(r,e.x,e.y);s&&("number"==typeof s?bo(r,s):bo(r,s.x,s.y));i&&Bo(r,i);return r}(r,n,o,l));break;case"repeat":(!u||o||l)&&(t=function(t,e,s,i,r){const n=mo();if(r)switch(Bo(n,r),r){case 90:wo(n,s,0);break;case 180:wo(n,e,s);break;case 270:wo(n,0,e)}wo(n,t.x,t.y),i&&xo(n,t,i);return n}(r,d,c,o,l));break;default:u&&!l||(t=function(t,e,s,i,r){const n=mo(),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;wo(n,d,c),bo(n,l),r&&vo(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=It.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 Eo={x:.5,y:0},To={x:.5,y:1};function Co(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,yo.string(i.color,s))}const{set:Ro,getAngle:Po,getDistance:Lo}=A,{get:Oo,rotateOf:So,scaleOf:Mo}=T,Do={x:.5,y:.5},Ao={x:.5,y:1},Io={},Wo={};const{set:No,getAngle:Fo,getDistance:zo}=A,{get:Ho,rotateOf:Uo,scaleOf:Yo}=T,jo={x:.5,y:.5},Xo={x:.5,y:1},Vo={},Go={};function Ko(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=qo(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function qo(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:yo.string(o,a)};case"image":return ko(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:r,blendMode:n,opacity:o}=t;s||(s=Eo),i||(i=To);const a=It.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 Co(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=Do),i||(i=Ao);const{x:h,y:l,width:d,height:c}=e;let u;Ro(Io,h+s.x*d,l+s.y*c),Ro(Wo,h+i.x*d,l+i.y*c),(d!==c||a)&&(u=Oo(),Mo(u,Io,d/c*(a||1),1),So(u,Io,Po(Io,Wo)+90));const _=It.canvas.createRadialGradient(Io.x,Io.y,0,Io.x,Io.y,Lo(Io,Wo));return Co(_,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=jo),i||(i=Xo);const{x:h,y:l,width:d,height:c}=e;No(Vo,h+s.x*d,l+s.y*c),No(Go,h+i.x*d,l+i.y*c);const u=Ho(),_=Fo(Vo,Go);It.conicGradientRotate90?(Yo(u,Vo,d/c*(a||1),1),Uo(u,Vo,_+90)):(Yo(u,Vo,1,d/c*(a||1)),Uo(u,Vo,_));const p=It.conicGradientSupport?It.canvas.createConicGradient(0,Vo.x,Vo.y):It.canvas.createRadialGradient(Vo.x,Vo.y,0,Vo.x,Vo.y,zo(Vo,Go));return Co(p,t.stops,n),{type:r,blendMode:o,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:yo.string(e)}:void 0}}var Qo=Object.freeze({__proto__:null,computeFill:function(t){Ko(t,"fill")},computeStroke:function(t){Ko(t,"stroke")},drawText:no,drawTextStroke:co,fill:function(t,e,s){e.fillStyle=s,t.__.__font?no(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?no(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?no(t,e):e.fill(r),e.restoreBlendMode()):n?no(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=fo(i?_o(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=po(h,n),r=go(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)oo(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:oo,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)ho(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),uo(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),uo(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.__),uo(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:ho});Object.assign(qn,ro),Object.assign(Qn,Qo);class Zo extends yt{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:Qn.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:Qn.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 $o={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Jo extends Zo{}class ta extends Jo{get __boxStroke(){return!0}}class ea extends Zo{get __boxStroke(){return!0}}const{parse:sa}=Di;const ia={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ra extends ea{}function na(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function oa(t){return(e,s)=>{ne(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const aa={__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}},ha={__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)}},la={__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&&Qn.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&Qn.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=Qn.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&qn.shadow(this,t,n),s&&(this.__.__isFills?Qn.fills(this,t,s):Qn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&qn.innerShadow(this,t,n),i&&(this.__.__isStrokes?Qn.strokes(this,t,i):Qn.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?Qn.fills(this,t,s):Qn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Qn.strokes(this,t,i):Qn.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&&Qn.fill(this,t,"#000000"),i&&Qn.stroke(this,t,"#000000")}},da={__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 ca=class extends Ze{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Di.toCanvasData(e,!0):e:[]}getPathString(t){return Di.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Qn.computeFill(this),e&&Qn.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?ln.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 Ft.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};Vt([we(Zo)],ca.prototype,"__",void 0),Vt([oe("")],ca.prototype,"id",void 0),Vt([oe("")],ca.prototype,"name",void 0),Vt([oe("")],ca.prototype,"className",void 0),Vt([ge("pass-through")],ca.prototype,"blendMode",void 0),Vt([fe(1)],ca.prototype,"opacity",void 0),Vt([fe(!0)],ca.prototype,"visible",void 0),Vt([me(!1)],ca.prototype,"isMask",void 0),Vt([ye(0)],ca.prototype,"zIndex",void 0),Vt([oe()],ca.prototype,"locked",void 0),Vt([ae(0)],ca.prototype,"x",void 0),Vt([ae(0)],ca.prototype,"y",void 0),Vt([de(100)],ca.prototype,"width",void 0),Vt([de(100)],ca.prototype,"height",void 0),Vt([he(1)],ca.prototype,"scaleX",void 0),Vt([he(1)],ca.prototype,"scaleY",void 0),Vt([le(0)],ca.prototype,"rotation",void 0),Vt([le(0)],ca.prototype,"skewX",void 0),Vt([le(0)],ca.prototype,"skewY",void 0),Vt([oe(!1)],ca.prototype,"draggable",void 0),Vt([ve(!0)],ca.prototype,"hittable",void 0),Vt([ve("path")],ca.prototype,"hitFill",void 0),Vt([_e("path")],ca.prototype,"hitStroke",void 0),Vt([ve(!0)],ca.prototype,"hitChildren",void 0),Vt([ve(!0)],ca.prototype,"hitSelf",void 0),Vt([ge()],ca.prototype,"fill",void 0),Vt([_e()],ca.prototype,"stroke",void 0),Vt([_e("inside")],ca.prototype,"strokeAlign",void 0),Vt([_e(1)],ca.prototype,"strokeWidth",void 0),Vt([_e("none")],ca.prototype,"strokeCap",void 0),Vt([_e("miter")],ca.prototype,"strokeJoin",void 0),Vt([_e()],ca.prototype,"dashPattern",void 0),Vt([_e()],ca.prototype,"dashOffset",void 0),Vt([_e(10)],ca.prototype,"miterLimit",void 0),Vt([ce()],ca.prototype,"cornerRadius",void 0),Vt([ce()],ca.prototype,"cornerSmoothing",void 0),Vt([na()],ca.prototype,"shadow",void 0),Vt([na()],ca.prototype,"innerShadow",void 0),Vt([na()],ca.prototype,"blur",void 0),Vt([na()],ca.prototype,"backgroundBlur",void 0),Vt([na()],ca.prototype,"grayscale",void 0),Vt([Ee(Pr.drawPathByData)],ca.prototype,"__drawPathByData",null),ca=Vt([Re(aa),Re(ha),Re(la),Te()],ca);let ua=class extends ca{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){}};Vt([we(Jo)],ua.prototype,"__",void 0),ua=Vt([Re(os),Pe()],ua);let _a=class extends ca{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)}};Vt([we(ea)],_a.prototype,"__",void 0),_a=Vt([Re(da),Pe()],_a);const pa=_a.prototype,ga=ua.prototype,fa={},{copy:ya,add:ma}=$;let va=class extends ua{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;ya(fa,t),super.__updateRenderBounds(),ma(t,fa)}}__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)}};Vt([we(ta)],va.prototype,"__",void 0),Vt([pe("show")],va.prototype,"overflow",void 0),Vt([Ee(pa.__updateStrokeSpread)],va.prototype,"__updateStrokeSpread",null),Vt([Ee(pa.__updateRenderSpread)],va.prototype,"__updateRectRenderSpread",null),Vt([Ee(pa.__updateBoxBounds)],va.prototype,"__updateBoxBounds",null),Vt([Ee(pa.__updateStrokeBounds)],va.prototype,"__updateStrokeBounds",null),Vt([Ee(pa.__updateRenderBounds)],va.prototype,"__updateRectRenderBounds",null),Vt([Ee(pa.__updateChange)],va.prototype,"__updateRectChange",null),Vt([Ee(pa.__drawPathByData)],va.prototype,"__drawPathByData",null),Vt([Ee(pa.__render)],va.prototype,"__renderRect",null),Vt([Ee(ga.__render)],va.prototype,"__renderGroup",null),va=Vt([Te(),Pe()],va);let wa=class extends va{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Vt([we(class extends ta{})],wa.prototype,"__",void 0),Vt([pe("hide")],wa.prototype,"overflow",void 0),wa=Vt([Pe()],wa);const{moveTo:xa,closePath:ba,ellipse:Ba}=$i;let ka=class extends ca{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&&Ba(a,n,o,n*s,o*s,0,i,r,!1),Ba(a,n,o,n,o,0,r,i,!0),s<1&&ba(a)):(s<1&&(Ba(a,n,o,n*s,o*s),xa(a,t,o)),Ba(a,n,o,n,o,0,0,360,!0)):i||r?(xa(a,n,o),Ba(a,n,o,n,o,0,i,r,!1),ba(a)):Ba(a,n,o,n,o)}};Vt([we(class extends Zo{get __boxStroke(){return!0}})],ka.prototype,"__",void 0),Vt([ce(0)],ka.prototype,"innerRadius",void 0),Vt([ce(0)],ka.prototype,"startAngle",void 0),Vt([ce(0)],ka.prototype,"endAngle",void 0),ka=Vt([Pe()],ka);const{sin:Ea,cos:Ta,PI:Ca}=Math,{moveTo:Ra,lineTo:Pa,closePath:La}=$i;let Oa=class extends ca{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=[];Ra(n,i,0);for(let t=1;t<s;t++)Pa(n,i+i*Ea(2*t*Ca/s),r-r*Ta(2*t*Ca/s));La(n)}};Vt([we(class extends Zo{})],Oa.prototype,"__",void 0),Vt([ce(3)],Oa.prototype,"sides",void 0),Oa=Vt([Pe()],Oa);const{sin:Sa,cos:Ma,PI:Da}=Math,{moveTo:Aa,lineTo:Ia,closePath:Wa}=$i;let Na=class extends ca{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=[];Aa(o,r,0);for(let t=1;t<2*s;t++)Ia(o,r+(t%2==0?r:r*i)*Sa(t*Da/s),n-(t%2==0?n:n*i)*Ma(t*Da/s));Wa(o)}};Vt([we(class extends Zo{})],Na.prototype,"__",void 0),Vt([ce(5)],Na.prototype,"points",void 0),Vt([ce(.382)],Na.prototype,"innerRadius",void 0),Na=Vt([Pe()],Na);const{moveTo:Fa,lineTo:za}=$i,{rotate:Ha,getAngle:Ua,getDistance:Ya,defaultPoint:ja}=A,{setPoint:Xa,addPoint:Va,toBounds:Ga}=F,Ka={};let qa=class extends ca{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&&Ha(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Ya(ja,t),this.rotation=Ua(ja,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Fa(t,0,0);const e=this.toPoint;za(t,e.x,e.y)}__updateBoxBounds(){Xa(Ka,0,0),Va(Ka,this.__toPoint.x,this.__toPoint.y),Ga(Ka,this.__layout.boxBounds)}};Vt([we(class extends Zo{})],qa.prototype,"__",void 0),Vt([de()],qa.prototype,"rotation",void 0),Vt([ue("center")],qa.prototype,"strokeAlign",void 0),qa=Vt([Pe()],qa);let Qa=class extends _a{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()}};Vt([we(ra)],Qa.prototype,"__",void 0),Vt([de("")],Qa.prototype,"url",void 0),Qa=Vt([Pe()],Qa);let Za=class extends _a{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Wt.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()}};Vt([we(ra)],Za.prototype,"__",void 0),Vt([oa(100)],Za.prototype,"width",void 0),Vt([oa(100)],Za.prototype,"height",void 0),Vt([oa(It.devicePixelRatio)],Za.prototype,"pixelRatio",void 0),Vt([oa(!0)],Za.prototype,"smooth",void 0),Vt([ve("all")],Za.prototype,"hitFill",void 0),Za=Vt([Pe()],Za);const $a=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",Ja=$a+"_#~&*+\\=|≮≯≈≠=…";function th(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const eh=th("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),sh=th("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),ih=th($a),rh=th(Ja),nh=th("- —/~|┆·");var oh;!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"}(oh||(oh={}));const{Letter:ah,Single:hh,Before:lh,After:dh,Symbol:ch,Break:uh}=oh;function _h(t){return eh[t]?ah:nh[t]?uh:/[\u3400-\u9FBF]/.test(t)?hh:sh[t]?lh:ih[t]?dh:rh[t]?ch:ah}const ph={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 gh(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:fh}=ph,{Letter:yh,Single:mh,Before:vh,After:wh,Symbol:xh,Break:bh}=oh;let Bh,kh,Eh,Th,Ch,Rh,Ph,Lh,Oh,Sh,Mh,Dh,Ah,Ih,Wh=[];function Nh(t,e){Bh.data.push({char:t,width:e}),Eh+=e}function Fh(){Th+=Eh,Bh.width=Eh,kh.words.push(Bh),Bh={data:[]},Eh=0}function zh(){Dh&&(Ah.paraNumber++,kh.paraStart=!0,Dh=!1),kh.width=Th,fh(kh),Wh.push(kh),kh.width>Ih.width&&(Ih.width=kh.width),kh={words:[]},Th=0}const Hh=0,Uh=1,Yh=2;const jh={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:It.canvas.font=l};return function(t,e,s){Ah=t,Wh=t.rows,Ih=t.bounds;const{__letterSpacing:i,paraIndent:r,textCase:n}=s,{canvas:o}=It,{width:a,height:h}=Ih;if(a||h||i||n){Dh=!0,Oh=null,Eh=Th=0,Bh={data:[]},kh={words:[]};for(let t=0,s=e.length;t<s;t++)Rh=e[t],"\n"===Rh?(Eh&&Fh(),kh.paraEnd=!0,zh(),Dh=!0):(Lh=_h(Rh),Lh===yh&&"none"!==n&&(Rh=gh(Rh,n,!Eh)),Ph=o.measureText(Rh).width,i&&(Ph+=i),Sh=Lh===mh&&(Oh===mh||Oh===yh)||Oh===mh&&Lh!==wh,Mh=!(Lh!==vh&&Lh!==mh||Oh!==xh&&Oh!==wh),Ch=Dh&&r?a-r:a,a&&Th+Eh+Ph>Ch&&(Mh||(Mh=Lh===yh&&Oh==wh),Sh||Mh||Lh===bh||Lh===vh||Lh===mh||Eh+Ph>Ch?(Eh&&Fh(),zh()):zh())," "===Rh&&Th+Eh===0||(Lh===bh?(" "===Rh&&Eh&&Fh(),Nh(Rh,Ph),Fh()):Sh||Mh?(Eh&&Fh(),Nh(Rh,Ph)):Nh(Rh,Ph)),Oh=Lh);Eh&&Fh(),Th&&zh(),Wh[Wh.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{Ah.paraNumber++,Wh.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?Hh:l>.01?Uh:Yh,c===Yh?(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===Uh?(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=It.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:Xh,includes:Vh,spread:Gh}=$;let Kh=class extends ca{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=jh.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=$o.number(r,a),t.__letterSpacing=$o.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&&Gh(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 _=Vh(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(){Xh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};Vt([we(class extends Zo{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ia[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Kh.prototype,"__",void 0),Vt([de(0)],Kh.prototype,"width",void 0),Vt([de(0)],Kh.prototype,"height",void 0),Vt([de(0)],Kh.prototype,"padding",void 0),Vt([ue("outside")],Kh.prototype,"strokeAlign",void 0),Vt([de("")],Kh.prototype,"text",void 0),Vt([de("L")],Kh.prototype,"fontFamily",void 0),Vt([de(12)],Kh.prototype,"fontSize",void 0),Vt([de("normal")],Kh.prototype,"fontWeight",void 0),Vt([de(!1)],Kh.prototype,"italic",void 0),Vt([de("none")],Kh.prototype,"textCase",void 0),Vt([de("none")],Kh.prototype,"textDecoration",void 0),Vt([de(0)],Kh.prototype,"letterSpacing",void 0),Vt([de({type:"percent",value:150})],Kh.prototype,"lineHeight",void 0),Vt([de(0)],Kh.prototype,"paraIndent",void 0),Vt([de(0)],Kh.prototype,"paraSpacing",void 0),Vt([de("left")],Kh.prototype,"textAlign",void 0),Vt([de("top")],Kh.prototype,"verticalAlign",void 0),Vt([de("show")],Kh.prototype,"textOverflow",void 0),Kh=Vt([Pe()],Kh);const{toBounds:qh}=hn;let Qh=class extends ca{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){qh(this.__.path,this.__layout.boxBounds)}};Vt([we(class extends Zo{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=sa(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],Qh.prototype,"__",void 0),Vt([ce()],Qh.prototype,"path",void 0),Vt([ce()],Qh.prototype,"windingRule",void 0),Vt([ue("center")],Qh.prototype,"strokeAlign",void 0),Qh=Vt([Pe()],Qh);let Zh=class extends ua{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Qh(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")}};Vt([we(class extends Jo{})],Zh.prototype,"__",void 0),Zh=Vt([Re(pr,["beginPath"]),Pe()],Zh);const $h=mt.get("Leafer");let Jh=class extends ua{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&>.assign(this.config,t);const{config:i}=this;Gn.run(i.type,this),this.canvas=Wt.canvas(i),this.__controllers.push(this.renderer=Wt.renderer(this,this.canvas,i),this.watcher=Wt.watcher(this,i),this.layouter=Wt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Wt.selector(this),this.__controllers.unshift(this.interaction=Wt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new jt,this.hitCanvasManager=new Xt,this.imageManager=new ws(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=gt.copyAttrs({},t,ee);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=gt.copyAttrs({},this.canvas,ee);this.canvas.resize(t),this.__onResize(new r(t,e))}__onResize(t){this.emitEvent(t),gt.copyAttrs(this.__,t,ee),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&&(ee.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&&ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=gt.copyAttrs({},this.canvas,ee);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=xt.start("FirstCreate "+this.innerName);this.once(l.START,(()=>xt.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){$h.error(t)}}};Vt([we(class extends Jo{})],Jh.prototype,"__",void 0),Vt([de()],Jh.prototype,"pixelRatio",void 0),Jh=Vt([Pe()],Jh);let tl=class extends Jh{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,(()=>{mt.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 Jh(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&>.assign(e,t),e.view=this.realCanvas?void 0:this.view,e.fill=e.hittable=e.realCanvas=void 0,this.autoLayout&>.copyAttrs(e,this,ee),e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};tl=Vt([Pe()],tl);var el=Object.freeze({__proto__:null,Animate:{},get App(){return tl},AutoBounds:it,BezierHelper:Hs,Bounds:st,BoundsHelper:$,get Box(){return va},get Branch(){return os},BranchHelper:ct,get Canvas(){return Za},CanvasManager:jt,ChildEvent:e,Creator:Wt,DataHelper:gt,Debug:mt,get DragEvent(){return us},get DropEvent(){return ps},Effect:qn,get Ellipse(){return ka},EllipseHelper:Qs,Event:t,EventCreator:Ut,Export:{},get Frame(){return wa},get Group(){return ua},HitCanvasManager:Xt,get Image(){return Qa},ImageEvent:i,ImageManager:ws,IncrementId:u,Interaction:jn,get KeyEvent(){return vs},Keyboard:hs,LayoutEvent:a,Layouter:At,get Leaf(){return Ze},LeafBounds:Ye,LeafBoundsHelper:dt,LeafData:yt,LeafDataProxy:Ie,LeafEventer:De,LeafHelper:nt,LeafHit:Ve,LeafLevelList:c,LeafList:d,LeafMask:Ke,LeafMatrix:ze,LeafRender:Ge,get Leafer(){return Jh},LeaferCanvas:xn,LeaferCanvasBase:se,LeaferEvent:l,LeaferImage:Bn,LeaferTypeCreator:Gn,get Line(){return qa},MathHelper:p,Matrix:N,MatrixHelper:T,get MoveEvent(){return gs},NeedConvertToCanvasCommandMap:Es,OneRadian:g,PI2:f,PI_2:y,Paint:Qn,get Path(){return Qh},PathBounds:hn,PathCommandDataHelper:$i,PathCommandMap:Bs,PathConvert:Di,PathCorner:ln,PathCreator:pr,PathDrawer:Pr,PathHelper:xs,PathNumberCommandLengthMap:Ps,PathNumberCommandMap:Rs,get Pen(){return Zh},Platform:It,Plugin:cn,Point:W,PointHelper:A,PointerButton:ls,get PointerEvent(){return cs},get Polygon(){return Oa},PropertyEvent:s,get Rect(){return _a},RectHelper:Ls,RectRender:da,RenderEvent:h,Renderer:fn,ResizeEvent:r,get RotateEvent(){return fs},Run:xt,Selector:vn,get Star(){return Na},StringNumberMap:rt,get SwipeEvent(){return ys},TaskItem:un,TaskProcessor:class{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 un(t),e)}addParallel(t,e){const s=new un(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new un(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){_n.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)}},get Text(){return Kh},TransformEvent:n,TwoPointBounds:class{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)}},TwoPointBoundsHelper:F,get UI(){return ca},UIBounds:aa,UICreator:Ft,UIEvent:ds,UIHit:ha,UIRender:la,WaitHelper:pt,WatchEvent:o,Watcher:pn,get ZoomEvent(){return ms},affectRenderBoundsType:pe,affectStrokeBoundsType:ue,aliasType:function(t){return(e,s)=>{ie(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}},boundsType:de,canvasSizeAttrs:ee,dataProcessor:we,dataType:oe,defineDataProcessor:xe,defineKey:ie,defineLeafAttr:ne,effectType:na,getDescriptor:re,hitType:ve,layoutProcessor:function(t){return(e,s)=>{ie(e,"__LayoutProcessor",{get:()=>t})}},maskType:me,opacityType:fe,pathType:ce,positionType:ae,registerUI:Pe,registerUIEvent:Le,resizeType:oa,rewrite:Ee,rewriteAble:Te,rotationType:le,scaleType:he,setDefaultValue:function(t,e,s){xe(t.prototype,e,s)},sortType:ye,strokeType:_e,surfaceType:ge,useModule:Re,usePlugin:function(t){if(cn.list.push(t),t.import){const e={};t.import.forEach((t=>{cn.powers[t]?e[t]=cn.powers[t]:dn.error(t+" non-existent")})),t.run(e)}else dn.error("no dependencies")}});window.LeaferUI=cn.powers=el;
|