leafer-ui 1.0.0-beta.1 → 1.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- class t{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class e extends t{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}e.ADD="child.add",e.REMOVE="child.remove";class s extends t{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}s.CHANGE="property.change";class i extends t{constructor(t,e,s,i,r,o){super(t,e),this.image=s,this.attrName=i,this.attrValue=r,o&&(this.error=o)}}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 o extends t{constructor(t,e){super(t),e&&Object.assign(this,e)}}o.START="transform.start",o.CHANGE="transform.change",o.END="transform.end",o.BEFORE_START="transform.before_start",o.BEFORE_CHANGE="transform.before_change",o.BEFORE_END="transform.before_end";class n extends t{constructor(t,e){super(t),this.data=e}}n.REQUEST="watch.request",n.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,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},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){R.toInnerPoint(t,e,k),R.scaleOfInner(t,k,s,i)},scaleOfInner(t,e,s,i=s){R.translateInner(t,e.x,e.y),R.scale(t,s,i),R.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=v(e*=g),i=m(e),{a:r,b:o,c:n,d:a}=t;t.a=r*s-o*i,t.b=r*i+o*s,t.c=n*s-a*i,t.d=n*i+a*s},rotateOf(t,e,s){R.toInnerPoint(t,e,k),R.rotateOfInner(t,k,s)},rotateOfInner(t,e,s){R.translateInner(t,e.x,e.y),R.rotate(t,s),R.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=g,t.a=i+o*s,t.b=r+n*s),e&&(e*=g,t.c=o+i*e,t.d=n+r*e)},skewOf(t,e,s,i){R.toInnerPoint(t,e,k),R.skewOfInner(t,k,s,i)},skewOfInner(t,e,s,i){R.translateInner(t,e.x,e.y),R.skew(t,s,i),R.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},preMultiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+o*e.c,t.d=r*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){R.multiply(t,R.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=R;return R.copy(e,t),R.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t,a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(r*l-o*h)*d,s.y=(o*n-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*n-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let o=e,n=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;o=b(i),n=t/o;const r=e/o;a=s>0?w(r):-w(r),h=x(d/i)/g}else{const e=i*i+r*r;n=b(e),o=t/n;const s=i/n;a=B/2-(r>0?w(-s):-w(s)),l=x(d/e)/g}a/=g}return{x:t.e,y:t.f,scaleX:o,scaleY:n,rotation:a,skewX:h,skewY:l}},reset(t){R.set(t)}},R=T,{toInnerPoint:C,toOuterPoint:O}=T,{sin:L,cos:P,abs:S,sqrt:D,atan2:M}=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=P(e*g),r=L(e*g),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r-n*i},tempToInnerOf(t,e){const{tempPoint:s}=I;return I.copy(s,t),C(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),C(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){C(e,t,s)},toOuterOf(t,e,s){O(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 D(s*s+i*i)},getAngle:(t,e)=>I.getAtan2(t,e)/g,getAtan2:(t,e)=>M(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=I.getAtan2(t,e);return{x:t.x+P(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,o){"object"==typeof t?T.copy(this,t):T.set(this,t,e,s,i,r,o)}set(t,e,s,i,r,o){T.set(this,t,e,s,i,r,o)}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:Y,setPoint:U,addPoint:j,toBounds:X}=F,{toOuterPoint:H}=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,H(e,Q,Z),U(Y,Z.x,Z.y),Q.x=t.x+t.width,H(e,Q,Z),j(Y,Z.x,Z.y),Q.y=t.y+t.height,H(e,Q,Z),j(Y,Z.x,Z.y),Q.x=t.x,H(e,Q,Z),j(Y,Z.x,Z.y),X(Y,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,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||et(t,r)):tt(t,r));o&&J.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?U(Y,t.x,t.y):j(Y,t.x,t.y)})),X(Y,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:o,height:n}=e;return V=i+o,G=r+n,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,o=V-i,n=G-r,{x:i,y:r,width:o,height:n}},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,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new st(r,e,o||t.width-r-s,n||t.height-e-i)}}class rt{constructor(t,e){F.setPoint(this,t,e)}addPoint(t,e){F.addPoint(this,t,e)}addBounds(t,e,s,i){F.addBounds(this,t,e,s,i)}add(t){F.add(this,t)}}const ot={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++)ht(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},updateAllChange(t){if(lt(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)dt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),at.moveLocal(t,i.x,i.y)},moveLocal(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOf(t,e,s,i,r){const o=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,i,r)},zoomOfLocal(t,e,s,i,r){i||(i=s),r||(r=t);const{x:o,y:n}=r.__,a=(new N).translate(o,n).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:o}=i.__,n=(new N).translate(r,o).rotateOf(e,s);i.x=n.e,i.y=n.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},at=nt,{updateAllWorldMatrix:ht,updateAllWorldOpacity:lt,updateAllChange:dt}=at,ct={worldBounds:t=>t.__world,localBoxBounds:t=>t.__local,localEventBounds:t=>t.__layout.localStrokeBounds,localRenderBounds:t=>t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.isMask?t.__local:null,maskLocalEventBounds:t=>t.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.isMask?t.__layout.localRenderBounds:null},ut={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.push(t),_t(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)pt(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:_t,pushAllBranchStack:pt}=ut,gt={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},ft={default:(t,e)=>(yt(e,t),yt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?yt(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:yt}=ft;class mt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]:e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__input:e}=this;let s,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}destroy(){this.__leaf=null}}class vt{constructor(t){this.name=t}static get(t){return new vt(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}vt.filterList=[],vt.excludeList=[];const wt=vt,xt=vt.get("RunTime");class bt{static start(t,e){const s=u.create(u.RUNTIME);return Bt.currentId=Bt.idMap[s]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[s]=t,Bt.nameToIdMap[t]=s,s}static end(t,e){const s=Bt.idMap[t],i=Bt.nameMap[t];Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[i]=void 0,e?xt.log(i,performance.now()-s,"µs"):xt.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}}bt.idMap={},bt.nameMap={},bt.nameToIdMap={};const Bt=bt,{updateAllWorldMatrix:kt,updateAllWorldOpacity:Et}=nt,{pushAllChildBranch:Tt,pushAllParent:Rt}=ut;const{worldBounds:Ct}=ct,{setByListWithHandle:Ot}=$;class Lt{constructor(t){this.updatedBounds=new st,this.beforeBounds=new st,this.afterBounds=new st,t instanceof Array&&(t=new d(t)),this.updatedList=t}setBefore(){Ot(this.beforeBounds,this.updatedList.list,Ct)}setAfter(){Ot(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:Pt,updateAllChange:St}=nt,{pushAllBranchStack:Dt,updateWorldBoundsByBranchStack:Mt}=ut,At=vt.get("Layouter");class It{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,e&&(this.config=ft.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(a.START),this.layoutOnce(),t.emitEvent(new a(a.END,this.layoutedBlocks,this.times))}catch(t){At.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?At.warn("layouting"):this.times>3?At.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(n.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updateList)||void 0===t?void 0:t.length))return;const e=bt.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=a,h=this.getBlocks(i);h.forEach((t=>{t.setBefore()})),s.emitEvent(new a(r,h,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(kt(t),e.push(t),t.isBranch&&Tt(t,e),Rt(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Rt(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&Et(t),t.__updateChange()}))}(i),h.forEach((t=>t.setAfter())),s.emitEvent(new a(o,h,this.times)),s.emitEvent(new a(n,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updateList=null,bt.end(e)}fullLayout(){const t=bt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=a,o=this.getBlocks(new d(e));e.emitEvent(new a(s,o,this.times)),It.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new a(i,o,this.times)),e.emitEvent(new a(r,o,this.times)),this.addBlocks(o),bt.end(t)}static fullLayout(t){if(Pt(t),t.isBranch){const e=[t];Dt(t,e),Mt(e)}else t.__updateWorldBounds();St(t)}createBlock(t){return new Lt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(a.REQUEST,this.layout,this),t.on_(a.AGAIN,this.layoutAgain,this),t.on_(n.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Wt={layout:It.fullLayout},Nt={},Ft=vt.get("UICreator"),zt={list:{},register(t){const{__tag:e}=t.prototype;Yt[e]?Ft.error("repeat:",e):Yt[e]=t},get(t,e,s,i,r,o){const n=new Yt[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),o&&(n.height=o)),n}},{list:Yt}=zt,Ut=vt.get("EventCreator"),jt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Xt[e]?Ut.error("repeat: ",e):Xt[e]=t)}))},changeName(t,e){const s=Xt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,Xt[e]=s)}},get:(t,...e)=>new Xt[t](...e)},{nameList:Xt}=jt;class Ht{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Nt.canvas(t);return this.add(i),i}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destory(){this.clear()}}class Vt extends Ht{constructor(){super(...arguments),this.pathTypeList=new d,this.imageTypeList=new d}get(t){}getImageType(t,e){return this.imageTypeList.push(t),Nt.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),Nt.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}function Gt(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Kt(t,e,s,i){return new(s||(s=Promise))((function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}function qt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const Qt=[];function Zt(){return(t,e)=>{Qt.push(e)}}const $t=[];let Jt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||$t)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};Gt([qt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Gt([qt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Gt([qt("globalAlpha")],Jt.prototype,"opacity",void 0),Gt([qt()],Jt.prototype,"fillStyle",void 0),Gt([qt()],Jt.prototype,"strokeStyle",void 0),Gt([qt("lineWidth")],Jt.prototype,"strokeWidth",void 0),Gt([qt("lineCap")],Jt.prototype,"strokeCap",void 0),Gt([qt("lineJoin")],Jt.prototype,"strokeJoin",void 0),Gt([qt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Gt([qt()],Jt.prototype,"miterLimit",void 0),Gt([qt()],Jt.prototype,"shadowBlur",void 0),Gt([qt()],Jt.prototype,"shadowColor",void 0),Gt([qt()],Jt.prototype,"shadowOffsetX",void 0),Gt([qt()],Jt.prototype,"shadowOffsetY",void 0),Gt([qt()],Jt.prototype,"filter",void 0),Gt([qt()],Jt.prototype,"font",void 0),Gt([qt()],Jt.prototype,"fontKerning",void 0),Gt([qt()],Jt.prototype,"fontStretch",void 0),Gt([qt()],Jt.prototype,"fontVariantCaps",void 0),Gt([qt()],Jt.prototype,"textAlign",void 0),Gt([qt()],Jt.prototype,"textBaseline",void 0),Gt([qt()],Jt.prototype,"textRendering",void 0),Gt([qt()],Jt.prototype,"wordSpacing",void 0),Gt([qt()],Jt.prototype,"letterSpacing",void 0),Gt([qt()],Jt.prototype,"direction",void 0),Gt([Zt()],Jt.prototype,"setTransform",null),Gt([Zt()],Jt.prototype,"resetTransform",null),Gt([Zt()],Jt.prototype,"getTransform",null),Gt([Zt()],Jt.prototype,"save",null),Gt([Zt()],Jt.prototype,"restore",null),Gt([Zt()],Jt.prototype,"transform",null),Gt([Zt()],Jt.prototype,"translate",null),Gt([Zt()],Jt.prototype,"scale",null),Gt([Zt()],Jt.prototype,"rotate",null),Gt([Zt()],Jt.prototype,"fill",null),Gt([Zt()],Jt.prototype,"stroke",null),Gt([Zt()],Jt.prototype,"clip",null),Gt([Zt()],Jt.prototype,"fillRect",null),Gt([Zt()],Jt.prototype,"strokeRect",null),Gt([Zt()],Jt.prototype,"clearRect",null),Gt([Zt()],Jt.prototype,"beginPath",null),Gt([Zt()],Jt.prototype,"moveTo",null),Gt([Zt()],Jt.prototype,"lineTo",null),Gt([Zt()],Jt.prototype,"bezierCurveTo",null),Gt([Zt()],Jt.prototype,"quadraticCurveTo",null),Gt([Zt()],Jt.prototype,"closePath",null),Gt([Zt()],Jt.prototype,"arc",null),Gt([Zt()],Jt.prototype,"arcTo",null),Gt([Zt()],Jt.prototype,"ellipse",null),Gt([Zt()],Jt.prototype,"rect",null),Gt([Zt()],Jt.prototype,"roundRect",null),Gt([Zt()],Jt.prototype,"createConicGradient",null),Gt([Zt()],Jt.prototype,"createLinearGradient",null),Gt([Zt()],Jt.prototype,"createPattern",null),Gt([Zt()],Jt.prototype,"createRadialGradient",null),Gt([Zt()],Jt.prototype,"fillText",null),Gt([Zt()],Jt.prototype,"measureText",null),Gt([Zt()],Jt.prototype,"strokeText",null);const te=new st,ee={width:1,height:1,pixelRatio:1},se=["width","height","pixelRatio"];class ie extends Jt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(t,e){super(),this.worldTransform={},t||(t=ee),t.pixelRatio||(t.pixelRatio=Wt.devicePixelRatio),this.manager=e,this.innerId=u.create(u.CNAVAS);const{width:s,height:i,pixelRatio:r}=t;this.autoLayout=!s||!i,this.pixelRatio=r,this.offscreen=Wt.isWorker||t.offscreen,this.config=t,this.init(),this.textBaseline="alphabetic"}init(){}setBackgroundColor(t){}setHittable(t){}resize(t){if(this.isSameSize(t))return;const{width:e,height:s}=t;let i;this.context&&!this.unreal&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this)),ft.copyAttrs(this,t,se),this.bounds=new st(0,0,e,s),this.unreal||(this.setViewSize(t),this.smooth=this.config.smooth),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}setViewSize(t){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*o+t.b*a)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*o+t.d*a)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*o+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,$.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,te.copy(t).scale(this.pixelRatio),this.fillRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,te.copy(t).scale(this.pixelRatio),this.strokeRect(te.x,te.y,te.width,te.height),s&&(this.blendMode="source-over")}clearWorld(t,e){te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.clearRect(te.x,te.y,te.width,te.height)}clipWorld(t,e){this.beginPath(),te.copy(t).scale(this.pixelRatio),e&&te.ceil(),this.rect(te.x,te.y,te.width,te.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:e,height:s,pixelRatio:i}=this,r={width:e,height:s,pixelRatio:i},o=this.manager?this.manager.get(r):Nt.canvas(r);if(o.save(),t){const t=this.worldTransform;o.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return o}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:r}=this;t&&(s+=t),e&&(i+=e);const o={width:s,height:i,pixelRatio:r},n=this.manager?this.manager.get(o):Nt.canvas(o);return n.save(),n}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function re(t,e,s){Object.defineProperty(t,e,s)}function oe(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ne(t){return(e,s)=>{re(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function ae(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};re(t,e,Object.assign(r,i||{})),Ee(t,e,s)}function he(t){return(e,s)=>{ae(e,s,t)}}function le(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function de(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function ce(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function ue(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const ge=pe;function fe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ye(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function me(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function ve(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function we(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.parent?this.parent.__updateMask(t):this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function xe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),vt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function be(t){return(e,s)=>{re(e,"__DataProcessor",{get:()=>t})}}function Be(t){return(e,s)=>{re(e,"__LayoutProcessor",{get:()=>t})}}function ke(t,e,s){Ee(t.prototype,e,s)}function Ee(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s&&(n.get=function(){return this[r]});const a=oe(i,e);a&&a.set&&(n.set=a.set),i[o]&&(n.set=i[o],delete i[o]),Object.defineProperty(i,e,n)}const Te=new vt("rewrite"),Re=[],Ce=["destroy","constructor"];function Oe(t){return(e,s)=>{Re.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Le(){return t=>{Pe()}}function Pe(t){Re.length&&(Re.forEach((e=>{t&&Te.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Re.length=0)}function Se(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Ce.includes(i)||e&&e.includes(i)))if(t.prototype){oe(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function De(){return t=>{zt.register(t)}}function Me(){return t=>{jt.register(t)}}setTimeout((()=>Pe(!0)));const{toOuterOf:Ae}=$;class Ie{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange()}checkUpdate(){const{leafer:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():(t.start(),t.layouter.layout());else{let t=this.leaf;for(;t.parent;)t=t.parent;Wt.layout(t)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),T.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Ae(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ae(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Ae(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const We={},Ne={on(t,e,s){let i,r,o;if(s){const t="boolean"==typeof s;i=t?s:s.capture,r=!t&&s.once}const n=Fe(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let i,r,o;s&&(i="boolean"==typeof s?s:s.capture);const n=Fe(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(o=r.findIndex((t=>t.listener===e)),o>-1&&r.splice(o,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=Fe(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&(r=i[o],r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Fe(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:We)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:We)}}const ze={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:i}=s,r=new s(i,this,t,this.__.__get(t),e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:Ye}=T,{sin:Ue,cos:je}=Math,Xe={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Ye,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:o,skewY:n}=this.__;r||o||n?(r*=g,o&&(o*=g),n&&(n*=g),t.a=s*je(r+n),t.b=s*Ue(r+n),t.c=i*-Ue(r-o),t.d=i*je(r-o)):(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:Ve}=$,Ge={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,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(){Ve(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ve(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Ke}=A,qe={},Qe={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Ke(t,this.__world,qe),this.__hit(qe)},__drawHitPath(t){this.__drawRenderPath(t)}},Ze={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__draw(t,e))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},$e={__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},{LEAF:Je,create:ts}=u;let es=class{get tag(){return this.__tag}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return mt}get __LayoutProcessor(){return Ie}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return this.__hasMask&&this.__.hitChildren}constructor(t){this.innerId=ts(Je),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&gt.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateMask(){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?T.toInnerPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}localToWorld(t,e,s){this.parent?T.toOuterPoint(this.parent.worldTransform,t,e,s):e&&A.copy(e,t)}worldToInner(t,e,s){T.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){T.toOuterPoint(this.worldTransform,t,e,s)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){this.parent&&this.parent.remove(this)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null,this.children&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};es=Gt([Se(ze),Se(Xe),Se(Ge),Se(Qe),Se(Ne),Se(Ze)],es);const{setByListWithHandle:ss}=$,{sort:is}=ut,{localBoxBounds:rs,localEventBounds:os,localRenderBounds:ns,maskLocalBoxBounds:as,maskLocalEventBounds:hs,maskLocalRenderBounds:ls}=ct;let ds=class extends es{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ss(this.__layout.boxBounds,this.children,this.__hasMask?as:rs)}__updateStrokeBounds(){ss(this.__layout.strokeBounds,this.children,this.__hasMask?hs:os)}__updateRenderBounds(){ss(this.__layout.renderBounds,this.children,this.__hasMask?ls:ns)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(is)}}__render(t,e){if(this.__worldOpacity){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,n,o),o.clear(),n.clear()):r=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:r,hideBounds:o}=e;for(let n=0,a=i.length;n<a;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}}add(t,s){if(t.parent&&t.parent.remove(t),t.parent=this,void 0===s?this.children.push(t):this.children.splice(s,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&gt.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready)){const{ADD:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}remove(t){if(t){const s=this.children.indexOf(t);if(s>-1&&(this.children.splice(s,1),this.__hasMask&&this.__updateMask(),this.__layout.boxChange(),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready))){const{REMOVE:s}=e,i=new e(s,t,this);t.hasEvent(s)&&t.emitEvent(i),this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}else super.remove()}};ds=Gt([Se($e)],ds);const cs={};class us{static isHoldSpaceKey(){return us.hasDownCode("Space")}static setDownCode(t){cs[t]||(cs[t]=!0)}static setUpCode(t){cs[t]=!1}static hasDownCode(t){return cs[t]}}class _s{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class ps extends t{get spaceKey(){return us.isHoldSpaceKey()}get left(){return _s.left(this)}get right(){return _s.right(this)}get middle(){return _s.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){jt.changeName(t,e)}}let gs=class extends ps{};gs.POINTER="pointer",gs.BEFORE_DOWN="pointer.before_down",gs.BEFORE_MOVE="pointer.before_move",gs.BEFORE_UP="pointer.before_up",gs.DOWN="pointer.down",gs.MOVE="pointer.move",gs.UP="pointer.up",gs.OVER="pointer.over",gs.OUT="pointer.out",gs.ENTER="pointer.enter",gs.LEAVE="pointer.leave",gs.TAP="tap",gs.DOUBLE_TAP="double_tap",gs.CLICK="click",gs.DOUBLE_CLICK="double_click",gs.LONG_PRESS="long_press",gs.LONG_TAP="long_tap",gs=Gt([Me()],gs);let fs=class extends gs{};var ys;fs.DRAG="drag",fs.START="drag.start",fs.END="drag.end",fs.OVER="drag.over",fs.OUT="drag.out",fs.ENTER="drag.enter",fs.LEAVE="drag.leave",fs=Gt([Me()],fs);let ms=ys=class extends gs{static setList(t){ys.dragList=t instanceof d?t:new d(t)}static setData(t){this.dragData=t}};ms.DROP="drop",ms=ys=Gt([Me()],ms);let vs=class extends fs{};vs.MOVE="move",vs.START="move.start",vs.END="move.end",vs=Gt([Me()],vs);let ws=class extends ps{};ws.ROTATE="rotate",ws.START="rotate.start",ws.END="rotate.end",ws=Gt([Me()],ws);let xs=class extends fs{};xs.SWIPE="swipe",xs.LEFT="swipe.left",xs.RIGHT="swipe.right",xs.UP="swipe.up",xs.DOWN="swipe.down",xs=Gt([Me()],xs);let bs=class extends ps{};bs.ZOOM="zoom",bs.START="zoom.start",bs.END="zoom.end",bs=Gt([Me()],bs);let Bs=class extends ps{};Bs.DOWN="key.down",Bs.PRESS="key.press",Bs.UP="key.up",Bs=Gt([Me()],Bs);class ks{constructor(t,e){this.map={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Nt.image(t),this.map[t.url]=e),e}destory(){this.leafer=null,this.map=null}}const Es={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ts={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Rs=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ts),Cs={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},Os={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ls=Object.assign(Object.assign({},Os),Ts),Ps=Rs,Ss={};for(let t in Ps)Ss[Ps[t]]=t;const Ds={};for(let t in Ps)Ds[Ps[t]]=Cs[t];const Ms={drawRoundRect(t,e,s,i,r,o){let[n,a,h,l]=p.fourNumber(o);const d=Math.min(i/2,r/2);n>d&&(n=d),a>d&&(a=d),h>d&&(h=d),l>d&&(l=d),n?t.moveTo(e+n,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),n?t.arcTo(e,s,e+i,s,n):t.lineTo(e,s)}},{sin:As,cos:Is,atan2:Ws,ceil:Ns,abs:Fs,PI:zs}=Math,{setPoint:Ys,addPoint:Us}=F,{set:js}=A,Xs={},Hs={rect(t,e,s,i,r){Es.creator.path=t,Es.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Es.creator.path=[],Ms.drawRoundRect(Es.creator,e,s,i,r,o),t.push(...Es.convertToCanvasData(Es.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let m=Ws(u,c),v=Ws(p,_),w=v-m;if(w<0&&(w+=f),w===zs||Fs(c+u)<1e-12||Fs(_+p)<1e-12)return t&&t.push(Rs.L,i,r),h&&(Ys(h,e,s),Us(h,i,r)),d&&js(d,e,s),void(l&&js(l,i,r));const x=c*p-_*u<0,b=x?-1:1,B=a/Is(w/2),k=i+B*Is(m+w/2+y*b),E=r+B*As(m+w/2+y*b);return m-=y*b,v-=y*b,Ks(t,k,E,a,a,0,m/g,v/g,x,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>Ks(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*g,_=As(u),p=Is(u);let m=n*g,v=a*g;m>zs&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Ns(Fs(w/y)),b=w/x,B=As(b/4),k=8/3*B*B/As(b/2);v=m+b;let E,T,R,C,O,L,P,S,D=Is(m),M=As(m),A=R=p*i*D-_*r*M,I=C=_*i*D+p*r*M,W=e+R,N=s+C;t&&t.push(Rs.L,W,N),l&&Ys(l,W,N),c&&js(c,W,N);for(let o=0;o<x;o++)E=Is(v),T=As(v),R=p*i*E-_*r*T,C=_*i*E+p*r*T,O=e+A-k*(p*i*M+_*r*D),L=s+I-k*(_*i*M-p*r*D),P=e+R+k*(p*i*T+_*r*E),S=s+C+k*(_*i*T-p*r*E),t&&t.push(Rs.C,O,L,P,S,e+R,s+C),l&&Gs(e+A,s+I,O,L,P,S,e+R,s+C,l,!0),A=R,I=C,D=E,M=T,m=v,v+=b;d&&js(d,e+R,s+C)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Rs.C,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){Gs(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Us(h,t,e):Ys(h,t,e),Us(h,n,a);for(let l=0,c=d.length;l<c;l++)Vs(d[l],t,e,s,i,r,o,n,a,Xs),Us(h,Xs.x,Xs.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return Vs(t,e,s,i,r,o,n,a,h,l),l}},{getPointAndSet:Vs,toTwoPointBounds:Gs,ellipse:Ks}=Hs,{sin:qs,cos:Qs,sqrt:Zs,atan2:$s}=Math,{ellipse:Js}=Hs,ti={ellipticalArc(t,e,s,i,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-s)/2,_=o*g,p=qs(_),y=Qs(_),m=-y*c-p*u,v=-y*u+p*c,w=i*i,x=r*r,b=v*v,B=m*m,k=w*x-w*b-x*B;let E=0;if(k<0){const t=Zs(1-k/(w*x));i*=t,r*=t}else E=(n===a?-1:1)*Zs(k/(w*b+x*B));const T=E*i*v/r,R=-E*r*m/i,C=$s((v-R)/r,(m-T)/i),O=$s((-v-R)/r,(-m-T)/i);let L=O-C;0===a&&L>0?L-=f:1===a&&L<0&&(L+=f);const P=e+c+y*T-p*R,S=s+u+p*T+y*R,D=L<0?1:0;d?Js(t,P,S,i,r,o,C/g,O/g,D):i!==r||o?t.push(Rs.G,P,S,i,r,o,C/g,O/g,D):t.push(Rs.O,P,S,i,C/g,O/g,D)}},{M:ei,m:si,L:ii,l:ri,H:oi,h:ni,V:ai,v:hi,C:li,c:di,S:ci,s:ui,Q:_i,q:pi,T:gi,t:fi,A:yi,a:mi,Z:vi,z:wi,N:xi,D:bi,X:Bi,G:ki,F:Ei,O:Ti,P:Ri,U:Ci}=Rs,{rect:Oi,roundRect:Li,arcTo:Pi,arc:Si,ellipse:Di,quadraticCurveTo:Mi}=Hs,{ellipticalArc:Ai}=ti,Ii=vt.get("PathConvert"),Wi={},Ni={current:{},stringify(t){let e,s,i,r=0,o=t.length,n="";for(;r<o;){s=t[r],e=Ds[s],n+=s===i?" ":Ss[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,o="";const n=[],a=e?Ls:Os;for(let e=0,h=t.length;e<h;e++)i=t[e],ot[i]?o+=i:Rs[i]?(o&&(zi(n,Number(o)),o=""),Fi.name=Rs[i],Fi.length=Cs[i],Fi.index=0,zi(n,Fi.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&zi(n,Number(o)),o=i):o&&(zi(n,Number(o)),o=""),r=i;return o&&zi(n,Number(o)),s?Ni.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case si:t[c+1]+=a,t[c+2]+=h;case ei:a=t[c+1],h=t[c+2],_.push(ei,a,h),c+=3;break;case ni:t[c+1]+=a;case oi:a=t[c+1],_.push(ii,a,h),c+=2;break;case hi:t[c+1]+=h;case ai:h=t[c+1],_.push(ii,a,h),c+=2;break;case ri:t[c+1]+=a,t[c+2]+=h;case ii:a=t[c+1],h=t[c+2],_.push(ii,a,h),c+=3;break;case ui:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ci;case ci:n=o===li||o===ci,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(li,l,d,s,i,a,h),c+=5;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=li;case li:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(li,t[c+1],t[c+2],s,i,a,h),c+=7;break;case fi:t[c+1]+=a,t[c+2]+=h,r=gi;case gi:n=o===_i||o===gi,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Mi(_,a,h,s,i,t[c+1],t[c+2]):_.push(_i,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=_i;case _i:s=t[c+1],i=t[c+2],e?Mi(_,a,h,s,i,t[c+3],t[c+4]):_.push(_i,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case mi:t[c+6]+=a,t[c+7]+=h;case yi:Ai(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case wi:case vi:_.push(vi),c++;break;case xi:a=t[c+1],h=t[c+2],e?Oi(_,a,h,t[c+3],t[c+4]):Yi(_,t,c,5),c+=5;break;case bi:a=t[c+1],h=t[c+2],e?Li(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Yi(_,t,c,9),c+=9;break;case Bi:a=t[c+1],h=t[c+2],e?Li(_,a,h,t[c+3],t[c+4],t[c+5]):Yi(_,t,c,6),c+=6;break;case ki:Di(e?_:Yi(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Wi),a=Wi.x,h=Wi.y,c+=9;break;case Ei:e?Di(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Yi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ti:Si(e?_:Yi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Wi),a=Wi.x,h=Wi.y,c+=7;break;case Ri:e?Si(_,t[c+1],t[c+2],t[c+3],0,360,!1):Yi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ci:Pi(e?_:Yi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Wi),a=Wi.x,h=Wi.y,c+=6;break;default:return Ii.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Fi.index===Fi.length&&(Fi.index=1,t.push(Fi.name)),t.push(e),Fi.index++}},{current:Fi,pushData:zi,copyData:Yi}=Ni,{M:Ui,L:ji,C:Xi,Q:Hi,Z:Vi,N:Gi,D:Ki,X:qi,G:Qi,F:Zi,O:$i,P:Ji,U:tr}=Rs,er={},sr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ui,e,s)},lineTo(t,e,s){t.push(ji,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Xi,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Hi,e,s,i,r)},closePath(t){t.push(Vi)},rect(t,e,s,i,r){t.push(Gi,e,s,i,r)},roundRect(t,e,s,i,r,o){if("number"==typeof o)t.push(qi,e,s,i,r,o);else{const n=p.fourNumber(o);n?t.push(Ki,e,s,i,r,...n):t.push(Gi,e,s,i,r)}},ellipse(t,e,s,i,r,o,n,a,h){void 0===o?t.push(Zi,e,s,i,r):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Qi,e,s,i,r,o,n,a,h?1:0))},arc(t,e,s,i,r,o,n){void 0===r?t.push(Ji,e,s,i):(void 0===o&&(o=360),t.push($i,e,s,i,r,o,n?1:0))},moveToEllipse(t,e,s,i,r,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Hs.ellipse(null,e,s,i,r,o,n,a,h,null,null,er),t.push(Ui,er.x,er.y),ir(t,e,s,i,r,o,n,a,h)},moveToArc(t,e,s,i,r,o,n){void 0===r&&(r=0),void 0===o&&(o=360),Hs.arc(null,e,s,i,r,o,n,null,null,er),t.push(Ui,er.x,er.y),rr(t,e,s,i,r,o,n)},arcTo(t,e,s,i,r,o){t.push(tr,e,s,i,r,o)}},{ellipse:ir,arc:rr}=sr,{moveTo:or,lineTo:nr,quadraticCurveTo:ar,bezierCurveTo:hr,closePath:lr,beginPath:dr,rect:cr,roundRect:ur,ellipse:_r,arc:pr,arcTo:gr,moveToEllipse:fr,moveToArc:yr}=sr;class mr{constructor(t){this.path=t?"string"==typeof t?Es.parse(t):t:[]}beginPath(){return dr(this.path),this}moveTo(t,e){return or(this.path,t,e),this}lineTo(t,e){return nr(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,o){return hr(this.path,t,e,s,i,r,o),this}quadraticCurveTo(t,e,s,i){return ar(this.path,t,e,s,i),this}closePath(){return lr(this.path),this}rect(t,e,s,i){return cr(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return ur(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,o,n,a){return _r(this.path,t,e,s,i,r,o,n,a),this}arc(t,e,s,i,r,o){return pr(this.path,t,e,s,i,r,o),this}arcTo(t,e,s,i,r){return gr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,o,n,a){return fr(this.path,t,e,s,i,r,o,n,a),this}moveToArc(t,e,s,i,r,o){return yr(this.path,t,e,s,i,r,o),this}}const{M:vr,L:wr,C:xr,Q:br,Z:Br,N:kr,D:Er,X:Tr,G:Rr,F:Cr,O:Or,P:Lr,U:Pr}=Rs,Sr=vt.get("PathDrawer"),Dr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case vr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case wr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case xr:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case br:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Br:t.closePath(),i+=1;break;case kr:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Er:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Tr:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Rr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*g,e[i+6]*g,e[i+7]*g,e[i+8]),i+=9;break;case Cr:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Or:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*g,e[i+5]*g,e[i+6]),i+=7;break;case Lr:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Pr:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Sr.error(`command: ${s} [index:${i}]`,e)}}},{M:Mr,L:Ar,C:Ir,Q:Wr,Z:Nr,N:Fr,D:zr,X:Yr,G:Ur,F:jr,O:Xr,P:Hr,U:Vr}=Rs,{toTwoPointBounds:Gr,toTwoPointBoundsByQuadraticCurve:Kr,arcTo:qr,arc:Qr,ellipse:Zr}=Hs,{add:$r,copy:Jr,addPoint:to,setPoint:eo,addBounds:so,toBounds:io}=F,ro=vt.get("PathBounds");let oo,no,ao;const ho={},lo={},co={},uo={toBounds(t,e){uo.toTwoPointBounds(t,lo),io(lo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return eo(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Nr||s===Ir||s===Wr?eo(e,h,l):eo(e,t[a+1],t[a+2])),s){case Mr:case Ar:h=t[a+1],l=t[a+2],to(e,h,l),a+=3;break;case Ir:o=t[a+5],n=t[a+6],Gr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,ho),$r(e,ho),h=o,l=n,a+=7;break;case Wr:i=t[a+1],r=t[a+2],o=t[a+3],n=t[a+4],Kr(h,l,i,r,o,n,ho),$r(e,ho),h=o,l=n,a+=5;break;case Nr:a+=1;break;case Fr:h=t[a+1],l=t[a+2],so(e,h,l,t[a+3],t[a+4]),a+=5;break;case zr:case Yr:h=t[a+1],l=t[a+2],so(e,h,l,t[a+3],t[a+4]),a+=s===zr?9:6;break;case Ur:Zr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],ho,co),0===a?Jr(e,ho):$r(e,ho),h=co.x,l=co.y,a+=9;break;case jr:h=t[a+1],l=t[a+2],no=t[a+3],ao=t[a+4],so(e,h-no,l-ao,2*no,2*ao),h+=no,a+=5;break;case Xr:Qr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ho,co),0===a?Jr(e,ho):$r(e,ho),h=co.x,l=co.y,a+=7;break;case Hr:h=t[a+1],l=t[a+2],oo=t[a+3],so(e,h-oo,l-oo,2*oo,2*oo),h+=oo,a+=4;break;case Vr:qr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ho,co),0===a?Jr(e,ho):$r(e,ho),h=co.x,l=co.y,a+=6;break;default:return void ro.error(`command: ${s} [index:${a}]`,t)}}},_o={smooth:(t,e,s)=>t};Es.creator=new mr,Es.parse=Ni.parse,Es.convertToCanvasData=Ni.toCanvasData;const po=vt.get("plugin"),go={list:[]};function fo(t,e){if(go.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:po.error(t+" non-existent")})),t.run(s)}else po.error("no dependencies")}class yo{constructor(t){this.taskTime=1,this.id=u.create(u.TASK),this.task=t}run(){return Kt(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const mo=vt.get("TaskProcessor");class vo{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 yo(t),e)}addParallel(t,e){const s=new yo(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new yo(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){mo.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class wo{constructor(t,e){this.updatedList=new d,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=ft.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(h.REQUEST)}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===e.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new n(n.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_(n.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const xo=vt.get("Renderer");class bo{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ft.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed||this.__requestRender(),this.changed=!0}requestLayout(){this.target.emit(a.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new st,xo.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){xo.error(t)}xo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?xo.warn("rendering"):this.times>3?xo.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 xo.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=bt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),o=(new st).copy(i);s.save(),r&&!vt.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,o),s.restore(),bt.end(e)}fullRender(){const t=bt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),bt.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),vt.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),vt.showHitView&&this.renderHitView(s),vt.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new st;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();Wt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new st(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(xo.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:Bo}=$;class ko{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],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,o;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(o=i.list[t],!r||!r.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(i=Bo(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 Eo{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ft.default(e,this.config)),this.findPath=new ko(t,this),this.__listenEvents()}getByPoint(t,e,s){return this.target.emit(a.CHECK_UPDATE),this.findPath.getByPoint(t,e,s)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(e.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(Nt,{watcher:(t,e)=>new wo(t,e),layouter:(t,e)=>new It(t,e),renderer:(t,e,s)=>new bo(t,e,s),selector:(t,e)=>new Eo(t,e)});const To=vt.get("LeaferCanvas");class Ro extends ie{init(){const{view:t}=this.config;if(this.offscreen)t?this.view=t:this.__createView();else{t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;this.autoLayout&&(e.display||(e.display="block")),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}setBackgroundColor(t){this.view.style.backgroundColor=t}setHittable(t){this.view.style.pointerEvents=t?"auto":"none"}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){To.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 To.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:o,height:n}=this.autoBounds.getBoundsFrom(t);if(o!==this.width||n!==this.height){const{style:t}=e,{pixelRatio:a}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const h={width:o,height:n,pixelRatio:a},l={};ft.copyAttrs(l,this,se),this.resize(h),void 0!==this.width&&this.resizeListener(new r(h,l))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}const{drawRoundRect:Co}=Ms;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){Co(this,t,e,s,i,r)})}();class Oo{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 o=r.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,e),r}destory(){this.view=null,this.options=null}}class Lo{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(vs.START,this.moveData)}t.path=this.moveData.path,e.emit(vs.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(bs.START,this.zoomData)}t.path=this.zoomData.path,e.emit(bs.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(ws.START,this.rotateData)}t.path=this.rotateData.path,e.emit(ws.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(vs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(bs.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(ws.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Po={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?xs.UP:t>45&&t<135?xs.DOWN:t<=45&&t>=-45?xs.RIGHT:xs.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:So.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}},So=Po,{getDragEventData:Do,getDropEventData:Mo,getSwipeEventData:Ao,filterPathByEventType:Io}=Po;class Wo{constructor(t){this.interaction=t}setDragData(t){this.dragData=Do(t,t,t)}getDragList(){return this.dragging?ms.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!_s.middle(t)&&!_s.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const o=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(_s.middle(t)||us.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(vs.START,r)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=i;this.dragData=Do(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(vs.MOVE,this.dragData):this.dragging&&(s.emit(fs.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=_s.left(t)&&e,this.dragging&&(this.interaction.emit(fs.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Io(this.dragData.path,fs.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{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(fs.OUT,t,s),e.emit(fs.OVER,t,i)):e.emit(fs.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(fs.ENTER,t,i,s),e.emit(fs.LEAVE,t,s,i),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,o=Do(s,t,t);r&&(o.throughPath=r),o.path=i,this.moving&&e.emit(vs.END,o),this.dragging&&(e.emit(fs.END,o),this.swipe(t,o),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=Ao(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Mo(t,this.getDragList(),ms.dragData);e.path=this.dragEnterPath,this.interaction.emit(ms.DROP,e),this.interaction.emit(fs.LEAVE,t,this.dragEnterPath)}dragReset(){ms.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=$.right(o),l=$.bottom(o),d=t.x<n?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,$.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 No=["move","zoom","rotate"];function Fo(t,e,s,i,r){if(No.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Yo(t,r)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&zo(o,e,s,i,r)}}function zo(t,e,s,i,r){if(t.__.hitSelf&&t.hasEvent(e,i)&&!Yo(t,r)){s.phase=i?1:t===s.target?2:3;const r=jt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Yo(t,e){return e&&e.has(t)}const{pathHasEventType:Uo}=Po;class jo{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 Lo(this),this.dragger=new Wo(this),i&&(this.config=ft.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(gs.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getByPoint(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(gs.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),_s.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(gs.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:gs.MOVE});t.path=e.path,this.emit(gs.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(gs.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(gs.UP,t),this.emit(gs.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(gs.OUT,t,this.overPath),this.emit(gs.OVER,t,e)):this.emit(gs.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(gs.ENTER,t,e,this.enterPath),this.emit(gs.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(gs.LEAVE,t),this.dragger.dragging&&this.emit(ms.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[gs.DOUBLE_TAP,gs.DOUBLE_CLICK].some((e=>Uo(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit(gs.TAP,t),this.emit(gs.CLICK,t)}emitDoubleTap(t){this.emit(gs.DOUBLE_TAP,t),this.emit(gs.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(gs.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(gs.LONG_TAP,t),Uo(t.path,gs.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new st(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(r.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--){if(r=s.list[o],zo(r,t,e,!0,i))return;r.isApp&&Fo(r,t,e,!0,i)}for(let o=0,n=s.length;o<n;o++)if(r=s.list[o],r.isApp&&Fo(r,t,e,!1,i),zo(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 Xo={convert(t,e){const s=Po.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=Po.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=Xo.getTouch(t),i=Po.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]},Ho={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},o=A.getDistance(t[0],t[1]),n=A.getDistance(e[0],e[1])/o,a=A.getAngle(t[0],t[1]),h=A.getAngle(e[0],e[1]);return{move:r,scale:n,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}},Vo={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:o}=e;const n=t.deltaY||t.deltaX;if(r){const e=Wt.intWheelDeltaY&&Math.abs(t.deltaY)>17;s=(Math.floor(t.deltaY)!==t.deltaY||e)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){o=p.within(o,0,1);i=1-n/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-o)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Go,getZoomEventData:Ko,getRotateEventData:qo}=Po;class Qo extends jo{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t){const e=this.view.getBoundingClientRect();return{x:t.clientX-e.x,y:t.clientY-e.y}}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}onKeyDown(t){us.setDownCode(t.code)}onKeyUp(t){us.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(Xo.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Xo.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(Xo.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Xo.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Xo.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(Xo.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=Xo.getTouch(t);this.pointerDown(Xo.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Xo.getTouch(t);this.pointerMove(Xo.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=Xo.getTouch(t);this.pointerUp(Xo.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Ho.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Ho.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])],o=[this.getLocal(s),this.getLocal(i)],{move:n,angle:a,scale:h,center:l}=Ho.getData(r,o),d=Po.getBase(t);this.rotate(qo(l,a,d)),this.zoom(Ko(l,h,d)),this.move(Go(l,n,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):Vo.getScale(t,e),i=this.getLocal(t),r=Po.getBase(t);1!==s?this.zoom(Ko(i,s,r)):this.move(Go(i,e.getMove?e.getMove(t,e):Vo.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=Po.getBase(t),i=t.scale/this.lastGestureScale,r=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=p.within(o,0,1),this.zoom(Ko(e,i*i,s)),this.rotate(qo(e,r/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}Object.assign(Nt,{canvas:(t,e)=>new Ro(t,e),image:t=>new Oo(t),hitCanvas:(t,e)=>new Ro(t,e),interaction:(t,e,s,i)=>new Qo(t,e,s,i)}),Wt.requestRender=function(t){window.requestAnimationFrame(t)},Wt.canvas=Nt.canvas(),Wt.devicePixelRatio=devicePixelRatio,Wt.conicGradientSupport=!!Wt.canvas.context.createConicGradient;const{userAgent:Zo}=navigator;Zo.indexOf("Firefox")>-1?(Wt.conicGradientRotate90=!0,Wt.intWheelDeltaY=!0):Zo.indexOf("Safari")>-1&&-1===Zo.indexOf("Chrome")&&(Wt.fullImageShadow=!0);const $o={},Jo={},tn={},en={},{copy:sn,toOffsetOutBounds:rn}=$,on={},nn={};function an(t,e,s,i){const{bounds:r,shapeBounds:o}=i;if(Wt.fullImageShadow){if(sn(on,t.bounds),on.x+=e.x-o.x,on.y+=e.y-o.y,s){const{matrix:t}=i;on.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),on.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),on.width*=s,on.height*=s}t.copyWorld(i.canvas,t.bounds,on)}else s&&(sn(on,e),on.x-=e.width/2*(s-1),on.y-=e.height/2*(s-1),on.width*=s,on.height*=s),t.copyWorld(i.canvas,o,s?on:e)}const{toOffsetOutBounds:hn}=$,ln={};var dn=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:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;hn(l,ln),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(ln.offsetX+t.x*c,ln.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,an(_,ln,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,n.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()},shadow:function(t,e,s){let i,r;const{__world:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;rn(l,nn),a.forEach(((t,a)=>{_.setWorldShadow(nn.offsetX+t.x*c,nn.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,an(_,nn,r,s),i=l,t.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(_,i,n.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()}});function cn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,o)}function un(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),fn(t,e);break;case"inside":_n(t,e,s,"inside");break;case"outside":_n(t,e,s,"outside")}}function _n(t,e,s,i){const{strokeWidth:r,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(s,2*r,t.__),n.font=o,fn(t,n),n.blendMode="outside"===i?"destination-out":"destination-in",cn(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}function pn(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),gn(t,s,e);break;case"inside":_n(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:r,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(void 0,2*r,t.__),n.font=o,gn(t,s,n),n.blendMode="outside"===i?"destination - out":"destination -in ",cn(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}(t,e,s,"outside")}}function gn(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),fn(t,s),s.restoreBlendMode()):fn(t,s)}))}function fn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),r&&e.strokeRect(s.x,s.y+r,s.width,o)}function yn(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:mn,getOuterOf:vn,getByMove:wn,getIntersectData:xn}=$;const bn={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:Bn,rotateOf:kn,translate:En,scaleOf:Tn,scale:Rn,rotate:Cn}=T;function On(t,e,s,r){let{type:o,blendMode:n}=s,a={type:o,blendMode:n,style:"rgba(255,255,255,0)"};const h=t.leafer.imageManager.get(s);if(h.ready){let t,{opacity:e,mode:i,offset:o,scale:n,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=Bn(),En(t,r.x,r.y));break;case"clip":(o||n||l)&&(t=function(t,e,s,i){const r=Bn();En(r,t.x,t.y),e&&En(r,e.x,e.y);s&&("number"==typeof s?Rn(r,s):Rn(r,s.x,s.y));i&&Cn(r,i);return r}(r,o,n,l));break;case"repeat":(!u||n||l)&&(t=function(t,e,s,i,r){const o=Bn();if(r)switch(Cn(o,r),r){case 90:En(o,s,0);break;case 180:En(o,e,s);break;case 270:En(o,0,e)}En(o,t.x,t.y),i&&Tn(o,t,i);return o}(r,d,c,n,l));break;default:u&&!l||(t=function(t,e,s,i,r){const o=Bn(),n=r&&180!==r,a=e.width/(n?i:s),h=e.height/(n?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;En(o,d,c),Rn(o,l),r&&kn(o,{x:e.x+e.width/2,y:e.y+e.height/2},r);return o}(i,r,d,c,l))}a.style=function(t,e,s){let i=Wt.canvas.createPattern(t,s?"repeat":"no-repeat");if(e){const{a:t,b:s,c:r,d:o,e:n,f:a}=e;i.setTransform(new DOMMatrix([t,s,r,o,n,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 Ln={x:.5,y:0},Pn={x:.5,y:1};function Sn(t,e,s){let i;for(let r=0,o=e.length;r<o;r++)i=e[r],t.addColorStop(i.offset,bn.string(i.color,s))}const{set:Dn,getAngle:Mn,getDistance:An}=A,{get:In,rotateOf:Wn,scaleOf:Nn}=T,Fn={x:.5,y:.5},zn={x:.5,y:1},Yn={},Un={};const{set:jn,getAngle:Xn,getDistance:Hn}=A,{get:Vn,rotateOf:Gn,scaleOf:Kn}=T,qn={x:.5,y:.5},Qn={x:.5,y:1},Zn={},$n={};function Jn(t,e){let s,i=t.__.__input[e];const r=[];i instanceof Array||(i=[i]);for(let o=0,n=i.length;o<n;o++)s=ta(t,i[o],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function ta(t,e,s){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:i}=t.__layout;switch(e.type){case"solid":let{type:r,blendMode:o,color:n,opacity:a}=e;return{type:r,blendMode:o,style:bn.string(n,a)};case"image":return On(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:r,blendMode:o,opacity:n}=t;s||(s=Ln),i||(i=Pn);const a=Wt.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+i.x*e.width,e.y+i.y*e.height);return Sn(a,t.stops,n),{type:r,blendMode:o,style:a}}(e,i);case"radial":return function(t,e){let{from:s,to:i,type:r,opacity:o,blendMode:n,stretch:a}=t;s||(s=Fn),i||(i=zn);const{x:h,y:l,width:d,height:c}=e;let u;Dn(Yn,h+s.x*d,l+s.y*c),Dn(Un,h+i.x*d,l+i.y*c),(d!==c||a)&&(u=In(),Nn(u,Yn,d/c*(a||1),1),Wn(u,Yn,Mn(Yn,Un)+90));const _=Wt.canvas.createRadialGradient(Yn.x,Yn.y,0,Yn.x,Yn.y,An(Yn,Un));return Sn(_,t.stops,o),{type:r,blendMode:n,style:_,transform:u}}(e,i);case"angular":return function(t,e){let{from:s,to:i,type:r,opacity:o,blendMode:n,stretch:a}=t;s||(s=qn),i||(i=Qn);const{x:h,y:l,width:d,height:c}=e;jn(Zn,h+s.x*d,l+s.y*c),jn($n,h+i.x*d,l+i.y*c);const u=Vn(),_=Xn(Zn,$n);Wt.conicGradientRotate90?(Kn(u,Zn,d/c*(a||1),1),Gn(u,Zn,_+90)):(Kn(u,Zn,1,d/c*(a||1)),Gn(u,Zn,_));const p=Wt.conicGradientSupport?Wt.canvas.createConicGradient(0,Zn.x,Zn.y):Wt.canvas.createRadialGradient(Zn.x,Zn.y,0,Zn.x,Zn.y,Hn(Zn,$n));return Sn(p,t.stops,o),{type:r,blendMode:n,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:bn.string(e)}:void 0}}var ea=Object.freeze({__proto__:null,computeFill:function(t){Jn(t,"fill")},computeStroke:function(t){Jn(t,"stroke")},drawText:cn,drawTextStroke:fn,fill:function(t,e,s){e.fillStyle=s,t.__.__font?cn(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:r,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)if(i=s[n],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:n,c:a,d:h,e:l,f:d}=i.transform;e.transform(s,n,a,h,l,d),i.blendMode&&(e.blendMode=i.blendMode),o?cn(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),o?cn(t,e):e.fill(r),e.restoreBlendMode()):o?cn(t,e):e.fill(r)},shape:function(t,e,s){const i=e.getSameCanvas();let r,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))r=n=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=xn(i?mn(e.bounds,i*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=vn(h,o),r=wn(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(i,s),{canvas:i,matrix:o,bounds:r,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:o,__font:n}=i;if(n)un(t,e,s);else switch(o){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 o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(i.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:un,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:o,__font:n}=i;if(n)pn(t,e,s);else switch(o){case"center":e.setStroke(void 0,r,i),yn(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),yn(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*r,t.__),yn(s,n),n.clip(i.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}},strokesText:pn});Object.assign($o,dn),Object.assign(Jo,ea);class sa extends mt{setBlendMode(t){this._blendMode=t,"pass-through"!==t&&t?this.__blendLayer=!0:this.__blendLayer&&(this.__blendLayer=!1)}setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:Jo.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:Jo.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const ia={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class ra extends sa{}class oa extends ra{get __boxStroke(){return!0}}class na extends sa{get __boxStroke(){return!0}}const{parse:aa}=Ni;const ha={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class la extends na{}function da(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ca(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ua={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:o}=this.__;if((s||"all"===i)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*g/2)*Math.sqrt(o)-t:0,r="none"===s?0:o;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(o=Math.max(o,r)),this.__layout.renderShapeSpread=o,t}},_a={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawHitPath(this.__hitCanvas),this.__hitCanvas.setStrokeOptions(this.__)},__hit(t){const{__hitCanvas:e}=this,{fill:s,hitFill:i,windingRule:r}=this.__,o=s&&"path"===i||"all"===i;if(o&&e.hitFill(t,r))return!0;const{stroke:n,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=n&&"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(!o&&e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c;break;case"outside":if(!o){if(!e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c}}return!!u&&e.hitStroke(t,u)}},pa={__updateChange(){let t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect||t.blendMode&&"pass-through"!==t.blendMode?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&Jo.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&Jo.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r,__blendLayer:o}=this.__;let n;if(o&&(n=t,t=t.getSameCanvas(!0)),this.__drawRenderPath(t),this.__.__useEffect){const o=Jo.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&$o.shadow(this,t,o),s&&(this.__.__isFills?Jo.fills(this,t,s):Jo.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&$o.innerShadow(this,t,o),i&&(this.__.__isStrokes?Jo.strokes(this,t,i):Jo.stroke(this,t,i)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?Jo.fills(this,t,s):Jo.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Jo.strokes(this,t,i):Jo.stroke(this,t,i));n&&(n.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&&Jo.fill(this,t,"#000000"),i&&Jo.stroke(this,t,"#000000")}},ga={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:o,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(o,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};let fa=class extends es{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Ni.toCanvasData(e,!0):e:[]}getPathString(t){return Ni.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Jo.computeFill(this),e&&Jo.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?_o.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}static one(t,e,s,i,r){return zt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};Gt([be(sa)],fa.prototype,"__",void 0),Gt([he("")],fa.prototype,"id",void 0),Gt([he("")],fa.prototype,"name",void 0),Gt([he("")],fa.prototype,"className",void 0),Gt([ye("pass-through")],fa.prototype,"blendMode",void 0),Gt([me(1)],fa.prototype,"opacity",void 0),Gt([me(!0)],fa.prototype,"visible",void 0),Gt([we(!1)],fa.prototype,"isMask",void 0),Gt([ve(0)],fa.prototype,"zIndex",void 0),Gt([he()],fa.prototype,"locked",void 0),Gt([le(0)],fa.prototype,"x",void 0),Gt([le(0)],fa.prototype,"y",void 0),Gt([ue(100)],fa.prototype,"width",void 0),Gt([ue(100)],fa.prototype,"height",void 0),Gt([de(1)],fa.prototype,"scaleX",void 0),Gt([de(1)],fa.prototype,"scaleY",void 0),Gt([ce(0)],fa.prototype,"rotation",void 0),Gt([ce(0)],fa.prototype,"skewX",void 0),Gt([ce(0)],fa.prototype,"skewY",void 0),Gt([he(!1)],fa.prototype,"draggable",void 0),Gt([xe(!0)],fa.prototype,"hittable",void 0),Gt([xe("path")],fa.prototype,"hitFill",void 0),Gt([ge("path")],fa.prototype,"hitStroke",void 0),Gt([xe(!0)],fa.prototype,"hitChildren",void 0),Gt([xe(!0)],fa.prototype,"hitSelf",void 0),Gt([ye()],fa.prototype,"fill",void 0),Gt([ge()],fa.prototype,"stroke",void 0),Gt([ge("inside")],fa.prototype,"strokeAlign",void 0),Gt([ge(1)],fa.prototype,"strokeWidth",void 0),Gt([ge("none")],fa.prototype,"strokeCap",void 0),Gt([ge("miter")],fa.prototype,"strokeJoin",void 0),Gt([ge()],fa.prototype,"dashPattern",void 0),Gt([ge()],fa.prototype,"dashOffset",void 0),Gt([ge(10)],fa.prototype,"miterLimit",void 0),Gt([_e()],fa.prototype,"cornerRadius",void 0),Gt([_e()],fa.prototype,"cornerSmoothing",void 0),Gt([da()],fa.prototype,"shadow",void 0),Gt([da()],fa.prototype,"innerShadow",void 0),Gt([da()],fa.prototype,"blur",void 0),Gt([da()],fa.prototype,"backgroundBlur",void 0),Gt([da()],fa.prototype,"grayscale",void 0),Gt([Oe(Dr.drawPathByData)],fa.prototype,"__drawPathByData",null),fa=Gt([Se(ua),Se(_a),Se(pa),Le()],fa);let ya=class extends fa{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}remove(t){}};Gt([be(ra)],ya.prototype,"__",void 0),ya=Gt([Se(ds),De()],ya);let ma=class extends fa{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};Gt([be(na)],ma.prototype,"__",void 0),ma=Gt([Se(ga),De()],ma);const va=ma.prototype,wa=ya.prototype,xa={},{copy:ba,add:Ba}=$;let ka=class extends ya{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;ba(xa,t),super.__updateRenderBounds(),Ba(t,xa)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};Gt([be(oa)],ka.prototype,"__",void 0),Gt([fe("show")],ka.prototype,"overflow",void 0),Gt([Oe(va.__updateStrokeSpread)],ka.prototype,"__updateStrokeSpread",null),Gt([Oe(va.__updateRenderSpread)],ka.prototype,"__updateRectRenderSpread",null),Gt([Oe(va.__updateBoxBounds)],ka.prototype,"__updateBoxBounds",null),Gt([Oe(va.__updateStrokeBounds)],ka.prototype,"__updateStrokeBounds",null),Gt([Oe(va.__updateRenderBounds)],ka.prototype,"__updateRectRenderBounds",null),Gt([Oe(va.__updateChange)],ka.prototype,"__updateRectChange",null),Gt([Oe(va.__drawPathByData)],ka.prototype,"__drawPathByData",null),Gt([Oe(va.__render)],ka.prototype,"__renderRect",null),Gt([Oe(wa.__render)],ka.prototype,"__renderGroup",null),ka=Gt([Le(),De()],ka);let Ea=class extends ka{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Gt([be(class extends oa{})],Ea.prototype,"__",void 0),Gt([fe("hide")],Ea.prototype,"overflow",void 0),Ea=Gt([De()],Ea);const{moveTo:Ta,closePath:Ra,ellipse:Ca}=sr;let Oa=class extends fa{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?i||r?(s<1&&Ca(a,o,n,o*s,n*s,0,i,r,!1),Ca(a,o,n,o,n,0,r,i,!0),s<1&&Ra(a)):(s<1&&(Ca(a,o,n,o*s,n*s),Ta(a,t,n)),Ca(a,o,n,o,n,0,0,360,!0)):i||r?(Ta(a,o,n),Ca(a,o,n,o,n,0,i,r,!1),Ra(a)):Ca(a,o,n,o,n)}};Gt([be(class extends sa{get __boxStroke(){return!0}})],Oa.prototype,"__",void 0),Gt([_e(0)],Oa.prototype,"innerRadius",void 0),Gt([_e(0)],Oa.prototype,"startAngle",void 0),Gt([_e(0)],Oa.prototype,"endAngle",void 0),Oa=Gt([De()],Oa);const{sin:La,cos:Pa,PI:Sa}=Math,{moveTo:Da,lineTo:Ma,closePath:Aa}=sr;let Ia=class extends fa{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,o=this.__.path=[];Da(o,i,0);for(let t=1;t<s;t++)Ma(o,i+i*La(2*t*Sa/s),r-r*Pa(2*t*Sa/s));Aa(o)}};Gt([be(class extends sa{})],Ia.prototype,"__",void 0),Gt([_e(3)],Ia.prototype,"sides",void 0),Ia=Gt([De()],Ia);const{sin:Wa,cos:Na,PI:Fa}=Math,{moveTo:za,lineTo:Ya,closePath:Ua}=sr;let ja=class extends fa{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];za(n,r,0);for(let t=1;t<2*s;t++)Ya(n,r+(t%2==0?r:r*i)*Wa(t*Fa/s),o-(t%2==0?o:o*i)*Na(t*Fa/s));Ua(n)}};Gt([be(class extends sa{})],ja.prototype,"__",void 0),Gt([_e(5)],ja.prototype,"points",void 0),Gt([_e(.382)],ja.prototype,"innerRadius",void 0),ja=Gt([De()],ja);const{moveTo:Xa,lineTo:Ha}=sr,{rotate:Va,getAngle:Ga,getDistance:Ka,defaultPoint:qa}=A,{setPoint:Qa,addPoint:Za,toBounds:$a}=F,Ja={};let th=class extends fa{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Va(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Ka(qa,t),this.rotation=Ga(qa,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Xa(t,0,0);const e=this.toPoint;Ha(t,e.x,e.y)}__updateBoxBounds(){Qa(Ja,0,0),Za(Ja,this.__toPoint.x,this.__toPoint.y),$a(Ja,this.__layout.boxBounds)}};Gt([be(class extends sa{})],th.prototype,"__",void 0),Gt([ue()],th.prototype,"rotation",void 0),Gt([pe("center")],th.prototype,"strokeAlign",void 0),th=Gt([De()],th);let eh=class extends ma{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(i.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};Gt([be(la)],eh.prototype,"__",void 0),Gt([ue("")],eh.prototype,"url",void 0),eh=Gt([De()],eh);let sh=class extends ma{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Nt.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new N(t.__world);r.invert();const o=new N;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.preMultiply(o),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};Gt([be(la)],sh.prototype,"__",void 0),Gt([ca(100)],sh.prototype,"width",void 0),Gt([ca(100)],sh.prototype,"height",void 0),Gt([ca(Wt.devicePixelRatio)],sh.prototype,"pixelRatio",void 0),Gt([ca(!0)],sh.prototype,"smooth",void 0),Gt([xe("all")],sh.prototype,"hitFill",void 0),sh=Gt([De()],sh);const ih=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",rh=ih+"_#~&*+\\=|≮≯≈≠=…";function oh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const nh=oh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ah=oh("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),hh=oh(ih),lh=oh(rh),dh=oh("- —/~|┆·");var ch;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ch||(ch={}));const{Letter:uh,Single:_h,Before:ph,After:gh,Symbol:fh,Break:yh}=ch;function mh(t){return nh[t]?uh:dh[t]?yh:/[\u3400-\u9FBF]/.test(t)?_h:ah[t]?ph:hh[t]?gh:lh[t]?fh:uh}const vh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function wh(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xh}=vh,{Letter:bh,Single:Bh,Before:kh,After:Eh,Symbol:Th,Break:Rh}=ch;let Ch,Oh,Lh,Ph,Sh,Dh,Mh,Ah,Ih,Wh,Nh,Fh,zh,Yh,Uh=[];function jh(t,e){Ch.data.push({char:t,width:e}),Lh+=e}function Xh(){Ph+=Lh,Ch.width=Lh,Oh.words.push(Ch),Ch={data:[]},Lh=0}function Hh(){Fh&&(zh.paraNumber++,Oh.paraStart=!0,Fh=!1),Oh.width=Ph,xh(Oh),Uh.push(Oh),Oh.width>Yh.width&&(Yh.width=Oh.width),Oh={words:[]},Ph=0}const Vh=0,Gh=1,Kh=2;const qh={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let s=0,i=0,{width:r,height:o,padding:n}=e;const{textDecoration:a,textOverflow:h,__font:l}=e;if(r||(r=0),n){const[t,e,a,h]=p.fourNumber(n);r&&(s=h,r-=e+h),o&&(i=t,o-=t+a)}const d={bounds:{x:s,y:i,width:r,height:o},rows:[],paraNumber:0,font:Wt.canvas.font=l};return function(t,e,s){zh=t,Uh=t.rows,Yh=t.bounds;const{__letterSpacing:i,paraIndent:r,textCase:o}=s,{canvas:n}=Wt,{width:a,height:h}=Yh;if(a||h||i||o){Fh=!0,Ih=null,Lh=Ph=0,Ch={data:[]},Oh={words:[]};for(let t=0,s=e.length;t<s;t++)Dh=e[t],"\n"===Dh?(Lh&&Xh(),Oh.paraEnd=!0,Hh(),Fh=!0):(Ah=mh(Dh),Ah===bh&&"none"!==o&&(Dh=wh(Dh,o,!Lh)),Mh=n.measureText(Dh).width,i&&(Mh+=i),Wh=Ah===Bh&&(Ih===Bh||Ih===bh)||Ih===Bh&&Ah!==Eh,Nh=!(Ah!==kh&&Ah!==Bh||Ih!==Th&&Ih!==Eh),Sh=Fh&&r?a-r:a,a&&Ph+Lh+Mh>Sh&&(Nh||(Nh=Ah===bh&&Ih==Eh),Wh||Nh||Ah===Rh||Ah===kh||Ah===Bh||Lh+Mh>Sh?(Lh&&Xh(),Hh()):Hh())," "===Dh&&Ph+Lh===0||(Ah===Rh?(" "===Dh&&Lh&&Xh(),jh(Dh,Mh),Xh()):Wh||Nh?(Lh&&Xh(),jh(Dh,Mh)):jh(Dh,Mh)),Ih=Ah);Lh&&Xh(),Ph&&Hh(),Uh[Uh.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{zh.paraNumber++,Uh.push({x:r||0,text:t,width:n.measureText(t).width,paraStart:!0})}))}(d,t,e),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:o,textAlign:n,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=o;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,n){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:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?Vh:l>.01?Gh:Kh,c===Kh?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===Gh?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(d,e,r),d.overflow&&function(t,e){const{rows:s,overflow:i}=t;if(s.splice(i),"hide"!==e){"ellipsis"===e&&(e="...");const r=Wt.canvas.measureText(e).width,o=s[i-1];let n,a,h=o.data.length-1;const{x:l,width:d}=t.bounds,c=l+d-r;for(let t=h;t>-1&&(n=o.data[t],a=n.x+n.width,!(t===h&&a<c));t--){if(a<c&&" "!==n.char){o.data.splice(t+1),o.width-=n.width;break}o.width-=n.width}o.width+=r,o.data.push({char:e,x:a})}}(d,h),"none"!==a&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(d,e),d}},{copyAndSpread:Qh,includes:Zh,spread:$h}=$;let Jh=class extends fa{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;t.rect(s,i,r,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=qh.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=ia.number(r,a),t.__letterSpacing=ia.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&$h(c,a/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=Zh(u,c)?u:c;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Qh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};Gt([be(class extends sa{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ha[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Jh.prototype,"__",void 0),Gt([ue(0)],Jh.prototype,"width",void 0),Gt([ue(0)],Jh.prototype,"height",void 0),Gt([ue(0)],Jh.prototype,"padding",void 0),Gt([pe("outside")],Jh.prototype,"strokeAlign",void 0),Gt([ue("")],Jh.prototype,"text",void 0),Gt([ue("L")],Jh.prototype,"fontFamily",void 0),Gt([ue(12)],Jh.prototype,"fontSize",void 0),Gt([ue("normal")],Jh.prototype,"fontWeight",void 0),Gt([ue(!1)],Jh.prototype,"italic",void 0),Gt([ue("none")],Jh.prototype,"textCase",void 0),Gt([ue("none")],Jh.prototype,"textDecoration",void 0),Gt([ue(0)],Jh.prototype,"letterSpacing",void 0),Gt([ue({type:"percent",value:150})],Jh.prototype,"lineHeight",void 0),Gt([ue(0)],Jh.prototype,"paraIndent",void 0),Gt([ue(0)],Jh.prototype,"paraSpacing",void 0),Gt([ue("left")],Jh.prototype,"textAlign",void 0),Gt([ue("top")],Jh.prototype,"verticalAlign",void 0),Gt([ue("show")],Jh.prototype,"textOverflow",void 0),Jh=Gt([De()],Jh);const{toBounds:tl}=uo;let el=class extends fa{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){tl(this.__.path,this.__layout.boxBounds)}};Gt([be(class extends sa{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=aa(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],el.prototype,"__",void 0),Gt([_e()],el.prototype,"path",void 0),Gt([_e()],el.prototype,"windingRule",void 0),Gt([pe("center")],el.prototype,"strokeAlign",void 0),el=Gt([De()],el);let sl=class extends ya{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new el(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,o,n,a){return this}moveToArc(t,e,s,i,r,o){return this}paint(){this.pathElement.forceUpdate("path")}};Gt([be(class extends ra{})],sl.prototype,"__",void 0),sl=Gt([Se(mr,["beginPath"]),De()],sl);const il=vt.get("LeaferType"),rl={list:{},register(t,e){ol[t]?il.error("repeat:",t):ol[t]=e},run(t,e){const s=rl.list[t];s?s(e):il.error("no",t)}},{list:ol}=rl;rl.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),rl.register("design",(function(t){const{MOVE:e}=vs,{ZOOM:s}=bs;t.__eventIds.push(t.on_(e,(e=>{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:o}=e;o*s<i?o=i/s:o*s>r&&(o=r/s),1!==o&&nt.zoomOf(t.zoomLayer,e,o)})))}));const nl=vt.get("Leafer");let al=class extends ya{get __tag(){return"Leafer"}get isApp(){return!1}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,(null==t?void 0:t.view)&&this.init(t)}init(t,e){if(this.canvas)return;let s;this.__setLeafer(this),t&&ft.assign(this.config,t);const{config:i}=this;rl.run(i.type,this),this.canvas=Nt.canvas(i),this.__controllers.push(this.renderer=Nt.renderer(this,this.canvas,i),this.watcher=Nt.watcher(this,i),this.layouter=Nt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Nt.selector(this),this.__controllers.unshift(this.interaction=Nt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new Ht,this.hitCanvasManager=new Vt,this.imageManager=new ks(this,i),s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(l.RESTART):this.emitLeafer(l.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(l.STOP))}resize(t){const e=ft.copyAttrs({},t,se);Object.keys(e).forEach((t=>this[t]=e[t]))}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ft.copyAttrs({},this.canvas,se);this.canvas.resize(t),this.__onResize(new r(t,e))}__onResize(t){this.emitEvent(t),ft.copyAttrs(this.__,t,se),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new it(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&this.canvas.setHittable(e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ft.copyAttrs({},this.canvas,se);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.setBackgroundColor(t):this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(l.BEFORE_READY),this.emitLeafer(l.READY),this.emitLeafer(l.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(l.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new l(t,this))}__listenEvents(){const t=bt.start("FirstCreate "+this.innerName);this.once(l.START,(()=>bt.end(t))),this.once(a.END,(()=>this.__onReady())),this.once(h.END,(()=>this.__onViewReady())),this.on(a.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new l(l.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>t.destroy())),this.__controllers.length=0,this.selector.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory(),this.canvas.destroy(),this.canvas=null,this.config=this.userConfig=this.view=null,super.destroy()}catch(t){nl.error(t)}}};Gt([be(class extends ra{})],al.prototype,"__",void 0),Gt([ue()],al.prototype,"pixelRatio",void 0),al=Gt([De()],al);let hl=class extends al{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(s.CHANGE,(()=>{vt.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new al(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(a.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(h.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(h.END,this.__onChildRenderEnd,this))}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return t&&ft.assign(e,t),e.view=this.realCanvas?void 0:this.view,e.fill=e.hittable=e.realCanvas=void 0,this.autoLayout&&ft.copyAttrs(e,this,se),e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};hl=Gt([De()],hl);export{tn as Animate,hl as App,it as AutoBounds,Hs as BezierHelper,st as Bounds,$ as BoundsHelper,ka as Box,ds as Branch,ut as BranchHelper,sh as Canvas,Ht as CanvasManager,e as ChildEvent,Nt as Creator,ft as DataHelper,vt as Debug,fs as DragEvent,ms as DropEvent,$o as Effect,Oa as Ellipse,ti as EllipseHelper,t as Event,jt as EventCreator,en as Export,Ea as Frame,ya as Group,Vt as HitCanvasManager,eh as Image,i as ImageEvent,ks as ImageManager,u as IncrementId,Qo as Interaction,Bs as KeyEvent,us as Keyboard,a as LayoutEvent,It as Layouter,es as Leaf,Ge as LeafBounds,ct as LeafBoundsHelper,mt as LeafData,ze as LeafDataProxy,Ne as LeafEventer,nt as LeafHelper,Qe as LeafHit,c as LeafLevelList,d as LeafList,$e as LeafMask,Xe as LeafMatrix,Ze as LeafRender,al as Leafer,Ro as LeaferCanvas,ie as LeaferCanvasBase,l as LeaferEvent,Oo as LeaferImage,th as Line,p as MathHelper,N as Matrix,T as MatrixHelper,vs as MoveEvent,Os as NeedConvertToCanvasCommandMap,g as OneRadian,f as PI2,y as PI_2,Jo as Paint,el as Path,uo as PathBounds,sr as PathCommandDataHelper,Rs as PathCommandMap,Ni as PathConvert,_o as PathCorner,mr as PathCreator,Dr as PathDrawer,Es as PathHelper,Ds as PathNumberCommandLengthMap,Ss as PathNumberCommandMap,sl as Pen,Wt as Platform,go as Plugin,W as Point,A as PointHelper,_s as PointerButton,gs as PointerEvent,Ia as Polygon,s as PropertyEvent,ma as Rect,Ms as RectHelper,ga as RectRender,h as RenderEvent,bo as Renderer,r as ResizeEvent,ws as RotateEvent,bt as Run,Eo as Selector,ja as Star,ot as StringNumberMap,xs as SwipeEvent,yo as TaskItem,vo as TaskProcessor,Jh as Text,o as TransformEvent,rt as TwoPointBounds,F as TwoPointBoundsHelper,fa as UI,ua as UIBounds,zt as UICreator,ps as UIEvent,_a as UIHit,pa as UIRender,gt as WaitHelper,n as WatchEvent,wo as Watcher,bs as ZoomEvent,fe as affectRenderBoundsType,pe as affectStrokeBoundsType,ne as aliasType,ue as boundsType,se as canvasSizeAttrs,be as dataProcessor,he as dataType,Ee as defineDataProcessor,re as defineKey,ae as defineLeafAttr,da as effectType,oe as getDescriptor,xe as hitType,Be as layoutProcessor,we as maskType,me as opacityType,_e as pathType,le as positionType,De as registerUI,Me as registerUIEvent,ca as resizeType,Oe as rewrite,Le as rewriteAble,ce as rotationType,de as scaleType,ke as setDefaultValue,ve as sortType,ge as strokeType,ye as surfaceType,Se as useModule,fo as usePlugin};
1
+ const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]}},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),i=h(e),{a:r,b:n,c:a,d:d}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=a*s-d*i,t.d=a*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:a}=t;s&&(s*=o,t.a=i+n*s,t.b=r+a*s),e&&(e*=o,t.c=n+i*e,t.d=a+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},preMultiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+o*e.c,t.d=r*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t,a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(r*l-o*h)*d,s.y=(o*n-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*n-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,a=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;n=u(i),a=t/n;const r=e/n;h=s>0?d(r):-d(r),l=c(g/i)/o}else{const e=i*i+r*r;a=u(e),n=t/a;const s=i/a;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:E}=Math,T={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},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=C.defaultPoint);const i=x(e*o),r=w(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*i-a*r,t.y=s.y+n*r+a*i},tempToInnerOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=C;return C.copy(s,t),C.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>C.getAtan2(t,e)/o,getAtan2:(t,e)=>E(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=C.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){C.reset(t)}},C=T;class k{constructor(t,e){"object"==typeof t?T.copy(this,t):T.set(this,t,e)}set(t,e){T.set(this,t,e)}copy(t){return T.copy(this,t),this}clone(){return new k(this)}rotate(t,e){return T.rotate(this,t,e),this}toInnerOf(t,e){return T.toInnerOf(this,t,e),this}toOuterOf(t,e){return T.toOuterOf(this,t,e),this}getCenter(t){return T.getCenter(this,t)}getDistance(t){return T.getDistance(this,t)}getAngle(t){return T.getAngle(this,t)}getAtan2(t){return T.getAtan2(this,t)}reset(){T.reset(this)}}class R{constructor(t,e,s,i,r,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,o)}set(t,e,s,i,r,o){f.set(this,t,e,s,i,r,o)}copy(t){return f.copy(this,t),this}clone(){return new R(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const L={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){O(t,e,s),O(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:O}=L,{tempPointBounds:P,setPoint:S,addPoint:D,toBounds:M}=L,{toOuterPoint:A}=f;let I,W,N,F;const z={},U={},Y={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){H.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),H.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(H.right(s)-t.x),e.offsetY=-(H.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),H.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(H.copy(H.tempBounds,t),H.toOuterOf(H.tempBounds,e),H.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),H.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else z.x=t.x,z.y=t.y,A(e,z,U),S(P,U.x,U.y),z.x=t.x+t.width,A(e,z,U),D(P,U.x,U.y),z.y=t.y+t.height,A(e,z,U),D(P,U.x,U.y),z.x=t.x,A(e,z,U),D(P,U.x,U.y),M(P,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new R(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return H.copyAndSpread(s,t,e),s},spread(t,e){H.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){I=t.x+t.width,W=t.y+t.height,N=e.x+e.width,F=e.y+e.height,I=I>N?I:N,W=W>F?W:F,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){H.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){H.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){H.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||X(t,r)):j(t,r));o&&H.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?S(P,t.x,t.y):D(P,t.x,t.y)})),M(P,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=T.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=T.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=H.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=H.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=H.tempToOuterOf(e,s));let{x:i,y:r,width:o,height:n}=e;return I=i+o,W=r+n,N=t.x+t.width,F=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<N?I:N,W=W<F?W:F,o=I-i,n=W-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){H.copy(t,H.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){H.set(t)}},H=Y,{add:j,copy:X}=H;class V{constructor(t,e,s,i){"object"==typeof t?Y.copy(this,t):Y.set(this,t,e,s,i)}set(t,e,s,i){Y.set(this,t,e,s,i)}copy(t){return Y.copy(this,t),this}clone(){return new V(this)}scale(t){return Y.scale(this,t),this}toOuterOf(t,e){return Y.toOuterOf(this,t,e),this}getFitMatrix(t){return Y.getFitMatrix(this,t)}spread(t){return Y.spread(this,t),this}ceil(){return Y.ceil(this),this}add(t){return Y.add(this,t),this}addList(t){return Y.setByList(this,t,!0),this}setByList(t,e){return Y.setByList(this,t,e),this}addListWithHandle(t,e){return Y.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return Y.setByListWithHandle(this,t,e,s),this}setByPoints(t){return Y.setByPoints(this,t),this}hitPoint(t,e){return Y.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Y.hitRadiusPoint(this,t,e)}hit(t,e){return Y.hit(this,t,e)}includes(t,e){return Y.includes(this,t,e)}intersect(t,e){return Y.intersect(this,t,e),this}getIntersect(t,e){return new V(Y.getIntersectData(this,t,e))}isSame(t){return Y.isSame(this,t)}isEmpty(){return Y.isEmpty(this)}reset(){Y.reset(this)}}class G{constructor(t,e,s,i,r,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new V(r,e,o||t.width-r-s,n||t.height-e-i)}}class K{constructor(t,e){L.setPoint(this,t,e)}addPoint(t,e){L.addPoint(this,t,e)}addBounds(t,e,s,i){L.addBounds(this,t,e,s,i)}add(t){L.add(this,t)}}const q={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const i=s.create(s.RUNTIME);return tt.currentId=tt.idMap[i]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[i]=t,tt.nameToIdMap[t]=i,i}static end(t,e){const s=tt.idMap[t],i=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[i]=void 0,e?$.log(i,performance.now()-s,"µs"):$.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;it[e]?et.repeat(e):it[e]=t},get(t,e,s,i,r,o){const n=new it[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),o&&(n.height=o)),n}},{list:it}=st,rt=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?rt.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,nt[e]=s)}},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(ut(e,t),ut(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ut(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ut}=ct;class _t{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];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]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}const pt={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function ft(t,e,s,i){return new(s||(s=Promise))((function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const mt=[];function vt(){return(t,e)=>{mt.push(e)}}const wt=[];let xt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||wt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;mt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};gt([yt("imageSmoothingEnabled")],xt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],xt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],xt.prototype,"opacity",void 0),gt([yt()],xt.prototype,"fillStyle",void 0),gt([yt()],xt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],xt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],xt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],xt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],xt.prototype,"dashOffset",void 0),gt([yt()],xt.prototype,"miterLimit",void 0),gt([yt()],xt.prototype,"shadowBlur",void 0),gt([yt()],xt.prototype,"shadowColor",void 0),gt([yt()],xt.prototype,"shadowOffsetX",void 0),gt([yt()],xt.prototype,"shadowOffsetY",void 0),gt([yt()],xt.prototype,"filter",void 0),gt([yt()],xt.prototype,"font",void 0),gt([yt()],xt.prototype,"fontKerning",void 0),gt([yt()],xt.prototype,"fontStretch",void 0),gt([yt()],xt.prototype,"fontVariantCaps",void 0),gt([yt()],xt.prototype,"textAlign",void 0),gt([yt()],xt.prototype,"textBaseline",void 0),gt([yt()],xt.prototype,"textRendering",void 0),gt([yt()],xt.prototype,"wordSpacing",void 0),gt([yt()],xt.prototype,"letterSpacing",void 0),gt([yt()],xt.prototype,"direction",void 0),gt([vt()],xt.prototype,"setTransform",null),gt([vt()],xt.prototype,"resetTransform",null),gt([vt()],xt.prototype,"getTransform",null),gt([vt()],xt.prototype,"save",null),gt([vt()],xt.prototype,"restore",null),gt([vt()],xt.prototype,"translate",null),gt([vt()],xt.prototype,"scale",null),gt([vt()],xt.prototype,"rotate",null),gt([vt()],xt.prototype,"fill",null),gt([vt()],xt.prototype,"stroke",null),gt([vt()],xt.prototype,"clip",null),gt([vt()],xt.prototype,"fillRect",null),gt([vt()],xt.prototype,"strokeRect",null),gt([vt()],xt.prototype,"clearRect",null),gt([vt()],xt.prototype,"beginPath",null),gt([vt()],xt.prototype,"moveTo",null),gt([vt()],xt.prototype,"lineTo",null),gt([vt()],xt.prototype,"bezierCurveTo",null),gt([vt()],xt.prototype,"quadraticCurveTo",null),gt([vt()],xt.prototype,"closePath",null),gt([vt()],xt.prototype,"arc",null),gt([vt()],xt.prototype,"arcTo",null),gt([vt()],xt.prototype,"ellipse",null),gt([vt()],xt.prototype,"rect",null),gt([vt()],xt.prototype,"roundRect",null),gt([vt()],xt.prototype,"createConicGradient",null),gt([vt()],xt.prototype,"createLinearGradient",null),gt([vt()],xt.prototype,"createPattern",null),gt([vt()],xt.prototype,"createRadialGradient",null),gt([vt()],xt.prototype,"fillText",null),gt([vt()],xt.prototype,"measureText",null),gt([vt()],xt.prototype,"strokeText",null);const bt=new V,Bt={width:1,height:1,pixelRatio:1},Et=Z.get("LeaferCanvasBase"),Tt=["width","height","pixelRatio"];class Ct extends xt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,i){super(),this.worldTransform={},e||(e=Bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=e;this.autoLayout=!r||!o,this.pixelRatio=n,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Et.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(pt.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Et.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,Tt),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*o+t.b*a)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*o+t.d*a)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*o+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Y.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")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,bt.copy(t).scale(this.pixelRatio),this.fillRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,bt.copy(t).scale(this.pixelRatio),this.strokeRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.clearRect(bt.x,bt.y,bt.width,bt.height)}clipWorld(t,e){this.beginPath(),bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.rect(bt.x,bt.y,bt.width,bt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,o={width:s,height:i,pixelRatio:r},n=this.manager?this.manager.get(o):e.canvas(o);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,s){let{width:i,height:r,pixelRatio:o}=this;t&&(i+=t),s&&(r+=s);const n={width:i,height:r,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.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}}const kt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Rt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Lt=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},Rt),Ot={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Pt={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},St=Object.assign(Object.assign({},Pt),Rt),Dt=Lt,Mt={};for(let t in Dt)Mt[Dt[t]]=t;const At={};for(let t in Dt)At[Dt[t]]=Ot[t];const It={drawRoundRect(t,e,s,i,o,n){let[a,h,l,d]=r.fourNumber(n);const c=Math.min(i/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+o,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+o,e,s+o,l):t.lineTo(e+i,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+i,s,a):t.lineTo(e,s)}},{sin:Wt,cos:Nt,atan2:Ft,ceil:zt,abs:Ut,PI:Yt}=Math,{setPoint:Ht,addPoint:jt}=L,{set:Xt}=T,Vt={},Gt={rect(t,e,s,i,r){kt.creator.path=t,kt.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){kt.creator.path=[],It.drawRoundRect(kt.creator,e,s,i,r,o),t.push(...kt.convertToCanvasData(kt.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Ft(g,p),v=Ft(y,f),w=v-m;if(w<0&&(w+=n),w===Yt||Ut(p+g)<1e-12||Ut(f+y)<1e-12)return t&&t.push(Lt.L,i,r),c&&(Ht(c,e,s),jt(c,i,r)),_&&Xt(_,e,s),void(u&&Xt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Nt(w/2),E=i+B*Nt(m+w/2+a*b),T=r+B*Wt(m+w/2+a*b);return m-=a*b,v-=a*b,Zt(t,E,T,d,d,0,m/o,v/o,x,c,u,_)},arc:(t,e,s,i,r,o,n,a,h,l)=>Zt(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*o,f=Wt(g),y=Nt(g);let m=l*o,v=d*o;m>Yt&&(m-=n),v<0&&(v+=n);let w=v-m;w<0?w+=n:w>n&&(w-=n),c&&(w-=n);const x=zt(Ut(w/a)),b=w/x,B=Wt(b/4),E=8/3*B*B/Wt(b/2);v=m+b;let T,C,k,R,L,O,P,S,D=Nt(m),M=Wt(m),A=k=y*i*D-f*r*M,I=R=f*i*D+y*r*M,W=e+k,N=s+R;t&&t.push(Lt.L,W,N),u&&Ht(u,W,N),p&&Xt(p,W,N);for(let o=0;o<x;o++)T=Nt(v),C=Wt(v),k=y*i*T-f*r*C,R=f*i*T+y*r*C,L=e+A-E*(y*i*M+f*r*D),O=s+I-E*(f*i*M-y*r*D),P=e+k+E*(y*i*C+f*r*T),S=s+R+E*(f*i*C-y*r*T),t&&t.push(Lt.C,L,O,P,S,e+k,s+R),u&&qt(e+A,s+I,L,O,P,S,e+k,s+R,u,!0),A=k,I=R,D=T,M=C,m=v,v+=b;_&&Xt(_,e+k,s+R)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Lt.C,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){qt(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?jt(h,t,e):Ht(h,t,e),jt(h,n,a);for(let l=0,c=d.length;l<c;l++)Kt(d[l],t,e,s,i,r,o,n,a,Vt),jt(h,Vt.x,Vt.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return Kt(t,e,s,i,r,o,n,a,h,l),l}},{getPointAndSet:Kt,toTwoPointBounds:qt,ellipse:Zt}=Gt,{sin:Qt,cos:$t,sqrt:Jt,atan2:te}=Math,{ellipse:ee}=Gt,se={ellipticalArc(t,e,s,i,r,a,h,l,d,c,u){const _=(d-e)/2,p=(c-s)/2,g=a*o,f=Qt(g),y=$t(g),m=-y*_-f*p,v=-y*p+f*_,w=i*i,x=r*r,b=v*v,B=m*m,E=w*x-w*b-x*B;let T=0;if(E<0){const t=Jt(1-E/(w*x));i*=t,r*=t}else T=(h===l?-1:1)*Jt(E/(w*b+x*B));const C=T*i*v/r,k=-T*r*m/i,R=te((v-k)/r,(m-C)/i),L=te((-v-k)/r,(-m-C)/i);let O=L-R;0===l&&O>0?O-=n:1===l&&O<0&&(O+=n);const P=e+_+y*C-f*k,S=s+p+f*C+y*k,D=O<0?1:0;u?ee(t,P,S,i,r,a,R/o,L/o,D):i!==r||a?t.push(Lt.G,P,S,i,r,a,R/o,L/o,D):t.push(Lt.O,P,S,i,R/o,L/o,D)}},{M:ie,m:re,L:oe,l:ne,H:ae,h:he,V:le,v:de,C:ce,c:ue,S:_e,s:pe,Q:ge,q:fe,T:ye,t:me,A:ve,a:we,Z:xe,z:be,N:Be,D:Ee,X:Te,G:Ce,F:ke,O:Re,P:Le,U:Oe}=Lt,{rect:Pe,roundRect:Se,arcTo:De,arc:Me,ellipse:Ae,quadraticCurveTo:Ie}=Gt,{ellipticalArc:We}=se,Ne=Z.get("PathConvert"),Fe={},ze={current:{dot:0},stringify(t){let e,s,i,r=0,o=t.length,n="";for(;r<o;){s=t[r],e=At[s],n+=s===i?" ":Mt[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,o="";const n=[],a=e?St:Pt;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?("."===i&&(Ue.dot++,Ue.dot>1&&(Ye(n,o),o="")),o+=i):Lt[i]?(o&&(Ye(n,o),o=""),Ue.name=Lt[i],Ue.length=Ot[i],Ue.index=0,Ye(n,Ue.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Ye(n,o),o=i):o&&(Ye(n,o),o=""),r=i;return o&&Ye(n,o),s?ze.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case re:t[c+1]+=a,t[c+2]+=h;case ie:a=t[c+1],h=t[c+2],_.push(ie,a,h),c+=3;break;case he:t[c+1]+=a;case ae:a=t[c+1],_.push(oe,a,h),c+=2;break;case de:t[c+1]+=h;case le:h=t[c+1],_.push(oe,a,h),c+=2;break;case ne:t[c+1]+=a,t[c+2]+=h;case oe:a=t[c+1],h=t[c+2],_.push(oe,a,h),c+=3;break;case pe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=_e;case _e:n=o===ce||o===_e,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(ce,l,d,s,i,a,h),c+=5;break;case ue: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=ce;case ce:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ce,t[c+1],t[c+2],s,i,a,h),c+=7;break;case me:t[c+1]+=a,t[c+2]+=h,r=ye;case ye:n=o===ge||o===ye,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ie(_,a,h,s,i,t[c+1],t[c+2]):_.push(ge,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case fe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ge;case ge:s=t[c+1],i=t[c+2],e?Ie(_,a,h,s,i,t[c+3],t[c+4]):_.push(ge,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case we:t[c+6]+=a,t[c+7]+=h;case ve:We(_,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 be:case xe:_.push(xe),c++;break;case Be:a=t[c+1],h=t[c+2],e?Pe(_,a,h,t[c+3],t[c+4]):He(_,t,c,5),c+=5;break;case Ee:a=t[c+1],h=t[c+2],e?Se(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):He(_,t,c,9),c+=9;break;case Te:a=t[c+1],h=t[c+2],e?Se(_,a,h,t[c+3],t[c+4],t[c+5]):He(_,t,c,6),c+=6;break;case Ce:Ae(e?_:He(_,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,Fe),a=Fe.x,h=Fe.y,c+=9;break;case ke:e?Ae(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):He(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Re:Me(e?_:He(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Fe),a=Fe.x,h=Fe.y,c+=7;break;case Le:e?Me(_,t[c+1],t[c+2],t[c+3],0,360,!1):He(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Oe:De(e?_:He(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Fe),a=Fe.x,h=Fe.y,c+=6;break;default:return Ne.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ue.index===Ue.length&&(Ue.index=1,t.push(Ue.name)),t.push(Number(e)),Ue.index++,Ue.dot=0}},{current:Ue,pushData:Ye,copyData:He}=ze,{M:je,L:Xe,C:Ve,Q:Ge,Z:Ke,N:qe,D:Ze,X:Qe,G:$e,F:Je,O:ts,P:es,U:ss}=Lt,is={},rs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(je,e,s)},lineTo(t,e,s){t.push(Xe,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Ve,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Ge,e,s,i,r)},closePath(t){t.push(Ke)},rect(t,e,s,i,r){t.push(qe,e,s,i,r)},roundRect(t,e,s,i,o,n){if("number"==typeof n)t.push(Qe,e,s,i,o,n);else{const a=r.fourNumber(n);a?t.push(Ze,e,s,i,o,...a):t.push(qe,e,s,i,o)}},ellipse(t,e,s,i,r,o,n,a,h){void 0===o?t.push(Je,e,s,i,r):(void 0===n&&(n=0),void 0===a&&(a=360),t.push($e,e,s,i,r,o,n,a,h?1:0))},arc(t,e,s,i,r,o,n){void 0===r?t.push(es,e,s,i):(void 0===o&&(o=360),t.push(ts,e,s,i,r,o,n?1:0))},moveToEllipse(t,e,s,i,r,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Gt.ellipse(null,e,s,i,r,o,n,a,h,null,null,is),t.push(je,is.x,is.y),os(t,e,s,i,r,o,n,a,h)},moveToArc(t,e,s,i,r,o,n){void 0===r&&(r=0),void 0===o&&(o=360),Gt.arc(null,e,s,i,r,o,n,null,null,is),t.push(je,is.x,is.y),ns(t,e,s,i,r,o,n)},arcTo(t,e,s,i,r,o){t.push(ss,e,s,i,r,o)}},{ellipse:os,arc:ns}=rs,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:us,rect:_s,roundRect:ps,ellipse:gs,arc:fs,arcTo:ys,moveToEllipse:ms,moveToArc:vs}=rs;class ws{constructor(t){this.path=t?"string"==typeof t?kt.parse(t):t:[]}beginPath(){return us(this.path),this}moveTo(t,e){return as(this.path,t,e),this}lineTo(t,e){return hs(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,o){return ds(this.path,t,e,s,i,r,o),this}quadraticCurveTo(t,e,s,i){return ls(this.path,t,e,s,i),this}closePath(){return cs(this.path),this}rect(t,e,s,i){return _s(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return ps(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,o,n,a){return gs(this.path,t,e,s,i,r,o,n,a),this}arc(t,e,s,i,r,o){return fs(this.path,t,e,s,i,r,o),this}arcTo(t,e,s,i,r){return ys(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,o,n,a){return ms(this.path,t,e,s,i,r,o,n,a),this}moveToArc(t,e,s,i,r,o){return vs(this.path,t,e,s,i,r,o),this}}const{M:xs,L:bs,C:Bs,Q:Es,Z:Ts,N:Cs,D:ks,X:Rs,G:Ls,F:Os,O:Ps,P:Ss,U:Ds}=Lt,Ms=Z.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case xs:t.moveTo(e[i+1],e[i+2]),i+=3;break;case bs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Bs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Es:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ts:t.closePath(),i+=1;break;case Cs:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ks: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 Rs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ls:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*o,e[i+6]*o,e[i+7]*o,e[i+8]),i+=9;break;case Os:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,n,!1),i+=5;break;case Ps:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*o,e[i+5]*o,e[i+6]),i+=7;break;case Ss:t.arc(e[i+1],e[i+2],e[i+3],0,n,!1),i+=4;break;case Ds:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Ms.error(`command: ${s} [index:${i}]`,e)}}},{M:Is,L:Ws,C:Ns,Q:Fs,Z:zs,N:Us,D:Ys,X:Hs,G:js,F:Xs,O:Vs,P:Gs,U:Ks}=Lt,{toTwoPointBounds:qs,toTwoPointBoundsByQuadraticCurve:Zs,arcTo:Qs,arc:$s,ellipse:Js}=Gt,{add:ti,copy:ei,addPoint:si,setPoint:ii,addBounds:ri,toBounds:oi}=L,ni=Z.get("PathBounds");let ai,hi,li;const di={},ci={},ui={},_i={toBounds(t,e){_i.toTwoPointBounds(t,ci),oi(ci,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ii(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===zs||s===Ns||s===Fs?ii(e,h,l):ii(e,t[a+1],t[a+2])),s){case Is:case Ws:h=t[a+1],l=t[a+2],si(e,h,l),a+=3;break;case Ns:o=t[a+5],n=t[a+6],qs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,di),ti(e,di),h=o,l=n,a+=7;break;case Fs:i=t[a+1],r=t[a+2],o=t[a+3],n=t[a+4],Zs(h,l,i,r,o,n,di),ti(e,di),h=o,l=n,a+=5;break;case zs:a+=1;break;case Us:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ys:case Hs:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=s===Ys?9:6;break;case js:Js(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],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=9;break;case Xs:h=t[a+1],l=t[a+2],hi=t[a+3],li=t[a+4],ri(e,h-hi,l-li,2*hi,2*li),h+=hi,a+=5;break;case Vs:$s(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=7;break;case Gs:h=t[a+1],l=t[a+2],ai=t[a+3],ri(e,h-ai,l-ai,2*ai,2*ai),h+=ai,a+=4;break;case Ks:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=6;break;default:return void ni.error(`command: ${s} [index:${a}]`,t)}}},pi={smooth:(t,e,s)=>t};kt.creator=new ws,kt.parse=ze.parse,kt.convertToCanvasData=ze.toCanvasData;const{drawRoundRect:gi}=It;function fi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){gi(this,t,e,s,i,r)})}(t)}function yi(t,e,s){Object.defineProperty(t,e,s)}function mi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vi(t){return(e,s)=>{yi(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function wi(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};yi(t,e,Object.assign(r,i||{})),Fi(t,e,s)}function xi(t){return(e,s)=>{wi(e,s,t)}}function bi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function Bi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Ei(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Ti(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const Ci=Ti;function ki(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ri=ki;function Li(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Oi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Pi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Si(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Di(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Mi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ai(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Ii(t){return(e,s)=>{yi(e,"__DataProcessor",{get:()=>t})}}function Wi(t){return(e,s)=>{yi(e,"__LayoutProcessor",{get:()=>t})}}function Ni(t,e,s){Fi(t.prototype,e,s)}function Fi(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[r]}:"width"===e?n.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});const a=mi(i,e);a&&a.set&&(n.set=a.set),i[o]&&(n.set=i[o],delete i[o]),Object.defineProperty(i,e,n)}const zi=new Z("rewrite"),Ui=[],Yi=["destroy","constructor"];function Hi(t){return(e,s)=>{Ui.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function ji(){return t=>{Xi()}}function Xi(t){Ui.length&&(Ui.forEach((e=>{t&&zi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ui.length=0)}function Vi(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Yi.includes(i)||e&&e.includes(i)))if(t.prototype){mi(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Gi(){return t=>{st.register(t)}}function Ki(){return t=>{ot.register(t)}}setTimeout((()=>Xi(!0)));const{toOuterOf:qi}=Y;class Zi{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.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={}),qi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),qi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),qi(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()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){this.leaf=null}}const Qi={},$i={on(t,e,s){let i,r,o;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Ji(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let i,r,o;s&&(i="boolean"==typeof s?s:s.capture);const n=Ji(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(o=r.findIndex((t=>t.listener===e)),o>-1&&r.splice(o,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=Ji(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&(r=i[o],r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Ji(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Qi)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Qi)}}class tr{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 er extends tr{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}er.ADD="child.add",er.REMOVE="child.remove";class sr extends tr{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}sr.CHANGE="property.change";class ir extends tr{constructor(t,e){super(t),Object.assign(this,e)}}ir.LOAD="image.load",ir.LOADED="image.loaded",ir.ERROR="image.error";class rr extends tr{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(rr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}rr.RESIZE="resize";class or extends tr{constructor(t,e){super(t),e&&Object.assign(this,e)}}or.START="transform.start",or.CHANGE="transform.change",or.END="transform.end",or.BEFORE_START="transform.before_start",or.BEFORE_CHANGE="transform.before_change",or.BEFORE_END="transform.before_end";class nr extends tr{constructor(t,e){super(t),this.data=e}}nr.REQUEST="watch.request",nr.DATA="watch.data";class ar extends tr{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ar.CHECK_UPDATE="layout.check_update",ar.REQUEST="layout.request",ar.START="layout.start",ar.BEFORE="layout.before",ar.LAYOUT="layout.layout",ar.AFTER="layout.after",ar.AGAIN="layout.again",ar.END="layout.end";class hr extends tr{}hr.FRAME="animate.frame";class lr extends tr{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}lr.REQUEST="render.request",lr.START="render.start",lr.BEFORE="render.before",lr.RENDER="render",lr.AFTER="render.after",lr.AGAIN="render.again",lr.END="render.end";class dr extends tr{}dr.START="leafer.start",dr.BEFORE_READY="leafer.before_ready",dr.READY="leafer.ready",dr.AFTER_READY="leafer.after_ready",dr.VIEW_READY="leafer.view_ready",dr.STOP="leafer.stop",dr.RESTART="leafer.restart",dr.END="leafer.end";const cr={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=sr,i=new sr(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:ur,cos:_r}=Math,pr=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1}),gr={__updateWorldMatrix(){const t=this.parent?this.parent.__world:pr,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.scaleX=t.scaleX*this.__.scaleX,s.scaleY=t.scaleY*this.__.scaleY):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:n,skewY:a}=this.__;r||n||a?(r*=o,n&&(n*=o),a&&(a*=o),t.a=s*_r(r+a),t.b=s*ur(r+a),t.c=i*-ur(r-n),t.d=i*_r(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:fr,copyAndSpread:yr}=Y,mr={__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,fr(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else fr(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){fr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){fr(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){fr(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(){yr(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){yr(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:vr}=T,wr={},xr={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),vr(t,this.__world,wr),this.__hit(wr)},__drawHitPath(t){this.__drawRenderPath(t)}},br={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,i)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},Br={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},Er={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,n,o),o.clear(),n.clear()):r=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:r,hideBounds:o}=e;for(let n=0,a=i.length;n<a;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{copy:Tr,translate:Cr,toInnerPoint:kr,scaleOfOuter:Rr,rotateOfOuter:Lr}=f,Or={},Pr={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Dr(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Mr(e[t])}},updateAllChange(t){if(Mr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ar(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){t.__layout.checkUpdate();const i={x:e,y:s};t.parent&&kr(t.parent.__world,i,i,!0),Sr.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i,r){t.__layout.checkUpdate();const o=t.parent?T.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,i,r)},zoomOfLocal(t,e,s,i=s,r){Tr(Or,t.__local),r&&Cr(Or,r.x,r.y),Rr(Or,e,s,i),r||(r=t),r.x+=Or.e-t.__local.e,r.y+=Or.f-t.__local.f,t.scaleX*=s,t.scaleY*=i},rotateOfWorld(t,e,s,i){t.__layout.checkUpdate();const r=t.parent?T.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){Tr(Or,t.__local),i&&Cr(Or,i.x,i.y),Lr(Or,e,s),i||(i=t),i.x+=Or.e-t.__local.e,i.y+=Or.f-t.__local.f,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)}},Sr=Pr,{updateAllWorldMatrix:Dr,updateAllWorldOpacity:Mr,updateAllChange:Ar}=Sr,Ir={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Wr={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),Nr(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++)Fr(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:Nr,pushAllBranchStack:Fr}=Wr,zr={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Ur,create:Yr}=s,{toInnerPoint:Hr,toOuterPoint:jr}=f,{tempToOuterOf:Xr,copy:Vr}=T,{moveLocal:Gr,zoomOfLocal:Kr,rotateOfLocal:qr}=Pr;let Zr=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return _t}get __LayoutProcessor(){return Zi}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.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=Yr(Ur),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,scaleX:1,scaleY:1},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&zr.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){void 0===t?t="x":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__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?Hr(this.parent.worldTransform,t,e,s):e&&Vr(e,t)}localToWorld(t,e,s){this.parent?jr(this.parent.worldTransform,t,e,s):e&&Vr(e,t)}worldToInner(t,e,s){Hr(this.worldTransform,t,e,s)}innerToWorld(t,e,s){jr(this.worldTransform,t,e,s)}move(t,e){Gr(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),Kr(this,Xr(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),qr(this,Xr(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}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.children&&this.children.length&&this.removeAll(!0),this.parent&&this.remove(),this.__hitCanvas&&this.__hitCanvas.destroy(),this.__.destroy(),this.__layout.destroy(),this.leafer=this.parent=this.__hitCanvas=this.__=this.__layout=this.__captureMap=this.__bubbleMap=null)}};Zr=gt([Vi(cr),Vi(gr),Vi(mr),Vi(xr),Vi($i),Vi(br)],Zr);const{setByListWithHandle:Qr}=Y,{sort:$r}=Wr,{localBoxBounds:Jr,localEventBounds:to,localRenderBounds:eo,maskLocalBoxBounds:so,maskLocalEventBounds:io,maskLocalRenderBounds:ro}=Ir;let oo=class extends Zr{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(){Qr(this.__layout.boxBounds,this.children,this.__hasMask?so:Jr)}__updateStrokeBounds(){Qr(this.__layout.strokeBounds,this.children,this.__hasMask?io:to)}__updateRenderBounds(){Qr(this.__layout.renderBounds,this.children,this.__hasMask?ro:eo)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort($r),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&zr.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(er.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()}))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(er.REMOVE,t))}__emitChildEvent(t,e){const s=new er(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};oo=gt([Vi(Er),Vi(Br)],oo);const no={};class ao{static isHoldSpaceKey(){return ao.hasDownCode("Space")}static setDownCode(t){no[t]||(no[t]=!0)}static setUpCode(t){no[t]=!1}static hasDownCode(t){return no[t]}}class ho{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const lo={};class co extends tr{get spaceKey(){return ao.isHoldSpaceKey()}get left(){return ho.left(this)}get right(){return ho.right(this)}get middle(){return ho.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,lo),Object.assign({},lo)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,lo),Object.assign({},lo)}static changeName(t,e){ot.changeName(t,e)}}let uo=class extends co{};uo.POINTER="pointer",uo.BEFORE_DOWN="pointer.before_down",uo.BEFORE_MOVE="pointer.before_move",uo.BEFORE_UP="pointer.before_up",uo.DOWN="pointer.down",uo.MOVE="pointer.move",uo.UP="pointer.up",uo.OVER="pointer.over",uo.OUT="pointer.out",uo.ENTER="pointer.enter",uo.LEAVE="pointer.leave",uo.TAP="tap",uo.DOUBLE_TAP="double_tap",uo.CLICK="click",uo.DOUBLE_CLICK="double_click",uo.LONG_PRESS="long_press",uo.LONG_TAP="long_tap",uo=gt([Ki()],uo);const _o={},po={};let go=class extends uo{getInnerMove(t){return t||(t=this.current),_o.x=this.moveX,_o.y=this.moveY,t.worldToInner(_o,po,!0),Object.assign({},po)}getLocalMove(t){return t||(t=this.current),_o.x=this.moveX,_o.y=this.moveY,t.worldToLocal(_o,po,!0),Object.assign({},po)}};var fo;go.DRAG="drag",go.START="drag.start",go.END="drag.end",go.OVER="drag.over",go.OUT="drag.out",go.ENTER="drag.enter",go.LEAVE="drag.leave",go=gt([Ki()],go);let yo=fo=class extends uo{static setList(t){fo.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}};yo.DROP="drop",yo=fo=gt([Ki()],yo);let mo=class extends go{};mo.MOVE="move",mo.START="move.start",mo.END="move.end",mo=gt([Ki()],mo);let vo=class extends co{};vo.ROTATE="rotate",vo.START="rotate.start",vo.END="rotate.end",vo=gt([Ki()],vo);let wo=class extends go{};wo.SWIPE="swipe",wo.LEFT="swipe.left",wo.RIGHT="swipe.right",wo.UP="swipe.up",wo.DOWN="swipe.down",wo=gt([Ki()],wo);let xo=class extends co{};xo.ZOOM="zoom",xo.START="zoom.start",xo.END="zoom.end",xo=gt([Ki()],xo);let bo=class extends co{};bo.DOWN="key.down",bo.PRESS="key.press",bo.UP="key.up",bo=gt([Ki()],bo);const Bo=Z.get("TaskProcessor");class Eo{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Bo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class To{get total(){return this.list.length}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,t&&ct.assign(this.config,t),this.empty()}add(t,e){let s,i,r,o;const n=new Eo(t);return n.parent=this,"number"==typeof e?o=e:e&&(i=e.parallel,s=e.start,r=e.time,o=e.delay),r&&(n.time=r),!1===i&&(n.parallel=!1),void 0===o?this.push(n,s):setTimeout((()=>this.push(n,s)),o),n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.empty(),this.config={}}}const Co={map:{},recycledList:[],tasker:new To,patternTasker:new To,get isComplete(){return ko.tasker.isComplete&&ko.patternTasker.isComplete},get(t){let s=ko.map[t.url];return s||(s=e.image(t),ko.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ko.recycledList.push(t)}))},clearRecycled(){const t=ko.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete ko.map[t.url],t.destroy())})),t.length=0)},destroy(){ko.map={},ko.tasker=null}},ko=Co,{IMAGE:Ro,create:Lo}=s;class Oo{get url(){return this.config&&this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=Lo(Ro),this.config=t;const{url:e}=t;e.startsWith("data:")?e.startsWith("data:image/svg")&&(this.isSVG=!0):e.includes(".svg")&&(this.isSVG=!0)}load(e,s){return this.loading||(this.loading=!0,Co.tasker.add((()=>ft(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.config.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t){const e=this.waitComplete,s=e[t+1];s&&s({type:"stop"}),e[t]=e[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return i&&(n.globalAlpha=i),n.drawImage(this.view,0,0,e,s),o}destroy(){this.view=null,this.config=null,this.waitComplete.length=0}}const Po=Z.get("plugin"),So={power:{},list:[],onLeafer(t){So.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function Do(t,e){const s={},{power:i,list:r}=So;if(r.includes(t))Po.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:Po.error(t+" non-existent")})):Po.warn("no import");try{t.run(s,e)}catch(t){Po.error(t)}}}class Mo{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(lr.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===er.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new nr(nr.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(sr.CHANGE,this.__onAttrChange,this),t.on_([er.ADD,er.REMOVE],this.__onChildEvent,this),t.on_(nr.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:Ao,updateAllWorldOpacity:Io}=Pr,{pushAllChildBranch:Wo,pushAllParent:No}=Wr;const{worldBounds:Fo}=Ir,{setByListWithHandle:zo}=Y;class Uo{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){zo(this.beforeBounds,this.updatedList.list,Fo)}setAfter(){zo(this.afterBounds,this.updatedList.list,Fo),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:Yo,updateAllChange:Ho}=Pr,{pushAllBranchStack:jo,updateWorldBoundsByBranchStack:Xo}=Wr,Vo=Z.get("Layouter");class Go{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(ar.START),this.layoutOnce(),t.emitEvent(new ar(ar.END,this.layoutedBlocks,this.times))}catch(t){Vo.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Vo.warn("layouting"):this.times>3?Vo.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(nr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=ar,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new ar(r,a,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(Ao(t),e.push(t),t.isBranch&&Wo(t,e),No(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),No(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&&Io(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new ar(o,a,this.times)),s.emitEvent(new ar(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=ar,o=this.getBlocks(new ht(e));e.emitEvent(new ar(s,o,this.times)),Go.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new ar(i,o,this.times)),e.emitEvent(new ar(r,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(Yo(t),t.isBranch){const e=[t];jo(t,e),Xo(e)}else t.__updateWorldBounds();Ho(t)}createBlock(t){return new Uo(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ar.REQUEST,this.layout,this),t.on_(ar.AGAIN,this.layoutAgain,this),t.on_(nr.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Ko=Z.get("Renderer");class qo{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ar.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Ko.log(e.innerName,"---\x3e");try{this.emitRender(lr.START),this.renderOnce(t),this.emitRender(lr.END,this.totalBounds),Co.clearRecycled()}catch(t){Ko.error(t)}Ko.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Ko.warn("rendering"):this.times>3?Ko.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(lr.BEFORE),t()):(this.requestLayout(),this.emitRender(lr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(lr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(lr.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 Ko.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=J.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),o=(new V).copy(i);s.save(),r&&!Z.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.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),Z.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),Z.showHitView&&this.renderHitView(s),Z.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 V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(hr.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ko.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new lr(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(lr.REQUEST,this.update,this),t.on_(ar.END,this.__onLayoutEnd,this),t.on_(lr.AGAIN,this.renderAgain,this),t.on_(rr.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:Zo}=Y;class Qo{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Pr.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,o;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(o=i.list[t],!r||!r.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(i=Zo(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 $o{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new Qo(t,this),this.__listenEvents()}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(ar.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(er.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(e,{watcher:(t,e)=>new Mo(t,e),layouter:(t,e)=>new Go(t,e),renderer:(t,e,s)=>new qo(t,e,s),selector:(t,e)=>new $o(t,e)}),t.layout=Go.fullLayout;const Jo=Z.get("LeaferCanvas");class tn extends Ct{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;e.display||(e.display="block"),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){Jo.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 Jo.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;if(!this.offscreen){const{style:s}=this.view;s.width=t+"px",s.height=e+"px"}this.view.width=t*s,this.view.height=e*s}updateClientBounds(){this.offscreen||(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(!this.offscreen){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:o}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||o!==this.height){const{style:t}=e,{pixelRatio:n}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:r,height:o,pixelRatio:n},h={};ct.copyAttrs(h,this,Tt),this.resize(a),void 0!==this.width&&this.resizeListener(new rr(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}fi(CanvasRenderingContext2D.prototype),fi(Path2D.prototype);class en{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(mo.START,this.moveData)}t.path=this.moveData.path,e.emit(mo.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(xo.START,this.zoomData)}t.path=this.zoomData.path,e.emit(xo.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(vo.START,this.rotateData)}t.path=this.rotateData.path,e.emit(vo.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(mo.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(xo.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(vo.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const sn={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?wo.UP:t>45&&t<135?wo.DOWN:t<=45&&t>=-45?wo.RIGHT:wo.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:rn.getSwipeDirection(T.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},rn=sn,{getDragEventData:on,getDropEventData:nn,getSwipeEventData:an,filterPathByEventType:hn}=sn;class ln{constructor(t){this.interaction=t}setDragData(t){this.dragData=on(t,t,t)}getDragList(){return this.dragging?yo.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ho.middle(t)&&!ho.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const o=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ho.middle(t)||ao.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(mo.START,r)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=i;this.dragData=on(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(mo.MOVE,this.dragData):this.dragging&&(s.emit(go.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ho.left(t)&&e,this.dragging&&(this.interaction.emit(go.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=hn(this.dragData.path,go.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=>{Pr.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(go.OUT,t,s),e.emit(go.OVER,t,i)):e.emit(go.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(go.ENTER,t,i,s),e.emit(go.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,o=on(s,t,t);r&&(o.throughPath=r),o.path=i,this.moving&&e.emit(mo.END,o),this.dragging&&(e.emit(go.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(T.getDistance(i,t)>s.config.pointer.swipeDistance){const t=an(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=nn(t,this.getDragList(),yo.dragData);e.path=this.dragEnterPath,this.interaction.emit(yo.DROP,e),this.interaction.emit(go.LEAVE,t,this.dragEnterPath)}dragReset(){yo.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 o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=Y.right(o),l=Y.bottom(o),d=t.x<n?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,T.move(s,d,c),T.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 dn=["move","zoom","rotate"];function cn(t,e,s,i,r){if(dn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!_n(t,r)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&un(o,e,s,i,r)}}function un(t,e,s,i,r){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!_n(t,r)){s.phase=i?1:t===s.target?2:3;const r=ot.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function _n(t,e){return e&&e.has(t)}const pn={getData(t){const e=t[0],s=t[1],i=T.getCenter(e.from,s.from),r=T.getCenter(e.to,s.to),o={x:r.x-i.x,y:r.y-i.y},n=T.getDistance(e.from,s.from),a=T.getDistance(e.to,s.to)/n,h=T.getAngle(e.from,s.from),l=T.getAngle(e.to,s.to);return{move:o,scale:a,angle:this.getChangedAngle(h,l),center:r}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:gn,getMoveEventData:fn,getZoomEventData:yn,getRotateEventData:mn}=sn;class vn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ht(e),this.transformer=new en(this),this.dragger=new ln(this),r&&(this.config=ct.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){this.emit(uo.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,{through:i});r.throughPath&&(t.throughPath=r.throughPath),t.path=e?this.defaultPath:r.path,this.emit(uo.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ho.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&ho.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(uo.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=T.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:uo.MOVE});t.path=e.path,this.emit(uo.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(uo.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(uo.UP,t),this.emit(uo.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)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:o}=pn.getData(e);this.rotate(mn(o,i,t)),this.zoom(yn(o,r,t)),this.move(fn(o,s,t))}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(uo.OUT,t,this.overPath),this.emit(uo.OVER,t,e)):this.emit(uo.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(uo.LEAVE,t,this.enterPath,e),this.emit(uo.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(uo.LEAVE,t),this.dragger.dragging&&this.emit(yo.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=[uo.DOUBLE_TAP,uo.DOUBLE_CLICK].some((e=>gn(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(uo.TAP,t),this.emit(uo.CLICK,t)}emitDoubleTap(t){this.emit(uo.DOUBLE_TAP,t),this.emit(uo.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(uo.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(uo.LONG_TAP,t),gn(t.path,uo.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(rr.RESIZE,this.__onResize,this)],t.once(dr.READY,(()=>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 o=s.length-1;o>-1;o--){if(r=s.list[o],un(r,t,e,!0,i))return;r.isApp&&cn(r,t,e,!0,i)}for(let o=0,n=s.length;o<n;o++)if(r=s.list[o],r.isApp&&cn(r,t,e,!1,i),un(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 wn={convert(t,e){const s=sn.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=sn.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=wn.getTouch(t),i=sn.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},xn={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:r}=t;return t.shiftKey&&!i&&(i=r,r=0),i>50&&(i=Math.max(50,i/3)),r>50&&(r=Math.max(50,r/3)),{x:-i*s*2,y:-r*s*2}},getScale(e,s){let i,o=1,{zoomMode:n,zoomSpeed:a}=s;const h=e.deltaY||e.deltaX;if(n?(i=!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(i=!0)):i=!e.shiftKey&&(e.metaKey||e.ctrlKey),i){a=r.within(a,0,1);o=1-h/(25*(e.deltaY?s.delta.y:s.delta.x)*(1-a)+10),o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}},{getMoveEventData:bn,getZoomEventData:Bn,getRotateEventData:En}=sn;class Tn extends vn{__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,scroll:this.onScroll};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t,e){e&&this.canvas.updateClientBounds();const{clientBounds:s}=this.canvas;return{x:t.clientX-s.x,y:t.clientY-s.y}}getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){ao.setDownCode(t.code)}onKeyUp(t){ao.setUpCode(t.code)}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.pointerDown(wn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerMove(wn.convert(t,this.getLocal(t,!0)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(wn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(wn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(wn.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(wn.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.multiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=wn.getTouch(t);this.pointerDown(wn.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=wn.getTouch(t);this.pointerMove(wn.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=wn.getTouch(t);this.pointerUp(wn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),s=this.getKeepTouchList(this.touches,e);s.length>1&&(this.multiTouch(sn.getBase(t),s),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let s;const i=[];return t.forEach((t=>{s=e.find((e=>e.identifier===t.identifier)),s&&i.push({from:this.getLocal(t),to:this.getLocal(s)})})),i}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):xn.getScale(t,e),i=this.getLocal(t),r=sn.getBase(t);1!==s?this.zoom(Bn(i,s,r)):this.move(bn(i,e.getMove?e.getMove(t,e):xn.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=sn.getBase(t),i=t.scale/this.lastGestureScale,o=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=r.within(n,0,1),this.zoom(Bn(e,i*i,s)),this.rotate(En(e,o/Math.PI*180*(n/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}const{mineType:Cn,fileType:kn}=pt;function Rn(s,i){t.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(Cn(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,Cn(e),s))),canvasSaveAs:(t,e,s)=>new Promise((i=>{let r=document.createElement("a");r.href=t.toDataURL(Cn(kn(e)),s),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),i()})),loadImage:t=>new Promise(((e,s)=>{const i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>{e(i)},i.onerror=t=>{s(t)},t.startsWith("data:")||t.includes("?"),i.src=t}))},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new tn(t,e),image:t=>new Oo(t),hitCanvas:(t,e)=>new tn(t,e),interaction:(t,e,s,i)=>new Tn(t,e,s,i)}),t.name="web",t.requestRender=function(t){window.requestAnimationFrame(t)},t.devicePixelRatio=devicePixelRatio,t.realtimeLayout=!0;const{userAgent:Ln}=navigator;Ln.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):Ln.indexOf("Safari")>-1&&-1===Ln.indexOf("Chrome")&&(t.fullImageShadow=!0),Ln.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):Ln.indexOf("Mac")>-1?t.os="Mac":Ln.indexOf("Linux")>-1&&(t.os="Linux");const On=Z.get("LeaferTypeCreator"),Pn={list:{},register(t,e){Sn[t]?On.repeat(t):Sn[t]=e},run(t,e){const s=Pn.list[t];s?s(e):On.error("no",t)}},{list:Sn}=Pn;Pn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),Pn.register("design",(function(t){const{MOVE:e}=mo,{ZOOM:s}=xo;t.__eventIds.push(t.on_(e,(e=>{Pr.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:o}=e;o*s<i?o=i/s:o*s>r&&(o=r/s),1!==o&&Pr.zoomOfWorld(t.zoomLayer,e,o)})))}));const Dn={};class Mn extends _t{setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Dn)):(this.__isFills&&(this.__removeInput("fill"),this.__recycleImage("fill"),this.__isFills=!1),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Dn)):(this.__isStrokes&&(this.__removeInput("stroke"),this.__recycleImage("stroke"),this.__isStrokes=!1),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}__recycleImage(t){const e="fill"===t?this._fill:this._stroke;if(e instanceof Array){let s,i;for(let r=0,o=e.length;r<o;r++)if(s=e[r].image,s&&s.url){const{url:o}=s;if(i||(i={}),i[o]=!0,Co.recycle(s),s.loading){const i=this.__input&&this.__input[t];i&&(i instanceof Array?i.some((t=>t.url===o)):i.url===o)||s.unload(e[r].loadId)}}return i}return null}}const An={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class In extends Mn{}class Wn extends In{get __boxStroke(){return!0}}class Nn extends Mn{get __boxStroke(){return!0}}const{parse:Fn}=ze;const zn={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Un extends Nn{}function Yn(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Hn(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const jn={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:n}=this.__;if((s||"all"===i)&&n&&"inside"!==r&&(e=t="center"===r?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,r="none"===s?0:n;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(o=Math.max(o,r)),this.__layout.renderShapeSpread=o,t}},Xn={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:o}=this.__,n=i&&"path"===r||"all"===r,a=s.hitFill(e,o);if(n&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!n&&a&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!n){if(!a&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},Vn={},Gn={},Kn={},qn={export(t,e,s){return function(t){Zn||(Zn=new To);return new Promise((e=>{Zn.add((()=>ft(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((r=>{const{leafer:o}=t;o?o.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,n,a,{canvas:h}=o,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}a=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):h.toDataURL(e,t),i({data:a}),r(),l&&h.recycle()})))):(i({data:!1}),r())}))))}};let Zn;const{copy:Qn,toOffsetOutBounds:$n}=Y,Jn={},ta={};function ea(e,s,i,r){const{bounds:o,shapeBounds:n}=r;if(t.fullImageShadow){if(Qn(Jn,e.bounds),Jn.x+=s.x-n.x,Jn.y+=s.y-n.y,i){const{matrix:t}=r;Jn.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Jn.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Jn.width*=i,Jn.height*=i}e.copyWorld(r.canvas,e.bounds,Jn)}else i&&(Qn(Jn,s),Jn.x-=s.width/2*(i-1),Jn.y-=s.height/2*(i-1),Jn.width*=i,Jn.height*=i),e.copyWorld(r.canvas,n,i?Jn:s)}const{toOffsetOutBounds:sa}=Y,ia={};var ra=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;sa(d,ia),h.forEach(((t,i)=>{p.save(),p.setWorldShadow(ia.offsetX+t.x*u,ia.offsetY+t.y*_,t.blur*u),o=t.spread?1-2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ea(p,ia,o,s),p.restore(),l?(p.copyWorld(p,d,n,"copy"),p.copyWorld(l,n,n,"source-out"),r=n):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(p,r,a.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,o;const{__world:n,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;$n(d,ta),h.forEach(((t,i)=>{p.setWorldShadow(ta.offsetX+t.x*u,ta.offsetY+t.y*_,t.blur*u,t.color),o=t.spread?1+2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ea(p,ta,o,s),r=d,t.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,n,"copy"),r=n),l?p.copyWorld(l,n,n,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(p,r,a.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()}});const{get:oa,rotateOfOuter:na,translate:aa,scaleOfOuter:ha,scale:la,rotate:da}=f;const{get:ca,scale:ua,copy:_a}=f;function pa(e,s,i){let{scaleX:r,scaleY:o}=e.__world;const n=r+o;if(s.patternId!==n){s.patternId=n;const{image:e,data:a}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:u,height:_,scaleX:p,scaleY:g,opacity:f,transform:y,mode:m}=a;p&&(c=ca(),_a(c,y),ua(c,1/p,1/g),r*=p,o*=g),r*=i,o*=i,u*=r,_*=o,u>h||_>l?d=Math.max(u/h,_/l):(u<32||_<32)&&(d=Math.min(u/32,_/32)),d&&(r/=d,o/=d,u/=d,_/=d),p&&(r/=p,o/=g),(y||1!==r||1!==o)&&(c||(c=ca(),y&&_a(c,y)),ua(c,1/r,1/o));const v=t.canvas.createPattern(e.getCanvas(u,_,f),"repeat"===m?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform=null,c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}return!1}const{get:ga,translate:fa}=f;function ya(t,e,s,i,r){let{width:o,height:n}=s;const{opacity:a,mode:h,offset:l,scale:d,rotation:c,blendMode:u}=i,_=r.width===o&&r.height===n;u&&(e.blendMode=u);const p=e.data={mode:h};switch(h){case"strench":_||(o=r.width,n=r.height),(r.x||r.y)&&(p.transform=ga(),fa(p.transform,r.x,r.y));break;case"clip":(l||d||c)&&function(t,e,s,i,r){const o=oa();aa(o,e.x,e.y),s&&aa(o,s.x,s.y),i&&("number"==typeof i?la(o,i):la(o,i.x,i.y),t.scaleX=o.a,t.scaleY=o.d),r&&da(o,r),t.transform=o}(p,r,l,d,c);break;case"repeat":(!_||d||c)&&function(t,e,s,i,r,o){const n=oa();if(o)switch(da(n,o),o){case 90:aa(n,i,0);break;case 180:aa(n,s,i);break;case 270:aa(n,0,s)}aa(n,e.x,e.y),r&&(ha(n,e,r),t.scaleX=t.scaleY=r),t.transform=n}(p,r,o,n,d,c);break;default:_&&!c||function(t,e,s,i,r,o){const n=oa(),a=o&&180!==o,h=s.width/(a?r:i),l=s.height/(a?i:r),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-i*d)/2,u=s.y+(s.height-r*d)/2;aa(n,c,u),la(n,d),o&&na(n,{x:s.x+s.width/2,y:s.y+s.height/2},o),t.scaleX=t.scaleY=d,t.transform=n}(p,h,r,o,n,c)}p.width=o,p.height=n,a&&(p.opacity=a);const g=t.leafer&&t.leafer.canvas;g&&g.bounds.hit(t.__world)&&pa(t,e,g.pixelRatio)}function ma(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function va(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new ir(t,e))}function wa(t,e,s,i){const{scaleX:r,scaleY:o}=t.__world;if(s.data&&s.patternId!==r+o){if(i)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=r*e.pixelRatio,n*=o*e.pixelRatio,i=t>4096||n>4096}else i=!1;if(i){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?Co.patternTasker.add((()=>ft(this,void 0,void 0,(function*(){e.bounds.hit(t.__world)&&pa(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300):pa(t,s,e.pixelRatio),!1}return!1}function xa(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,o)}function ba(t,e,s){const{strokeAlign:i}=t.__,r="string"!=typeof s;switch(i){case"center":e.setStroke(r?void 0:s,t.__.strokeWidth,t.__),r?Ta(t,s,e,!0):Ea(t,e);break;case"inside":Ba(t,e,s,"inside",r);break;case"outside":Ba(t,e,s,"outside",r)}}function Ba(t,e,s,i,r){const{strokeWidth:o,__font:n}=t.__,a=e.getSameCanvas(!0);a.setStroke(r?void 0:s,2*o,t.__),a.font=n,r?Ta(t,s,a,!0):Ea(t,a),a.blendMode="outside"===i?"destination-out":"destination-in",xa(t,a),a.blendMode="normal",e.copyWorldToInner(a,t.__world,t.__layout.renderBounds),a.recycle()}function Ea(t,e){let s;const{rows:i,decorationY:r,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),r&&e.strokeRect(s.x,s.y+r,s.width,o)}function Ta(t,e,s,i){let r;for(let o=0,n=e.length;o<n;o++)r=e[o],r.image&&wa(t,s,r,!1)||r.style&&(s.strokeStyle=r.style,r.blendMode?(s.saveBlendMode(r.blendMode),i?Ea(t,s):s.stroke(),s.restoreBlendMode()):i?Ea(t,s):s.stroke())}const{getSpread:Ca,getOuterOf:ka,getByMove:Ra,getIntersectData:La}=Y;const Oa={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+")"}},Pa={x:.5,y:0},Sa={x:.5,y:1};function Da(t,e,s){let i;for(let r=0,o=e.length;r<o;r++)i=e[r],t.addColorStop(i.offset,Oa.string(i.color,s))}const{set:Ma,getAngle:Aa,getDistance:Ia}=T,{get:Wa,rotateOfOuter:Na,scaleOfOuter:Fa}=f,za={x:.5,y:.5},Ua={x:.5,y:1},Ya={},Ha={};const{set:ja,getAngle:Xa,getDistance:Va}=T,{get:Ga,rotateOfOuter:Ka,scaleOfOuter:qa}=f,Za={x:.5,y:.5},Qa={x:.5,y:1},$a={},Ja={};let th;function eh(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=e.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:Oa.string(a,h)};case"image":return function(t,e,s,i,r){const o={type:s.type},n=o.image=Co.get(s);if(n.ready&&ma(t,e,n)&&ya(t,o,n,s,i),r){const r={target:t,image:n,attrName:e,attrValue:s};n.ready?(va(ir.LOAD,r),va(ir.LOADED,r)):n.error?(t.forceUpdate("surface"),r.error=n.error,va(ir.ERROR,r)):(va(ir.LOAD,r),o.loadId=n.load((()=>{t.__&&(ma(t,e,n)&&(ya(t,o,n,s,i),t.forceUpdate("surface")),va(ir.LOADED,r))}),(e=>{t.forceUpdate("surface"),r.error=e,va(ir.ERROR,r)})))}return o}(e,i,s,r,!th||!th[s.url]);case"linear":return function(e,s){let{from:i,to:r,type:o,blendMode:n,opacity:a}=e;i||(i=Pa),r||(r=Sa);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);Da(h,e.stops,a);const l={type:o,style:h};return n&&(l.blendMode=n),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=za),r||(r=Ua);const{x:l,y:d,width:c,height:u}=s;let _;Ma(Ya,l+i.x*c,d+i.y*u),Ma(Ha,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=Wa(),Fa(_,Ya,c/u*(h||1),1),Na(_,Ya,Aa(Ya,Ha)+90));const p=t.canvas.createRadialGradient(Ya.x,Ya.y,0,Ya.x,Ya.y,Ia(Ya,Ha));Da(p,e.stops,n);const g={type:o,style:p,transform:_};return a&&(g.blendMode=a),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:o,opacity:n,blendMode:a,stretch:h}=e;i||(i=Za),r||(r=Qa);const{x:l,y:d,width:c,height:u}=s;ja($a,l+i.x*c,d+i.y*u),ja(Ja,l+r.x*c,d+r.y*u);const _=Ga(),p=Xa($a,Ja);t.conicGradientRotate90?(qa(_,$a,c/u*(h||1),1),Ka(_,$a,p+90)):(qa(_,$a,1,c/u*(h||1)),Ka(_,$a,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,$a.x,$a.y):t.canvas.createRadialGradient($a.x,$a.y,0,$a.x,$a.y,Va($a,Ja));Da(g,e.stops,n);const f={type:o,style:g,transform:_};return a&&(f.blendMode=a),f}(s,r);default:return s.r?{type:"solid",style:Oa.string(s)}:void 0}}var sh=Object.freeze({__proto__:null,compute:function(t,e){const s=[];let i,r=t.__.__input[e];r instanceof Array||(r=[r]),th=t.__.__recycleImage(e);for(let o=0,n=r.length;o<n;o++)i=eh(t,r[o],e),i&&s.push(i);t.__["_"+e]=s.length?s:void 0},drawTextStroke:Ea,fill:function(t,e,s){e.fillStyle=s,t.__.__font?xa(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fillText:xa,fills:function(t,e,s){let i;const{windingRule:r,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)i=s[n],i.image&&wa(t,e,i,!o)||i.style&&(e.fillStyle=i.style,i.transform?(e.save(),e.transform(i.transform),i.blendMode&&(e.blendMode=i.blendMode),o?xa(t,e):r?e.fill(r):e.fill(),e.restore()):i.blendMode?(e.saveBlendMode(i.blendMode),o?xa(t,e):r?e.fill(r):e.fill(),e.restoreBlendMode()):o?xa(t,e):r?e.fill(r):e.fill())},shape:function(t,e,s){const i=e.getSameCanvas();let r,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=n=ka(h,s.matrix)):r=n=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=La(i?Ca(e.bounds,i*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=ka(h,o),r=Ra(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(i,s),{canvas:i,matrix:o,bounds:r,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:o,__font:n}=i;if(r)if(n)ba(t,e,s);else switch(o){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 o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(i.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:ba,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:o,__font:n}=i;if(r)if(n)ba(t,e,s);else switch(o){case"center":e.setStroke(void 0,r,i),Ta(t,s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),Ta(t,s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*r,t.__),Ta(t,s,n),n.clip(i.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}}});Object.assign(Vn,ra),Object.assign(Gn,sh);const ih={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&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}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=Gn.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&Vn.shadow(this,t,o,e),s&&(this.__.__isFills?Gn.fills(this,t,s):Gn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&Vn.innerShadow(this,t,o,e),i&&(this.__.__isStrokes?Gn.strokes(this,t,i):Gn.stroke(this,t,i)),o.worldCanvas&&o.worldCanvas.recycle(),o.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))}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")}},rh={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:o,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(o,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};let oh=class extends Zr{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?ze.toCanvasData(e,!0):e:[]}getPathString(t){return ze.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&Gn.compute(this,"fill"),e&&Gn.compute(this,"stroke")}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?pi.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return qn.export(this,t,e)}static one(t,e,s,i,r){return st.get(t.tag||this.prototype.__tag,t,e,s,i,r)}destroy(){this.fill=this.stroke=null,super.destroy()}};gt([Ii(Mn)],oh.prototype,"__",void 0),gt([xi("")],oh.prototype,"id",void 0),gt([xi("")],oh.prototype,"name",void 0),gt([xi("")],oh.prototype,"className",void 0),gt([Oi("pass-through")],oh.prototype,"blendMode",void 0),gt([Pi(1)],oh.prototype,"opacity",void 0),gt([Pi(!0)],oh.prototype,"visible",void 0),gt([Di(!1)],oh.prototype,"isMask",void 0),gt([Mi(!1)],oh.prototype,"isEraser",void 0),gt([Si(0)],oh.prototype,"zIndex",void 0),gt([xi()],oh.prototype,"locked",void 0),gt([bi(0)],oh.prototype,"x",void 0),gt([bi(0)],oh.prototype,"y",void 0),gt([Ti(100)],oh.prototype,"width",void 0),gt([Ti(100)],oh.prototype,"height",void 0),gt([Bi(1)],oh.prototype,"scaleX",void 0),gt([Bi(1)],oh.prototype,"scaleY",void 0),gt([Ei(0)],oh.prototype,"rotation",void 0),gt([Ei(0)],oh.prototype,"skewX",void 0),gt([Ei(0)],oh.prototype,"skewY",void 0),gt([xi(!1)],oh.prototype,"draggable",void 0),gt([Ai(!0)],oh.prototype,"hittable",void 0),gt([Ai("path")],oh.prototype,"hitFill",void 0),gt([Ri("path")],oh.prototype,"hitStroke",void 0),gt([Ai(!0)],oh.prototype,"hitChildren",void 0),gt([Ai(!0)],oh.prototype,"hitSelf",void 0),gt([Oi()],oh.prototype,"fill",void 0),gt([Ri()],oh.prototype,"stroke",void 0),gt([Ri("inside")],oh.prototype,"strokeAlign",void 0),gt([Ri(1)],oh.prototype,"strokeWidth",void 0),gt([Ri("none")],oh.prototype,"strokeCap",void 0),gt([Ri("miter")],oh.prototype,"strokeJoin",void 0),gt([Ri()],oh.prototype,"dashPattern",void 0),gt([Ri()],oh.prototype,"dashOffset",void 0),gt([Ri(10)],oh.prototype,"miterLimit",void 0),gt([Ci()],oh.prototype,"cornerRadius",void 0),gt([Ci()],oh.prototype,"cornerSmoothing",void 0),gt([Yn()],oh.prototype,"shadow",void 0),gt([Yn()],oh.prototype,"innerShadow",void 0),gt([Yn()],oh.prototype,"blur",void 0),gt([Yn()],oh.prototype,"backgroundBlur",void 0),gt([Yn()],oh.prototype,"grayscale",void 0),gt([Hi(As.drawPathByData)],oh.prototype,"__drawPathByData",null),oh=gt([Vi(jn),Vi(Xn),Vi(ih),ji()],oh);let nh=class extends oh{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,e){}removeAll(t){}};gt([Ii(In)],nh.prototype,"__",void 0),nh=gt([Vi(oo),Gi()],nh);let ah=class extends oh{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};gt([Ii(Nn)],ah.prototype,"__",void 0),ah=gt([Vi(rh),Gi()],ah);const hh=ah.prototype,lh=nh.prototype,dh={},{copy:ch,add:uh}=Y;let _h=class extends nh{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;ch(dh,t),super.__updateRenderBounds(),uh(t,dh)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};gt([Ii(Wn)],_h.prototype,"__",void 0),gt([Li("show")],_h.prototype,"overflow",void 0),gt([Hi(hh.__updateStrokeSpread)],_h.prototype,"__updateStrokeSpread",null),gt([Hi(hh.__updateRenderSpread)],_h.prototype,"__updateRectRenderSpread",null),gt([Hi(hh.__updateBoxBounds)],_h.prototype,"__updateBoxBounds",null),gt([Hi(hh.__updateStrokeBounds)],_h.prototype,"__updateStrokeBounds",null),gt([Hi(hh.__updateRenderBounds)],_h.prototype,"__updateRectRenderBounds",null),gt([Hi(hh.__updateChange)],_h.prototype,"__updateRectChange",null),gt([Hi(hh.__drawPathByData)],_h.prototype,"__drawPathByData",null),gt([Hi(hh.__render)],_h.prototype,"__renderRect",null),gt([Hi(lh.__render)],_h.prototype,"__renderGroup",null),_h=gt([ji(),Gi()],_h);let ph=class extends _h{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};gt([Ii(class extends Wn{})],ph.prototype,"__",void 0),gt([Li("hide")],ph.prototype,"overflow",void 0),ph=gt([Gi()],ph);const{moveTo:gh,closePath:fh,ellipse:yh}=rs;let mh=class extends oh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?i||r?(s<1&&yh(a,o,n,o*s,n*s,0,i,r,!1),yh(a,o,n,o,n,0,r,i,!0),s<1&&fh(a)):(s<1&&(yh(a,o,n,o*s,n*s),gh(a,t,n)),yh(a,o,n,o,n,0,0,360,!0)):i||r?(gh(a,o,n),yh(a,o,n,o,n,0,i,r,!1),fh(a)):yh(a,o,n,o,n)}};gt([Ii(class extends Mn{get __boxStroke(){return!0}})],mh.prototype,"__",void 0),gt([Ci(0)],mh.prototype,"innerRadius",void 0),gt([Ci(0)],mh.prototype,"startAngle",void 0),gt([Ci(0)],mh.prototype,"endAngle",void 0),mh=gt([Gi()],mh);const{sin:vh,cos:wh,PI:xh}=Math,{moveTo:bh,lineTo:Bh,closePath:Eh}=rs;let Th=class extends oh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,o=this.__.path=[];bh(o,i,0);for(let t=1;t<s;t++)Bh(o,i+i*vh(2*t*xh/s),r-r*wh(2*t*xh/s));Eh(o)}};gt([Ii(class extends Mn{})],Th.prototype,"__",void 0),gt([Ci(3)],Th.prototype,"sides",void 0),Th=gt([Gi()],Th);const{sin:Ch,cos:kh,PI:Rh}=Math,{moveTo:Lh,lineTo:Oh,closePath:Ph}=rs;let Sh=class extends oh{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Lh(n,r,0);for(let t=1;t<2*s;t++)Oh(n,r+(t%2==0?r:r*i)*Ch(t*Rh/s),o-(t%2==0?o:o*i)*kh(t*Rh/s));Ph(n)}};gt([Ii(class extends Mn{})],Sh.prototype,"__",void 0),gt([Ci(5)],Sh.prototype,"points",void 0),gt([Ci(.382)],Sh.prototype,"innerRadius",void 0),Sh=gt([Gi()],Sh);const{moveTo:Dh,lineTo:Mh}=rs,{rotate:Ah,getAngle:Ih,getDistance:Wh,defaultPoint:Nh}=T,{setPoint:Fh,addPoint:zh,toBounds:Uh}=L,Yh={};let Hh=class extends oh{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&&Ah(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Wh(Nh,t),this.rotation=Ih(Nh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Dh(t,0,0);const e=this.toPoint;Mh(t,e.x,e.y)}__updateBoxBounds(){Fh(Yh,0,0),zh(Yh,this.__toPoint.x,this.__toPoint.y),Uh(Yh,this.__layout.boxBounds)}};gt([Ii(class extends Mn{})],Hh.prototype,"__",void 0),gt([Ti()],Hh.prototype,"rotation",void 0),gt([ki("center")],Hh.prototype,"strokeAlign",void 0),Hh=gt([Gi()],Hh);let jh=class extends ah{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(ir.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};gt([Ii(Un)],jh.prototype,"__",void 0),gt([Ti("")],jh.prototype,"url",void 0),jh=gt([Gi()],jh);let Xh=class extends ah{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new R(t.__world);r.invert();const o=new R;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.preMultiply(o),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};gt([Ii(Un)],Xh.prototype,"__",void 0),gt([Hn(100)],Xh.prototype,"width",void 0),gt([Hn(100)],Xh.prototype,"height",void 0),gt([Hn(t.devicePixelRatio)],Xh.prototype,"pixelRatio",void 0),gt([Hn(!0)],Xh.prototype,"smooth",void 0),gt([Ai("all")],Xh.prototype,"hitFill",void 0),Xh=gt([Gi()],Xh);const Vh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Gh=Vh+"_#~&*+\\=|≮≯≈≠=…",Kh=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function qh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Zh=qh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Qh=qh("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),$h=qh(Vh),Jh=qh(Gh),tl=qh("- —/~|┆·");var el;!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"}(el||(el={}));const{Letter:sl,Single:il,Before:rl,After:ol,Symbol:nl,Break:al}=el;function hl(t){return Zh[t]?sl:tl[t]?al:Qh[t]?rl:$h[t]?ol:Jh[t]?nl:Kh.test(t)?il:sl}const ll={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function dl(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:cl}=ll,{Letter:ul,Single:_l,Before:pl,After:gl,Symbol:fl,Break:yl}=el;let ml,vl,wl,xl,bl,Bl,El,Tl,Cl,kl,Rl,Ll,Ol,Pl,Sl=[];function Dl(t,e){ml.data.push({char:t,width:e}),wl+=e}function Ml(){xl+=wl,ml.width=wl,vl.words.push(ml),ml={data:[]},wl=0}function Al(){Ll&&(Ol.paraNumber++,vl.paraStart=!0,Ll=!1),vl.width=xl,Pl.width&&cl(vl),Sl.push(vl),vl={words:[]},xl=0}const Il=0,Wl=1,Nl=2;const Fl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,o=0,{width:n,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=r.fourNumber(h);n&&(i=l,n-=e+l),a&&(o=t,a-=t+s)}const u={bounds:{x:i,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,i){Ol=e,Sl=e.rows,Pl=e.bounds;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=t,{width:h,height:l}=Pl;if(h||l||r||"none"!==n){Ll=!0,Cl=null,wl=xl=0,ml={data:[]},vl={words:[]};for(let t=0,e=s.length;t<e;t++)Bl=s[t],"\n"===Bl?(wl&&Ml(),vl.paraEnd=!0,Al(),Ll=!0):(Tl=hl(Bl),Tl===ul&&"none"!==n&&(Bl=dl(Bl,n,!wl)),El=a.measureText(Bl).width,r&&(El+=r),kl=Tl===_l&&(Cl===_l||Cl===ul)||Cl===_l&&Tl!==gl,Rl=!(Tl!==pl&&Tl!==_l||Cl!==fl&&Cl!==gl),bl=Ll&&o?h-o:h,h&&xl+wl+El>bl&&(Rl||(Rl=Tl===ul&&Cl==gl),kl||Rl||Tl===yl||Tl===pl||Tl===_l||wl+El>bl?(wl&&Ml(),Al()):Al())," "===Bl&&!0!==Ll&&xl+wl===0||(Tl===yl?(" "===Bl&&wl&&Ml(),Dl(Bl,El),Ml()):kl||Rl?(wl&&Ml(),Dl(Bl,El)):Dl(Bl,El)),Cl=Tl);wl&&Ml(),xl&&Al(),Sl.length>0&&(Sl[Sl.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{Ol.paraNumber++,Sl.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:o,textAlign:n,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=o;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,o=s.length;e<o;e++){switch(d=s[e],d.x=c,n){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),d.x<i.x&&(i.x=d.x),d.width>i.width&&(i.width=d.width)}i.y=u,i.height=g}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?Il:l>.01?Wl:Nl,c===Nl?(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===Wl?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,n),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=i[r-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<u));t--){if(h<u&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(u,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},{copyAndSpread:zl,includes:Ul,spread:Yl}=Y;let Hl=class extends oh{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:o}=this.__layout.boxBounds;t.rect(s,i,r,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Fl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=An.number(r,a),t.__letterSpacing=An.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&Yl(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 _=Ul(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(){zl(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};gt([Ii(class extends Mn{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=zn[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Hl.prototype,"__",void 0),gt([Ti(0)],Hl.prototype,"width",void 0),gt([Ti(0)],Hl.prototype,"height",void 0),gt([Ti(0)],Hl.prototype,"padding",void 0),gt([ki("outside")],Hl.prototype,"strokeAlign",void 0),gt([Ti("")],Hl.prototype,"text",void 0),gt([Ti("L")],Hl.prototype,"fontFamily",void 0),gt([Ti(12)],Hl.prototype,"fontSize",void 0),gt([Ti("normal")],Hl.prototype,"fontWeight",void 0),gt([Ti(!1)],Hl.prototype,"italic",void 0),gt([Ti("none")],Hl.prototype,"textCase",void 0),gt([Ti("none")],Hl.prototype,"textDecoration",void 0),gt([Ti(0)],Hl.prototype,"letterSpacing",void 0),gt([Ti({type:"percent",value:150})],Hl.prototype,"lineHeight",void 0),gt([Ti(0)],Hl.prototype,"paraIndent",void 0),gt([Ti(0)],Hl.prototype,"paraSpacing",void 0),gt([Ti("left")],Hl.prototype,"textAlign",void 0),gt([Ti("top")],Hl.prototype,"verticalAlign",void 0),gt([Ti("show")],Hl.prototype,"textOverflow",void 0),Hl=gt([Gi()],Hl);const{toBounds:jl}=_i;let Xl=class extends oh{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){jl(this.__.path,this.__layout.boxBounds)}};gt([Ii(class extends Mn{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Fn(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],Xl.prototype,"__",void 0),gt([Ci()],Xl.prototype,"path",void 0),gt([Ci()],Xl.prototype,"windingRule",void 0),gt([ki("center")],Xl.prototype,"strokeAlign",void 0),Xl=gt([Gi()],Xl);let Vl=class extends nh{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Xl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,o,n,a){return this}moveToArc(t,e,s,i,r,o){return this}paint(){this.pathElement.forceUpdate("path")}};gt([Ii(class extends In{})],Vl.prototype,"__",void 0),Vl=gt([Vi(ws,["beginPath"]),Gi()],Vl);const Gl=Z.get("Leafer");let Kl=class extends nh{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&Co.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:r}=this;Pn.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new at,this.hitCanvasManager=new dt,i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),So.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(dr.RESTART):this.emitLeafer(dr.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(dr.STOP))}resize(t){const e=ct.copyAttrs({},t,Tt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,Tt);this.canvas.resize(t),this.__onResize(new rr(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,Tt),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const i=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),i(),this.viewLoaded||(s=this.on_(hr.FRAME,i))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(Tt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Tt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,Tt);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(dr.BEFORE_READY),this.emitLeafer(dr.READY),this.emitLeafer(dr.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(dr.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new dr(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(dr.START,(()=>J.end(t))),this.once(ar.END,(()=>this.__onReady())),this.once(lr.END,(()=>this.__onViewReady())),this.on(ar.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){setTimeout((()=>{if(this.canvas)try{this.stop(),this.emitEvent(new dr(dr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config=this.userConfig=this.canvas=this.view=null,this.selector=this.interaction=this.canvasManager=this.hitCanvasManager=null,super.destroy(),setTimeout((()=>{Co.clearRecycled()}),100)}catch(t){Gl.error(t)}}),0)}};gt([Ii(class extends In{})],Kl.prototype,"__",void 0),gt([Ti()],Kl.prototype,"pixelRatio",void 0),Kl=gt([Gi()],Kl);let ql=class extends Kl{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(sr.CHANGE,(()=>{Z.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 Kl(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ar.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(lr.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(lr.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,Tt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}};ql=gt([Gi()],ql);var Zl=Object.freeze({__proto__:null,Animate:Kn,AnimateEvent:hr,get App(){return ql},AutoBounds:G,BezierHelper:Gt,Bounds:V,BoundsHelper:Y,get Box(){return _h},get Branch(){return oo},BranchHelper:Wr,BranchRender:Er,get Canvas(){return Xh},CanvasManager:at,ChildEvent:er,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return go},get DropEvent(){return yo},Effect:Vn,get Ellipse(){return mh},EllipseHelper:se,Event:tr,EventCreator:ot,Export:qn,FileHelper:pt,get Frame(){return ph},get Group(){return nh},HitCanvasManager:dt,get Image(){return jh},ImageEvent:ir,ImageManager:Co,IncrementId:s,Interaction:Tn,get KeyEvent(){return bo},Keyboard:ao,LayoutEvent:ar,Layouter:Go,get Leaf(){return Zr},LeafBounds:mr,LeafBoundsHelper:Ir,LeafData:_t,LeafDataProxy:cr,LeafEventer:$i,LeafHelper:Pr,LeafHit:xr,LeafLevelList:lt,LeafList:ht,LeafMask:Br,LeafMatrix:gr,LeafRender:br,get Leafer(){return Kl},LeaferCanvas:tn,LeaferCanvasBase:Ct,LeaferEvent:dr,LeaferImage:Oo,LeaferImageBase:Oo,LeaferTypeCreator:Pn,get Line(){return Hh},MathHelper:r,Matrix:R,MatrixHelper:f,get MoveEvent(){return mo},NeedConvertToCanvasCommandMap:Pt,OneRadian:o,PI2:n,PI_2:a,Paint:Gn,get Path(){return Xl},PathBounds:_i,PathCommandDataHelper:rs,PathCommandMap:Lt,PathConvert:ze,PathCorner:pi,PathCreator:ws,PathDrawer:As,PathHelper:kt,PathNumberCommandLengthMap:At,PathNumberCommandMap:Mt,get Pen(){return Vl},Platform:t,PluginManager:So,Point:k,PointHelper:T,PointerButton:ho,get PointerEvent(){return uo},get Polygon(){return Th},PropertyEvent:sr,get Rect(){return ah},RectHelper:It,RectRender:rh,RenderEvent:lr,Renderer:qo,ResizeEvent:rr,get RotateEvent(){return vo},Run:J,Selector:$o,get Star(){return Sh},StringNumberMap:q,get SwipeEvent(){return wo},TaskItem:Eo,TaskProcessor:To,get Text(){return Hl},TransformEvent:or,TwoPointBounds:K,TwoPointBoundsHelper:L,get UI(){return oh},UIBounds:jn,UICreator:st,UIEvent:co,UIHit:Xn,UIRender:ih,WaitHelper:zr,WatchEvent:nr,Watcher:Mo,get ZoomEvent(){return xo},affectRenderBoundsType:Li,affectStrokeBoundsType:ki,aliasType:vi,boundsType:Ti,canvasPatch:fi,canvasSizeAttrs:Tt,dataProcessor:Ii,dataType:xi,defineDataProcessor:Fi,defineKey:yi,defineLeafAttr:wi,effectType:Yn,eraserType:Mi,getDescriptor:mi,hitType:Ai,layoutProcessor:Wi,maskType:Di,opacityType:Pi,pathType:Ci,positionType:bi,registerUI:Gi,registerUIEvent:Ki,resizeType:Hn,rewrite:Hi,rewriteAble:ji,rotationType:Ei,scaleType:Bi,setDefaultValue:Ni,sortType:Si,strokeType:Ri,surfaceType:Oi,useCanvas:Rn,useModule:Vi,usePlugin:Do});So.power=Zl,Rn();export{Kn as Animate,hr as AnimateEvent,ql as App,G as AutoBounds,Gt as BezierHelper,V as Bounds,Y as BoundsHelper,_h as Box,oo as Branch,Wr as BranchHelper,Er as BranchRender,Xh as Canvas,at as CanvasManager,er as ChildEvent,e as Creator,ct as DataHelper,Z as Debug,go as DragEvent,yo as DropEvent,Vn as Effect,mh as Ellipse,se as EllipseHelper,tr as Event,ot as EventCreator,qn as Export,pt as FileHelper,ph as Frame,nh as Group,dt as HitCanvasManager,jh as Image,ir as ImageEvent,Co as ImageManager,s as IncrementId,Tn as Interaction,bo as KeyEvent,ao as Keyboard,ar as LayoutEvent,Go as Layouter,Zr as Leaf,mr as LeafBounds,Ir as LeafBoundsHelper,_t as LeafData,cr as LeafDataProxy,$i as LeafEventer,Pr as LeafHelper,xr as LeafHit,lt as LeafLevelList,ht as LeafList,Br as LeafMask,gr as LeafMatrix,br as LeafRender,Kl as Leafer,tn as LeaferCanvas,Ct as LeaferCanvasBase,dr as LeaferEvent,Oo as LeaferImage,Oo as LeaferImageBase,Pn as LeaferTypeCreator,Hh as Line,r as MathHelper,R as Matrix,f as MatrixHelper,mo as MoveEvent,Pt as NeedConvertToCanvasCommandMap,o as OneRadian,n as PI2,a as PI_2,Gn as Paint,Xl as Path,_i as PathBounds,rs as PathCommandDataHelper,Lt as PathCommandMap,ze as PathConvert,pi as PathCorner,ws as PathCreator,As as PathDrawer,kt as PathHelper,At as PathNumberCommandLengthMap,Mt as PathNumberCommandMap,Vl as Pen,t as Platform,So as PluginManager,k as Point,T as PointHelper,ho as PointerButton,uo as PointerEvent,Th as Polygon,sr as PropertyEvent,ah as Rect,It as RectHelper,rh as RectRender,lr as RenderEvent,qo as Renderer,rr as ResizeEvent,vo as RotateEvent,J as Run,$o as Selector,Sh as Star,q as StringNumberMap,wo as SwipeEvent,Eo as TaskItem,To as TaskProcessor,Hl as Text,or as TransformEvent,K as TwoPointBounds,L as TwoPointBoundsHelper,oh as UI,jn as UIBounds,st as UICreator,co as UIEvent,Xn as UIHit,ih as UIRender,zr as WaitHelper,nr as WatchEvent,Mo as Watcher,xo as ZoomEvent,Li as affectRenderBoundsType,ki as affectStrokeBoundsType,vi as aliasType,Ti as boundsType,fi as canvasPatch,Tt as canvasSizeAttrs,Ii as dataProcessor,xi as dataType,Fi as defineDataProcessor,yi as defineKey,wi as defineLeafAttr,Yn as effectType,Mi as eraserType,mi as getDescriptor,Ai as hitType,Wi as layoutProcessor,Di as maskType,Pi as opacityType,Ci as pathType,bi as positionType,Gi as registerUI,Ki as registerUIEvent,Hn as resizeType,Hi as rewrite,ji as rewriteAble,Ei as rotationType,Bi as scaleType,Ni as setDefaultValue,Si as sortType,Ri as strokeType,Oi as surfaceType,Rn as useCanvas,Vi as useModule,Do as usePlugin};