leafer-ui 1.0.0-alpha.23 → 1.0.0-alpha.30

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,2 +1 @@
1
- const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,o={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t)},n=Math.PI/180,{sin:r,cos:a,acos:h,atan:l,sqrt:d,PI:c}=Math,u={};function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const p={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,o=1,n=0,r=0){t.a=e,t.b=s,t.c=i,t.d=o,t.e=n,t.f=r},get:_,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){g.toInnerPoint(t,e,u),g.scaleOfInner(t,u,s,i)},scaleOfInner(t,e,s,i=s){g.translateInner(t,e.x,e.y),g.scale(t,s,i),g.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=a(e*=n),i=r(e),{a:o,b:h,c:l,d:d}=t;t.a=o*s-h*i,t.b=o*i+h*s,t.c=l*s-d*i,t.d=l*i+d*s},rotateOf(t,e,s){g.toInnerPoint(t,e,u),g.rotateOfInner(t,u,s)},rotateOfInner(t,e,s){g.translateInner(t,e.x,e.y),g.rotate(t,s),g.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:o,c:r,d:a}=t;s&&(s*=n,t.a=i+r*s,t.b=o+a*s),e&&(e*=n,t.c=r+i*e,t.d=a+o*e)},skewOf(t,e,s,i){g.toInnerPoint(t,e,u),g.skewOfInner(t,u,s,i)},skewOfInner(t,e,s,i){g.translateInner(t,e.x,e.y),g.skew(t,s,i),g.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:o,d:n,e:r,f:a}=t;t.a=e.a*s+e.b*o,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*o,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*o+r,t.f=e.e*i+e.f*n+a},divide(t,e){g.multiply(t,g.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=g;return g.copy(e,t),g.invert(e),e},invert(t){const{a:e,b:s,c:i,d:o,e:n,f:r}=t,a=1/(e*o-s*i);t.a=o*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*o-r*i)*a,t.f=-(r*e-n*s)*a},toOuterPoint(t,e,s,i){const{x:o,y:n}=e;s||(s=e),s.x=o*t.a+n*t.c,s.y=o*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:o,y:n}=e,{a:r,b:a,c:h,d:l}=t,d=1/(r*l-a*h);if(s||(s=e),s.x=(o*l-n*h)*d,s.y=(n*r-o*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*r-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:o}=t;let r=e,a=o,u=0,_=0,p=0;if(s||i){const t=e*o-s*i,g=e*i+s*o;if(s){const i=e*e+s*s;r=d(i),a=t/r;const o=e/r;u=s>0?h(o):-h(o),_=l(g/i)/n}else{const e=i*i+o*o;a=d(e),r=t/a;const s=i/a;u=c/2-(o>0?h(-s):-h(s)),p=l(g/e)/n}u/=n}return{x:t.e,y:t.f,scaleX:r,scaleY:a,rotation:u,skewX:_,skewY:p}},reset(t){g.set(t)}},g=p,{toInnerPoint:f,toOuterPoint:y}=p,{sin:m,cos:v,abs:w,sqrt:x,atan2:B}=Math,b={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=E.defaultPoint);const i=v(e*n),o=m(e*n),r=t.x-s.x,a=t.y-s.y;t.x=s.x+r*i-a*o,t.y=s.y+r*o-a*i},tempToInnerOf(t,e){const{tempPoint:s}=E;return E.copy(s,t),f(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=E;return E.copy(s,t),E.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),f(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){f(e,t,s)},toOuterOf(t,e,s){y(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=w(e.x-t.x),i=w(e.y-t.y);return x(s*s+i*i)},getAngle:(t,e)=>E.getAtan2(t,e)/n,getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=E.getAtan2(t,e);return{x:t.x+v(i)*s,y:t.y+m(i)*s}},reset(t){E.reset(t)}},E=b;class T{constructor(t,e){"object"==typeof t?b.copy(this,t):b.set(this,t,e)}set(t,e){b.set(this,t,e)}copy(t){return b.copy(this,t),this}clone(){return new T(this)}rotate(t,e){return b.rotate(this,t,e),this}toInnerOf(t,e){return b.toInnerOf(this,t,e),this}toOuterOf(t,e){return b.toOuterOf(this,t,e),this}getCenter(t){return b.getCenter(this,t)}getDistance(t){return b.getDistance(this,t)}getAngle(t){return b.getAngle(this,t)}getAtan2(t){return b.getAtan2(this,t)}reset(){b.reset(this)}}class k{constructor(t,e,s,i,o,n){"object"==typeof t?p.copy(this,t):p.set(this,t,e,s,i,o,n)}set(t,e,s,i,o,n){p.set(this,t,e,s,i,o,n)}copy(t){return p.copy(this,t),this}clone(){return new k(this)}translate(t,e){return p.translate(this,t,e),this}translateInner(t,e){return p.translateInner(this,t,e),this}scale(t,e){return p.scale(this,t,e),this}scaleOf(t,e,s){return p.scaleOf(this,t,e,s),this}scaleOfInner(t,e,s){return p.scaleOfInner(this,t,e,s),this}rotate(t){return p.rotate(this,t),this}rotateOf(t,e){return p.rotateOf(this,t,e),this}rotateOfInner(t,e){return p.rotateOfInner(this,t,e),this}skew(t,e){return p.skew(this,t,e),this}skewOf(t,e,s){return p.skewOf(this,t,e,s),this}skewOfInner(t,e,s){return p.skewOfInner(this,t,e,s),this}multiply(t){return p.multiply(this,t),this}divide(t){return p.divide(this,t),this}invert(){return p.invert(this),this}toOuterPoint(t,e){p.toOuterPoint(this,t,e)}toInnerPoint(t,e){p.toInnerPoint(this,t,e)}decompose(){return p.decompose(this)}reset(){p.reset(this)}}const R={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},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}},{tempPointBounds:C,setPoint:P,addPoint:O,toBounds:S}=R,{toOuterPoint:D}=p;let L,M,A,W;const I={},N={},F={tempBounds:{},set(t,e=0,s=0,i=0,o=0){t.x=e,t.y=s,t.width=i,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){z.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),z.move(t,e,s),t),getOutOfBounds(t,e){const s=-(z.right(e)-t.x),i=-(z.bottom(e)-t.y),o=Object.assign(Object.assign({},t),{offsetX:s,offsetY:i});return z.move(o,-s,-i),o},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(z.copy(z.tempBounds,t),z.toOuterOf(z.tempBounds,e),z.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),z.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):(I.x=t.x,I.y=t.y,D(e,I,N),P(C,N.x,N.y),I.x=t.x+t.width,D(e,I,N),O(C,N.x,N.y),I.y=t.y+t.height,D(e,I,N),O(C,N.x,N.y),I.x=t.x,D(e,I,N),O(C,N.x,N.y),S(C,s))},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new k(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return z.copyAndSpread(s,t,e),s},spread(t,e){z.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){L=t.x+t.width,M=t.y+t.height,A=e.x+e.width,W=e.y+e.height,L=L>A?L:A,M=M>W?M:W,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=L-t.x,t.height=M-t.y},addList(t,e){z.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){z.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){z.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){if(!e.length)return void z.reset(t);let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=s?s(e[r]):e[r],o&&(o.width||o.height)&&(n?(n=!1,i||j(t,o)):Y(t,o))},setByPoints(t,e){e.forEach(((t,e)=>{0===e?P(C,t.x,t.y):O(C,t.x,t.y)})),S(C,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=b.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=b.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=z.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=z.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=z.tempToOuterOf(e,s));let{x:i,y:o,width:n,height:r}=e;return L=i+n,M=o+r,A=t.x+t.width,W=t.y+t.height,i=i>t.x?i:t.x,o=o>t.y?o:t.y,L=L<A?L:A,M=M<W?M:W,n=L-i,r=M-o,{x:i,y:o,width:n,height:r}},intersect(t,e,s){z.copy(t,z.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){z.set(t)}},z=F,{add:Y,copy:j}=z;class X{constructor(t,e,s,i){"object"==typeof t?F.copy(this,t):F.set(this,t,e,s,i)}set(t,e,s,i){F.set(this,t,e,s,i)}copy(t){return F.copy(this,t),this}clone(){return new X(this)}scale(t){return F.scale(this,t),this}toOuterOf(t,e){return F.toOuterOf(this,t,e),this}getFitMatrix(t){return F.getFitMatrix(this,t)}spread(t){return F.spread(this,t),this}ceil(){return F.ceil(this),this}add(t){return F.add(this,t),this}addList(t){return F.setByList(this,t,!0),this}setByList(t,e){return F.setByList(this,t,e),this}addListWithHandle(t,e){return F.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return F.setByListWithHandle(this,t,e,s),this}setByPoints(t){return F.setByPoints(this,t),this}hitPoint(t,e){return F.hitPoint(this,t,e)}hitRadiusPoint(t,e){return F.hitRadiusPoint(this,t,e)}hit(t,e){return F.hit(this,t,e)}includes(t,e){return F.includes(this,t,e)}intersect(t,e){return F.intersect(this,t,e),this}getIntersect(t,e){return new X(F.getIntersectData(this,t,e))}isSame(t){return F.isSame(this,t)}isEmpty(){return F.isEmpty(this)}reset(){F.reset(this)}}class H{constructor(t,e,s,i,o,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,o,n)}set(t=0,e=0,s=0,i=0,o=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=o,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:o,width:n,height:r}=t;this.set(e,s,i,o,n,r)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:o,width:n,height:r}=this;return new X(o,e,n||t.width-o-s,r||t.height-e-i)}}class V{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}add(t){R.add(this,t)}}const U={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 G{constructor(t){this.name=t}static get(t){return new G(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(K.enable){if(K.filterList.length&&K.filterList.every((t=>t!==this.name)))return;if(K.excludeList.length&&K.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}error(...t){console.error(this.name,...t)}}G.filterList=[],G.excludeList=[],G.__={};const K=G,q=G.get("RunTime");class Q{static start(t,e){const i=s.create(s.RUNTIME);return Z.currentId=Z.idMap[i]=e?performance.now():Date.now(),Z.currentName=Z.nameMap[i]=t,Z.nameToIdMap[t]=i,i}static end(t,e){const s=Z.idMap[t],i=Z.nameMap[t];Z.idMap[t]=Z.nameMap[t]=Z.nameToIdMap[i]=void 0,e?q.log(i,performance.now()-s,"µs"):q.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=Z.nameToIdMap[t];void 0!==s&&Z.end(s,e)}}Q.idMap={},Q.nameMap={},Q.nameToIdMap={};const Z=Q,$=G.get("UICreator"),J={list:{},register(t){const{__tag:e}=t.prototype;tt[e]?$.error("register the repeat UI: ",e):tt[e]=t},get(t,e,s,i,o,n){const r=new tt[t](e);return void 0!==s&&(r.x=s,i&&(r.y=i),o&&(r.width=o),n&&(r.height=n)),r}},{list:tt}=J,et=G.get("EventCreator"),st={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(it[e]?et.error("register the repeat EventType: ",e):it[e]=t)}))},changeName(t,e){const s=it[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,it[e]=s)}},get:(t,...e)=>new it[t](...e)},{nameList:it}=st;class ot{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,o=i.length;e<o;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s;const o=e.canvas(t);return this.add(o),o}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 nt{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,o=e.length;i<o;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 nt;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class rt{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 at extends ot{constructor(){super(...arguments),this.pathTypeList=new nt,this.imageTypeList=new nt}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 ht={default:(t,e)=>(lt(e,t),lt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var o;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object?lt(t[i],e[i]):t[i]=e[i]}))},clone:t=>JSON.parse(JSON.stringify(t))},{assign:lt}=ht;class dt{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]}__getInputData(){const t={},{__input:e}=this;let s,i;for(let o in this)s=o.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[o]: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}}function ct(t,e,s){Object.defineProperty(t,e,s)}function ut(t,e){return Object.getOwnPropertyDescriptor(t,e)}function _t(t){return(e,s)=>{ct(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function pt(t,e,s,i){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};ct(t,e,Object.assign(o,i||{})),Pt(t,e,s)}function gt(t){return(e,s)=>{pt(e,s,t)}}function ft(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function yt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function mt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function vt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange()}})}}const wt=vt;function xt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeBoundsChanged||this.__layout.strokeBoundsChange()}})}}function Bt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}})}}function bt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Et(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Tt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.__addParentWait((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function kt(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange(),this.parent?this.parent.__hasMask=!!t||this.parent.children.some((t=>t.isMask)):this.__addParentWait((()=>{this.parent.__hasMask=!!t||this.parent.children.some((t=>t.isMask))}))}})}}function Rt(t){return(e,s)=>{ct(e,"__DataProcessor",{get:()=>t})}}function Ct(t){return(e,s)=>{ct(e,"__LayoutProcessor",{get:()=>t})}}function Pt(t,e,s){const i=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[o];return void 0===t?s:t},set(t){this[o]=t}};void 0===s&&(r.get=function(){return this[o]});const a=ut(i,e);a&&(a.set&&(r.set=a.set),a.get&&(r.get=a.get)),i[n]&&(r.set=i[n],delete i[n]),Object.defineProperty(i,e,r)}const Ot=new G("rewrite"),St=[],Dt=["destroy","constructor"];function Lt(t){return(e,s)=>{St.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Mt(){return t=>{At()}}function At(t){St.length&&(St.forEach((e=>{t&&Ot.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),St.length=0)}function Wt(t){return e=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!Dt.includes(s))if(t.prototype){ut(t.prototype,s).writable&&(e.prototype[s]=t.prototype[s])}else e.prototype[s]=t[s]}))}}function It(){return t=>{J.register(t)}}function Nt(){return t=>{st.register(t)}}function Ft(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}function zt(t,e,s,i){return new(s||(s=Promise))((function(o,n){function r(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}h((i=i.apply(t,e||[])).next())}))}setTimeout((()=>At(!0)));const{toOuterOf:Yt}=F;class jt{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.boxBoundsChange()}update(){const{leafer:t}=this.leaf;t&&(t.ready?t.watcher.changed&&t.layouter.layout():(t.start(),t.layouter.layout()))}getTransform(t){return this.update(),"world"===t?this.leaf.__world:this.leaf.__local}getMatrixDecompositionData(t){return this.update(),p.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.update(),"world"===e)switch(t){case"render":return this.leaf.__world;case"box":return this.getWorldBoxBounds();case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}return this.leaf.__world}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Yt(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Yt(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}strokeBoundsSpreadCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}strokeBoundsSpread(){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.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){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}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged=!0}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged=!0}strokeBoundsChange(){this.strokeBoundsChanged=!0,this.strokeBoundsSpreadWidth||(this.strokeBoundsSpreadWidth=1),this.boundsChanged=!0}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const Xt=G.get("Life"),Ht={},Vt={on(t,e,s){let i,o,n;if(s){const t="boolean"==typeof s;i=t?s:s.capture,o=!t&&s.once}const r=Ut(this,i,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(n=r[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):r[t]=[h])}))},off(t,e,s){let i,o,n;s&&(i="boolean"==typeof s?s:s.capture);const r=Ut(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(o=r[t],o&&(n=o.findIndex((t=>t.listener===e)),n>-1&&o.splice(n,1),o.length||delete r[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){G.enable&&Xt.log(t);const i=Ut(this,s)[t];if(i){let o;for(let n=0,r=i.length;n<r&&(o=i[n],o.listener(e),o.once&&(this.off(t,o.listener,s),n--,r--),!e||!e.isStopNow);n++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Ut(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Ht)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Ht)}}class Gt{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 Kt extends Gt{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Kt.ADD="child.add",Kt.REMOVE="child.remove";class qt extends Gt{constructor(t,e,s,i,o){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=o}}qt.CHANGE="property.change";class Qt extends Gt{constructor(t,e,s,i,o,n){super(t,e),this.image=s,this.attrName=i,this.attrValue=o,n&&(this.error=n)}}Qt.LOADED="image.loaded",Qt.ERROR="image.error";class Zt extends Gt{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?Zt.RESIZE:t),s&&Object.assign(this,t),this.old=e}}Zt.RESIZE="resize";class $t extends Gt{constructor(t,e){super(t),e&&Object.assign(this,e)}}$t.START="transform.start",$t.CHANGE="transform.change",$t.END="transform.end",$t.BEFORE_START="transform.before_start",$t.BEFORE_CHANGE="transform.before_change",$t.BEFORE_END="transform.before_end";class Jt extends Gt{constructor(t,e){super(t),this.data=e}}Jt.REQUEST="watch.request",Jt.DATA="watch.data";class te extends Gt{constructor(t,e){super(t),e&&(this.data=e)}}te.REQUEST="layout.request",te.START="layout.start",te.BEFORE="layout.before",te.LAYOUT="layout.layout",te.AFTER="layout.after",te.AGAIN="layout.again",te.END="layout.end";class ee extends Gt{}ee.REQUEST="render.request",ee.START="render.start",ee.BEFORE="render.before",ee.RENDER="render",ee.AFTER="render.after",ee.AGAIN="render.again",ee.END="render.end";class se extends Gt{}se.START="leafer.start",se.BEFORE_READY="leafer.before_ready",se.READY="leafer.ready",se.AFTER_READY="leafer.after_ready",se.VIEW_READY="leafer.view_ready",se.STOP="leafer.stop",se.RESTART="leafer.restart",se.END="leafer.end";const ie={__setAttr(t,e){if(this.leafer&&this.leafer.ready){const s=this.__.__get(t);s!==e&&(this.__[t]=e,this.leafer.emitEvent(new qt(qt.CHANGE,this,t,s,e)))}else this.__[t]=e},__getAttr(t){return this.__.__get(t)},__updateAttr(t){if(this.leafer&&this.leafer.ready){t||(t="fill");const e=this.__.__get(t);this[t]=e,this.leafer.emitEvent(new qt(qt.CHANGE,this,t,e,e))}}},{defaultMatrix:oe}=p,{sin:ne,cos:re}=Math,ae={__updateWorldMatrix(){const t=this.parent?this.parent.__world:oe,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:o,skewX:r,skewY:a}=this.__;o||r||a?(o*=n,r&&(r*=n),a&&(a*=n),t.a=s*re(o+a),t.b=s*ne(o+a),t.c=i*-ne(o-r),t.d=i*re(o-r)):(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:le}=F,de={__updateWorldBounds(){var t,e,s;if(this.__layout.boundsChanged){let i;const o=this.__layout;o.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),o.boxBoundsChanged=!1,i=!0),o.localBoxBoundsChanged&&(this.__updateLocalBoxBounds(),o.localBoxBoundsChanged=!1,o.strokeBoundsSpreadWidth&&(o.strokeBoundsChanged=!0),o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),o.strokeBoundsChanged&&(o.strokeBoundsSpreadWidth=this.__updateStrokeBoundsSpreadWidth(),o.strokeBoundsSpreadWidth?(o.strokeBounds===o.boxBounds&&o.strokeBoundsSpread(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds(),o.strokeBoundsChanged=!1,o.renderBoundsSpreadWidth&&(o.renderBoundsChanged=!0)):o.strokeBoundsSpreadCancel(),null===(e=this.parent)||void 0===e||e.__layout.strokeBoundsChange(),i||(i=!0)),o.renderBoundsChanged&&(o.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),o.renderBoundsSpreadWidth?(o.renderBounds!==o.boxBounds&&o.renderBounds!==o.strokeBounds||o.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateLocalRenderBounds(),o.renderBoundsChanged=!1):o.renderBoundsSpreadCancel(),null===(s=this.parent)||void 0===s||s.__layout.renderBoundsChange()),o.boundsChanged=!1,he(this.__layout.renderBounds,this.__world,this.__world),i&&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(){le(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeBoundsSpreadWidth)},__updateRenderBounds(){le(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderBoundsSpreadWidth)}},{toInnerRadiusPointOf:ce}=b,ue={},_e={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),ce(t,this.__world,ue),this.__hit(ue)},__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawHitPath(this.__hitCanvas)},__drawHitPath(t){this.__drawRenderPath(t)}},pe={__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)}},{LEAF:ge,create:fe}=s;let ye=class{get tag(){return this.__tag}get __tag(){return"Leaf"}get __DataProcessor(){return dt}get __LayoutProcessor(){return jt}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.update(),this.__worldOpacity}constructor(t){this.innerId=fe(ge),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)}__addParentWait(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}__runParentWait(){const t=this.__parentWait.length;for(let e=0;e<t;e++)this.__parentWait[e]();this.__parentWait=null}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,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){}__updateAttr(t,e){}forceUpdate(){this.__updateAttr("x")}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}getWorld(t){return this.__layout.getMatrixDecompositionData("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?p.toInnerPoint(this.parent.worldTransform,t,e,s):e&&b.copy(e,t)}localToWorld(t,e,s){this.parent?p.toOuterPoint(this.parent.worldTransform,t,e,s):e&&b.copy(e,t)}worldToInner(t,e,s){p.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){p.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(){}__updateRenderTime(){}__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.__isBranch&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};ye=Ft([Wt(ie),Wt(ae),Wt(de),Wt(_e),Wt(Vt),Wt(pe)],ye);const me={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)we(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)xe(e[t])}},updateAllChange(t){if(xe(t),t.__updateChange(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Be(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&p.toInnerPoint(t.parent.__world,i,i,!0),ve.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,o){const n=t.parent?b.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,n,s,i,o)},zoomOfLocal(t,e,s,i,o){i||(i=s),o||(o=t);const{x:n,y:r}=o.__,a=(new k).translate(n,r).scaleOf(e,s,i);o.x=a.e,o.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOf(t,e,s,i){const o=t.parent?b.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,o,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:o,y:n}=i.__,r=(new k).translate(o,n).rotateOf(e,s);i.x=r.e,i.y=r.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)}},ve=me,{updateAllWorldMatrix:we,updateAllWorldOpacity:xe,updateAllChange:Be}=ve,be={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},Ee={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,o=s.length;i<o;i++)(t=s[i]).__isBranch&&(t.__tempNumber=1,e.push(t),Te(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++)ke(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:Te,pushAllBranchStack:ke}=Ee,{setByListWithHandle:Re}=F,{sort:Ce}=Ee,{localBoxBounds:Pe,localEventBounds:Oe,localRenderBounds:Se,maskLocalBoxBounds:De,maskLocalEventBounds:Le,maskLocalRenderBounds:Me}=be;class Ae extends ye{constructor(){super(),this.__isBranch=!0,this.children=[]}__updateStrokeBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){Re(this.__layout.boxBounds,this.children,this.__hasMask?De:Pe)}__updateStrokeBounds(){Re(this.__layout.strokeBounds,this.children,this.__hasMask?Le:Oe)}__updateRenderBounds(){Re(this.__layout.renderBounds,this.children,this.__hasMask?Me:Se)}__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(Ce)}}__render(t,e){if(this.__worldOpacity){let s;const{children:i}=this;if(this.__hasMask){let o,n=t;for(let n=0,r=i.length;n<r;n++)s=i[n],s.isMask?(o=(t=t.getSameCanvas()).getSameCanvas(),s.__render(o,e)):s.__render(t,e);o&&(o.resetTransform(),o.copyWorld(t,this.__world,null,"source-in"),n.resetTransform(),n.copyWorld(o,this.__world),t.recycle(),o.recycle())}else{const{bounds:o,hideBounds:n}=e;for(let r=0,a=i.length;r<a;r++)s=i[r],o&&!o.hit(s.__world,e.matrix)||n&&n.includes(s.__world)||s.__render(t,e)}}}add(t,e){if(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),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready)){const e=new Kt(Kt.ADD,t,this);this.hasEvent(Kt.ADD)&&this.emitEvent(e),this.leafer.emitEvent(e)}t.__parentWait&&t.__runParentWait()}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1){if(this.children.splice(e,1),t.__isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.leafer){if(this.leafer.ready){const e=new Kt(Kt.REMOVE,t,this);this.hasEvent(Kt.REMOVE)&&this.emitEvent(e),this.leafer.emitEvent(e)}t.__bindLeafer(null)}t.parent=null,this.__layout.boxBoundsChange()}}else this.parent&&this.parent.remove(this)}}const We={};class Ie{static isHoldSpaceKey(){return Ie.hasDownCode("Space")}static setDownCode(t){We[t]||(We[t]=!0)}static setUpCode(t){We[t]=!1}static hasDownCode(t){return We[t]}}class Ne{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class Fe extends Gt{get spaceKey(){return Ie.isHoldSpaceKey()}get left(){return Ne.left(this)}get right(){return Ne.right(this)}get middle(){return Ne.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){st.changeName(t,e)}}let ze=class extends Fe{};ze.POINTER="pointer",ze.BEFORE_DOWN="pointer.before_down",ze.BEFORE_MOVE="pointer.before_move",ze.BEFORE_UP="pointer.before_up",ze.DOWN="pointer.down",ze.MOVE="pointer.move",ze.UP="pointer.up",ze.OVER="pointer.over",ze.OUT="pointer.out",ze.ENTER="pointer.enter",ze.LEAVE="pointer.leave",ze.TAP="tap",ze.DOUBLE_TAP="double_tap",ze.CLICK="click",ze.DOUBLE_CLICK="double_click",ze.LONG_PRESS="long_press",ze.LONG_TAP="long_tap",ze=Ft([Nt()],ze);let Ye=class extends ze{};var je;Ye.DRAG="drag",Ye.START="drag.start",Ye.END="drag.end",Ye=Ft([Nt()],Ye);let Xe=je=class extends ze{static setList(t){je.dragList=t instanceof nt?t:new nt(t)}static setData(t){this.dragData=t}};Xe.DROP="drop",Xe.ENTER="drop.enter",Xe.LEAVE="drop.leave",Xe=je=Ft([Nt()],Xe);let He=class extends Ye{};He.MOVE="move",He.START="move.start",He.END="move.end",He=Ft([Nt()],He);let Ve=class extends Fe{};Ve.ROTATE="rotate",Ve.START="rotate.start",Ve.END="rotate.end",Ve=Ft([Nt()],Ve);let Ue=class extends Ye{};Ue.SWIPE="swipe",Ue.LEFT="swipe.left",Ue.RIGHT="swipe.right",Ue.UP="swipe.up",Ue.DOWN="swipe.down",Ue=Ft([Nt()],Ue);let Ge=class extends Fe{};Ge.ZOOM="zoom",Ge.START="zoom.start",Ge.END="zoom.end",Ge=Ft([Nt()],Ge);let Ke=class extends Fe{};Ke.DOWN="key.down",Ke.PRESS="key.press",Ke.UP="key.up",Ke=Ft([Nt()],Ke);class qe{constructor(t,e){this.map={},this.__onLoadMap={},this.__onErrorMap={},this.leafer=t}get(t){let s=this.map[t.url];return s||(s=e.image(t),this.map[t.url]=s),s}onLoad(t,e){const s=this.map[t.url];s&&s.ready&&e(s)}onError(t,e){}destory(){this.leafer=null}}const Qe={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Ze={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,rect:5,roundRect:6,ellipse:9,arc:7,arcTo:6},$e={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Je=Qe,ts={};for(let t in Je)ts[Je[t]]=t;const es={};for(let t in Je)es[Je[t]]=Ze[t];const ss={},{sin:is,cos:os,sqrt:ns,atan2:rs,ceil:as,abs:hs,PI:ls}=Math,{setPoint:ds,addPoint:cs}=R,us={getFromACommand(t,e,s,i,o,n,r,a,h){const l=a-t,d=h-e,c=o*ls/180,u=is(c),_=os(c),p=-_*l*.5-u*d*.5,g=-_*d*.5+u*l*.5,f=s*s,y=i*i,m=g*g,v=p*p,w=f*y-f*m-y*v;let x=0;if(w<0){const t=ns(1-w/(f*y));s*=t,i*=t}else{x=(n===r?-1:1)*ns(w/(f*m+y*v))}const B=x*s*g/i,b=-x*i*p/s,E=_*B-u*b+.5*l,T=u*B+_*b+.5*d;let k=rs((g-b)/i,(p-B)/s),R=rs((-g-b)/i,(-p-B)/s),C=R-k;0===r&&C>0?C-=2*ls:1===r&&C<0&&(C+=2*ls);const P=[],O=as(hs(C/ls*2)),S=C/O,D=is(S/2),L=is(S/4),M=8/3*L*L/D;k=0,R=rs((g-b)/i,(p-B)/s);let A,W,I,N,F,z,Y,j,X=R-k,H=X+S,V=os(X),U=is(X),G=0,K=0;for(let o=0;o<O;o++)A=os(H),W=is(H),I=_*s*A-u*i*W+E,N=u*s*A+_*i*W+T,F=G+M*(-_*s*U-u*i*V),z=K+M*(-u*s*U+_*i*V),Y=I+M*(_*s*W+u*i*A),j=N+M*(u*s*W-_*i*A),P.push(Qe.C,F+t,z+e,Y+t,j+e,I+t,N+e),G=I,K=N,X=H,V=A,U=W,H+=S;return P},toTwoPointBounds(t,e,s,i,o,n,r,a,h){const l=[];let d,c,u,_,p,g,f,y,m=t,v=s,w=o,x=r;for(let t=0;t<2;++t)if(1==t&&(m=e,v=i,w=n,x=a),d=-3*m+9*v-9*w+3*x,c=6*m-12*v+6*w,u=3*v-3*m,Math.abs(d)<1e-12){if(Math.abs(c)<1e-12)continue;_=-u/c,0<_&&_<1&&l.push(_)}else f=c*c-4*u*d,y=Math.sqrt(f),f<0||(p=(-c+y)/(2*d),0<p&&p<1&&l.push(p),g=(-c-y)/(2*d),0<g&&g<1&&l.push(g));ds(h,t,e),cs(h,r,a);for(let d=0,c=l.length;d<c;d++)_s.getPointAndSet(l[d],t,e,s,i,o,n,r,a,ss),cs(h,ss.x,ss.y)},getPointAndSet(t,e,s,i,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*n+p*a,l.y=c*s+u*o+_*r+p*h},getPoint(t,e,s,i,o,n,r,a,h){const l={};return _s.getPointAndSet(t,e,s,i,o,n,r,a,h,l),l}},_s=us,{M:ps,m:gs,L:fs,l:ys,H:ms,h:vs,V:ws,v:xs,C:Bs,c:bs,S:Es,s:Ts,Q:ks,q:Rs,T:Cs,t:Ps,A:Os,a:Ss,Z:Ds,z:Ls}=Qe,{getFromACommand:Ms}=us,As={current:{},stringify(t){let e,s,i,o=0,n=t.length,r="";for(;o<n;){s=t[o],e=es[s],r+=s===i?" ":ts[s];for(let s=1;s<e;s++)r+=t[o+s],s===e-1||(r+=" ");i=s,o+=e}return r},parse(t,e=!0){let s,i,o="";const n=[];for(let e=0,r=t.length;e<r;e++)i=t[e],U[i]?o+=i:Qe[i]?(o&&(Is(n,Number(o)),o=""),Ws.name=Qe[i],Ws.length=Ze[i],Ws.index=0,Is(n,Ws.name),!s&&$e[i]&&(s=!0)):"-"===i?(o&&Is(n,Number(o)),o=i):o&&(Is(n,Number(o)),o="");return o&&Is(n,Number(o)),e&&s?As.convertToSimple(n):n},convertToSimple(t){let e,s,i,o,n,r=0,a=0,h=0,l=0,d=0,c=t.length;const u=[];for(;d<c;){switch(i=t[d],i){case gs:t[d+1]+=r,t[d+2]+=a;case ps:r=t[d+1],a=t[d+2],u.push(ps,r,a),d+=3;break;case vs:t[d+1]+=r;case ms:r=t[d+1],u.push(fs,r,a),d+=2;break;case xs:t[d+1]+=a;case ws:a=t[d+1],u.push(fs,r,a),d+=2;break;case ys:t[d+1]+=r,t[d+2]+=a;case fs:r=t[d+1],a=t[d+2],u.push(fs,r,a),d+=3;break;case Ts:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,i=Es;case Es:n=o===Bs||o===Es,h=n?2*r-e:t[d+1],l=n?2*a-s:t[d+2],e=t[d+1],s=t[d+2],r=t[d+3],a=t[d+4],u.push(Bs,h,l,e,s,r,a),d+=5;break;case bs:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,t[d+5]+=r,t[d+6]+=a,i=Bs;case Bs:e=t[d+3],s=t[d+4],r=t[d+5],a=t[d+6],u.push(Bs,t[d+1],t[d+2],e,s,r,a),d+=7;break;case Ps:t[d+1]+=r,t[d+2]+=a,i=Cs;case Cs:n=o===ks||o===Cs,e=n?2*r-e:t[d+1],s=n?2*a-s:t[d+2],r=t[d+1],a=t[d+2],u.push(ks,e,s,r,a),d+=3;break;case Rs:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,i=ks;case ks:e=t[d+1],s=t[d+2],r=t[d+3],a=t[d+4],u.push(ks,e,s,r,a),d+=5;break;case Ss:t[d+6]+=r,t[d+7]+=a;case Os:u.push(...Ms(r,a,t[d+1],t[d+2],t[d+3],t[d+4],t[d+5],t[d+6],t[d+7])),r=t[d+6],a=t[d+7],d+=8;break;case Ls:case Ds:u.push(Ds),d++}o=i}return u},pushData(t,e){Ws.index===Ws.length&&(Ws.index=1,t.push(Ws.name)),t.push(e),Ws.index++}},{current:Ws,pushData:Is}=As,{M:Ns,L:Fs,C:zs,Q:Ys,Z:js,ellipse:Xs}=Qe,{toTwoPointBounds:Hs}=us,{add:Vs,addPoint:Us,setPoint:Gs,toBounds:Ks}=R,qs={},Qs={},Zs={smoothCorner:(t,e,s)=>t,toBounds(t,e){$s.toTwoPointBounds(t,Qs),Ks(Qs,e)},toTwoPointBounds(t,e){let s,i,o,n,r,a,h,l=0;const d=t.length;for(;l<d;)switch(s=t[l],0===l&&(s===Ns?Gs(e,t[1],t[2]):Gs(e,0,0)),s){case Ns:case Fs:i=t[l+1],o=t[l+2],Us(e,i,o),l+=3;break;case zs:a=t[l+5],h=t[l+6],Hs(i,o,t[l+1],t[l+2],t[l+3],t[l+4],a,h,qs),Vs(e,qs),i=a,o=h,l+=7;break;case Ys:n=t[l+1],r=t[l+2],a=t[l+3],h=t[l+4],Hs(i,o,n,r,n,r,a,h,qs),Vs(e,qs),i=a,o=h,l+=5;break;case js:l+=1}e.minX--,e.minY--,e.maxX++,e.maxY++},drawData(t,e){if(e){let s,i=0,o=e.length;for(;i<o;)switch(s=e[i],s){case Ns:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Fs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case zs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ys:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case js:t.closePath(),i+=1;break;case Xs:t.ellipse(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}}}},$s=Zs;let Js;const{M:ti,L:ei,C:si,Q:ii,Z:oi,rect:ni,roundRect:ri,ellipse:ai,arc:hi,arcTo:li}=Qe,di={begin(t){Js=t},end(){Js=null},moveTo(t,e){Js.push(ti,t,e)},lineTo(t,e){Js.push(ei,t,e)},bezierCurveTo(t,e,s,i,o,n){Js.push(si,t,e,s,i,o,n)},quadraticCurveTo(t,e,s,i){Js.push(ii,t,e,s,i)},close(t){Js.push(oi),t&&(Js=null)},rect(t,e,s,i){Js.push(ni,t,e,s,i)},roundRect(t,e,s,i,o){Js.push(ri,t,e,s,i,o)},ellipse(t,e,s,i,o,n,r,a){Js.push(ai,t,e,s,i,o,n,r,a)},arc(t,e,s,i,o,n){Js.push(hi,t,e,s,i,o,n)},arcTo(t,e,s,i,o){Js.push(li,t,e,s,i,o)}},ci=G.get("plugin"),ui={list:[]};function _i(t,e){if(ui.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:ci.error(t+" non-existent")})),t.run(s)}else ci.error("no dependencies")}class pi{constructor(t){this.taskTime=1,this.id=s.create(s.TASK),this.task=t}run(){return zt(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 gi=G.get("TaskProcessor");class fi{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 pi(t),e)}addParallel(t,e){const s=new pi(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new pi(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){gi.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 yi{constructor(t,e){this.updatedList=new nt,this.totalTimes=0,this.changed=!0,this.config={},this.target=t,e&&(this.config=ht.default(e,this.config)),this.__listenEvents()}start(){this.running=!0,this.changed=!1,this.update()}stop(){this.running=!1}update(){this.running&&(this.changed=!0,this.target.emit(ee.REQUEST))}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===Kt.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new Jt(Jt.DATA,{updatedList:this.updatedList})),this.updatedList=new nt,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(qt.CHANGE,this.__onAttrChange,this),t.on__([Kt.ADD,Kt.REMOVE],this.__onChildEvent,this),t.on__(Jt.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:mi,updateAllWorldOpacity:vi}=me,{pushAllChildBranch:wi,pushAllParent:xi}=Ee;const{worldBounds:Bi}=be,{setByListWithHandle:bi}=F;class Ei{constructor(t){this.updatedBounds=new X,this.beforeBounds=new X,this.afterBounds=new X,t instanceof Array&&(t=new nt(t)),this.updatedList=t}setBefore(){bi(this.beforeBounds,this.updatedList.list,Bi)}setAfter(){bi(this.afterBounds,this.updatedList.list,Bi),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:Ti,updateAllChange:ki}=me,{pushAllBranchStack:Ri,updateWorldBoundsByBranchStack:Ci}=Ee;class Pi{constructor(t,e){this.totalTimes=0,this.changed=!0,this.config={partLayout:{maxTimes:3}},this.__levelList=new rt,this.target=t,e&&(this.config=ht.default(e,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0,this.changed=!1,t.emit(te.START),this.layoutOnce(),t.emitEvent(new te(te.END,this.layoutedBlocks)),this.layoutedBlocks=null}layoutOnce(){this.totalTimes++,this.times++,this.target.emit(Jt.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout()}partLayout(){var t;if(!(null===(t=this.__updateList)||void 0===t?void 0:t.length))return;const e=Q.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=te,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new te(o,a)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(mi(t),e.push(t),t.__isBranch&&wi(t,e),xi(t,e)):s.boundsChanged&&(e.push(t),t.__isBranch&&(t.__tempNumber=0),xi(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&&vi(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new te(n,a)),s.emitEvent(new te(r,a)),this.setBlocks(a),this.__levelList.reset(),this.__updateList=null,Q.end(e),this.__checkAgain()}fullLayout(){const t=Q.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:o}=te,n=this.getBlocks(new nt(e));e.emitEvent(new te(s,n)),Pi.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new te(i,n)),e.emitEvent(new te(o,n)),this.setBlocks(n),Q.end(t),this.__checkAgain()}static fullLayout(t){if(Ti(t),t.__isBranch){const e=[t];Ri(t,e),Ci(e)}else t.__updateWorldBounds();ki(t)}createBlock(t){return new Ei(t)}getBlocks(t){return[this.createBlock(t)]}setBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__checkAgain(){}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(te.REQUEST,this.layout,this),t.on__(te.AGAIN,this.layoutOnce,this),t.on__(Jt.DATA,this.__onReceiveWatchData,this),t.on__(ee.REQUEST,this.update,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null)}}const Oi=[];for(let t=0;t<360;t++)Oi.push(Math.round(360*Math.random())+"");function Si(t,e,s,i){t.hittable&&(t.__isBranch?Di(t,e,s):Li(t,e,s,i))}function Di(t,e,s){const{children:i}=t;let o;for(let t=0,n=i.length;t<n;t++)o=i[t],o.hittable&&(o.__isBranch?Di(o,e,s):Li(o,e,s,o.__hasMask))}function Li(t,e,s,i){if(t.__worldOpacity){const{isMask:o,__strokeOuterWidth:n}=t.__;if(i&&!o)return;e.setWorld(t.__world,s.matrix),e.opacity=.5,t.__drawHitPath(e),e.fillStyle=e.strokeStyle="hsl("+Oi[t.innerId%360]+",50%, 50%)",e.fill(t.__.windingRule),e.strokeWidth=n?2*n:1,e.stroke()}}const Mi=G.get("Renderer");class Ai{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=ht.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(te.REQUEST)}render(t){const{target:e}=this;this.times=0,Mi.log(e.innerId,"---\x3e"),e.emit(ee.START),this.renderOnce(t),e.emit(ee.END),Mi.log(e.innerId,"---|")}renderOnce(t){const{target:e}=this;this.times++,this.totalTimes++,this.changed=!1,t?(e.emit(ee.BEFORE),t()):(this.requestLayout(),e.emit(ee.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),e.emit(ee.RENDER),e.emit(ee.AFTER),this.updateBlocks=null,this.__checkAgain()}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Mi.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=Q.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),o=t.includes(this.target.__world);s.save(),G.showRepaint||!o?(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0),G.showRepaint&&s.strokeWorld(i,"red")):s.clear(),this.__render(i),s.restore(),Q.end(e)}fullRender(){const t=Q.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Q.end(t)}__render(t){const e=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.target.__render(this.canvas,e),G.showHitView&&Si(this.target,this.canvas,e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new X;e.setByList(t),t.length=0,t.push(e)}}__checkAgain(){}__requestRender(){const e=Date.now();t.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&this.render())}))}__onResize(t){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;new X(0,0,e,s).includes(this.target.__world)||(this.target.__updateAttr("fill"),this.update())}}__onLayoutEnd(t){var e;null===(e=t.data)||void 0===e||e.map((t=>this.addBlock(t.updatedBounds)))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(ee.REQUEST,this.update,this),t.on__(te.END,this.__onLayoutEnd,this),t.on__(ee.AGAIN,this.renderOnce,this),t.on__(Zt.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:Wi}=F;class Ii{constructor(t,e){this.target=t,this.selector=e}getHitPointPath(t,e,s){const i=!!s&&s.through;this.exclude=s?s.exclude:null,this.isStop=!1,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.eachFind(this.target.children,this.target.__hasMask);const{leaf:o}=this,{defaultPath:n}=this.selector,r=this.getPath(o);let a;if(r.pushList(n.list),i){const t=this.throughPath=new nt;this.eachThroughFind(this.target.children,this.target.__hasMask),t.pushList(n.list),a={path:r,leaf:o,throughPath:t}}else a={path:r,leaf:o};return this.clear(),a}getPath(t){const e=new nt;for(;t;)e.push(t),t=t.parent;return e}eachThroughFind(t,e){let s;const{point:i}=this;for(let o=t.length-1;o>-1;o--)if(s=t[o],(e?s.isMask&&s.__.hittable:s.__.hittable)&&Wi(s.__world,i)){if(s.__isBranch&&s.__.hitChildren&&this.eachThroughFind(s.children,s.__hasMask),this.exclude&&this.exclude.has(s))continue;s.__hitWorld(i)&&this.throughPath.push(s)}}eachFind(t,e){let s;const{point:i}=this;for(let o=t.length-1;o>-1&&(s=t[o],!(e?s.isMask&&s.__.hittable:s.__.hittable)||(Wi(s.__world,i)&&(s.__isBranch?(s.__.hitChildren&&this.eachFind(s.children,s.__hasMask),s.__isBranchLeaf&&(this.isStop||this.hitChild(s,i))):this.hitChild(s,i)),!this.isStop));o--);}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&(this.leaf=t,this.isStop=!0)}clear(){this.point=null,this.leaf=null,this.throughPath=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class Ni{constructor(t){this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,this.defaultPath=new nt(t),this.pathFinder=new Ii(t,this),this.__listenEvents()}getHitPointPath(t,e,s){return this.pathFinder.getHitPointPath(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,o=s.length;i<o;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__(Kt.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.pathFinder.destroy(),this.target=null,this.pathFinder=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}function Fi(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 zi=[];function Yi(){return(t,e)=>{zi.push(e)}}const ji=[];class Xi{set dashPattern(t){this.context.setLineDash(t||ji)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;zi.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,o,n){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/o*h;o+=s,s=0,r+=t,h-=t}this.context.drawImage(t,e,s,i,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,s,i,o);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,o,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,o,n){}arcTo(t,e,s,i,o){}ellipse(t,e,s,i,o,n,r,a){}rect(t,e,s,i){}roundRect(t,e,s,i,o){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,o,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}Ft([Fi("imageSmoothingEnabled")],Xi.prototype,"smooth",void 0),Ft([Fi("imageSmoothingQuality")],Xi.prototype,"smoothLevel",void 0),Ft([Fi("globalAlpha")],Xi.prototype,"opacity",void 0),Ft([Fi("globalCompositeOperation")],Xi.prototype,"blendMode",void 0),Ft([Fi()],Xi.prototype,"fillStyle",void 0),Ft([Fi()],Xi.prototype,"strokeStyle",void 0),Ft([Fi("lineWidth")],Xi.prototype,"strokeWidth",void 0),Ft([Fi("lineCap")],Xi.prototype,"strokeCap",void 0),Ft([Fi("lineJoin")],Xi.prototype,"strokeJoin",void 0),Ft([Fi("lineDashOffset")],Xi.prototype,"dashOffset",void 0),Ft([Fi()],Xi.prototype,"miterLimit",void 0),Ft([Fi()],Xi.prototype,"shadowBlur",void 0),Ft([Fi()],Xi.prototype,"shadowColor",void 0),Ft([Fi()],Xi.prototype,"shadowOffsetX",void 0),Ft([Fi()],Xi.prototype,"shadowOffsetY",void 0),Ft([Fi()],Xi.prototype,"filter",void 0),Ft([Fi()],Xi.prototype,"font",void 0),Ft([Fi()],Xi.prototype,"fontKerning",void 0),Ft([Fi()],Xi.prototype,"fontStretch",void 0),Ft([Fi()],Xi.prototype,"fontVariantCaps",void 0),Ft([Fi()],Xi.prototype,"textAlign",void 0),Ft([Fi()],Xi.prototype,"textBaseline",void 0),Ft([Fi()],Xi.prototype,"textRendering",void 0),Ft([Fi()],Xi.prototype,"wordSpacing",void 0),Ft([Fi()],Xi.prototype,"letterSpacing",void 0),Ft([Fi()],Xi.prototype,"direction",void 0),Ft([Yi()],Xi.prototype,"setTransform",null),Ft([Yi()],Xi.prototype,"resetTransform",null),Ft([Yi()],Xi.prototype,"getTransform",null),Ft([Yi()],Xi.prototype,"save",null),Ft([Yi()],Xi.prototype,"restore",null),Ft([Yi()],Xi.prototype,"transform",null),Ft([Yi()],Xi.prototype,"translate",null),Ft([Yi()],Xi.prototype,"scale",null),Ft([Yi()],Xi.prototype,"rotate",null),Ft([Yi()],Xi.prototype,"fill",null),Ft([Yi()],Xi.prototype,"stroke",null),Ft([Yi()],Xi.prototype,"clip",null),Ft([Yi()],Xi.prototype,"fillRect",null),Ft([Yi()],Xi.prototype,"strokeRect",null),Ft([Yi()],Xi.prototype,"clearRect",null),Ft([Yi()],Xi.prototype,"beginPath",null),Ft([Yi()],Xi.prototype,"moveTo",null),Ft([Yi()],Xi.prototype,"lineTo",null),Ft([Yi()],Xi.prototype,"bezierCurveTo",null),Ft([Yi()],Xi.prototype,"quadraticCurveTo",null),Ft([Yi()],Xi.prototype,"closePath",null),Ft([Yi()],Xi.prototype,"arc",null),Ft([Yi()],Xi.prototype,"arcTo",null),Ft([Yi()],Xi.prototype,"ellipse",null),Ft([Yi()],Xi.prototype,"rect",null),Ft([Yi()],Xi.prototype,"roundRect",null),Ft([Yi()],Xi.prototype,"createConicGradient",null),Ft([Yi()],Xi.prototype,"createLinearGradient",null),Ft([Yi()],Xi.prototype,"createPattern",null),Ft([Yi()],Xi.prototype,"createRadialGradient",null),Ft([Yi()],Xi.prototype,"fillText",null),Ft([Yi()],Xi.prototype,"measureText",null),Ft([Yi()],Xi.prototype,"strokeText",null);const Hi=G.get("LeaferCanvas"),Vi=new X,Ui={width:1,height:1,pixelRatio:1};class Gi extends Xi{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}constructor(e,i){super(),e||(e=Ui),e.pixelRatio||(e.pixelRatio=devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{view:o,width:n,height:r,pixelRatio:a,fill:h,hittable:l}=e,d=!n||!r;if(this.pixelRatio=a,this.offscreen=t.isWorker||e.offscreen,this.offscreen)o?this.view=o:this.__createView();else{o?this.__createViewFrom(o):this.__createView();const{style:t}=this.view;h&&(t.backgroundColor=h),l||(t.pointerEvents="none"),d&&(t.display||(t.display="block")),this.parentView=this.view.parentElement}this.__init(),d||this.resize(e)}__init(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){this.view=this.offscreen?new OffscreenCanvas(1,1):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 Hi.error(`can't find view by id: ${t}`),this.__createView()}debug(){const t=document.createElement("div");t.style.position="absolute",t.style.top="10px",t.style.left="10px",t.style.transform="scale(0.5)",t.style.transformOrigin="0px 0px",t.style.pointerEvents="none",t.style.zIndex="100",document.body.appendChild(t),t.appendChild(this.view)}pixel(t){return t*this.pixelRatio}startAutoLayout(t,e){if(!this.offscreen){const s=this.view,i=i=>{const{x:o,y:n,width:r,height:a}=t.getBoundsFrom(i),{style:h}=s;if(h.marginLeft=o+"px",h.marginTop=n+"px",r!==this.width||a!==this.height){const{pixelRatio:t}=this,s={width:r,height:a,pixelRatio:t},i={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(s),void 0!==this.width&&e(new Zt(s,i))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)i(e.contentRect)}));const o=this.parentView;o&&(this.resizeObserver.observe(o),i(o.getBoundingClientRect()))}}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}resize(t){const{width:e,height:s,pixelRatio:i}=t;if(this.isSameSize(t))return;let o;if(this.context&&this.width&&(o=this.getSameCanvas(),o.copyWorld(this)),Object.assign(this,{width:e,height:s,pixelRatio:i}),this.bounds=new X(0,0,e,s),!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,this.smooth=!1,this.context&&o&&(this.copyWorld(o),o.recycle())}saveBlendMode(t){this.savedblendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedblendMode}setWorld(t,e,s){const{pixelRatio:i}=this;if(e)if(s)this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,(t.e+e.e)*i,(t.f+e.f)*i);else{const{a:s,b:o,c:n,d:r,e:a,f:h}=e;this.setTransform((t.a*s+t.b*n)*i,(t.a*o+t.b*r)*i,(t.c*s+t.d*n)*i,(t.c*o+t.d*r)*i,(t.e*s+t.f*n+a)*i,(t.e*o+t.f*r+h)*i)}else this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i)}useSameTransform(t){this.setTransform(t.getTransform())}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&(this.strokeCap=s.strokeCap,this.strokeJoin=s.strokeJoin,this.dashPattern=s.dashPattern,this.dashOffset=s.dashOffset,this.miterLimit=s.miterLimit)}hitFill(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t){return this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=s*o,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="normal")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,F.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="normal")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Vi.copy(t).scale(this.pixelRatio),this.fillRect(Vi.x,Vi.y,Vi.width,Vi.height),s&&(this.blendMode="normal")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Vi.copy(t).scale(this.pixelRatio),this.strokeRect(Vi.x,Vi.y,Vi.width,Vi.height),s&&(this.blendMode="normal")}clearWorld(t,e){Vi.copy(t).scale(this.pixelRatio),e&&Vi.ceil(),this.clearRect(Vi.x,Vi.y,Vi.width,Vi.height)}clipWorld(t,e){this.beginPath(),Vi.copy(t).scale(this.pixelRatio),e&&Vi.ceil(),this.rect(Vi.x,Vi.y,Vi.width,Vi.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,o=this.manager.get({width:e,height:s,pixelRatio:i});return o.manager||(o.manager=this.manager),o.save(),t&&o.useSameTransform(this),o}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:o}=this;t&&(s+=t),e&&(i+=e);const n=this.manager.get({width:s,height:i,pixelRatio:o});return n.manager||(n.manager=this.manager),n.save(),n}recycle(){this.restore(),this.manager.recycle(this)}unloadView(){if(this.parentView){const t=this.view,e=t.style.backgroundColor;e&&(this.parentView.style.backgroundColor=e),t.remove()}}destroy(){if(this.view){if(super.destroy(),this.stopAutoLayout(),!this.offscreen){const t=this.view;t.parentElement&&t.remove()}this.manager=null,this.view=null,this.parentView=null,this.context=null}}}CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,o){let n,r,a,h;if(o instanceof Array)switch(o.length){case 4:n=o[0],r=o[1],a=o[2],h=o[3];break;case 2:n=a=o[0],r=h=o[1];break;case 3:n=o[0],r=h=o[1],a=o[2];break;case 1:o=o[0];break;default:o=0}if(void 0===n){if(!o)return void this.rect(t,e,s,i);n=r=a=h=o}const l=Math.min(s/2,i/2);n>l&&(n=l),r>l&&(r=l),a>l&&(a=l),h>l&&(h=l);const d=this;n?d.moveTo(t+n,e):d.moveTo(t,e),r?d.arcTo(t+s,e,t+s,e+i,r):d.lineTo(t+s,e),a?d.arcTo(t+s,e+i,t,e+i,a):d.lineTo(t+s,e+i),h?d.arcTo(t,e+i,t,e,h):d.lineTo(t,e+i),n?d.arcTo(t,e,t+s,e,n):d.lineTo(t,e),d.closePath()});class Ki{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)},i.src=s.includes("?")?s+"&xhr":s+"?xhr"}getCanvas(t,e,s,i){const o=document.createElement("canvas");t||(t=this.width),e||(e=this.height),o.width=t,o.height=e;const n=o.getContext("2d");return s&&(n.globalAlpha=s),n.drawImage(this.view,0,0,t,e),o}destory(){}}class qi{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(He.START,this.moveData)}t.path=this.moveData.path,e.emit(He.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Ge.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Ge.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Ve.START,this.rotateData)}t.path=this.rotateData.path,e.emit(Ve.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(He.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(Ge.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(Ve.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Qi={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?Ue.UP:t>45&&t<135?Ue.DOWN:t<=45&&t>=-45?Ue.RIGHT:Ue.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:Zi.getSwipeDirection(b.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 nt,{list:i}=t;for(let t=0,o=i.length;t<o;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Zi=Qi,{getDragEventData:$i,getDropEventData:Ji,getSwipeEventData:to,filterPathByEventType:eo}=Qi;class so{constructor(t){this.interaction=t}setDragData(t){this.dragData=$i(t,t,t)}getDragList(){return this.dragging?Xe.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Ne.middle(t)&&!Ne.left(t))return void s.pointerCancel();const{dragData:o}=this;this.moving||(this.moving=(Ne.middle(t)||Ie.isHoldSpaceKey())&&e,this.moving&&s.emit(He.START,o)),this.moving||this.dragStart(t,e);const{path:n,throughPath:r}=i;this.dragData=$i(i,o,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.moving?s.emit(He.MOVE,this.dragData):this.dragging&&(s.emit(Ye.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=Ne.left(t)&&e,this.dragging&&(this.interaction.emit(Ye.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=eo(this.dragData.path,Ye.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){this.dragableList=[e];break}}dragDragableList(){if(this.dragableList){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{me.move(s,t,e)}))}}dropEnterOrLeave(t){const{interaction:e}=this,{dropEnterPath:s}=this,{path:i}=t;e.emit(Xe.ENTER,t,i,s),e.emit(Xe.LEAVE,t,s,i),this.dropEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:o}=s,n=$i(s,t,t);o&&(n.throughPath=o),n.path=i,this.moving&&e.emit(He.END,n),this.dragging&&(e.emit(Ye.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(b.getDistance(i,t)>s.config.pointer.swipeDistance){const t=to(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Ji(t,this.getDragList(),Xe.dragData);e.path=this.dropEnterPath,this.interaction.emit(Xe.DROP,e),this.interaction.emit(Xe.LEAVE,t,this.dropEnterPath)}dragReset(){Xe.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dropEnterPath=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,{autoMoveDistance:i}=e.config.pointer;if(!i)return;const o=e.shrinkCanvasBounds,{x:n,y:r}=o,a=F.right(o),h=F.bottom(o),l=t.x<n?i:a<t.x?-i:0,d=t.y<r?i:h<t.y?-i:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=l,u+=d,F.move(s,l,d),F.move(this.dragData,l,d),e.move(Object.assign(Object.assign({},t),{moveX:l,moveY:d,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const{pathHasEventType:io}=Qi;class oo{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,autoMoveDistance:2,ignoreMove:!1}},this.tapCount=0,this.target=t,this.canvas=e,this.selector=s,this.transformer=new qi(this),this.dragger=new so(this),i&&(this.config=ht.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(ze.BEFORE_DOWN,t,this.selector.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getHitPointPath(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(ze.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),Ne.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(ze.BEFORE_MOVE,t,this.selector.defaultPath),this.downData){const e=b.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.getHitPointPath(t,this.hitRadius,{exclude:this.dragger.getDragList()});t.path=e.path,this.emit(ze.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&this.dragger.dropEnterOrLeave(t)}pointerUp(t){if(!this.downData)return;this.emit(ze.BEFORE_UP,t,this.selector.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getHitPointPath(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(ze.UP,t),this.emit(ze.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(ze.OUT,t,this.overPath),this.emit(ze.OVER,t,e)):this.emit(ze.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(ze.ENTER,t,e,this.enterPath),this.emit(ze.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ze.LEAVE,t),this.dragger.dragging&&this.emit(Xe.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMulti&&s)return;if(!this.waitTap)return;e.tapMulti&&this.emitTap(t);const i=Date.now()-this.downTime,o=[ze.DOUBLE_TAP,ze.DOUBLE_CLICK].some((e=>io(t.path,e)));i<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout((()=>{e.tapMulti||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMulti||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit(ze.TAP,t),this.emit(ze.CLICK,t)}emitDoubleTap(t){this.emit(ze.DOUBLE_TAP,t),this.emit(ze.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=window.setTimeout((()=>{this.longPressed=!0,this.emit(ze.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ze.LONG_TAP,t),io(t.path,ze.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new X(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Zt.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let o;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let n=s.length-1;n>-1;n--)if(o=s.list[n],o.__.hittable&&o.hasEvent(t,!0)&&(!i||!i.has(o))){e.phase=1;const s=st.get(t,e);if(o.emitEvent(s,!0),s.isStop)return}for(let n=0,r=s.length;n<r;n++)if(o=s.list[n],o.__.hittable&&o.hasEvent(t,!1)&&(!i||!i.has(o))){e.phase=o===e.target?2:3;const s=st.get(t,e);if(o.emitEvent(s),s.isStop)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 no={convert(t,e){const s=Qi.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=Qi.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=no.getTouch(t),i=Qi.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]},ro={getData(t,e){const s=b.getCenter(t[0],t[1]),i=b.getCenter(e[0],e[1]),o={x:i.x-s.x,y:i.y-s.y},n=b.getDistance(t[0],t[1]),r=b.getDistance(e[0],e[1])/n,a=b.getAngle(t[0],t[1]),h=b.getAngle(e[0],e[1]);return{move:o,scale:r,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}};let ao=0;const ho={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:n,zoomSpeed:r}=e;const a=t.deltaY||t.deltaX;if(n){const e=t.mozInputSource&&t.deltaY%18==0;e?ao++:ao=0,s=(Math.floor(t.deltaY)!==t.deltaY||e&&ao>2)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){r=o.within(r,0,1);i=1-a/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-r)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:lo,getZoomEventData:co,getRotateEventData:uo}=Qi;class _o extends oo{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.__onResize(),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();for(let t in this.viewEvents)this.view.removeEventListener(t,this.viewEvents[t]),this.viewEvents={};for(let t in this.windowEvents)window.removeEventListener(t,this.windowEvents[t]),this.windowEvents={}}__onResize(){super.__onResize(),this.clientBounds=new X(this.view.getBoundingClientRect())}getLocal(t){return{x:t.clientX-this.clientBounds.x,y:t.clientY-this.clientBounds.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){Ie.setDownCode(t.code)}onKeyUp(t){Ie.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(no.convert(t,this.getLocal(t)))}onPointerMove(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(no.convert(t,this.getLocal(t)))}onPointerUp(t){this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(no.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(no.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerMove(no.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(no.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(this.preventDefaultPointer(t),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=no.getTouch(t);this.pointerDown(no.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.preventDefaultPointer(t),this.mutiTouchMove(t),this.usePointer)return;const e=no.getTouch(t);this.pointerMove(no.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.preventDefaultPointer(t),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=window.setTimeout((()=>{this.useTouch=!1}),500);const e=no.getTouch(t);this.pointerUp(no.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?ro.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=ro.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 o=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(s),this.getLocal(i)],{move:r,angle:a,scale:h,center:l}=ro.getData(o,n),d=Qi.getBase(t);this.rotate(uo(l,a,d)),this.zoom(co(l,h,d)),this.move(lo(l,r,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):ho.getScale(t,e),i=this.getLocal(t),o=Qi.getBase(t);1!==s?this.zoom(co(i,s,o)):this.move(lo(i,e.getMove?e.getMove(t,e):ho.getMove(t,e),o))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=Qi.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:r}=this.config.wheel;r=o.within(r,0,1),this.zoom(co(e,i*i,s)),this.rotate(uo(e,n/Math.PI*180*(r/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)}}function po(t){return(e,s)=>{pt(e,s,t,{set(t){this.__setAttr(s,t),this.__.__useEffect=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}})}}Object.assign(e,{canvas:(t,e)=>new Gi(t,e),image:t=>new Ki(t),hitCanvas:(t,e)=>new Gi(t,e),watcher:t=>new yi(t),layouter:t=>new Pi(t),renderer:(t,e,s)=>new Ai(t,e,s),selector:t=>new Ni(t),interaction:(t,e,s,i)=>new _o(t,e,s,i)}),t.requestRender=function(t){window.requestAnimationFrame(t)},t.canvas=e.canvas(),navigator.userAgent.indexOf("Firefox")>-1&&(t.conicGradientRotate90=!0);class go extends dt{setFill(t){this._fill=t,"string"!=typeof t&&t?t instanceof Array?(this.__setInput("fill",t),this.__isFills=!0):"object"==typeof t&&(this.__setInput("fill",[t]),this.__isFills=!0):this.__isFills&&(this.__isFills=!1)}setStroke(t){this._stroke=t,"string"!=typeof t&&t?t instanceof Array?(this.__setInput("stroke",t),this.__isStrokes=!0):"object"==typeof t&&(this.__setInput("stroke",[t]),this.__isStrokes=!0):this.__isStrokes&&(this.__isStrokes=!1)}setShadow(t){this._shadow=t instanceof Array?t:[t]}setInnerShadow(t){this._innerShadow=t instanceof Array?t:[t]}}class fo extends go{}const{parse:yo}=As;const mo={__updateStrokeBoundsSpreadWidth(){let t=0;const{stroke:e,strokeAlign:s}=this.__;if(e&&"inside"!==s){const{strokeWidth:e,miterLimit:i,path:o}=this.__,r=o?1/Math.sin(i*n/2)*Math.sqrt(e):0;t="center"===s?e/2:e,this.__.__strokeOuterWidth=t,r&&(t+=r-t)}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:o}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),o&&(n=Math.max(n,o)),this.__layout.renderShapeBoundsSpreadWidth=n,t}},vo=["visible","fill-visible"],wo=["all","fill"],xo=["visible","stroke-visible"],Bo=["all","stroke"],bo={__hit(t){const{__hitCanvas:e}=this,{fill:s,hitType:i}=this.__,o=s&&vo.includes(i)||wo.includes(i);if(o&&e.hitFill(t,this.__.windingRule))return!0;const{stroke:n,__strokeOuterWidth:r}=this.__,a=n&&xo.includes(i)||Bo.includes(i);if(!o&&!a)return!1;const h=2*((a&&r||0)+t.radiusX);return e.strokeWidth!==h&&(e.strokeWidth=h,e.stroke()),e.hitStroke(t)}},Eo={},To={},ko={},Ro={},Co={width:4,height:4};const Po={width:4,height:4};var Oo=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;const{__world:o,__layout:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,shapeBounds:l,scaleX:d,scaleY:c}=s,u=e.getBiggerCanvas(Po.width,Po.height),_=F.getOutOfBounds(h,e.bounds);r.forEach((t=>{u.save(),u.setWorldShadow(_.offsetX+t.x*d,_.offsetY+t.y*c,t.blur*d),u.copyWorld(s.canvas,l,t.spread?F.getSpread(_,-t.spread*d*(n.renderBounds.width/n.strokeBounds.width)):_),u.restore(),a?(u.copyWorld(u,h,o,"copy"),u.copyWorld(a,o,o,"source-out"),i=o):(u.copyWorld(s.canvas,l,h,"source-out"),i=h),u.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(u,i,n.renderBounds,t.blendMode)})),u.recycle()},shadow:function(t,e,s){let i;const{__world:o,__layout:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,shapeBounds:l,scaleX:d,scaleY:c}=s,u=e.getBiggerCanvas(Co.width,Co.height),_=F.getOutOfBounds(h,e.bounds);r.forEach((t=>{u.setWorldShadow(_.offsetX+t.x*d,_.offsetY+t.y*c,t.blur*d,t.color),u.copyWorld(s.canvas,l,t.spread?F.getSpread(_,t.spread*d*(n.renderBounds.width/n.strokeBounds.width)):_),i=h,t.showBehind||(u.restore(),u.save(),a&&(u.copyWorld(u,h,o,"copy"),i=o),a?u.copyWorld(a,o,o,"destination-out"):u.copyWorld(s.canvas,l,h,"destination-out")),e.copyWorldToInner(u,i,n.renderBounds,t.blendMode)})),u.recycle()}});function So(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}function Do(t,e){return"string"==typeof t?t:(e&&(t.a=e),"rgba("+t.r+","+t.g+","+t.b+","+t.a+")")}const{get:Lo,rotateOf:Mo,translate:Ao,scaleOf:Wo,scale:Io,rotate:No}=p;function Fo(e,s,i,o,n){let{type:r,blendMode:a}=i,h={type:r,blendMode:a,style:"rgba(255,255,255,0)"};const l=e.leafer.imageManager.get(i);if(l.ready){let e,{opacity:s,mode:r,offset:a,scale:d,rotation:c}=i,{width:u,height:_}=l;const p=o===u&&n===_;switch(r){case"strench":p||(u=o,_=n);break;case"clip":(a||d||c)&&(e=function(t,e,s){const i=Lo();t&&Ao(i,t.x,t.y);e&&("number"==typeof e?Io(i,e):Io(i,e.x,e.y));s&&No(i,s);return i}(a,d,c));break;case"repeat":(!p||d||c)&&(e=function(t,e,s,i){const o=Lo();if(i)switch(No(o,i),i){case 90:Ao(o,e,0);break;case 180:Ao(o,t,e);break;case 270:Ao(o,0,t)}s&&Wo(o,{x:0,y:0},s);return o}(u,_,d,c));break;default:p&&!c||(e=function(t,e,s,i,o,n){const r=Lo(),a=n&&180!==n,h=i/(a?s:e),l=o/(a?e:s),d="fit"===t?Math.min(h,l):Math.max(h,l),c=(i-e*d)/2,u=(o-s*d)/2;if(Ao(r,c,u),Io(r,d),n){Mo(r,{x:i/2,y:o/2},n)}return r}(r,u,_,o,n,c))}h.style=function(e,s,i){let o=t.canvas.createPattern(e,i?"repeat":"no-repeat");if(s){const{a:t,b:e,c:i,d:n,e:r,f:a}=s;o.setTransform(new DOMMatrix([t,e,i,n,r,a]))}return o}(l.getCanvas(u,_,s),e,"repeat"===r)}else l.load((()=>{e.__.__getInput("width")||(e.width=l.width),e.__.__getInput("height")||(e.height=l.height),e.__updateAttr("width"),e.emitEvent(new Qt(Qt.LOADED,e,l,s,i))}),(t=>{e.emitEvent(new Qt(Qt.ERROR,e,l,s,i,t))}));return h}const zo={x:.5,y:0},Yo={x:.5,y:1};function jo(t,e,s){let i;for(let o=0,n=e.length;o<n;o++)i=e[o],t.addColorStop(i.offset,Do(i.color,s))}const{set:Xo,getAngle:Ho,getDistance:Vo}=b,{get:Uo,rotateOf:Go,scaleOf:Ko}=p,qo={x:.5,y:.5},Qo={x:.5,y:1},Zo={},$o={};const{set:Jo,getAngle:tn}=b,{get:en,rotateOf:sn,scaleOf:on}=p,nn={x:.5,y:.5},rn={x:.5,y:1},an={},hn={};function ln(t,e){const s=t.__.__input[e];if("object"==typeof s){let i;const o=[];for(let n=0,r=s.length;n<r;n++)i=dn(t,s[n],e),i&&o.push(i);t.__["_"+e]=o.length?o:void 0}}function dn(e,s,i){if(!1===s.visible||0===s.opacity)return;const{width:o,height:n}=e.__layout.boxBounds;switch(s.type){case"solid":let{type:r,blendMode:a,color:h}=s;return{type:r,blendMode:a,style:Do(h)};case"image":return Fo(e,i,s,o,n);case"linear":return function(e,s,i){let{from:o,to:n,type:r,blendMode:a,opacity:h}=e;o||(o=zo),n||(n=Yo);const l=t.canvas.createLinearGradient(o.x*s,o.y*i,n.x*s,n.y*i);return jo(l,e.stops,h),{type:r,blendMode:a,style:l}}(s,o,n);case"radial":return function(e,s,i){let o,{from:n,to:r,type:a,opacity:h,blendMode:l,stretch:d}=e;n||(n=qo),r||(r=Qo),Xo(Zo,n.x*s,n.y*i),Xo($o,r.x*s,r.y*i),(s!==i||d)&&(o=Uo(),Ko(o,Zo,s/i*(d||1),1),Go(o,Zo,Ho(Zo,$o)+90));const c=t.canvas.createRadialGradient(Zo.x,Zo.y,0,Zo.x,Zo.y,Vo(Zo,$o));return jo(c,e.stops,h),{type:a,blendMode:l,style:c,transform:o}}(s,o,n);case"angular":return function(e,s,i){let{from:o,to:n,type:r,opacity:a,blendMode:h,stretch:l}=e;o||(o=nn),n||(n=rn),Jo(an,o.x*s,o.y*i),Jo(hn,n.x*s,n.y*i);const d=en(),c=tn(an,hn);t.conicGradientRotate90?(on(d,an,s/i*(l||1),1),sn(d,an,c+90)):(on(d,an,1,s/i*(l||1)),sn(d,an,c));const u=t.canvas.createConicGradient(0,an.x,an.y);return jo(u,e.stops,a),{type:r,blendMode:h,style:u,transform:d}}(s,o,n)}}var cn=Object.freeze({__proto__:null,computeFill:function(t){ln(t,"fill")},computeStroke:function(t){ln(t,"stroke")},fill:function(t,e,s){e.fillStyle=s,e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:o}=t.__;for(let t=0,n=s.length;t<n;t++)if(i=s[t],e.fillStyle=i.style,i.transform){e.save();const{a:t,b:s,c:n,d:r,e:a,f:h}=i.transform;e.transform(t,s,n,r,a,h),i.blendMode&&(e.blendMode=i.blendMode),e.fill(o),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),e.fill(o),e.restoreBlendMode()):e.fill(o)},shape:function(t,e,s){const i=e.getSameCanvas();let o,n,r,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))o=r=h,a=i;else{const{renderBoundsSpreadWidth:i}=t.__layout,c=F.getIntersectData(i?F.getSpread(e.bounds,i*h.a):e.bounds,h,s.matrix);n=e.bounds.getFitMatrix(c),n.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=n.a,d*=n.d),r=F.getOuterOf(h,n),o=F.getByMove(r,-n.e,-n.f),s.matrix&&n.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:n})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:o,worldCanvas:a,shapeBounds:r,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:o,strokeAlign:n}=i;switch(n){case"center":e.setStroke(void 0,o,i),e.strokeStyle=s,e.stroke();break;case"inside":e.save(),e.setStroke(void 0,2*o,i),e.clip(i.windingRule),e.strokeStyle=s,e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*o,t.__),n.strokeStyle=s,n.stroke(),n.clip(i.windingRule),n.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokes:function(t,e,s){const i=t.__,{strokeWidth:o,strokeAlign:n}=i;switch(n){case"center":e.setStroke(void 0,o,i),So(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*o,i),e.clip(i.windingRule),So(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*o,t.__),So(s,r),r.clip(i.windingRule),r.clearWorld(n),e.copyWorldToInner(r,t.__world,n),r.recycle()}}});Object.assign(Eo,Oo),Object.assign(To,cn);const un={__updateChange(){let t=this.__;t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&To.fill(this,t,s),i&&To.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=To.shape(this,t,e),{shadow:n,innerShadow:r}=this.__;n&&Eo.shadow(this,t,o),s&&(this.__.__isFills?To.fills(this,t,s):To.fill(this,t,s)),r&&Eo.innerShadow(this,t,o),i&&(this.__.__isStrokes?To.strokes(this,t,i):To.stroke(this,t,i)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?To.fills(this,t,s):To.fill(this,t,s)),i&&(this.__.__isStrokes?To.strokes(this,t,i):To.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,fills:i,stroke:o,strokes:n}=this.__,{context:r}=t;this.__drawRenderPath(t),(s||i)&&(r.fillStyle="#000000",r.fill()),(o||n)&&(r.lineWidth=2,r.stroke())}},_n={__render(t,e){const{fill:s,stroke:i}=this.__;i&&(this.__.stroke=void 0),this.__renderRect(t,e);const{clip:o}=this.__;o?(t.save(),t.clip(),this.__renderGroup(t,e),t.restore()):this.__renderGroup(t,e),i&&(this.__.stroke=i,s&&(this.__.fill=void 0),this.__renderRect(t,e),s&&(this.__.fill=s))}},pn={__drawFast(t,e){const{width:s,height:i,fill:o,stroke:n}=this.__;if(t.smooth=!1,o&&(t.fillStyle=o,t.fillRect(0,0,s,i)),n){const{strokeAlign:e,strokeWidth:o}=this.__;t.setStroke(n,o,this.__);const r=o/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(r,r,s-o,i-o);break;case"outside":t.strokeRect(-r,-r,s+o,i+o)}}}},gn={__drawFast(t,e){const{fill:s,stroke:i}=this.__,{list:o,font:n,decorationY:r,decorationHeight:a}=this.__.__textDrawData;let h;if(t.font=n,t.textBaseline="alphabetic",s){t.fillStyle=s;for(let e=0,s=o.length;e<s;e++)h=o[e],t.fillText(h.text,h.x,h.y),r&&t.fillRect(h.x,h.y+r,h.width,a)}if(i){t.strokeStyle=i;for(let e=0,s=o.length;e<s;e++)h=o[e],t.strokeText(h.text,h.x,h.y),r&&t.strokeRect(h.x,h.y+r,h.width,a)}}};gn.__draw=gn.__drawFast;let fn=class extends ye{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&To.computeFill(this),e&&To.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?Zs.smoothCorner(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,o){return J.get(t.tag||this.prototype.__tag,t,e,s,i,o)}};Ft([Rt(go)],fn.prototype,"__",void 0),Ft([gt("")],fn.prototype,"id",void 0),Ft([gt("")],fn.prototype,"name",void 0),Ft([gt("")],fn.prototype,"className",void 0),Ft([bt()],fn.prototype,"blendMode",void 0),Ft([Et(1)],fn.prototype,"opacity",void 0),Ft([Et(!0)],fn.prototype,"visible",void 0),Ft([kt(!1)],fn.prototype,"isMask",void 0),Ft([Tt(0)],fn.prototype,"zIndex",void 0),Ft([gt()],fn.prototype,"locked",void 0),Ft([ft(0)],fn.prototype,"x",void 0),Ft([ft(0)],fn.prototype,"y",void 0),Ft([vt(100)],fn.prototype,"width",void 0),Ft([vt(100)],fn.prototype,"height",void 0),Ft([yt(1)],fn.prototype,"scaleX",void 0),Ft([yt(1)],fn.prototype,"scaleY",void 0),Ft([mt(0)],fn.prototype,"rotation",void 0),Ft([mt(0)],fn.prototype,"skewX",void 0),Ft([mt(0)],fn.prototype,"skewY",void 0),Ft([gt(!1)],fn.prototype,"draggable",void 0),Ft([gt(!0)],fn.prototype,"hittable",void 0),Ft([gt("visible")],fn.prototype,"hitType",void 0),Ft([gt(!0)],fn.prototype,"hitChildren",void 0),Ft([bt()],fn.prototype,"fill",void 0),Ft([xt()],fn.prototype,"stroke",void 0),Ft([xt("inside")],fn.prototype,"strokeAlign",void 0),Ft([xt(1)],fn.prototype,"strokeWidth",void 0),Ft([bt("none")],fn.prototype,"strokeCap",void 0),Ft([bt("miter")],fn.prototype,"strokeJoin",void 0),Ft([bt()],fn.prototype,"dashPattern",void 0),Ft([bt()],fn.prototype,"dashOffset",void 0),Ft([bt(10)],fn.prototype,"miterLimit",void 0),Ft([wt()],fn.prototype,"cornerRadius",void 0),Ft([wt()],fn.prototype,"cornerSmoothing",void 0),Ft([po()],fn.prototype,"shadow",void 0),Ft([po()],fn.prototype,"innerShadow",void 0),Ft([po()],fn.prototype,"blur",void 0),Ft([po()],fn.prototype,"backgroundBlur",void 0),Ft([po()],fn.prototype,"grayscale",void 0),Ft([Lt(Zs.drawData)],fn.prototype,"__drawPathByData",null),fn=Ft([Wt(mo),Wt(bo),Wt(un),Mt()],fn);let yn=class extends fn{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){}__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&&(t.isMask=!1,this.remove(t),i--,s--)}}};Ft([Rt(fo)],yn.prototype,"__",void 0),yn=Ft([Wt(Ae),It()],yn);let mn=class extends fn{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:o}=this.__;o?t.roundRect(0,0,s,i,o):t.rect(0,0,s,i)}};Ft([Rt(class extends go{})],mn.prototype,"__",void 0),mn=Ft([Wt(pn),It()],mn);const vn=mn.prototype,wn=yn.prototype,xn={},{copy:Bn,add:bn}=F;let En=class extends yn{get __tag(){return"Frame"}constructor(t){super(t),this.fill||(this.fill="#FFFFFF"),this.__isBranchLeaf=!0}__drawPathByData(t,e){}__updateBoxBounds(){if(this.__updateRectBoxBounds(),!this.__.clip){const{boxBounds:t}=this.__layout;Bn(xn,t),super.__updateBoxBounds(),bn(t,xn)}}__updateStrokeBounds(){if(this.__updateRectStrokeBounds(),!this.__.clip){const{strokeBounds:t}=this.__layout;Bn(xn,t),super.__updateStrokeBounds(),bn(t,xn)}}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.clip){const{renderBounds:t}=this.__layout;Bn(xn,t),super.__updateRenderBounds(),bn(t,xn)}}__updateRectBoxBounds(){}__updateRectStrokeBounds(){}__updateRectRenderBounds(){}__renderRect(t,e){}__renderGroup(t,e){}};Ft([Rt(class extends fo{})],En.prototype,"__",void 0),Ft([vt(!0)],En.prototype,"clip",void 0),Ft([Lt(vn.__drawPathByData)],En.prototype,"__drawPathByData",null),Ft([Lt(vn.__updateBoxBounds)],En.prototype,"__updateRectBoxBounds",null),Ft([Lt(vn.__updateStrokeBounds)],En.prototype,"__updateRectStrokeBounds",null),Ft([Lt(vn.__updateRenderBounds)],En.prototype,"__updateRectRenderBounds",null),Ft([Lt(vn.__render)],En.prototype,"__renderRect",null),Ft([Lt(wn.__render)],En.prototype,"__renderGroup",null),En=Ft([Wt(_n),Mt(),It()],En);const{PI:Tn}=Math,{begin:kn,moveTo:Rn,close:Cn,ellipse:Pn}=di;let On=class extends fn{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:o}=this.__,r=t/2,a=e/2;kn(this.__.path=[]),s?i||o?(s<1&&Pn(r,a,r*s,a*s,0,i*n,o*n,!1),Pn(r,a,r,a,0,o*n,i*n,!0),s<1&&Cn()):(s<1&&(Pn(r,a,r*s,a*s,0,0,2*Tn,!1),Rn(t,a)),Pn(r,a,r,a,0,0,2*Tn,!0)):i||o?(Rn(r,a),Pn(r,a,r,a,0,i*n,o*n,!1),Cn()):Pn(r,a,r,a,0,0,2*Tn,!1)}};Ft([Rt(class extends go{})],On.prototype,"__",void 0),Ft([wt(0)],On.prototype,"innerRadius",void 0),Ft([wt(0)],On.prototype,"startAngle",void 0),Ft([wt(0)],On.prototype,"endAngle",void 0),On=Ft([It()],On);const{sin:Sn,cos:Dn,PI:Ln}=Math,{begin:Mn,moveTo:An,lineTo:Wn,close:In}=di;let Nn=class extends fn{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,o=e/2;Mn(this.__.path=[]),An(i,0);for(let t=1;t<s;t++)Wn(i+i*Sn(2*t*Ln/s),o-o*Dn(2*t*Ln/s));In()}};Ft([Rt(class extends go{})],Nn.prototype,"__",void 0),Ft([wt(3)],Nn.prototype,"sides",void 0),Nn=Ft([It()],Nn);const{sin:Fn,cos:zn,PI:Yn}=Math,{begin:jn,moveTo:Xn,lineTo:Hn,close:Vn}=di;let Un=class extends fn{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,o=t/2,n=e/2;jn(this.__.path=[]),Xn(o,0);for(let t=1;t<2*s;t++)Hn(o+(t%2==0?o:o*i)*Fn(t*Yn/s),n-(t%2==0?n:n*i)*zn(t*Yn/s));Vn()}};Ft([Rt(class extends go{})],Un.prototype,"__",void 0),Ft([wt(5)],Un.prototype,"points",void 0),Ft([wt(.382)],Un.prototype,"innerRadius",void 0),Un=Ft([It()],Un);const{begin:Gn,moveTo:Kn,lineTo:qn,end:Qn}=di,{rotate:Zn,getAngle:$n,getDistance:Jn,defaultPoint:tr}=b,{setPoint:er,addPoint:sr,toBounds:ir}=R,or={};let nr=class extends fn{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxBoundsChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Zn(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Jn(tr,t),this.rotation=$n(tr,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){Gn(this.__.path=[]),Kn(0,0);const t=this.toPoint;qn(t.x,t.y),Qn()}__updateBoxBounds(){er(or,0,0),sr(or,this.__toPoint.x,this.__toPoint.y),ir(or,this.__layout.boxBounds)}};Ft([Rt(class extends go{})],nr.prototype,"__",void 0),Ft([vt()],nr.prototype,"rotation",void 0),Ft([xt("center")],nr.prototype,"strokeAlign",void 0),nr=Ft([It()],nr);const{toBounds:rr}=Zs;let ar=class extends fn{get __tag(){return"Path"}constructor(t){super(t)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__updateBoxBounds(){rr(this.__.path,this.__layout.boxBounds)}};Ft([Rt(class extends go{setPath(t){this._path="string"==typeof t?yo(t):t}})],ar.prototype,"__",void 0),Ft([wt()],ar.prototype,"path",void 0),Ft([wt()],ar.prototype,"windingRule",void 0),Ft([xt("center")],ar.prototype,"strokeAlign",void 0),ar=Ft([It()],ar);let hr=class extends yn{get __tag(){return"Vector"}constructor(t){super(t)}__updatePath(){}};Ft([Rt(class extends go{})],hr.prototype,"__",void 0),Ft([wt()],hr.prototype,"paths",void 0),hr=Ft([It()],hr);const lr={getFont(t){const{fontFamily:e,fontSize:s,fontWeight:i,italic:o,textCase:n}=t;return`${o?"italic":""} ${"small-caps"===n?"small-caps":"normal"} ${i||"normal"} ${s}px/${s}px ${e}`},getDrawData(e,s){const{width:i,height:o,fontSize:n,textDecoration:r,textAlign:a,verticalAlign:h}=s,{canvas:l}=t,d=[],c=n*s.lineHeight,u=l.font=dr.getFont(s);if(i){let t,s,o,n="",r=0,a="",h=0,c="",u=0;for(let _=0,p=e.length;_<p;_++)switch(t=e[_],t){case"\n":d.push({text:c+a}),c=a=n="",u=h=r=0;break;case" ":o||(o=l.measureText(t).width),n+=t,r+=o;break;default:s=l.measureText(t).width,u+h+r+s>i&&(h+r+s>i?(d.push({text:c+a}),c=a=n="",u=h=r=0):(d.push({text:c}),c="",u=0)),n&&(c+=a+n,u+=h+r,a=n="",h=r=0),a+=t,h+=s}d.push({text:c+a+n})}else e.split("\n").map((t=>{d.push({text:t})}));let _=0,p=c*d.length;d.forEach((t=>{t.width=l.measureText(t.text).width,_=Math.max(_,t.width)}));let g,f=c-(c-.7*n)/2;if(o)switch(h){case"middle":f+=(o-p)/2;break;case"bottom":f+=o-p}for(let t=0,e=d.length;t<e;t++){if(g=d[t],g.x=0,i)switch(a){case"center":g.x=(i-g.width)/2;break;case"right":g.x=i-g.width}g.y=f+c*t}let y,m=n/11;switch(r){case"underline":y=.1*n;break;case"strikethrough":y=.35*-n}return{list:d,x:0,y:0,width:_,height:p,font:u,decorationY:y,decorationHeight:m}}},dr=lr;let cr=class extends fn{get __tag(){return"Text"}get realWidth(){return this.textDrawData.width}get realHeight(){return this.textDrawData.height}get textDrawData(){return this.__updateTextDrawData(),this.__.__textDrawData}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i}=this.__;t.rect(0,0,s,i)}__updateTextDrawData(){this.__.__textDrawData||(this.__.__textDrawData=lr.getDrawData(this.__.content,this.__))}__updateBoxBounds(){this.__updateTextDrawData();const{width:t,height:e,__textDrawData:s}=this.__,i=this.__layout.boxBounds;i.x=t?0:s.x||0,i.y=e?0:s.y||0,i.width=t?Math.max(t,s.width):s.width,i.height=e?Math.max(e,s.height):s.height}};Ft([Rt(class extends go{})],cr.prototype,"__",void 0),Ft([vt(void 0)],cr.prototype,"width",void 0),Ft([vt(void 0)],cr.prototype,"height",void 0),Ft([vt("")],cr.prototype,"content",void 0),Ft([vt("arial")],cr.prototype,"fontFamily",void 0),Ft([vt(12)],cr.prototype,"fontSize",void 0),Ft([vt("normal")],cr.prototype,"fontWeight",void 0),Ft([vt(!1)],cr.prototype,"italic",void 0),Ft([vt("normal")],cr.prototype,"textCase",void 0),Ft([vt("none")],cr.prototype,"textDecoration",void 0),Ft([vt()],cr.prototype,"letterSpacing",void 0),Ft([vt(1)],cr.prototype,"lineHeight",void 0),Ft([vt()],cr.prototype,"paragraphIndent",void 0),Ft([vt()],cr.prototype,"paragraphSpacing",void 0),Ft([bt("left")],cr.prototype,"textAlign",void 0),Ft([bt("top")],cr.prototype,"verticalAlign",void 0),cr=Ft([Wt(gn),It()],cr);let ur=class extends mn{get __tag(){return"Image"}get ready(){var t;return null===(t=this.image)||void 0===t?void 0:t.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s[0].url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(Qt.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}};Ft([Rt(class extends go{})],ur.prototype,"__",void 0),Ft([vt("")],ur.prototype,"url",void 0),ur=Ft([It()],ur);class _r extends yn{get isApp(){return!1}get bounds(){return this.canvas.bounds}constructor(t){super(),this.config={type:"design",start:!0,hittable:!0},this.__eventIds=[],this.userConfig=t,(null==t?void 0:t.view)&&this.init(t)}init(t,s){this.__setLeafer(this),this.__setConfig(t);const{config:i}=this;this.creator=e,this.hittable=i.hittable,this.canvas=e.canvas(i),this.renderer=e.renderer(this,this.canvas,i),this.view=this.canvas.view,this.isApp?this.__setApp():(this.watcher=e.watcher(this),this.layouter=e.layouter(this)),this.__checkAutoLayout(i),s?this.__bindApp(s):(this.selector=e.selector(this),i.hittable&&(this.interaction=e.interaction(this,this,this.selector,i)),this.canvasManager=new ot,this.hitCanvasManager=new at,this.imageManager=new qe(this,i),i.start&&(this.startTimer=setTimeout(this.start.bind(this)))),this.canvasManager.add(this.canvas),this.__listenEvents()}__listenEvents(){Q.start("FirstCreate"),this.once(se.START,(()=>{Q.endOfName("FirstCreate"),Q.start("FirstLayout")})),this.once(te.END,(()=>{Q.endOfName("FirstLayout"),Q.start("FirstRender"),this.ready=!0,this.emit(se.BEFORE_READY),this.emit(se.READY),this.emit(se.AFTER_READY)})),this.once(ee.END,(()=>{Q.endOfName("FirstRender"),this.emit(se.VIEW_READY)}))}__removeListenEvents(){this.off__(this.__eventIds)}__setApp(){}__bindApp(t){var e;null===(e=t.selector)||void 0===e||e.defaultPath.unshift(this),this.selector=t.selector,this.config.hittable&&(this.interaction=t.interaction),this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager,t.running&&(this.startTimer=setTimeout(this.start.bind(this)))}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}__setConfig(t){t&&(this.config=ht.default(t,this.config),this.__setAppType(this.config.type))}__setAppType(t){if("user"===t){const{config:t}=this;t.pointer||(t.pointer={}),t.pointer.autoMoveDistance=0}}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new H(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}start(){this.running||(this.ready?this.emit(se.RESTART):this.emit(se.START),this.interaction&&(this.__interactiveWindow(),this.interaction.start()),this.renderer.start(),this.layouter.start(),this.watcher.start(),this.running=!0)}stop(){this.running&&(this.interaction&&this.interaction.stop(),this.watcher.stop(),this.layouter.stop(),this.renderer.stop(),this.running=!1,this.emit(se.STOP))}__interactiveWindow(){if("user"!==this.config.type){const{MOVE:t}=He,{ZOOM:e}=Ge;this.hasEvent(t)||this.__eventIds.push(this.on__(t,(t=>{me.move(this,t.moveX,t.moveY)}))),this.hasEvent(e)||this.__eventIds.push(this.on__(e,(t=>{me.zoomOf(this,t,t.scale)})))}}resize(t){if(this.canvas.isSameSize(t))return;const{width:e,height:s,pixelRatio:i}=this.canvas,o={width:e,height:s,pixelRatio:i};this.canvas.resize(t),this.__onResize(new Zt(t,o))}__onResize(t){this.emitEvent(t),setTimeout((()=>{this.canvasManager.clearRecycled()}),0)}destory(){var t,e,s;this.canvas&&(clearTimeout(this.startTimer),this.emit(se.END),this.stop(),this.__removeListenEvents(),null===(t=this.interaction)||void 0===t||t.destroy(),this.selector.destroy(),this.renderer.destroy(),null===(e=this.watcher)||void 0===e||e.destroy(),null===(s=this.layouter)||void 0===s||s.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory(),this.canvas.destroy(),this.canvas=null,this.creator=null,this.config=null,this.interaction=null,this.selector=null,this.renderer=null,this.watcher=null,this.layouter=null,this.canvasManager=null,this.hitCanvasManager=null,this.imageManager=null,this.zoomLayer=null,this.moveLayer=void 0,this.parent=void 0,super.destroy())}}function pr(){return(t,e)=>{const s={get(){return this.canvas[e]},set(t){const{width:s,height:i,pixelRatio:o}=this.canvas,n={width:s,height:i,pixelRatio:o};n[e]=t,this.resize(n)}};Object.defineProperty(t,e,s)}}Ft([pr()],_r.prototype,"width",void 0),Ft([pr()],_r.prototype,"height",void 0),Ft([pr()],_r.prototype,"pixelRatio",void 0);class gr extends _r{constructor(){super(...arguments),this.children=[]}get isApp(){return!0}__setApp(){this.config.view===this.canvas.view?this.virtualCanvas=!0:(this.canvas.unloadView(),this.view=this.canvas.parentView)}start(){this.running||(this.children.forEach((t=>{t.start()})),this.renderer.start(),this.running=!0)}stop(){this.running&&(this.children.forEach((t=>{t.stop()})),this.renderer.stop(),this.running=!1)}addLeafer(t){const e=new _r(t);return this.add(e),e}add(t){if(t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),this.virtualCanvas){const{renderer:e}=this;this.__eventIds.push(t.on__(te.END,this.__onChildLayoutEnd,this),t.on__(ee.END,e.update,e),this.on__(te.REQUEST,e.mergeBlocks,e))}}__onChildLayoutEnd(t){const{renderer:e}=this;t.current.config.usePartRender?t.data.map((t=>e.addBlock(t.updatedBounds))):e.addBlock(e.canvas.bounds)}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.emitEvent(t),this.children.forEach((e=>{e.resize(t)}))}__getChildConfig(t){let e=Object.assign({},this.config);return(t=t?ht.default(t,e):e).view=this.virtualCanvas?null:this.canvas.parentView,t.virtualCanvas=null,this.autoLayout&&(t.width=this.width,t.height=this.height,t.pixelRatio=this.pixelRatio),t}}var fr;Ft([(fr=!0,(t,e)=>{pt(t,e,fr,{set(t){this.__setAttr(e,t),this.children.forEach((e=>{e.hittable=t}))}})})],gr.prototype,"hittable",void 0);export{ko as Animate,gr as App,H as AutoBounds,us as BezierHelper,X as Bounds,F as BoundsHelper,Ae as Branch,Ee as BranchHelper,ot as CanvasManager,Kt as ChildEvent,e as Creator,ht as DataHelper,G as Debug,Ye as DragEvent,Xe as DropEvent,Eo as Effect,On as Ellipse,Gt as Event,st as EventCreator,Ro as Export,En as Frame,_n as FrameRender,yn as Group,at as HitCanvasManager,ur as Image,Qt as ImageEvent,qe as ImageManager,s as IncrementId,_o as Interaction,Ke as KeyEvent,Ie as Keyboard,te as LayoutEvent,Pi as Layouter,ye as Leaf,de as LeafBounds,be as LeafBoundsHelper,dt as LeafData,ie as LeafDataProxy,Vt as LeafEventer,me as LeafHelper,_e as LeafHit,rt as LeafLevelList,nt as LeafList,ae as LeafMatrix,pe as LeafRender,_r as Leafer,Gi as LeaferCanvas,se as LeaferEvent,Ki as LeaferImage,nr as Line,o as MathHelper,k as Matrix,p as MatrixHelper,He as MoveEvent,es as NumberPathCommandLengthMap,ts as NumberPathCommandMap,n as OneRadian,To as Paint,ar as Path,Qe as PathCommandMap,$e as PathCommandNeedConvertMap,As as PathConvert,di as PathCreator,Zs as PathHelper,t as Platform,ui as Plugin,T as Point,b as PointHelper,Ne as PointerButton,ze as PointerEvent,Nn as Polygon,qt as PropertyEvent,mn as Rect,pn as RectRender,ee as RenderEvent,Ai as Renderer,Zt as ResizeEvent,Ve as RotateEvent,Q as Run,Ni as Selector,Un as Star,U as StringNumberMap,Ue as SwipeEvent,pi as TaskItem,fi as TaskProcessor,cr as Text,gn as TextRender,$t as TransformEvent,V as TwoPointBounds,R as TwoPointBoundsHelper,fn as UI,mo as UIBounds,J as UICreator,Fe as UIEvent,bo as UIHit,un as UIRender,hr as Vector,Jt as WatchEvent,yi as Watcher,Ge as ZoomEvent,xt as affectEventBoundsType,Bt as affectRenderBoundsType,_t as aliasType,vt as boundsType,Rt as dataProcessor,gt as dataType,Pt as defineDataProcessor,ct as defineKey,pt as defineLeafAttr,po as effectType,ut as getDescriptor,Ct as layoutProcessor,kt as maskType,Et as opacityType,wt as pathType,ft as positionType,It as registerUI,Nt as registerUIEvent,Lt as rewrite,Mt as rewriteAble,mt as rotationType,yt as scaleType,Tt as sortType,bt as surfaceType,Wt as useModule,_i as usePlugin};
2
- //# sourceMappingURL=index.js.map
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,n){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=n}}s.CHANGE="property.change";class i extends t{constructor(t,e,s,i,n,o){super(t,e),this.image=s,this.attrName=i,this.attrValue=n,o&&(this.error=o)}}i.LOADED="image.loaded",i.ERROR="image.error";class n 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?n.RESIZE:t),s&&Object.assign(this,t),this.old=e}}n.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 r extends t{constructor(t,e){super(t),this.data=e}}r.REQUEST="watch.request",r.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 d extends t{}d.START="leafer.start",d.BEFORE_READY="leafer.before_ready",d.READY="leafer.ready",d.AFTER_READY="leafer.after_ready",d.VIEW_READY="leafer.view_ready",d.STOP="leafer.stop",d.RESTART="leafer.restart",d.END="leafer.end";class l{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,n=e.length;i<n;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 l;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,n;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=n=t[1];break;case 3:e=t[0],s=n=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,n]}},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,n=1,o=0,r=0){t.a=e,t.b=s,t.c=i,t.d=n,t.e=o,t.f=r},get:E,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s},scaleOf(t,e,s,i=s){C.toInnerPoint(t,e,k),C.scaleOfInner(t,k,s,i)},scaleOfInner(t,e,s,i=s){C.translateInner(t,e.x,e.y),C.scale(t,s,i),C.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=v(e*=g),i=m(e),{a:n,b:o,c:r,d:a}=t;t.a=n*s-o*i,t.b=n*i+o*s,t.c=r*s-a*i,t.d=r*i+a*s},rotateOf(t,e,s){C.toInnerPoint(t,e,k),C.rotateOfInner(t,k,s)},rotateOfInner(t,e,s){C.translateInner(t,e.x,e.y),C.rotate(t,s),C.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:n,c:o,d:r}=t;s&&(s*=g,t.a=i+o*s,t.b=n+r*s),e&&(e*=g,t.c=o+i*e,t.d=r+n*e)},skewOf(t,e,s,i){C.toInnerPoint(t,e,k),C.skewOfInner(t,k,s,i)},skewOfInner(t,e,s,i){C.translateInner(t,e.x,e.y),C.skew(t,s,i),C.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:n,d:o,e:r,f:a}=t;t.a=e.a*s+e.b*n,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*n,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*n+r,t.f=e.e*i+e.f*o+a},preMultiply(t,e){const{a:s,b:i,c:n,d:o,e:r,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=n*e.a+o*e.c,t.d=n*e.b+o*e.d),t.e=r*e.a+a*e.c+e.e,t.f=r*e.b+a*e.d+e.f},divide(t,e){C.multiply(t,C.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=C;return C.copy(e,t),C.invert(e),e},invert(t){const{a:e,b:s,c:i,d:n,e:o,f:r}=t,a=1/(e*n-s*i);t.a=n*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*n-r*i)*a,t.f=-(r*e-o*s)*a},toOuterPoint(t,e,s,i){const{x:n,y:o}=e;s||(s=e),s.x=n*t.a+o*t.c,s.y=n*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:n,y:o}=e,{a:r,b:a,c:h,d:d}=t,l=1/(r*d-a*h);if(s||(s=e),s.x=(n*d-o*h)*l,s.y=(o*r-n*a)*l,!i){const{e:e,f:i}=t;s.x-=(e*d-i*h)*l,s.y-=(i*r-e*a)*l}},decompose(t){const{a:e,b:s,c:i,d:n}=t;let o=e,r=n,a=0,h=0,d=0;if(s||i){const t=e*n-s*i,l=e*i+s*n;if(s){const i=e*e+s*s;o=B(i),r=t/o;const n=e/o;a=s>0?w(n):-w(n),h=x(l/i)/g}else{const e=i*i+n*n;r=B(e),o=t/r;const s=i/r;a=b/2-(n>0?w(-s):-w(s)),d=x(l/e)/g}a/=g}return{x:t.e,y:t.f,scaleX:o,scaleY:r,rotation:a,skewX:h,skewY:d}},reset(t){C.set(t)}},C=T,{toInnerPoint:R,toOuterPoint:O}=T,{sin:P,cos:S,abs:L,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=W.defaultPoint);const i=S(e*g),n=P(e*g),o=t.x-s.x,r=t.y-s.y;t.x=s.x+o*i-r*n,t.y=s.y+o*n-r*i},tempToInnerOf(t,e){const{tempPoint:s}=W;return W.copy(s,t),R(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=W;return W.copy(s,t),W.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),R(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){R(e,t,s)},toOuterOf(t,e,s){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=L(e.x-t.x),i=L(e.y-t.y);return D(s*s+i*i)},getAngle:(t,e)=>W.getAtan2(t,e)/g,getAtan2:(t,e)=>M(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=W.getAtan2(t,e);return{x:t.x+S(i)*s,y:t.y+P(i)*s}},reset(t){W.reset(t)}},W=A;class I{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 I(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,n,o){"object"==typeof t?T.copy(this,t):T.set(this,t,e,s,i,n,o)}set(t,e,s,i,n,o){T.set(this,t,e,s,i,n,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,n){z(t,e,s),z(t,e+i,s+n)},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:H}=F,{toOuterPoint:X}=T;let V,G,K,q;const Q={},Z={},$={tempBounds:{},set(t,e=0,s=0,i=0,n=0){t.x=e,t.y=s,t.width=i,t.height=n},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),getOutOfBounds(t,e){const s=-(J.right(e)-t.x),i=-(J.bottom(e)-t.y),n=Object.assign(Object.assign({},t),{offsetX:s,offsetY:i});return J.move(n,-s,-i),n},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(J.copy(J.tempBounds,t),J.toOuterOf(J.tempBounds,e),J.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),J.toOuterOf(t,e),t),toOuterOf(t,e,s){s||(s=t),0===e.b&&0===e.c?(s.x=e.e+t.x*e.a,s.y=e.f+t.y*e.d,s.width=t.width*e.a,s.height=t.height*e.d):(Q.x=t.x,Q.y=t.y,X(e,Q,Z),U(Y,Z.x,Z.y),Q.x=t.x+t.width,X(e,Q,Z),j(Y,Z.x,Z.y),Q.y=t.y+t.height,X(e,Q,Z),j(Y,Z.x,Z.y),Q.x=t.x,X(e,Q,Z),j(Y,Z.x,Z.y),H(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 n,o=!0;for(let r=0,a=e.length;r<a;r++)n=s?s(e[r]):e[r],n&&(n.width||n.height)&&(o?(o=!1,i||et(t,n)):tt(t,n));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)})),H(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:n,width:o,height:r}=e;return V=i+o,G=n+r,K=t.x+t.width,q=t.y+t.height,i=i>t.x?i:t.x,n=n>t.y?n:t.y,V=V<K?V:K,G=G<q?G:q,o=V-i,r=G-n,{x:i,y:n,width:o,height:r}},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,n,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,n,o)}set(t=0,e=0,s=0,i=0,n=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=n,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=t;this.set(e,s,i,n,o,r)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=this;return new st(n,e,o||t.width-n-s,r||t.height-e-i)}}class nt{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},rt={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++)dt(e[t])}},updateAllChange(t){if(dt(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)lt(e[t])}},move(t,e,s){const i={x:e,y:s};t.parent&&T.toInnerPoint(t.parent.__world,i,i,!0),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,n){const o=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,i,n)},zoomOfLocal(t,e,s,i,n){i||(i=s),n||(n=t);const{x:o,y:r}=n.__,a=(new N).translate(o,r).scaleOf(e,s,i);n.x=a.e,n.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOf(t,e,s,i){const n=t.parent?A.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,n,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:n,y:o}=i.__,r=(new N).translate(n,o).rotateOf(e,s);i.x=r.e,i.y=r.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=rt,{updateAllWorldMatrix:ht,updateAllWorldOpacity:dt,updateAllChange:lt}=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,n=s.length;i<n;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 n;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.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 n in this)s=n.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[n]: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}=rt,{pushAllChildBranch:Tt,pushAllParent:Ct}=ut;const{worldBounds:Rt}=ct,{setByListWithHandle:Ot}=$;class Pt{constructor(t){this.updatedBounds=new st,this.beforeBounds=new st,this.afterBounds=new st,t instanceof Array&&(t=new l(t)),this.updatedList=t}setBefore(){Ot(this.beforeBounds,this.updatedList.list,Rt)}setAfter(){Ot(this.afterBounds,this.updatedList.list,Rt),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:St,updateAllChange:Lt}=rt,{pushAllBranchStack:Dt,updateWorldBoundsByBranchStack:Mt}=ut,At=vt.get("Layouter");class Wt{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(r.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:n,LAYOUT:o,AFTER:r}=a,h=this.getBlocks(i);h.forEach((t=>{t.setBefore()})),s.emitEvent(new a(n,h,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(kt(t),e.push(t),t.isBranch&&Tt(t,e),Ct(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Ct(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&Et(t),t.__updateChange()}))}(i),h.forEach((t=>t.setAfter())),s.emitEvent(new a(o,h,this.times)),s.emitEvent(new a(r,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:n}=a,o=this.getBlocks(new l(e));e.emitEvent(new a(s,o,this.times)),Wt.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new a(i,o,this.times)),e.emitEvent(new a(n,o,this.times)),this.addBlocks(o),Bt.end(t)}static fullLayout(t){if(St(t),t.isBranch){const e=[t];Dt(t,e),Mt(e)}else t.__updateWorldBounds();Lt(t)}createBlock(t){return new Pt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(a.REQUEST,this.layout,this),t.on__(a.AGAIN,this.layoutAgain,this),t.on__(r.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const It={layout:Wt.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,n,o){const r=new Yt[t](e);return void 0!==s&&(r.x=s,i&&(r.y=i),n&&(r.width=n),o&&(r.height=o)),r}},{list:Yt}=zt,Ut=vt.get("EventCreator"),jt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Ht[e]?Ut.error("repeat: ",e):Ht[e]=t)}))},changeName(t,e){const s=Ht[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,Ht[e]=s)}},get:(t,...e)=>new Ht[t](...e)},{nameList:Ht}=jt;class Xt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Nt.canvas(t);return this.add(i),i}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destory(){this.clear()}}class Vt extends Xt{constructor(){super(...arguments),this.pathTypeList=new l,this.imageTypeList=new l}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 n,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,s,r):n(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r}function Kt(t,e,s,i){return new(s||(s=Promise))((function(n,o){function r(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?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,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 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,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,n,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,n,o,r,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/n*h;n+=s,s=0,r+=t,h-=t}this.context.drawImage(t,e,s,i,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,s,i,n);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,n,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,n,o){}arcTo(t,e,s,i,n){}ellipse(t,e,s,i,n,o,r,a){}rect(t,e,s,i){}roundRect(t,e,s,i,n){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,n,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("globalCompositeOperation")],Jt.prototype,"blendMode",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(),t||(t=ee),t.pixelRatio||(t.pixelRatio=devicePixelRatio),this.manager=e,this.innerId=u.create(u.CNAVAS);const{width:s,height:i,pixelRatio:n}=t;this.autoLayout=!s||!i,this.pixelRatio=n,this.offscreen=It.isWorker||t.offscreen,this.config=t,this.init(),this.textBaseline="alphabetic"}init(){}setBackgroundColor(t){}setHittable(t){}resize(t){const{width:e,height:s}=t;if(this.isSameSize(t))return;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;if(e)if(s)this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,(t.e+e.e)*i,(t.f+e.f)*i);else{const{a:s,b:n,c:o,d:r,e:a,f:h}=e;this.setTransform((t.a*s+t.b*o)*i,(t.a*n+t.b*r)*i,(t.c*s+t.d*o)*i,(t.c*n+t.d*r)*i,(t.e*s+t.f*o+a)*i,(t.e*n+t.f*r+h)*i)}else this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i)}useSameTransform(t){this.setTransform(t.getTransform())}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:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=s*n,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="normal")}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="normal")}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="normal")}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="normal")}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,n={width:e,height:s,pixelRatio:i},o=this.manager?this.manager.get(n):Nt.canvas(n);return o.save(),t&&o.useSameTransform(this),o}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:n}=this;t&&(s+=t),e&&(i+=e);const o={width:s,height:i,pixelRatio:n},r=this.manager?this.manager.get(o):Nt.canvas(o);return r.save(),r}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 ne(t,e,s){Object.defineProperty(t,e,s)}function oe(t,e){return Object.getOwnPropertyDescriptor(t,e)}function re(t){return(e,s)=>{ne(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function ae(t,e,s,i){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};ne(t,e,Object.assign(n,i||{})),Ee(t,e,s)}function he(t){return(e,s)=>{ae(e,s,t)}}function de(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function le(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.boxBoundsChanged||this.__layout.boxBoundsChange()}})}}const _e=ue;function pe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeBoundsChanged||this.__layout.strokeBoundsChange()}})}}const ge=pe;function fe(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}})}}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.boxBoundsChanged||this.__layout.boxBoundsChange(),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)=>{ne(e,"__DataProcessor",{get:()=>t})}}function be(t){return(e,s)=>{ne(e,"__LayoutProcessor",{get:()=>t})}}function ke(t,e,s){Ee(t.prototype,e,s)}function Ee(t,e,s){const i=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[n];return void 0===t?s:t},set(t){this[n]=t},configurable:!0,enumerable:!0};void 0===s&&(r.get=function(){return this[n]});const a=oe(i,e);a&&a.set&&(r.set=a.set),i[o]&&(r.set=i[o],delete i[o]),Object.defineProperty(i,e,r)}const Te=new vt("rewrite"),Ce=[],Re=["destroy","constructor"];function Oe(t){return(e,s)=>{Ce.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Pe(){return t=>{Se()}}function Se(t){Ce.length&&(Ce.forEach((e=>{t&&Te.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ce.length=0)}function Le(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Re.includes(i)||e&&e.includes(i)))if(t.prototype){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((()=>Se(!0)));const{toOuterOf:Ae}=$;class We{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.boxBoundsChange()}checkUpdate(){const{leafer:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():(t.start(),t.layouter.layout());else{let t=this.leaf;for(;t.parent;)t=t.parent;It.layout(t)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}getMatrixDecompositionData(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}strokeBoundsSpreadCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}strokeBoundsSpread(){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.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){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}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged=!0}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged=!0}strokeBoundsChange(){this.strokeBoundsChanged=!0,this.strokeBoundsSpreadWidth||(this.strokeBoundsSpreadWidth=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const Ie={},Ne={on(t,e,s){let i,n,o;if(s){const t="boolean"==typeof s;i=t?s:s.capture,n=!t&&s.once}const r=Fe(this,i,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(o=r[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):r[t]=[h])}))},off(t,e,s){let i,n,o;s&&(i="boolean"==typeof s?s:s.capture);const r=Fe(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(n=r[t],n&&(o=n.findIndex((t=>t.listener===e)),o>-1&&n.splice(o,1),n.length||delete r[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 n;for(let o=0,r=i.length;o<r&&(n=i[o],n.listener(e),n.once&&(this.off(t,n.listener,s),o--,r--),!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={}:Ie)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Ie)}}const ze={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:i}=s,n=new s(i,this,t,this.__.__get(t),e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(n),this.leafer.emitEvent(n)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:Ye}=T,{sin:Ue,cos:je}=Math,He={__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:n,skewX:o,skewY:r}=this.__;n||o||r?(n*=g,o&&(o*=g),r&&(r*=g),t.a=s*je(n+r),t.b=s*Ue(n+r),t.c=i*-Ue(n-o),t.d=i*je(n-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:Xe,copyAndSpread:Ve}=$,Ge={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxBoundsChanged=!1,e=!0),s.localBoxBoundsChanged&&(this.__updateLocalBoxBounds(),s.localBoxBoundsChanged=!1,s.strokeBoundsSpreadWidth&&(s.strokeBoundsChanged=!0),s.renderBoundsSpreadWidth&&(s.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),s.strokeBoundsChanged&&(s.strokeBoundsSpreadWidth=this.__updateStrokeBoundsSpreadWidth(),s.strokeBoundsSpreadWidth?(s.strokeBounds===s.boxBounds&&s.strokeBoundsSpread(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.strokeBoundsSpreadCancel(),s.strokeBoundsChanged=!1,s.renderBoundsSpreadWidth&&(s.renderBoundsChanged=!0),this.parent&&this.parent.__layout.strokeBoundsChange(),e||(e=!0)),s.renderBoundsChanged&&(s.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),s.renderBoundsSpreadWidth?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.renderBoundsSpreadCancel(),s.renderBoundsChanged=!1,this.parent&&this.parent.__layout.renderBoundsChange()),s.boundsChanged=!1,Xe(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Xe(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Xe(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Xe(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Xe(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){Ve(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeBoundsSpreadWidth)},__updateRenderBounds(){Ve(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderBoundsSpreadWidth)}},{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 We}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(){}__updateStrokeBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}__updateMask(){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.getMatrixDecompositionData("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(){}__updateRenderTime(){}__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([Le(ze),Le(He),Le(Ge),Le(Qe),Le(Ne),Le(Ze)],es);const{setByListWithHandle:ss}=$,{sort:is}=ut,{localBoxBounds:ns,localEventBounds:os,localRenderBounds:rs,maskLocalBoxBounds:as,maskLocalEventBounds:hs,maskLocalRenderBounds:ds}=ct;let ls=class extends es{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){ss(this.__layout.boxBounds,this.children,this.__hasMask?as:ns)}__updateStrokeBounds(){ss(this.__layout.strokeBounds,this.children,this.__hasMask?hs:os)}__updateRenderBounds(){ss(this.__layout.renderBounds,this.children,this.__hasMask?ds:rs)}__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 n,o=t.getSameCanvas(),r=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(n?(this.__renderMask(t,r,o),o.clear(),r.clear()):n=!0,s.__render(o,e)):s.__render(r,e);this.__renderMask(t,r,o),o.recycle(),r.recycle()}else{const{bounds:n,hideBounds:o}=e;for(let r=0,a=i.length;r<a;r++)s=i[r],n&&!n.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.boxBoundsChange(),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()}};ls=Gt([Le($e)],ls);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 l?t:new l(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.__onLoadMap={},this.__onErrorMap={},this.leafer=t}get(t){let e=this.map[t.url];return e||(e=Nt.image(t),this.map[t.url]=e),e}onLoad(t,e){const s=this.map[t.url];s&&s.ready&&e(s)}onError(t,e){}destory(){this.leafer=null}}const Es={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ts={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Cs=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ts),Rs={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},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},Ps=Object.assign(Object.assign({},Os),Ts),Ss=Cs,Ls={};for(let t in Ss)Ls[Ss[t]]=t;const Ds={};for(let t in Ss)Ds[Ss[t]]=Rs[t];const Ms={drawRoundRect(t,e,s,i,n,o){let[r,a,h,d]=p.fourNumber(o);const l=Math.min(i/2,n/2);r>l&&(r=l),a>l&&(a=l),h>l&&(h=l),d>l&&(d=l),r?t.moveTo(e+r,s):t.moveTo(e,s),a?t.arcTo(e+i,s,e+i,s+n,a):t.lineTo(e+i,s),h?t.arcTo(e+i,s+n,e,s+n,h):t.lineTo(e+i,s+n),d?t.arcTo(e,s+n,e,s,d):t.lineTo(e,s+n),r?t.arcTo(e,s,e+i,s,r):t.lineTo(e,s)}},{sin:As,cos:Ws,atan2:Is,ceil:Ns,abs:Fs,PI:zs}=Math,{setPoint:Ys,addPoint:Us}=F,{set:js}=A,Hs={},Xs={rect(t,e,s,i,n){Es.creator.path=t,Es.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+n).lineTo(e,s+n).lineTo(e,s)},roundRect(t,e,s,i,n,o){Es.creator.path=[],Ms.drawRoundRect(Es.creator,e,s,i,n,o),t.push(...Es.convertToCanvasData(Es.creator.path,!0))},arcTo(t,e,s,i,n,o,r,a,h,d,l){const c=i-e,u=n-s,_=o-i,p=r-n;let m=Is(u,c),v=Is(p,_),w=v-m;if(w<0&&(w+=f),w===zs||Fs(c+u)<1e-12||Fs(_+p)<1e-12)return t&&t.push(Cs.L,i,n),h&&(Ys(h,e,s),Us(h,i,n)),l&&js(l,e,s),void(d&&js(d,i,n));const x=c*p-_*u<0,B=x?-1:1,b=a/Ws(w/2),k=i+b*Ws(m+w/2+y*B),E=n+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,d,l)},arc:(t,e,s,i,n,o,r,a,h,d)=>Ks(t,e,s,i,i,0,n,o,r,a,h,d),ellipse(t,e,s,i,n,o,r,a,h,d,l,c){const u=o*g,_=As(u),p=Ws(u);let m=r*g,v=a*g;m>zs&&(m-=f),v<0&&(v+=f);let w=v-m;w<0?w+=f:w>f&&(w-=f),h&&(w-=f);const x=Ns(Fs(w/y)),B=w/x,b=As(B/4),k=8/3*b*b/As(B/2);v=m+B;let E,T,C,R,O,P,S,L,D=Ws(m),M=As(m),A=C=p*i*D-_*n*M,W=R=_*i*D+p*n*M,I=e+C,N=s+R;t&&t.push(Cs.L,I,N),d&&Ys(d,I,N),c&&js(c,I,N);for(let o=0;o<x;o++)E=Ws(v),T=As(v),C=p*i*E-_*n*T,R=_*i*E+p*n*T,O=e+A-k*(p*i*M+_*n*D),P=s+W-k*(_*i*M-p*n*D),S=e+C+k*(p*i*T+_*n*E),L=s+R+k*(_*i*T-p*n*E),t&&t.push(Cs.C,O,P,S,L,e+C,s+R),d&&Gs(e+A,s+W,O,P,S,L,e+C,s+R,d,!0),A=C,W=R,D=E,M=T,m=v,v+=B;l&&js(l,e+C,s+R)},quadraticCurveTo(t,e,s,i,n,o,r){t.push(Cs.C,(e+2*i)/3,(s+2*n)/3,(o+2*i)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,n,o,r,a){Gs(t,e,(t+2*s)/3,(e+2*i)/3,(n+2*s)/3,(o+2*i)/3,n,o,r,a)},toTwoPointBounds(t,e,s,i,n,o,r,a,h,d){const l=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=n,B=r;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&&l.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&l.push(g),f=(-u-m)/(2*c),0<f&&f<1&&l.push(f));d?Us(h,t,e):Ys(h,t,e),Us(h,r,a);for(let d=0,c=l.length;d<c;d++)Vs(l[d],t,e,s,i,n,o,r,a,Hs),Us(h,Hs.x,Hs.y)},getPointAndSet(t,e,s,i,n,o,r,a,h,d){const l=1-t,c=l*l*l,u=3*l*l*t,_=3*l*t*t,p=t*t*t;d.x=c*e+u*i+_*o+p*a,d.y=c*s+u*n+_*r+p*h},getPoint(t,e,s,i,n,o,r,a,h){const d={};return Vs(t,e,s,i,n,o,r,a,h,d),d}},{getPointAndSet:Vs,toTwoPointBounds:Gs,ellipse:Ks}=Xs,{sin:qs,cos:Qs,sqrt:Zs,atan2:$s}=Math,{ellipse:Js}=Xs,ti={ellipticalArc(t,e,s,i,n,o,r,a,h,d,l){const c=(h-e)/2,u=(d-s)/2,_=o*g,p=qs(_),y=Qs(_),m=-y*c-p*u,v=-y*u+p*c,w=i*i,x=n*n,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,n*=t}else E=(r===a?-1:1)*Zs(k/(w*B+x*b));const T=E*i*v/n,C=-E*n*m/i,R=$s((v-C)/n,(m-T)/i),O=$s((-v-C)/n,(-m-T)/i);let P=O-R;0===a&&P>0?P-=f:1===a&&P<0&&(P+=f);const S=e+c+y*T-p*C,L=s+u+p*T+y*C,D=P<0?1:0;l?Js(t,S,L,i,n,o,R/g,O/g,D):i!==n||o?t.push(Cs.G,S,L,i,n,o,R/g,O/g,D):t.push(Cs.O,S,L,i,R/g,O/g,D)}},{M:ei,m:si,L:ii,l:ni,H:oi,h:ri,V:ai,v:hi,C:di,c:li,S:ci,s:ui,Q:_i,q:pi,T:gi,t:fi,A:yi,a:mi,Z:vi,z:wi,N:xi,D:Bi,X:bi,G:ki,F:Ei,O:Ti,P:Ci,U:Ri}=Cs,{rect:Oi,roundRect:Pi,arcTo:Si,arc:Li,ellipse:Di,quadraticCurveTo:Mi}=Xs,{ellipticalArc:Ai}=ti,Wi=vt.get("PathConvert"),Ii={},Ni={current:{},stringify(t){let e,s,i,n=0,o=t.length,r="";for(;n<o;){s=t[n],e=Ds[s],r+=s===i?" ":Ls[s];for(let s=1;s<e;s++)r+=t[n+s],s===e-1||(r+=" ");i=s,n+=e}return r},parse(t,e){let s,i,n,o="";const r=[],a=e?Ps:Os;for(let e=0,h=t.length;e<h;e++)i=t[e],ot[i]?o+=i:Cs[i]?(o&&(zi(r,Number(o)),o=""),Fi.name=Cs[i],Fi.length=Rs[i],Fi.index=0,zi(r,Fi.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===n||"E"===n?o+=i:(o&&zi(r,Number(o)),o=i):o&&(zi(r,Number(o)),o=""),n=i;return o&&zi(r,Number(o)),s?Ni.toCanvasData(r,e):r},toCanvasData(t,e){let s,i,n,o,r,a=0,h=0,d=0,l=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){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 ri: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 ni: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,n=ci;case ci:r=o===di||o===ci,d=r?2*a-s:t[c+1],l=r?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(di,d,l,s,i,a,h),c+=5;break;case li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=di;case di:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(di,t[c+1],t[c+2],s,i,a,h),c+=7;break;case fi:t[c+1]+=a,t[c+2]+=h,n=gi;case gi:r=o===_i||o===gi,s=r?2*a-s:t[c+1],i=r?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,n=_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?Pi(_,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?Pi(_,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,Ii),a=Ii.x,h=Ii.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:Li(e?_:Yi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ii),a=Ii.x,h=Ii.y,c+=7;break;case Ci:e?Li(_,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 Ri:Si(e?_:Yi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ii),a=Ii.x,h=Ii.y,c+=6;break;default:return Wi.error(`command: ${n} [index:${c}]`,t),_}o=n}return _},copyData(t,e,s,i){for(let n=s,o=s+i;n<o;n++)t.push(e[n])},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:Hi,Q:Xi,Z:Vi,N:Gi,D:Ki,X:qi,G:Qi,F:Zi,O:$i,P:Ji,U:tn}=Cs,en={},sn={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,n,o,r){t.push(Hi,e,s,i,n,o,r)},quadraticCurveTo(t,e,s,i,n){t.push(Xi,e,s,i,n)},closePath(t){t.push(Vi)},rect(t,e,s,i,n){t.push(Gi,e,s,i,n)},roundRect(t,e,s,i,n,o){if("number"==typeof o)t.push(qi,e,s,i,n,o);else{const r=p.fourNumber(o);r?t.push(Ki,e,s,i,n,...r):t.push(Gi,e,s,i,n)}},ellipse(t,e,s,i,n,o,r,a,h){void 0===o?t.push(Zi,e,s,i,n):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Qi,e,s,i,n,o,r,a,h?1:0))},arc(t,e,s,i,n,o,r){void 0===n?t.push(Ji,e,s,i):(void 0===o&&(o=360),t.push($i,e,s,i,n,o,r?1:0))},moveToEllipse(t,e,s,i,n,o,r,a,h){void 0===o&&(o=0),void 0===r&&(r=0),void 0===a&&(a=360),Xs.ellipse(null,e,s,i,n,o,r,a,h,null,null,en),t.push(Ui,en.x,en.y),nn(t,e,s,i,n,o,r,a,h)},moveToArc(t,e,s,i,n,o,r){void 0===n&&(n=0),void 0===o&&(o=360),Xs.arc(null,e,s,i,n,o,r,null,null,en),t.push(Ui,en.x,en.y),on(t,e,s,i,n,o,r)},arcTo(t,e,s,i,n,o){t.push(tn,e,s,i,n,o)}},{ellipse:nn,arc:on}=sn,{moveTo:rn,lineTo:an,quadraticCurveTo:hn,bezierCurveTo:dn,closePath:ln,beginPath:cn,rect:un,roundRect:_n,ellipse:pn,arc:gn,arcTo:fn,moveToEllipse:yn,moveToArc:mn}=sn;class vn{constructor(t){this.path=t?"string"==typeof t?Es.parse(t):t:[]}beginPath(){return cn(this.path),this}moveTo(t,e){return rn(this.path,t,e),this}lineTo(t,e){return an(this.path,t,e),this}bezierCurveTo(t,e,s,i,n,o){return dn(this.path,t,e,s,i,n,o),this}quadraticCurveTo(t,e,s,i){return hn(this.path,t,e,s,i),this}closePath(){return ln(this.path),this}rect(t,e,s,i){return un(this.path,t,e,s,i),this}roundRect(t,e,s,i,n){return _n(this.path,t,e,s,i,n),this}ellipse(t,e,s,i,n,o,r,a){return pn(this.path,t,e,s,i,n,o,r,a),this}arc(t,e,s,i,n,o){return gn(this.path,t,e,s,i,n,o),this}arcTo(t,e,s,i,n){return fn(this.path,t,e,s,i,n),this}moveToEllipse(t,e,s,i,n,o,r,a){return yn(this.path,t,e,s,i,n,o,r,a),this}moveToArc(t,e,s,i,n,o){return mn(this.path,t,e,s,i,n,o),this}}const{M:wn,L:xn,C:Bn,Q:bn,Z:kn,N:En,D:Tn,X:Cn,G:Rn,F:On,O:Pn,P:Sn,U:Ln}=Cs,Dn=vt.get("PathDrawer"),Mn={drawPathByData(t,e){if(!e)return;let s,i=0,n=e.length;for(;i<n;)switch(s=e[i],s){case wn:t.moveTo(e[i+1],e[i+2]),i+=3;break;case xn:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Bn:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case bn:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case kn:t.closePath(),i+=1;break;case En:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Tn: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 Cn:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Rn: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 On:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,f,!1),i+=5;break;case Pn: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 Sn:t.arc(e[i+1],e[i+2],e[i+3],0,f,!1),i+=4;break;case Ln:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Dn.error(`command: ${s} [index:${i}]`,e)}}},{M:An,L:Wn,C:In,Q:Nn,Z:Fn,N:zn,D:Yn,X:Un,G:jn,F:Hn,O:Xn,P:Vn,U:Gn}=Cs,{toTwoPointBounds:Kn,toTwoPointBoundsByQuadraticCurve:qn,arcTo:Qn,arc:Zn,ellipse:$n}=Xs,{add:Jn,copy:to,addPoint:eo,setPoint:so,addBounds:io,toBounds:no}=F,oo=vt.get("PathBounds");let ro,ao,ho;const lo={},co={},uo={},_o={toBounds(t,e){_o.toTwoPointBounds(t,co),no(co,e)},toTwoPointBounds(t,e){if(!t||!t.length)return so(e,0,0);let s,i,n,o,r,a=0,h=0,d=0;const l=t.length;for(;a<l;)switch(s=t[a],0===a&&(s===Fn||s===In||s===Nn?so(e,h,d):so(e,t[a+1],t[a+2])),s){case An:case Wn:h=t[a+1],d=t[a+2],eo(e,h,d),a+=3;break;case In:o=t[a+5],r=t[a+6],Kn(h,d,t[a+1],t[a+2],t[a+3],t[a+4],o,r,lo),Jn(e,lo),h=o,d=r,a+=7;break;case Nn:i=t[a+1],n=t[a+2],o=t[a+3],r=t[a+4],qn(h,d,i,n,o,r,lo),Jn(e,lo),h=o,d=r,a+=5;break;case Fn:a+=1;break;case zn:h=t[a+1],d=t[a+2],io(e,h,d,t[a+3],t[a+4]),a+=5;break;case Yn:case Un:h=t[a+1],d=t[a+2],io(e,h,d,t[a+3],t[a+4]),a+=s===Yn?9:6;break;case jn:$n(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],lo,uo),0===a?to(e,lo):Jn(e,lo),h=uo.x,d=uo.y,a+=9;break;case Hn:h=t[a+1],d=t[a+2],ao=t[a+3],ho=t[a+4],io(e,h-ao,d-ho,2*ao,2*ho),h+=ao,a+=5;break;case Xn:Zn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],lo,uo),0===a?to(e,lo):Jn(e,lo),h=uo.x,d=uo.y,a+=7;break;case Vn:h=t[a+1],d=t[a+2],ro=t[a+3],io(e,h-ro,d-ro,2*ro,2*ro),h+=ro,a+=4;break;case Gn:Qn(null,h,d,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],lo,uo),0===a?to(e,lo):Jn(e,lo),h=uo.x,d=uo.y,a+=6;break;default:return void oo.error(`command: ${s} [index:${a}]`,t)}}},po={smooth:(t,e,s)=>t};Es.creator=new vn,Es.parse=Ni.parse,Es.convertToCanvasData=Ni.toCanvasData;const go=vt.get("plugin"),fo={list:[]};function yo(t,e){if(fo.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:go.error(t+" non-existent")})),t.run(s)}else go.error("no dependencies")}class mo{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 vo=vt.get("TaskProcessor");class wo{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 mo(t),e)}addParallel(t,e){const s=new mo(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new mo(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){vo.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 xo{constructor(t,e){this.updatedList=new l,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 r(r.DATA,{updatedList:this.updatedList})),this.updatedList=new l,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__(r.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const Bo=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,Bo.log(e.innerName,"---\x3e");try{this.emitRender(h.START),this.renderOnce(t),this.emitRender(h.END,this.totalBounds)}catch(t){Bo.error(t)}Bo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Bo.warn("rendering"):this.times>3?Bo.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 Bo.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),n=t.includes(this.target.__world),o=(new st).copy(i);s.save(),n&&!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();It.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new st(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(Bo.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__(n.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:ko}=$;class Eo{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,n=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,r=this.getBestMatchLeaf(),a=n?this.getPath(r):this.getHitablePath(r);return this.clear(),i?{path:a,leaf:r,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:r}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,n={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,n),this.findList.length)return this.findList[0]}return t[0]}getPath(t){const e=new l;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 l;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 l,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,n,o;for(let t=0,r=s.length;t<r;t++){i=s[t],n=s[t+1];for(let t=0,s=i.length;t<s&&(o=i.list[t],!n||!n.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,i;const{point:n}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(i=ko(s.__world,n),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,n)):i&&this.hitChild(s,n))}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 To{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 Eo(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,n=s.length;i<n;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 xo(t,e),layouter:(t,e)=>new Wt(t,e),renderer:(t,e,s)=>new bo(t,e,s),selector:(t,e)=>new To(t,e)});const Co=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(){this.view=this.offscreen?new OffscreenCanvas(1,1):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 Co.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){const s=this.view,i=i=>{const{x:o,y:r,width:a,height:h}=t.getBoundsFrom(i),{style:d}=s;if(d.marginLeft=o+"px",d.marginTop=r+"px",a!==this.width||h!==this.height){const{pixelRatio:t}=this,s={width:a,height:h,pixelRatio:t},i={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(s),void 0!==this.width&&e(new n(s,i))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)i(e.contentRect)}));const o=this.parentView;o&&(this.resizeObserver.observe(o),i(o.getBoundingClientRect()))}}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null,this.autoLayout=!1)}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:Oo}=Ms;CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,n){Oo(this,t,e,s,i,n)});class Po{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 n=document.createElement("canvas");t||(t=this.width),e||(e=this.height),n.width=t,n.height=e;const o=n.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,e),n}destory(){}}class So{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 Lo={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:Do.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 l,{list:i}=t;for(let t=0,n=i.length;t<n;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Do=Lo,{getDragEventData:Mo,getDropEventData:Ao,getSwipeEventData:Wo,filterPathByEventType:Io}=Lo;class No{constructor(t){this.interaction=t}setDragData(t){this.dragData=Mo(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:n}=this;this.moving||(this.moving=(_s.middle(t)||us.isHoldSpaceKey())&&e,this.moving&&s.emit(vs.START,n)),this.moving||this.dragStart(t,e);const{path:o,throughPath:r}=i;this.dragData=Mo(i,n,t),r&&(this.dragData.throughPath=r),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=>{rt.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:n}=s,o=Mo(s,t,t);n&&(o.throughPath=n),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=Wo(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Ao(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,{autoMoveDistance:i}=e.config.pointer;if(!i)return;const n=e.shrinkCanvasBounds,{x:o,y:r}=n,a=$.right(n),h=$.bottom(n),d=t.x<o?i:a<t.x?-i:0,l=t.y<r?i:h<t.y?-i:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=d,u+=l,$.move(s,d,l),$.move(this.dragData,d,l),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:l,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}function Fo(t,e,s,i,n){if(t.__.hitChildren&&!Yo(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!s.path.has(o)&&o.__.hittable&&zo(o,e,s,i,n)}}function zo(t,e,s,i,n){if(t.__.hitSelf&&t.hasEvent(e,i)&&!Yo(t,n)){s.phase=i?1:t===s.target?2:3;const n=jt.get(e,s);if(t.emitEvent(n,i),n.isStop)return!0}return!1}function Yo(t,e){return e&&e.has(t)}const{pathHasEventType:Uo}=Lo;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,autoMoveDistance:2,ignoreMove:!1}},this.tapCount=0,this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new l(t),this.transformer=new So(this),this.dragger=new No(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,n=[gs.DOUBLE_TAP,gs.DOUBLE_CLICK].some((e=>Uo(t.path,e)));i<e.tapTime+50&&n?(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__(n.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 n;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(n=s.list[o],zo(n,t,e,!0,i))return;n.isApp&&Fo(n,t,e,!0,i)}for(let o=0,r=s.length;o<r;o++)if(n=s.list[o],n.isApp&&Fo(n,t,e,!1,i),zo(n,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 Ho={convert(t,e){const s=Lo.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=Lo.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=Ho.getTouch(t),i=Lo.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]},Xo={getData(t,e){const s=A.getCenter(t[0],t[1]),i=A.getCenter(e[0],e[1]),n={x:i.x-s.x,y:i.y-s.y},o=A.getDistance(t[0],t[1]),r=A.getDistance(e[0],e[1])/o,a=A.getAngle(t[0],t[1]),h=A.getAngle(e[0],e[1]);return{move:n,scale:r,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}};let Vo=0;const Go={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n){const e=t.mozInputSource&&t.deltaY%18==0;e?Vo++:Vo=0,s=(Math.floor(t.deltaY)!==t.deltaY||e&&Vo>2)&&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-r/(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:Ko,getZoomEventData:qo,getRotateEventData:Qo}=Lo;class Zo 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(Ho.convert(t,this.getLocal(t)))}onPointerMove(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Ho.convert(t,this.getLocal(t)))}onPointerUp(t){this.preventDefaultPointer(t),this.useMutiTouch||this.pointerUp(Ho.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Ho.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerMove(Ho.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerUp(Ho.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=Ho.getTouch(t);this.pointerDown(Ho.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(t.preventDefault(),this.mutiTouchMove(t),this.usePointer)return;const e=Ho.getTouch(t);this.pointerMove(Ho.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(t.preventDefault(),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=Ho.getTouch(t);this.pointerUp(Ho.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Xo.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Xo.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 n=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],o=[this.getLocal(s),this.getLocal(i)],{move:r,angle:a,scale:h,center:d}=Xo.getData(n,o),l=Lo.getBase(t);this.rotate(Qo(d,a,l)),this.zoom(qo(d,h,l)),this.move(Ko(d,r,l)),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):Go.getScale(t,e),i=this.getLocal(t),n=Lo.getBase(t);1!==s?this.zoom(qo(i,s,n)):this.move(Ko(i,e.getMove?e.getMove(t,e):Go.getMove(t,e),n))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=Lo.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=p.within(o,0,1),this.zoom(qo(e,i*i,s)),this.rotate(Qo(e,n/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 Po(t),hitCanvas:(t,e)=>new Ro(t,e),interaction:(t,e,s,i)=>new Zo(t,e,s,i)}),It.requestRender=function(t){window.requestAnimationFrame(t)},It.canvas=Nt.canvas(),navigator.userAgent.indexOf("Firefox")>-1&&(It.conicGradientRotate90=!0);const $o={},Jo={},tr={},er={},sr={width:4,height:4};const ir={width:4,height:4};var nr=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;const{__world:n,__layout:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,shapeBounds:d,scaleX:l,scaleY:c}=s,u=e.getBiggerCanvas(ir.width,ir.height),_=$.getOutOfBounds(h,e.bounds);r.forEach((t=>{u.save(),u.setWorldShadow(_.offsetX+t.x*l,_.offsetY+t.y*c,t.blur*l),u.copyWorld(s.canvas,d,t.spread?$.getSpread(_,-t.spread*l*(o.renderBounds.width/o.strokeBounds.width)):_),u.restore(),a?(u.copyWorld(u,h,n,"copy"),u.copyWorld(a,n,n,"source-out"),i=n):(u.copyWorld(s.canvas,d,h,"source-out"),i=h),u.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(u,i,o.renderBounds,t.blendMode)})),u.recycle()},shadow:function(t,e,s){let i;const{__world:n,__layout:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,shapeBounds:d,scaleX:l,scaleY:c}=s,u=e.getBiggerCanvas(sr.width,sr.height),_=$.getOutOfBounds(h,e.bounds);r.forEach((t=>{u.setWorldShadow(_.offsetX+t.x*l,_.offsetY+t.y*c,t.blur*l,t.color),u.copyWorld(s.canvas,d,t.spread?$.getSpread(_,t.spread*l*(o.renderBounds.width/o.strokeBounds.width)):_),i=h,t.showBehind||(u.restore(),u.save(),a&&(u.copyWorld(u,h,n,"copy"),i=n),a?u.copyWorld(a,n,n,"destination-out"):u.copyWorld(s.canvas,d,h,"destination-out")),e.copyWorldToInner(u,i,o.renderBounds,t.blendMode)})),u.recycle()}});function or(t,e){let s;const{rows:i,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,r=i.length;t<r;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)})),n&&e.fillRect(s.x,s.y+n,s.width,o)}function rr(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),lr(t,e);break;case"inside":ar(t,e,s,"inside");break;case"outside":ar(t,e,s,"outside")}}function ar(t,e,s,i){const{strokeWidth:n,__font:o}=t.__,r=e.getSameCanvas(!0);r.setStroke(s,2*n,t.__),r.font=o,lr(t,r),r.blendMode="outside"===i?"destination-out":"destination-in",or(t,r),r.blendMode="normal",e.copyWorldToInner(r,t.__world,t.__layout.renderBounds),r.recycle()}function hr(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),dr(t,s,e);break;case"inside":ar(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:n,__font:o}=t.__,r=e.getSameCanvas(!0);r.setStroke(void 0,2*n,t.__),r.font=o,dr(t,s,r),r.blendMode="outside"===i?"destination - out":"destination -in ",or(t,r),r.blendMode="normal",e.copyWorldToInner(r,t.__world,t.__layout.renderBounds),r.recycle()}(t,e,s,"outside")}}function dr(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),lr(t,s),s.restoreBlendMode()):lr(t,s)}))}function lr(t,e){let s;const{rows:i,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,r=i.length;t<r;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)})),n&&e.strokeRect(s.x,s.y+n,s.width,o)}function cr(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const ur={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:_r,rotateOf:pr,translate:gr,scaleOf:fr,scale:yr,rotate:mr}=T;function vr(t,e,s,n){let{type:o,blendMode:r}=s,a={type:o,blendMode:r,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:r,rotation:d}=s,{width:l,height:c}=h;const u=n.width===l&&n.height===c;switch(i){case"strench":u||(l=n.width,c=n.height),(n.x||n.y)&&(t=_r(),gr(t,n.x,n.y));break;case"clip":(o||r||d)&&(t=function(t,e,s,i){const n=_r();gr(n,t.x,t.y),e&&gr(n,e.x,e.y);s&&("number"==typeof s?yr(n,s):yr(n,s.x,s.y));i&&mr(n,i);return n}(n,o,r,d));break;case"repeat":(!u||r||d)&&(t=function(t,e,s,i,n){const o=_r();if(n)switch(mr(o,n),n){case 90:gr(o,s,0);break;case 180:gr(o,e,s);break;case 270:gr(o,0,e)}gr(o,t.x,t.y),i&&fr(o,t,i);return o}(n,l,c,r,d));break;default:u&&!d||(t=function(t,e,s,i,n){const o=_r(),r=n&&180!==n,a=e.width/(r?i:s),h=e.height/(r?s:i),d="fit"===t?Math.min(a,h):Math.max(a,h),l=e.x+(e.width-s*d)/2,c=e.y+(e.height-i*d)/2;gr(o,l,c),yr(o,d),n&&pr(o,{x:e.x+e.width/2,y:e.y+e.height/2},n);return o}(i,n,l,c,d))}a.style=function(t,e,s){let i=It.canvas.createPattern(t,s?"repeat":"no-repeat");if(e){const{a:t,b:s,c:n,d:o,e:r,f:a}=e;i.setTransform(new DOMMatrix([t,s,n,o,r,a]))}return i}(h.getCanvas(l,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))}),(n=>{t.emitEvent(new i(i.ERROR,t,h,e,s,n))}));return a}const wr={x:.5,y:0},xr={x:.5,y:1};function Br(t,e,s){let i;for(let n=0,o=e.length;n<o;n++)i=e[n],t.addColorStop(i.offset,ur.string(i.color,s))}const{set:br,getAngle:kr,getDistance:Er}=A,{get:Tr,rotateOf:Cr,scaleOf:Rr}=T,Or={x:.5,y:.5},Pr={x:.5,y:1},Sr={},Lr={};const{set:Dr,getAngle:Mr}=A,{get:Ar,rotateOf:Wr,scaleOf:Ir}=T,Nr={x:.5,y:.5},Fr={x:.5,y:1},zr={},Yr={};function Ur(t,e){let s,i=t.__.__input[e];const n=[];i instanceof Array||(i=[i]);for(let o=0,r=i.length;o<r;o++)s=jr(t,i[o],e),s&&n.push(s);t.__["_"+e]=n.length?n:void 0}function jr(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:n,blendMode:o,color:r,opacity:a}=e;return{type:n,blendMode:o,style:ur.string(r,a)};case"image":return vr(t,s,e,i);case"linear":return function(t,e){let{from:s,to:i,type:n,blendMode:o,opacity:r}=t;s||(s=wr),i||(i=xr);const a=It.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+i.x*e.width,e.y+i.y*e.height);return Br(a,t.stops,r),{type:n,blendMode:o,style:a}}(e,i);case"radial":return function(t,e){let{from:s,to:i,type:n,opacity:o,blendMode:r,stretch:a}=t;s||(s=Or),i||(i=Pr);const{x:h,y:d,width:l,height:c}=e;let u;br(Sr,h+s.x*l,d+s.y*c),br(Lr,h+i.x*l,d+i.y*c),(l!==c||a)&&(u=Tr(),Rr(u,Sr,l/c*(a||1),1),Cr(u,Sr,kr(Sr,Lr)+90));const _=It.canvas.createRadialGradient(Sr.x,Sr.y,0,Sr.x,Sr.y,Er(Sr,Lr));return Br(_,t.stops,o),{type:n,blendMode:r,style:_,transform:u}}(e,i);case"angular":return function(t,e){let{from:s,to:i,type:n,opacity:o,blendMode:r,stretch:a}=t;s||(s=Nr),i||(i=Fr);const{x:h,y:d,width:l,height:c}=e;Dr(zr,h+s.x*l,d+s.y*c),Dr(Yr,h+i.x*l,d+i.y*c);const u=Ar(),_=Mr(zr,Yr);It.conicGradientRotate90?(Ir(u,zr,l/c*(a||1),1),Wr(u,zr,_+90)):(Ir(u,zr,1,l/c*(a||1)),Wr(u,zr,_));const p=It.canvas.createConicGradient(0,zr.x,zr.y);return Br(p,t.stops,o),{type:n,blendMode:r,style:p,transform:u}}(e,i);default:return e.r?{type:"solid",style:ur.string(e)}:void 0}}var Hr=Object.freeze({__proto__:null,computeFill:function(t){Ur(t,"fill")},computeStroke:function(t){Ur(t,"stroke")},drawText:or,drawTextStroke:lr,fill:function(t,e,s){e.fillStyle=s,t.__.__font?or(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:n,__font:o}=t.__;for(let r=0,a=s.length;r<a;r++)if(i=s[r],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:r,c:a,d:h,e:d,f:l}=i.transform;e.transform(s,r,a,h,d,l),i.blendMode&&(e.blendMode=i.blendMode),o?or(t,e):e.fill(n),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),o?or(t,e):e.fill(n),e.restoreBlendMode()):o?or(t,e):e.fill(n)},shape:function(t,e,s){const i=e.getSameCanvas();let n,o,r,a;const{__world:h}=t;let{a:d,d:l}=h;if(e.bounds.includes(h,s.matrix))n=r=h,a=i;else{const{renderBoundsSpreadWidth:i}=t.__layout,c=$.getIntersectData(i?$.getSpread(e.bounds,i*h.a):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),d*=o.a,l*=o.d),r=$.getOuterOf(h,o),n=$.getByMove(r,-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:n,worldCanvas:a,shapeBounds:r,scaleX:d,scaleY:l}},stroke:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o,__font:r}=i;if(r)rr(t,e,s);else switch(o){case"center":e.setStroke(s,n,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*n,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);o.setStroke(s,2*n,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:rr,strokes:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o,__font:r}=i;if(r)hr(t,e,s);else switch(o){case"center":e.setStroke(void 0,n,i),cr(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*n,i),e.clip(i.windingRule),cr(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*n,t.__),cr(s,r),r.clip(i.windingRule),r.clearWorld(o),e.copyWorldToInner(r,t.__world,o),r.recycle()}},strokesText:hr});Object.assign($o,nr),Object.assign(Jo,Hr);class Xr extends mt{setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxBoundsChanged?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.boxBoundsChanged?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._shadow=t instanceof Array?t:t?[t]:t}setInnerShadow(t){t instanceof Array?this._innerShadow=t:t?this._innerShadow=[t]:this._shadow=t}}const Vr={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Gr extends Xr{}class Kr extends Gr{}const{parse:qr}=Ni;const Qr={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Zr extends Xr{}function $r(t){return(e,s)=>{ae(e,s,t,{set(t){this.__setAttr(s,t),this.__.__useEffect=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}})}}const Jr={__updateStrokeBoundsSpreadWidth(){let t=0;const{stroke:e,hitStroke:s,strokeAlign:i,strokeWidth:n}=this.__;if((e||"always"===s)&&n&&"inside"!==i){t="center"===i?n/2:n,this.__.__strokeOuterWidth=t;const{miterLimit:e,strokeCap:s,path:o}=this.__;if(o){const i=1/Math.sin(e*g/2)*Math.sqrt(n)-t,o="none"===s?0:n;t+=Math.max(i,o)}}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:n}=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)})),n&&(o=Math.max(o,n)),this.__layout.renderShapeBoundsSpreadWidth=o,t}},ta={__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:n}=this.__,o=s&&"visible"===i||"always"===i;if(o&&e.hitFill(t,n))return!0;const{stroke:r,hitStroke:a,strokeWidth:h,strokeAlign:d}=this.__,l=r&&"visible"===a||"always"===a,c=2*t.radiusX;let u=2*(l?"center"===d?h/2:h:0)+c;if(!u)return!1;switch(d){case"inside":if(!o&&e.hitFill(t,n)&&e.hitStroke(t,u))return!0;u=c;break;case"outside":if(!o){if(!e.hitFill(t,n)&&e.hitStroke(t,u))return!0;u=c}}return!!u&&e.hitStroke(t,u)}},ea={__updateChange(){let t=this.__;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:n}=this.__;this.__drawRenderPath(t),s&&Jo.fill(this,t,s),n&&this.__drawAfterFill(t,e),i&&Jo.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:n,__font:o}=this.__;if(o?t.font=o:this.__drawRenderPath(t),this.__.__useEffect){const o=Jo.shape(this,t,e),{shadow:r,innerShadow:a}=this.__;r&&$o.shadow(this,t,o),s&&(this.__.__isFills?Jo.fills(this,t,s):Jo.fill(this,t,s)),n&&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)),n&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?Jo.strokes(this,t,i):Jo.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,__font:n}=this.__;if(n?t.font=n:this.__drawRenderPath(t),s&&(t.fillStyle="#000000",n?Jo.drawText(this,t):t.fill()),i){const{strokeWidth:e,strokeAlign:s}=this.__;"inside"!==s&&(t.setStroke("#000000","outside"===s?2*e:e,this.__),n?Jo.drawTextStroke(this,t):t.stroke())}}},sa={__drawFast(t,e){const{width:s,height:i,fill:n,stroke:o,__drawAfterFill:r}=this.__;if(n&&(t.fillStyle=n,t.fillRect(0,0,s,i)),r&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:n}=this.__;t.setStroke(o,n,this.__);const r=n/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(r,r,s-n,i-n);break;case"outside":t.strokeRect(-r,-r,s+n,i+n)}}}},ia={__drawFast(t,e){const{fill:s,stroke:i}=this.__,{__font:n}=this.__;t.font=n,s&&(t.fillStyle=s,Jo.drawText(this,t)),i&&Jo.strokeText(this,t,i)}};let na=class extends es{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}__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?po.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,n){return zt.get(t.tag||this.prototype.__tag,t,e,s,i,n)}};Gt([Be(Xr)],na.prototype,"__",void 0),Gt([he("")],na.prototype,"id",void 0),Gt([he("")],na.prototype,"name",void 0),Gt([he("")],na.prototype,"className",void 0),Gt([ye()],na.prototype,"blendMode",void 0),Gt([me(1)],na.prototype,"opacity",void 0),Gt([me(!0)],na.prototype,"visible",void 0),Gt([we(!1)],na.prototype,"isMask",void 0),Gt([ve(0)],na.prototype,"zIndex",void 0),Gt([he()],na.prototype,"locked",void 0),Gt([de(0)],na.prototype,"x",void 0),Gt([de(0)],na.prototype,"y",void 0),Gt([ue(100)],na.prototype,"width",void 0),Gt([ue(100)],na.prototype,"height",void 0),Gt([le(1)],na.prototype,"scaleX",void 0),Gt([le(1)],na.prototype,"scaleY",void 0),Gt([ce(0)],na.prototype,"rotation",void 0),Gt([ce(0)],na.prototype,"skewX",void 0),Gt([ce(0)],na.prototype,"skewY",void 0),Gt([he(!1)],na.prototype,"draggable",void 0),Gt([xe(!0)],na.prototype,"hittable",void 0),Gt([xe("visible")],na.prototype,"hitFill",void 0),Gt([ge("visible")],na.prototype,"hitStroke",void 0),Gt([xe(!0)],na.prototype,"hitChildren",void 0),Gt([xe(!0)],na.prototype,"hitSelf",void 0),Gt([ye()],na.prototype,"fill",void 0),Gt([ge()],na.prototype,"stroke",void 0),Gt([ge("inside")],na.prototype,"strokeAlign",void 0),Gt([ge(1)],na.prototype,"strokeWidth",void 0),Gt([ge("none")],na.prototype,"strokeCap",void 0),Gt([ge("miter")],na.prototype,"strokeJoin",void 0),Gt([ge()],na.prototype,"dashPattern",void 0),Gt([ge()],na.prototype,"dashOffset",void 0),Gt([ge(10)],na.prototype,"miterLimit",void 0),Gt([_e()],na.prototype,"cornerRadius",void 0),Gt([_e()],na.prototype,"cornerSmoothing",void 0),Gt([$r()],na.prototype,"shadow",void 0),Gt([$r()],na.prototype,"innerShadow",void 0),Gt([$r()],na.prototype,"blur",void 0),Gt([$r()],na.prototype,"backgroundBlur",void 0),Gt([$r()],na.prototype,"grayscale",void 0),Gt([Oe(Mn.drawPathByData)],na.prototype,"__drawPathByData",null),na=Gt([Le(Jr),Le(ta),Le(ea),Pe()],na);let oa=class extends na{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(Gr)],oa.prototype,"__",void 0),oa=Gt([Le(ls),De()],oa);let ra=class extends na{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:n}=this.__;n?t.roundRect(0,0,s,i,n):t.rect(0,0,s,i)}};Gt([Be(class extends Xr{})],ra.prototype,"__",void 0),ra=Gt([Le(sa),De()],ra);const aa=ra.prototype,ha=oa.prototype,da={},{copy:la,add:ca}=$;let ua=class extends oa{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}__updateStrokeBoundsSpreadWidth(){return 0}__updateRectRenderBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){let t=this.__updateRectRenderBoundsSpreadWidth()||super.__updateRenderBoundsSpreadWidth();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;la(da,t),super.__updateRenderBounds(),ca(t,da)}}__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(Kr)],ua.prototype,"__",void 0),Gt([fe("show")],ua.prototype,"overflow",void 0),Gt([Oe(aa.__updateStrokeBoundsSpreadWidth)],ua.prototype,"__updateStrokeBoundsSpreadWidth",null),Gt([Oe(aa.__updateRenderBoundsSpreadWidth)],ua.prototype,"__updateRectRenderBoundsSpreadWidth",null),Gt([Oe(aa.__updateBoxBounds)],ua.prototype,"__updateBoxBounds",null),Gt([Oe(aa.__updateStrokeBounds)],ua.prototype,"__updateStrokeBounds",null),Gt([Oe(aa.__updateRenderBounds)],ua.prototype,"__updateRectRenderBounds",null),Gt([Oe(aa.__updateChange)],ua.prototype,"__updateRectChange",null),Gt([Oe(aa.__drawPathByData)],ua.prototype,"__drawPathByData",null),Gt([Oe(aa.__render)],ua.prototype,"__renderRect",null),Gt([Oe(ha.__render)],ua.prototype,"__renderGroup",null),ua=Gt([Pe(),De()],ua);let _a=class extends ua{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};Gt([Be(class extends Kr{})],_a.prototype,"__",void 0),Gt([fe("hide")],_a.prototype,"overflow",void 0),_a=Gt([De()],_a);const{moveTo:pa,closePath:ga,ellipse:fa}=sn;let ya=class extends na{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:n}=this.__,o=t/2,r=e/2,a=this.__.path=[];s?i||n?(s<1&&fa(a,o,r,o*s,r*s,0,i,n,!1),fa(a,o,r,o,r,0,n,i,!0),s<1&&ga(a)):(s<1&&(fa(a,o,r,o*s,r*s),pa(a,t,r)),fa(a,o,r,o,r,0,0,360,!0)):i||n?(pa(a,o,r),fa(a,o,r,o,r,0,i,n,!1),ga(a)):fa(a,o,r,o,r)}};Gt([Be(class extends Xr{})],ya.prototype,"__",void 0),Gt([_e(0)],ya.prototype,"innerRadius",void 0),Gt([_e(0)],ya.prototype,"startAngle",void 0),Gt([_e(0)],ya.prototype,"endAngle",void 0),ya=Gt([De()],ya);const{sin:ma,cos:va,PI:wa}=Math,{moveTo:xa,lineTo:Ba,closePath:ba}=sn;let ka=class extends na{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,n=e/2,o=this.__.path=[];xa(o,i,0);for(let t=1;t<s;t++)Ba(o,i+i*ma(2*t*wa/s),n-n*va(2*t*wa/s));ba(o)}};Gt([Be(class extends Xr{})],ka.prototype,"__",void 0),Gt([_e(3)],ka.prototype,"sides",void 0),ka=Gt([De()],ka);const{sin:Ea,cos:Ta,PI:Ca}=Math,{moveTo:Ra,lineTo:Oa,closePath:Pa}=sn;let Sa=class extends na{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,n=t/2,o=e/2,r=this.__.path=[];Ra(r,n,0);for(let t=1;t<2*s;t++)Oa(r,n+(t%2==0?n:n*i)*Ea(t*Ca/s),o-(t%2==0?o:o*i)*Ta(t*Ca/s));Pa(r)}};Gt([Be(class extends Xr{})],Sa.prototype,"__",void 0),Gt([_e(5)],Sa.prototype,"points",void 0),Gt([_e(.382)],Sa.prototype,"innerRadius",void 0),Sa=Gt([De()],Sa);const{moveTo:La,lineTo:Da}=sn,{rotate:Ma,getAngle:Aa,getDistance:Wa,defaultPoint:Ia}=A,{setPoint:Na,addPoint:Fa,toBounds:za}=F,Ya={};let Ua=class extends na{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxBoundsChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Ma(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Wa(Ia,t),this.rotation=Aa(Ia,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];La(t,0,0);const e=this.toPoint;Da(t,e.x,e.y)}__updateBoxBounds(){Na(Ya,0,0),Fa(Ya,this.__toPoint.x,this.__toPoint.y),za(Ya,this.__layout.boxBounds)}};Gt([Be(class extends Xr{})],Ua.prototype,"__",void 0),Gt([ue()],Ua.prototype,"rotation",void 0),Gt([pe("center")],Ua.prototype,"strokeAlign",void 0),Ua=Gt([De()],Ua);let ja=class extends ra{get __tag(){return"Image"}get ready(){var t;return null===(t=this.image)||void 0===t?void 0:t.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()}};Gt([Be(Zr)],ja.prototype,"__",void 0),Gt([ue("")],ja.prototype,"url",void 0),ja=Gt([De()],ja);let Ha=class extends ra{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=Nt.canvas(t),this.context=this.canvas.context,this.__.hitType="all",this.__.pixelRatio=this.canvas.pixelRatio}draw(t,e,s,i){t.__layout.checkUpdate();const n=new N(t.__world);n.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),n.preMultiply(o),t.__render(this.canvas,{matrix:n}),this.forceUpdate("fill")}__draw(t,e){t.drawImage(this.canvas.view,0,0)}__updateBoxBounds(){super.__updateBoxBounds(),this.canvas.resize(this.__)}};Gt([Be(Zr)],Ha.prototype,"__",void 0),Gt([ue("")],Ha.prototype,"pixelRatio",void 0),Gt([ye("true")],Ha.prototype,"smooth",void 0),Ha=Gt([De()],Ha);const Xa=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",Va=Xa+"_#~&*+\\=|≮≯≈≠=…";function Ga(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ka=Ga("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),qa=Ga("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),Qa=Ga(Xa),Za=Ga(Va),$a=Ga("- —/~|┆·");var Ja;!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"}(Ja||(Ja={}));const{Letter:th,Single:eh,Before:sh,After:ih,Symbol:nh,Break:oh}=Ja;function rh(t){return Ka[t]?th:$a[t]?oh:/[\u3400-\u9FBF]/.test(t)?eh:qa[t]?sh:Qa[t]?ih:Za[t]?nh:th}const ah={trimRight(t){const{words:e}=t;let s,i=0,n=e.length;for(let o=n-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(n-i,i)}};function hh(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:dh}=ah,{Letter:lh,Single:ch,Before:uh,After:_h,Symbol:ph,Break:gh}=Ja;let fh,yh,mh,vh,wh,xh,Bh,bh,kh,Eh,Th,Ch,Rh,Oh,Ph=[];function Sh(t,e){fh.data.push({char:t,width:e}),mh+=e}function Lh(){vh+=mh,fh.width=mh,yh.words.push(fh),fh={data:[]},mh=0}function Dh(){Ch&&(Rh.paraNumber++,yh.paraStart=!0,Ch=!1),yh.width=vh,dh(yh),Ph.push(yh),yh.width>Oh.width&&(Oh.width=yh.width),yh={words:[]},vh=0}const Mh=0,Ah=1,Wh=2;const Ih={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let s=0,i=0,{width:n,height:o,padding:r}=e;const{textDecoration:a,textOverflow:h,fontSize:d,__font:l}=e;if(n||(n=0),o=Math.max(o,d),r){const[t,e,a,h]=p.fourNumber(r);n&&(s=h,n-=e+h),o&&(i=t,o-=t+a)}const c={bounds:{x:s,y:i,width:n,height:o},rows:[],paraNumber:0,font:It.canvas.font=l};return function(t,e,s){Rh=t,Ph=t.rows,Oh=t.bounds;const{__letterSpacing:i,paraIndent:n,textCase:o}=s,{canvas:r}=It,{width:a,height:h}=Oh;if(a||h||i||o){Ch=!0,kh=null,mh=vh=0,fh={data:[]},yh={words:[]};for(let t=0,s=e.length;t<s;t++)xh=e[t],"\n"===xh?(mh&&Lh(),yh.paraEnd=!0,Dh(),Ch=!0):(bh=rh(xh),bh===lh&&"none"!==o&&(xh=hh(xh,o,!mh)),Bh=r.measureText(xh).width,i&&(Bh+=i),Eh=bh===ch&&(kh===ch||kh===lh)||kh===ch&&bh!==_h,Th=!(bh!==uh&&bh!==ch||kh!==ph&&kh!==_h),wh=Ch&&n?a-n:a,vh+mh+Bh>wh&&(Th||(Th=bh===lh&&kh==_h),Eh||Th||bh===gh||bh===uh||bh===ch||mh+Bh>wh?(mh&&Lh(),Dh()):Dh())," "===xh&&vh+mh===0||(bh===gh?(" "===xh&&mh&&Lh(),Sh(xh,Bh),Lh()):Eh||Th?(mh&&Lh(),Sh(xh,Bh)):Sh(xh,Bh)),kh=bh);mh&&Lh(),vh&&Dh(),Ph[Ph.length-1].paraEnd=!0}else e.split("\n").forEach((t=>{Rh.paraNumber++,Ph.push({x:n||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,t,e),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:n,__baseLine:o,textAlign:r,verticalAlign:a,paraSpacing:h,textOverflow:d}=e;let l,{x:c,y:u,width:_,height:p}=i,g=n*s.length+(h?h*(t.paraNumber-1):0),f=o;if(p){if("show"!==d&&g>p)g=Math.max(p,n),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(l=s[e],l.x=c,r){case"center":l.x+=(_-l.width)/2;break;case"right":l.x+=_-l.width}l.paraStart&&h&&e>0&&(f+=h),l.y=f,f+=n,t.overflow>e&&f>g&&(l.isOverflow=!0,t.overflow=e+1)}i.y=u,i.height=g}(c,e),function(t,e,s,i){const{rows:n}=t,{textAlign:o,paraIndent:r,letterSpacing:a}=e;let h,d,l,c,u;n.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,d=s&&"justify"===o&&t.words.length>1?(s-t.width-l)/(t.words.length-1):0,c=a||t.isOverflow?Mh:d>.01?Ah:Wh,c===Wh?(t.text="",t.x+=l,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=l,h=t.x,t.data=[],t.words.forEach((e=>{c===Ah?(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&&d&&(h+=d,t.width+=d)}))),t.words=null)}))}(c,e,n),c.overflow&&function(t,e){const{rows:s,overflow:i}=t;if(s.splice(i),"hide"!==e){"ellipsis"===e&&(e="...");const n=It.canvas.measureText(e).width,o=s[i-1];let r,a,h=o.data.length-1;const{x:d,width:l}=t.bounds,c=d+l-n;for(let t=h;t>-1&&(r=o.data[t],a=r.x+r.width,!(t===h&&a<c));t--){if(a<c&&" "!==r.char){o.data.splice(t+1),o.width-=r.width;break}o.width-=r.width}o.width+=n,o.data.push({char:e,x:a})}}(c,h),"none"!==a&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"underline":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(c,e),c}},{copyAndSpread:Nh,includes:Fh,spread:zh}=$;let Yh=class extends na{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:n,height:o}=this.__layout.boxBounds;t.rect(s,i,n,o)}__updateTextDrawData(){const t=this.__;t.__textDrawData=Ih.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:n,letterSpacing:o,fontFamily:r,fontSize:a,fontWeight:h,italic:d}=t;t.__lineHeight=Vr.number(n,a),t.__letterSpacing=Vr.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${d?"italic ":""}${"normal"!==h?h+" ":""}${a}px ${r}`,this.__updateTextDrawData();const{bounds:l}=t.__textDrawData,c=e.boxBounds;t.__lineHeight<a&&zh(l,a/2),s&&i?super.__updateBoxBounds():(c.x=s?0:l.x,c.y=i?0:l.y,c.width=s||l.width,c.height=i||l.height);const u=Fh(c,l)?c:l;u!==e.contentBounds&&(e.contentBounds=u,e.renderBoundsChanged=!0)}__updateRenderBoundsSpreadWidth(){let t=super.__updateRenderBoundsSpreadWidth();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Nh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderBoundsSpreadWidth)}};Gt([Be(class extends Xr{setFontWeight(t){this._fontWeight="string"==typeof t?Qr[t]||400:t}})],Yh.prototype,"__",void 0),Gt([ue(0)],Yh.prototype,"width",void 0),Gt([ue(0)],Yh.prototype,"height",void 0),Gt([ue(0)],Yh.prototype,"padding",void 0),Gt([pe("outside")],Yh.prototype,"strokeAlign",void 0),Gt([ue("")],Yh.prototype,"text",void 0),Gt([ue("L")],Yh.prototype,"fontFamily",void 0),Gt([ue(12)],Yh.prototype,"fontSize",void 0),Gt([ue("normal")],Yh.prototype,"fontWeight",void 0),Gt([ue(!1)],Yh.prototype,"italic",void 0),Gt([ue("none")],Yh.prototype,"textCase",void 0),Gt([ue("none")],Yh.prototype,"textDecoration",void 0),Gt([ue(0)],Yh.prototype,"letterSpacing",void 0),Gt([ue({type:"percent",value:150})],Yh.prototype,"lineHeight",void 0),Gt([ue(0)],Yh.prototype,"paraIndent",void 0),Gt([ue(0)],Yh.prototype,"paraSpacing",void 0),Gt([ue("left")],Yh.prototype,"textAlign",void 0),Gt([ue("top")],Yh.prototype,"verticalAlign",void 0),Gt([ue("show")],Yh.prototype,"textOverflow",void 0),Yh=Gt([Le(ia),De()],Yh);const{toBounds:Uh}=_o;let jh=class extends na{get __tag(){return"Path"}constructor(t){super(t)}getCurvePath(){return Ni.toCanvasData(this.__.path,!0)}getStringPath(t){let e=this.__.path;return t&&(e=Ni.toCanvasData([...e],!0)),Ni.stringify(e)}__updateBoxBounds(){Uh(this.__.path,this.__layout.boxBounds)}};Gt([Be(class extends Xr{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=qr(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],jh.prototype,"__",void 0),Gt([_e()],jh.prototype,"path",void 0),Gt([_e()],jh.prototype,"windingRule",void 0),Gt([pe("center")],jh.prototype,"strokeAlign",void 0),jh=Gt([De()],jh);let Hh=class extends oa{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new jh(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,n,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,n){return this}ellipse(t,e,s,i,n,o,r,a){return this}arc(t,e,s,i,n,o){return this}arcTo(t,e,s,i,n){return this}moveToEllipse(t,e,s,i,n,o,r,a){return this}moveToArc(t,e,s,i,n,o){return this}paint(){this.pathElement.forceUpdate("path")}};Gt([Be(class extends Gr{})],Hh.prototype,"__",void 0),Hh=Gt([Le(vn,["beginPath"]),De()],Hh);let Xh=class extends oa{get __tag(){return"Vector"}constructor(t){super(t)}__updatePath(){}};Gt([Be(class extends Xr{})],Xh.prototype,"__",void 0),Gt([_e()],Xh.prototype,"paths",void 0),Xh=Gt([De()],Xh);const Vh=vt.get("LeaferType"),Gh={list:{},register(t,e){Kh[t]?Vh.error("repeat:",t):Kh[t]=e},run(t,e){const s=Gh.list[t];s?s(e):Vh.error("no",t)}},{list:Kh}=Gh;Gh.register("user",(function(t){const{config:e}=t;e.pointer||(e.pointer={}),e.pointer.autoMoveDistance=0})),Gh.register("design",(function(t){const{MOVE:e}=vs,{ZOOM:s}=Bs;t.__eventIds.push(t.on__(e,(e=>{rt.move(t.moveLayer,e.moveX,e.moveY)})),t.on__(s,(e=>{rt.zoomOf(t.zoomLayer,e,e.scale)})))}));const qh=vt.get("Leafer");let Qh=class extends oa{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},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;Gh.run(i.type,this),this.canvas=Nt.canvas(i),this.__controllers.push(this.renderer=Nt.renderer(this,this.canvas,i),this.watcher=Nt.watcher(this,i),this.layouter=Nt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,e?(this.__bindApp(e),s=e.running):(this.selector=Nt.selector(this),this.__controllers.unshift(this.interaction=Nt.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new Xt,this.hitCanvasManager=new Vt,this.imageManager=new ks(this,i),s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(d.RESTART):this.emitLeafer(d.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(d.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 n(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}__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(d.BEFORE_READY),this.emitLeafer(d.READY),this.emitLeafer(d.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(d.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new d(t,this))}__listenEvents(){const t=Bt.start("FirstCreate "+this.innerName);this.once(d.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 d(d.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){qh.error(t)}}};Gt([Be(class extends Gr{})],Qh.prototype,"__",void 0),Gt([ue()],Qh.prototype,"pixelRatio",void 0),Qh=Gt([De()],Qh);let Zh=class extends Qh{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 Qh(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()}};Zh=Gt([De()],Zh);export{tr as Animate,Zh as App,it as AutoBounds,Xs as BezierHelper,st as Bounds,$ as BoundsHelper,ua as Box,ls as Branch,ut as BranchHelper,Ha as Canvas,Xt as CanvasManager,e as ChildEvent,Nt as Creator,ft as DataHelper,vt as Debug,fs as DragEvent,ms as DropEvent,$o as Effect,ya as Ellipse,ti as EllipseHelper,t as Event,jt as EventCreator,er as Export,_a as Frame,oa as Group,Vt as HitCanvasManager,ja as Image,i as ImageEvent,ks as ImageManager,u as IncrementId,Zo as Interaction,bs as KeyEvent,us as Keyboard,a as LayoutEvent,Wt as Layouter,es as Leaf,Ge as LeafBounds,ct as LeafBoundsHelper,mt as LeafData,ze as LeafDataProxy,Ne as LeafEventer,rt as LeafHelper,Qe as LeafHit,c as LeafLevelList,l as LeafList,$e as LeafMask,He as LeafMatrix,Ze as LeafRender,Qh as Leafer,Ro as LeaferCanvas,ie as LeaferCanvasBase,d as LeaferEvent,Po as LeaferImage,Ua 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,jh as Path,_o as PathBounds,sn as PathCommandDataHelper,Cs as PathCommandMap,Ni as PathConvert,po as PathCorner,vn as PathCreator,Mn as PathDrawer,Es as PathHelper,Ds as PathNumberCommandLengthMap,Ls as PathNumberCommandMap,Hh as Pen,It as Platform,fo as Plugin,I as Point,A as PointHelper,_s as PointerButton,gs as PointerEvent,ka as Polygon,s as PropertyEvent,ra as Rect,Ms as RectHelper,sa as RectRender,h as RenderEvent,bo as Renderer,n as ResizeEvent,ws as RotateEvent,Bt as Run,To as Selector,Sa as Star,ot as StringNumberMap,xs as SwipeEvent,mo as TaskItem,wo as TaskProcessor,Yh as Text,ia as TextRender,o as TransformEvent,nt as TwoPointBounds,F as TwoPointBoundsHelper,na as UI,Jr as UIBounds,zt as UICreator,ps as UIEvent,ta as UIHit,ea as UIRender,Xh as Vector,gt as WaitHelper,r as WatchEvent,xo as Watcher,Bs as ZoomEvent,fe as affectRenderBoundsType,pe as affectStrokeBoundsType,re as aliasType,ue as boundsType,se as canvasSizeAttrs,Be as dataProcessor,he as dataType,Ee as defineDataProcessor,ne as defineKey,ae as defineLeafAttr,$r as effectType,oe as getDescriptor,xe as hitType,be as layoutProcessor,we as maskType,me as opacityType,_e as pathType,de as positionType,De as registerUI,Me as registerUIEvent,Oe as rewrite,Pe as rewriteAble,ce as rotationType,le as scaleType,ke as setDefaultValue,ve as sortType,ge as strokeType,ye as surfaceType,Le as useModule,yo as usePlugin};