@leafer-ui/node 1.0.0-beta.5 → 1.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,i={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,r,i;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=r=t[0],s=i=t[1];break;case 3:e=t[0],s=i=t[1],r=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,r,i]}},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:p,PI:u}=Math,_={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s},scaleOfOuter(t,e,s,r=s){x.toInnerPoint(t,e,_),x.scaleOfInner(t,_,s,r)},scaleOfInner(t,e,s,r=s){x.translateInner(t,e.x,e.y),x.scale(t,s,r),x.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),r=h(e),{a:i,b:n,c:a,d:d}=t;t.a=i*s-n*r,t.b=i*r+n*s,t.c=a*s-d*r,t.d=a*r+d*s},rotateOfOuter(t,e,s){x.toInnerPoint(t,e,_),x.rotateOfInner(t,_,s)},rotateOfInner(t,e,s){x.translateInner(t,e.x,e.y),x.rotate(t,s),x.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:a}=t;s&&(s*=o,t.a=r+n*s,t.b=i+a*s),e&&(e*=o,t.c=n+r*e,t.d=a+i*e)},skewOfOuter(t,e,s,r){x.toInnerPoint(t,e,_),x.skewOfInner(t,_,s,r)},skewOfInner(t,e,s,r){x.translateInner(t,e.x,e.y),x.skew(t,s,r),x.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},preMultiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+r*e.c,t.b=s*e.b+r*e.d,t.c=i*e.a+o*e.c,t.d=i*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){x.multiply(t,x.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=x;return x.copy(e,t),x.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t,a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{x:i,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(i*l-o*h)*d,s.y=(o*n-i*a)*d,!r){const{e:e,f:r}=t;s.x-=(e*l-r*h)*d,s.y-=(r*n-e*a)*d}},decompose(t){const{a:e,b:s,c:r,d:i}=t;let n=e,a=i,h=0,l=0,_=0;if(s||r){const t=e*i-s*r,g=e*r+s*i;if(s){const r=e*e+s*s;n=p(r),a=t/n;const i=e/n;h=s>0?d(i):-d(i),l=c(g/r)/o}else{const e=r*r+i*i;a=p(e),n=t/a;const s=r/a;h=u/2-(i>0?d(-s):-d(s)),_=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:_}},reset(t){x.set(t)}},x=f,{toInnerPoint:y,toOuterPoint:v}=f,{sin:m,cos:w,abs:E,sqrt:b,atan2:B}=Math,k={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=T.defaultPoint);const r=w(e*o),i=m(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*r-a*i,t.y=s.y+n*i-a*r},tempToInnerOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),y(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=T;return T.copy(s,t),T.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),y(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){y(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=E(e.x-t.x),r=E(e.y-t.y);return b(s*s+r*r)},getAngle:(t,e)=>T.getAtan2(t,e)/o,getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=T.getAtan2(t,e);return{x:t.x+w(r)*s,y:t.y+m(r)*s}},reset(t){T.reset(t)}},T=k;class P{constructor(t,e){"object"==typeof t?k.copy(this,t):k.set(this,t,e)}set(t,e){k.set(this,t,e)}copy(t){return k.copy(this,t),this}clone(){return new P(this)}rotate(t,e){return k.rotate(this,t,e),this}toInnerOf(t,e){return k.toInnerOf(this,t,e),this}toOuterOf(t,e){return k.toOuterOf(this,t,e),this}getCenter(t){return k.getCenter(this,t)}getDistance(t){return k.getDistance(this,t)}getAngle(t){return k.getAngle(this,t)}getAtan2(t){return k.getAtan2(this,t)}reset(){k.reset(this)}}class C{constructor(t,e,s,r,i,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,r,i,o)}set(t,e,s,r,i,o){f.set(this,t,e,s,r,i,o)}copy(t){return f.copy(this,t),this}clone(){return new C(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const 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},addBounds(t,e,s,r,i){L(t,e,s),L(t,e+r,s+i)},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:L}=R,{tempPointBounds:S,setPoint:O,addPoint:D,toBounds:M}=R,{toOuterPoint:I}=f;let A,W,U,N;const F={},H={},z={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){Y.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),Y.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(Y.right(s)-t.x),e.offsetY=-(Y.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Y.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(Y.copy(Y.tempBounds,t),Y.toOuterOf(Y.tempBounds,e),Y.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),Y.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else F.x=t.x,F.y=t.y,I(e,F,H),O(S,H.x,H.y),F.x=t.x+t.width,I(e,F,H),D(S,H.x,H.y),F.y=t.y+t.height,I(e,F,H),D(S,H.x,H.y),F.x=t.x,I(e,F,H),D(S,H.x,H.y),M(S,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new C(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return Y.copyAndSpread(s,t,e),s},spread(t,e){Y.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){A=t.x+t.width,W=t.y+t.height,U=e.x+e.width,N=e.y+e.height,A=A>U?A:U,W=W>N?W:N,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=A-t.x,t.height=W-t.y},addList(t,e){Y.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){Y.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){Y.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||X(t,i)):j(t,i));o&&Y.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?O(S,t.x,t.y):D(S,t.x,t.y)})),M(S,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=k.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=k.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Y.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=Y.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=Y.tempToOuterOf(e,s));let{x:r,y:i,width:o,height:n}=e;return A=r+o,W=i+n,U=t.x+t.width,N=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,A=A<U?A:U,W=W<N?W:N,o=A-r,n=W-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){Y.copy(t,Y.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){Y.set(t)}},Y=z,{add:j,copy:X}=Y;class V{constructor(t,e,s,r){"object"==typeof t?z.copy(this,t):z.set(this,t,e,s,r)}set(t,e,s,r){z.set(this,t,e,s,r)}copy(t){return z.copy(this,t),this}clone(){return new V(this)}scale(t){return z.scale(this,t),this}toOuterOf(t,e){return z.toOuterOf(this,t,e),this}getFitMatrix(t){return z.getFitMatrix(this,t)}spread(t){return z.spread(this,t),this}ceil(){return z.ceil(this),this}add(t){return z.add(this,t),this}addList(t){return z.setByList(this,t,!0),this}setByList(t,e){return z.setByList(this,t,e),this}addListWithHandle(t,e){return z.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return z.setByListWithHandle(this,t,e,s),this}setByPoints(t){return z.setByPoints(this,t),this}hitPoint(t,e){return z.hitPoint(this,t,e)}hitRadiusPoint(t,e){return z.hitRadiusPoint(this,t,e)}hit(t,e){return z.hit(this,t,e)}includes(t,e){return z.includes(this,t,e)}intersect(t,e){return z.intersect(this,t,e),this}getIntersect(t,e){return new V(z.getIntersectData(this,t,e))}isSame(t){return z.isSame(this,t)}isEmpty(){return z.isEmpty(this)}reset(){z.reset(this)}}class G{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new V(i,e,o||t.width-i-s,n||t.height-e-r)}}class q{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}addBounds(t,e,s,r){R.addBounds(this,t,e,s,r)}add(t){R.add(this,t)}}const K={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const r=s.create(s.RUNTIME);return tt.currentId=tt.idMap[r]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[r]=t,tt.nameToIdMap[t]=r,r}static end(t,e){const s=tt.idMap[t],r=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[r]=void 0,e?$.log(r,performance.now()-s,"µs"):$.log(r,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;rt[e]?et.repeat(e):rt[e]=t},get(t,e,s,r,i,o){const n=new rt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:rt}=st,it=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?it.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,nt[e]=s)}},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.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,r=this.list.length;s<r;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 ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(pt(e,t),pt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?pt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:pt}=ct;class ut{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,r;for(let i in this)s=i.substring(1),void 0!==this[s]&&(r=e?e[s]:void 0,t[s]=void 0===r?this[i]:r);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}function _t(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function gt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function ft(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,r)}}const xt=[];function yt(){return(t,e)=>{xt.push(e)}}const vt=[];class mt{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||vt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}_t([ft("imageSmoothingEnabled")],mt.prototype,"smooth",void 0),_t([ft("imageSmoothingQuality")],mt.prototype,"smoothLevel",void 0),_t([ft("globalAlpha")],mt.prototype,"opacity",void 0),_t([ft()],mt.prototype,"fillStyle",void 0),_t([ft()],mt.prototype,"strokeStyle",void 0),_t([ft("lineWidth")],mt.prototype,"strokeWidth",void 0),_t([ft("lineCap")],mt.prototype,"strokeCap",void 0),_t([ft("lineJoin")],mt.prototype,"strokeJoin",void 0),_t([ft("lineDashOffset")],mt.prototype,"dashOffset",void 0),_t([ft()],mt.prototype,"miterLimit",void 0),_t([ft()],mt.prototype,"shadowBlur",void 0),_t([ft()],mt.prototype,"shadowColor",void 0),_t([ft()],mt.prototype,"shadowOffsetX",void 0),_t([ft()],mt.prototype,"shadowOffsetY",void 0),_t([ft()],mt.prototype,"filter",void 0),_t([ft()],mt.prototype,"font",void 0),_t([ft()],mt.prototype,"fontKerning",void 0),_t([ft()],mt.prototype,"fontStretch",void 0),_t([ft()],mt.prototype,"fontVariantCaps",void 0),_t([ft()],mt.prototype,"textAlign",void 0),_t([ft()],mt.prototype,"textBaseline",void 0),_t([ft()],mt.prototype,"textRendering",void 0),_t([ft()],mt.prototype,"wordSpacing",void 0),_t([ft()],mt.prototype,"letterSpacing",void 0),_t([ft()],mt.prototype,"direction",void 0),_t([yt()],mt.prototype,"setTransform",null),_t([yt()],mt.prototype,"resetTransform",null),_t([yt()],mt.prototype,"getTransform",null),_t([yt()],mt.prototype,"save",null),_t([yt()],mt.prototype,"restore",null),_t([yt()],mt.prototype,"transform",null),_t([yt()],mt.prototype,"translate",null),_t([yt()],mt.prototype,"scale",null),_t([yt()],mt.prototype,"rotate",null),_t([yt()],mt.prototype,"fill",null),_t([yt()],mt.prototype,"stroke",null),_t([yt()],mt.prototype,"clip",null),_t([yt()],mt.prototype,"fillRect",null),_t([yt()],mt.prototype,"strokeRect",null),_t([yt()],mt.prototype,"clearRect",null),_t([yt()],mt.prototype,"beginPath",null),_t([yt()],mt.prototype,"moveTo",null),_t([yt()],mt.prototype,"lineTo",null),_t([yt()],mt.prototype,"bezierCurveTo",null),_t([yt()],mt.prototype,"quadraticCurveTo",null),_t([yt()],mt.prototype,"closePath",null),_t([yt()],mt.prototype,"arc",null),_t([yt()],mt.prototype,"arcTo",null),_t([yt()],mt.prototype,"ellipse",null),_t([yt()],mt.prototype,"rect",null),_t([yt()],mt.prototype,"roundRect",null),_t([yt()],mt.prototype,"createConicGradient",null),_t([yt()],mt.prototype,"createLinearGradient",null),_t([yt()],mt.prototype,"createPattern",null),_t([yt()],mt.prototype,"createRadialGradient",null),_t([yt()],mt.prototype,"fillText",null),_t([yt()],mt.prototype,"measureText",null),_t([yt()],mt.prototype,"strokeText",null);const wt={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}},Et=new V,bt={width:1,height:1,pixelRatio:1},Bt=Z.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Tt extends mt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,r){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.pixelRatio=n,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init(),this.textBaseline="alphabetic"}init(){}toBlob(e,s){return new Promise((r=>{const i=this.getSaveCanvas(e);t.origin.canvasToBolb(i.view,e,s).then((t=>{i.recycle(),r(t)})).catch((t=>{Bt.error(t),r(null)}))}))}toDataURL(e,s){const r=this.getSaveCanvas(e),i=t.origin.canvasToDataURL(r.view,e,s);return r.recycle(),i}saveAs(e,s){return new Promise((r=>{const i=this.getSaveCanvas(wt.fileType(e));t.origin.canvasSaveAs(i.view,e,s).then((()=>{i.recycle(),r(!0)})).catch((t=>{Bt.error(t),r(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,r=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&r.fillWorld(s,"#FFFFFF"),e&&r.fillWorld(s,e),r.copyWorld(this),r}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,kt),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:r}=this,i=this.worldTransform;if(e)if(s)this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=(t.e+e.e)*r,i.f=(t.f+e.f)*r);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*s+t.b*n)*r,i.b=(t.a*o+t.b*a)*r,i.c=(t.c*s+t.d*n)*r,i.d=(t.c*o+t.d*a)*r,i.e=(t.e*s+t.f*n+h)*r,i.f=(t.e*o+t.f*a+l)*r)}else this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=t.e*r,i.f=t.f*r)}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,z.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Et.copy(t).scale(this.pixelRatio),this.fillRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Et.copy(t).scale(this.pixelRatio),this.strokeRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.clearRect(Et.x,Et.y,Et.width,Et.height)}clipWorld(t,e){this.beginPath(),Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.rect(Et.x,Et.y,Et.width,Et.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:r,pixelRatio:i}=this,o={width:s,height:r,pixelRatio:i},n=this.manager?this.manager.get(o):e.canvas(o);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:r,height:i,pixelRatio:o}=this;t&&(r+=t),s&&(i+=s);const n={width:r,height:i,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function Pt(t,e,s){Object.defineProperty(t,e,s)}function Ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Rt(t){return(e,s)=>{Pt(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function Lt(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Pt(t,e,Object.assign(i,r||{})),Kt(t,e,s)}function St(t){return(e,s)=>{Lt(e,s,t)}}function Ot(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function Dt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Mt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function It(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const At=It;function Wt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ut=Wt;function Nt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ft(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Ht(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function zt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function Yt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function jt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Xt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Vt(t){return(e,s)=>{Pt(e,"__DataProcessor",{get:()=>t})}}function Gt(t){return(e,s)=>{Pt(e,"__LayoutProcessor",{get:()=>t})}}function qt(t,e,s){Kt(t.prototype,e,s)}function Kt(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t},configurable:!0,enumerable:!0};void 0===s&&(n.get=function(){return this[i]});const a=Ct(r,e);a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const Zt=new Z("rewrite"),Qt=[],$t=["destroy","constructor"];function Jt(t){return(e,s)=>{Qt.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function te(){return t=>{ee()}}function ee(t){Qt.length&&(Qt.forEach((e=>{t&&Zt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Qt.length=0)}function se(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!($t.includes(r)||e&&e.includes(r)))if(t.prototype){Ct(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function re(){return t=>{st.register(t)}}function ie(){return t=>{ot.register(t)}}setTimeout((()=>ee(!0)));const{toOuterOf:oe}=z;class ne{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),oe(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),oe(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),oe(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:r},this.localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:r},this.localRenderBounds={x:t,y:e,width:s,height:r}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const ae={},he={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=le(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=le(this,r);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,listener:e,options:r}},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 r=le(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this;return void 0===e?!!(r&&r[t]||s&&s[t]):!!(e?r&&r[t]:s&&s[t])}};function le(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ae)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ae)}}class de{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 ce extends de{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ce.ADD="child.add",ce.REMOVE="child.remove";class pe extends de{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}pe.CHANGE="property.change";class ue extends de{constructor(t,e,s,r,i,o){super(t,e),this.image=s,this.attrName=r,this.attrValue=i,o&&(this.error=o)}}ue.LOADED="image.loaded",ue.ERROR="image.error";class _e extends de{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(_e.RESIZE),Object.assign(this,t)):super(t),this.old=e}}_e.RESIZE="resize";class ge extends de{constructor(t,e){super(t),e&&Object.assign(this,e)}}ge.START="transform.start",ge.CHANGE="transform.change",ge.END="transform.end",ge.BEFORE_START="transform.before_start",ge.BEFORE_CHANGE="transform.before_change",ge.BEFORE_END="transform.before_end";class fe extends de{constructor(t,e){super(t),this.data=e}}fe.REQUEST="watch.request",fe.DATA="watch.data";class xe extends de{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}xe.CHECK_UPDATE="layout.check_update",xe.REQUEST="layout.request",xe.START="layout.start",xe.BEFORE="layout.before",xe.LAYOUT="layout.layout",xe.AFTER="layout.after",xe.AGAIN="layout.again",xe.END="layout.end";class ye extends de{}ye.FRAME="animate.frame";class ve extends de{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}ve.REQUEST="render.request",ve.START="render.start",ve.BEFORE="render.before",ve.RENDER="render",ve.AFTER="render.after",ve.AGAIN="render.again",ve.END="render.end";class me extends de{}me.START="leafer.start",me.BEFORE_READY="leafer.before_ready",me.READY="leafer.ready",me.AFTER_READY="leafer.after_ready",me.VIEW_READY="leafer.view_ready",me.STOP="leafer.stop",me.RESTART="leafer.restart",me.END="leafer.end";const we={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=pe,r=new pe(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:Ee}=f,{sin:be,cos:Be}=Math,ke={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Ee,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:r}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:i,skewX:n,skewY:a}=this.__;i||n||a?(i*=o,n&&(n*=o),a&&(a*=o),t.a=s*Be(i+a),t.b=s*be(i+a),t.c=r*-be(i-n),t.d=r*Be(i-n)):(t.a=s,t.b=0,t.c=0,t.d=r,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=r,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:Te,copyAndSpread:Pe}=z,Ce={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,Te(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Te(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Te(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Te(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Te(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(){Pe(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Pe(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Re}=k,Le={},Se={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Re(t,this.__world,Le),this.__hit(Le)},__drawHitPath(t){this.__drawRenderPath(t)}},Oe={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e),t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},De={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,r=e.length;s<r;s++)(t=e[s]).isMask&&(this.__removeMask(t),r--,s--)}}},Me={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity,t.copyWorld(s,this.__world,this.__world,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:r}=this;if(this.__hasMask&&r.length>1){let i,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=r.length;a<h;a++)s=r[a],s.isMask?(i?(this.__renderMask(t,n,o),o.clear(),n.clear()):i=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:i,hideBounds:o}=e;for(let n=0,a=r.length;n<a;n++)s=r[n],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},Ie={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++)Ue(e[t])}},updateAllChange(t){if(Ue(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ne(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const r={x:e,y:s};t.parent&&f.toInnerPoint(t.parent.__world,r,r,!0),Ae.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,r,i){const o=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,r,i)},zoomOfLocal(t,e,s,r,i){r||(r=s),i||(i=t);const{x:o,y:n}=i.__,a=(new C).translate(o,n).scaleOfOuter(e,s,r);i.x=a.e,i.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*r},rotateOfWorld(t,e,s,r){const i=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,i,s,r)},rotateOfLocal(t,e,s,r){r||(r=t);const{x:i,y:o}=r.__,n=(new C).translate(i,o).rotateOfOuter(e,s);r.x=n.e,r.y=n.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Ae=Ie,{updateAllWorldMatrix:We,updateAllWorldOpacity:Ue,updateAllChange:Ne}=Ae,Fe={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},He={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 r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.push(t),ze(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:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)Ye(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:ze,pushAllBranchStack:Ye}=He,je={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Xe,create:Ve}=s;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return ut}get __LayoutProcessor(){return ne}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=Ve(Xe),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.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&je.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?f.toInnerPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}localToWorld(t,e,s){this.parent?f.toOuterPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}worldToInner(t,e,s){f.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){f.toOuterPoint(this.worldTransform,t,e,s)}move(t,e){Ie.moveLocal(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),void 0===s&&(s=e),Ie.zoomOfLocal(this,k.tempToOuterOf(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Ie.rotateOfLocal(this,k.tempToOuterOf(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){this.parent&&this.parent.remove(this)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}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))}},exports.Leaf=_t([se(we),se(ke),se(Ce),se(Se),se(he),se(Oe)],exports.Leaf);const{setByListWithHandle:Ge}=z,{sort:qe}=He,{localBoxBounds:Ke,localEventBounds:Ze,localRenderBounds:Qe,maskLocalBoxBounds:$e,maskLocalEventBounds:Je,maskLocalRenderBounds:ts}=Fe;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Ge(this.__layout.boxBounds,this.children,this.__hasMask?$e:Ke)}__updateStrokeBounds(){Ge(this.__layout.strokeBounds,this.children,this.__hasMask?Je:Ze)}__updateRenderBounds(){Ge(this.__layout.renderBounds,this.children,this.__hasMask?ts:Qe)}__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(qe)}}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),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&je.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready)){const{ADD:e}=ce,s=new ce(e,t,this);t.hasEvent(e)&&t.emitEvent(s),this.hasEvent(e)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1&&(this.children.splice(e,1),this.__hasMask&&this.__updateMask(),this.__layout.boxChange(),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready))){const{REMOVE:e}=ce,s=new ce(e,t,this);t.hasEvent(e)&&t.emitEvent(s),this.hasEvent(e)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}}else super.remove()}},exports.Branch=_t([se(Me),se(De)],exports.Branch);const es={};class ss{static isHoldSpaceKey(){return ss.hasDownCode("Space")}static setDownCode(t){es[t]||(es[t]=!0)}static setUpCode(t){es[t]=!1}static hasDownCode(t){return es[t]}}class rs{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class is extends de{get spaceKey(){return ss.isHoldSpaceKey()}get left(){return rs.left(this)}get right(){return rs.right(this)}get middle(){return rs.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){ot.changeName(t,e)}}var os;exports.PointerEvent=class extends is{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent=_t([ie()],exports.PointerEvent),exports.DragEvent=class extends exports.PointerEvent{},exports.DragEvent.DRAG="drag",exports.DragEvent.START="drag.start",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=_t([ie()],exports.DragEvent),exports.DropEvent=os=class extends exports.PointerEvent{static setList(t){os.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}},exports.DropEvent.DROP="drop",exports.DropEvent=os=_t([ie()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.MOVE="move",exports.MoveEvent.START="move.start",exports.MoveEvent.END="move.end",exports.MoveEvent=_t([ie()],exports.MoveEvent),exports.RotateEvent=class extends is{},exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.END="rotate.end",exports.RotateEvent=_t([ie()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=_t([ie()],exports.SwipeEvent),exports.ZoomEvent=class extends is{},exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=_t([ie()],exports.ZoomEvent),exports.KeyEvent=class extends is{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.PRESS="key.press",exports.KeyEvent.UP="key.up",exports.KeyEvent=_t([ie()],exports.KeyEvent);class ns{constructor(t){this.options=t}load(e,s){return gt(this,void 0,void 0,(function*(){return t.origin.loadImage(this.options.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,e&&e(this)})).catch((t=>{s&&s(t)}))}))}getCanvas(e,s,r,i){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),o}destory(){this.view=null,this.options=null}}class as{constructor(t){this.taskTime=1,this.id=s.create(s.TASK),this.task=t}run(){return gt(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const hs=Z.get("TaskProcessor");class ls{get isComplete(){return this._isComplete}get running(){return this._running}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].taskTime,r===this.finishedIndex&&(e=s)):e+=this.list[r].taskTime;return this._isComplete?1:s/e}get total(){return this.list.length}get finishedIndex(){return this._isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this._isComplete?0:this.total-this.finishedIndex}constructor(t){this.config={parallel:6},this.list=[],this.index=0,t&&ct.assign(this.config,t),this.init()}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!0}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 as(t),e)}addParallel(t,e){const s=new as(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new as(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.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}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.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this._running)return;r<this.total&&(t=this.list[r],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._isComplete=!0,this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask(),this.finishedIndex+1===this.total&&this.onComplete()}onParallelError(t){hs.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destory(){this.empty(),this.config={}}}class ds{constructor(t,e){this.map={},this.leafer=t,this.tasker=new ls}get(t){let s=this.map[t.url];return s||(s=e.image(t),this.map[t.url]=s),s}load(t,e,s){this.tasker.add((()=>gt(this,void 0,void 0,(function*(){return yield t.load(e,s)})))),this.tasker.running||this.tasker.start()}destory(){this.leafer=null,this.map=null}}const cs={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ps={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},us=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},ps),_s={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},gs={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},fs=Object.assign(Object.assign({},gs),ps),xs=us,ys={};for(let t in xs)ys[xs[t]]=t;const vs={};for(let t in xs)vs[xs[t]]=_s[t];const ms={drawRoundRect(t,e,s,r,o,n){let[a,h,l,d]=i.fourNumber(n);const c=Math.min(r/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+r,s,e+r,s+o,h):t.lineTo(e+r,s),l?t.arcTo(e+r,s+o,e,s+o,l):t.lineTo(e+r,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+r,s,a):t.lineTo(e,s)}},{sin:ws,cos:Es,atan2:bs,ceil:Bs,abs:ks,PI:Ts}=Math,{setPoint:Ps,addPoint:Cs}=R,{set:Rs}=k,Ls={},Ss={rect(t,e,s,r,i){cs.creator.path=t,cs.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){cs.creator.path=[],ms.drawRoundRect(cs.creator,e,s,r,i,o),t.push(...cs.convertToCanvasData(cs.creator.path,!0))},arcTo(t,e,s,r,i,h,l,d,c,p,u){const _=r-e,g=i-s,f=h-r,x=l-i;let y=bs(g,_),v=bs(x,f),m=v-y;if(m<0&&(m+=n),m===Ts||ks(_+g)<1e-12||ks(f+x)<1e-12)return t&&t.push(us.L,r,i),c&&(Ps(c,e,s),Cs(c,r,i)),u&&Rs(u,e,s),void(p&&Rs(p,r,i));const w=_*x-f*g<0,E=w?-1:1,b=d/Es(m/2),B=r+b*Es(y+m/2+a*E),k=i+b*ws(y+m/2+a*E);return y-=a*E,v-=a*E,Ms(t,B,k,d,d,0,y/o,v/o,w,c,p,u)},arc:(t,e,s,r,i,o,n,a,h,l)=>Ms(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,h,l,d,c,p,u,_){const g=h*o,f=ws(g),x=Es(g);let y=l*o,v=d*o;y>Ts&&(y-=n),v<0&&(v+=n);let m=v-y;m<0?m+=n:m>n&&(m-=n),c&&(m-=n);const w=Bs(ks(m/a)),E=m/w,b=ws(E/4),B=8/3*b*b/ws(E/2);v=y+E;let k,T,P,C,R,L,S,O,D=Es(y),M=ws(y),I=P=x*r*D-f*i*M,A=C=f*r*D+x*i*M,W=e+P,U=s+C;t&&t.push(us.L,W,U),p&&Ps(p,W,U),_&&Rs(_,W,U);for(let o=0;o<w;o++)k=Es(v),T=ws(v),P=x*r*k-f*i*T,C=f*r*k+x*i*T,R=e+I-B*(x*r*M+f*i*D),L=s+A-B*(f*r*M-x*i*D),S=e+P+B*(x*r*T+f*i*k),O=s+C+B*(f*r*T-x*i*k),t&&t.push(us.C,R,L,S,O,e+P,s+C),p&&Ds(e+I,s+A,R,L,S,O,e+P,s+C,p,!0),I=P,A=C,D=k,M=T,y=v,v+=E;u&&Rs(u,e+P,s+C)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(us.C,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Ds(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let c,p,u,_,g,f,x,y,v=t,m=s,w=i,E=n;for(let t=0;t<2;++t)if(1==t&&(v=e,m=r,w=o,E=a),c=-3*v+9*m-9*w+3*E,p=6*v-12*m+6*w,u=3*m-3*v,Math.abs(c)<1e-12){if(Math.abs(p)<1e-12)continue;_=-u/p,0<_&&_<1&&d.push(_)}else x=p*p-4*u*c,y=Math.sqrt(x),x<0||(g=(-p+y)/(2*c),0<g&&g<1&&d.push(g),f=(-p-y)/(2*c),0<f&&f<1&&d.push(f));l?Cs(h,t,e):Ps(h,t,e),Cs(h,n,a);for(let l=0,c=d.length;l<c;l++)Os(d[l],t,e,s,r,i,o,n,a,Ls),Cs(h,Ls.x,Ls.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,c=d*d*d,p=3*d*d*t,u=3*d*t*t,_=t*t*t;l.x=c*e+p*r+u*o+_*a,l.y=c*s+p*i+u*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return Os(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:Os,toTwoPointBounds:Ds,ellipse:Ms}=Ss,{sin:Is,cos:As,sqrt:Ws,atan2:Us}=Math,{ellipse:Ns}=Ss,Fs={ellipticalArc(t,e,s,r,i,a,h,l,d,c,p){const u=(d-e)/2,_=(c-s)/2,g=a*o,f=Is(g),x=As(g),y=-x*u-f*_,v=-x*_+f*u,m=r*r,w=i*i,E=v*v,b=y*y,B=m*w-m*E-w*b;let k=0;if(B<0){const t=Ws(1-B/(m*w));r*=t,i*=t}else k=(h===l?-1:1)*Ws(B/(m*E+w*b));const T=k*r*v/i,P=-k*i*y/r,C=Us((v-P)/i,(y-T)/r),R=Us((-v-P)/i,(-y-T)/r);let L=R-C;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const S=e+u+x*T-f*P,O=s+_+f*T+x*P,D=L<0?1:0;p?Ns(t,S,O,r,i,a,C/o,R/o,D):r!==i||a?t.push(us.G,S,O,r,i,a,C/o,R/o,D):t.push(us.O,S,O,r,C/o,R/o,D)}},{M:Hs,m:zs,L:Ys,l:js,H:Xs,h:Vs,V:Gs,v:qs,C:Ks,c:Zs,S:Qs,s:$s,Q:Js,q:tr,T:er,t:sr,A:rr,a:ir,Z:or,z:nr,N:ar,D:hr,X:lr,G:dr,F:cr,O:pr,P:ur,U:_r}=us,{rect:gr,roundRect:fr,arcTo:xr,arc:yr,ellipse:vr,quadraticCurveTo:mr}=Ss,{ellipticalArc:wr}=Fs,Er=Z.get("PathConvert"),br={},Br={current:{},stringify(t){let e,s,r,i=0,o=t.length,n="";for(;i<o;){s=t[i],e=vs[s],n+=s===r?" ":ys[s];for(let s=1;s<e;s++)n+=t[i+s],s===e-1||(n+=" ");r=s,i+=e}return n},parse(t,e){let s,r,i,o="";const n=[],a=e?fs:gs;for(let e=0,h=t.length;e<h;e++)r=t[e],K[r]?o+=r:us[r]?(o&&(Tr(n,Number(o)),o=""),kr.name=us[r],kr.length=_s[r],kr.index=0,Tr(n,kr.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&Tr(n,Number(o)),o=r):o&&(Tr(n,Number(o)),o=""),i=r;return o&&Tr(n,Number(o)),s?Br.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,c=0,p=t.length;const u=[];for(;c<p;){switch(i=t[c],i){case zs:t[c+1]+=a,t[c+2]+=h;case Hs:a=t[c+1],h=t[c+2],u.push(Hs,a,h),c+=3;break;case Vs:t[c+1]+=a;case Xs:a=t[c+1],u.push(Ys,a,h),c+=2;break;case qs:t[c+1]+=h;case Gs:h=t[c+1],u.push(Ys,a,h),c+=2;break;case js:t[c+1]+=a,t[c+2]+=h;case Ys:a=t[c+1],h=t[c+2],u.push(Ys,a,h),c+=3;break;case $s:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Qs;case Qs:n=o===Ks||o===Qs,l=n?2*a-s:t[c+1],d=n?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],u.push(Ks,l,d,s,r,a,h),c+=5;break;case Zs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=Ks;case Ks:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],u.push(Ks,t[c+1],t[c+2],s,r,a,h),c+=7;break;case sr:t[c+1]+=a,t[c+2]+=h,i=er;case er:n=o===Js||o===er,s=n?2*a-s:t[c+1],r=n?2*h-r:t[c+2],e?mr(u,a,h,s,r,t[c+1],t[c+2]):u.push(Js,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case tr:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Js;case Js:s=t[c+1],r=t[c+2],e?mr(u,a,h,s,r,t[c+3],t[c+4]):u.push(Js,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ir:t[c+6]+=a,t[c+7]+=h;case rr:wr(u,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 nr:case or:u.push(or),c++;break;case ar:a=t[c+1],h=t[c+2],e?gr(u,a,h,t[c+3],t[c+4]):Pr(u,t,c,5),c+=5;break;case hr:a=t[c+1],h=t[c+2],e?fr(u,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Pr(u,t,c,9),c+=9;break;case lr:a=t[c+1],h=t[c+2],e?fr(u,a,h,t[c+3],t[c+4],t[c+5]):Pr(u,t,c,6),c+=6;break;case dr:vr(e?u:Pr(u,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,br),a=br.x,h=br.y,c+=9;break;case cr:e?vr(u,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Pr(u,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pr:yr(e?u:Pr(u,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,br),a=br.x,h=br.y,c+=7;break;case ur:e?yr(u,t[c+1],t[c+2],t[c+3],0,360,!1):Pr(u,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case _r:xr(e?u:Pr(u,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,br),a=br.x,h=br.y,c+=6;break;default:return Er.error(`command: ${i} [index:${c}]`,t),u}o=i}return u},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){kr.index===kr.length&&(kr.index=1,t.push(kr.name)),t.push(e),kr.index++}},{current:kr,pushData:Tr,copyData:Pr}=Br,{M:Cr,L:Rr,C:Lr,Q:Sr,Z:Or,N:Dr,D:Mr,X:Ir,G:Ar,F:Wr,O:Ur,P:Nr,U:Fr}=us,Hr={},zr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Cr,e,s)},lineTo(t,e,s){t.push(Rr,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Lr,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Sr,e,s,r,i)},closePath(t){t.push(Or)},rect(t,e,s,r,i){t.push(Dr,e,s,r,i)},roundRect(t,e,s,r,o,n){if("number"==typeof n)t.push(Ir,e,s,r,o,n);else{const a=i.fourNumber(n);a?t.push(Mr,e,s,r,o,...a):t.push(Dr,e,s,r,o)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Wr,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ar,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Nr,e,s,r):(void 0===o&&(o=360),t.push(Ur,e,s,r,i,o,n?1:0))},moveToEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Ss.ellipse(null,e,s,r,i,o,n,a,h,null,null,Hr),t.push(Cr,Hr.x,Hr.y),Yr(t,e,s,r,i,o,n,a,h)},moveToArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),Ss.arc(null,e,s,r,i,o,n,null,null,Hr),t.push(Cr,Hr.x,Hr.y),jr(t,e,s,r,i,o,n)},arcTo(t,e,s,r,i,o){t.push(Fr,e,s,r,i,o)}},{ellipse:Yr,arc:jr}=zr,{moveTo:Xr,lineTo:Vr,quadraticCurveTo:Gr,bezierCurveTo:qr,closePath:Kr,beginPath:Zr,rect:Qr,roundRect:$r,ellipse:Jr,arc:ti,arcTo:ei,moveToEllipse:si,moveToArc:ri}=zr;class ii{constructor(t){this.path=t?"string"==typeof t?cs.parse(t):t:[]}beginPath(){return Zr(this.path),this}moveTo(t,e){return Xr(this.path,t,e),this}lineTo(t,e){return Vr(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return qr(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Gr(this.path,t,e,s,r),this}closePath(){return Kr(this.path),this}rect(t,e,s,r){return Qr(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return $r(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return Jr(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return ti(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return ei(this.path,t,e,s,r,i),this}moveToEllipse(t,e,s,r,i,o,n,a){return si(this.path,t,e,s,r,i,o,n,a),this}moveToArc(t,e,s,r,i,o){return ri(this.path,t,e,s,r,i,o),this}}const{M:oi,L:ni,C:ai,Q:hi,Z:li,N:di,D:ci,X:pi,G:ui,F:_i,O:gi,P:fi,U:xi}=us,yi=Z.get("PathDrawer"),vi={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case oi:t.moveTo(e[r+1],e[r+2]),r+=3;break;case ni:t.lineTo(e[r+1],e[r+2]),r+=3;break;case ai:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case hi:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case li:t.closePath(),r+=1;break;case di:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ci:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case pi:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case ui:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*o,e[r+6]*o,e[r+7]*o,e[r+8]),r+=9;break;case _i:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,n,!1),r+=5;break;case gi:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*o,e[r+5]*o,e[r+6]),r+=7;break;case fi:t.arc(e[r+1],e[r+2],e[r+3],0,n,!1),r+=4;break;case xi:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void yi.error(`command: ${s} [index:${r}]`,e)}}},{M:mi,L:wi,C:Ei,Q:bi,Z:Bi,N:ki,D:Ti,X:Pi,G:Ci,F:Ri,O:Li,P:Si,U:Oi}=us,{toTwoPointBounds:Di,toTwoPointBoundsByQuadraticCurve:Mi,arcTo:Ii,arc:Ai,ellipse:Wi}=Ss,{add:Ui,copy:Ni,addPoint:Fi,setPoint:Hi,addBounds:zi,toBounds:Yi}=R,ji=Z.get("PathBounds");let Xi,Vi,Gi;const qi={},Ki={},Zi={},Qi={toBounds(t,e){Qi.toTwoPointBounds(t,Ki),Yi(Ki,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Hi(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Bi||s===Ei||s===bi?Hi(e,h,l):Hi(e,t[a+1],t[a+2])),s){case mi:case wi:h=t[a+1],l=t[a+2],Fi(e,h,l),a+=3;break;case Ei:o=t[a+5],n=t[a+6],Di(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,qi),Ui(e,qi),h=o,l=n,a+=7;break;case bi:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],Mi(h,l,r,i,o,n,qi),Ui(e,qi),h=o,l=n,a+=5;break;case Bi:a+=1;break;case ki:h=t[a+1],l=t[a+2],zi(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ti:case Pi:h=t[a+1],l=t[a+2],zi(e,h,l,t[a+3],t[a+4]),a+=s===Ti?9:6;break;case Ci:Wi(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],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=9;break;case Ri:h=t[a+1],l=t[a+2],Vi=t[a+3],Gi=t[a+4],zi(e,h-Vi,l-Gi,2*Vi,2*Gi),h+=Vi,a+=5;break;case Li:Ai(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=7;break;case Si:h=t[a+1],l=t[a+2],Xi=t[a+3],zi(e,h-Xi,l-Xi,2*Xi,2*Xi),h+=Xi,a+=4;break;case Oi:Ii(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=6;break;default:return void ji.error(`command: ${s} [index:${a}]`,t)}}},$i={smooth:(t,e,s)=>t};cs.creator=new ii,cs.parse=Br.parse,cs.convertToCanvasData=Br.toCanvasData;const Ji=Z.get("plugin"),to={power:{},list:[]};function eo(t,e){e||(e=to.power),to.list.push(t);const s={};t.import?t.import.forEach((t=>{e[t]?s[t]=e[t]:Ji.error(t+" non-existent")})):Ji.warn("no import");try{t.run(s)}catch(t){Ji.error(t)}}class so{constructor(t,e){this.updatedList=new ht,this.totalTimes=0,this.config={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ve.REQUEST)}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===ce.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new fe(fe.DATA,{updatedList:this.updatedList})),this.updatedList=new ht,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(pe.CHANGE,this.__onAttrChange,this),t.on_([ce.ADD,ce.REMOVE],this.__onChildEvent,this),t.on_(fe.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:ro,updateAllWorldOpacity:io}=Ie,{pushAllChildBranch:oo,pushAllParent:no}=He;const{worldBounds:ao}=Fe,{setByListWithHandle:ho}=z;class lo{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){ho(this.beforeBounds,this.updatedList.list,ao)}setAfter(){ho(this.afterBounds,this.updatedList.list,ao),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:co,updateAllChange:po}=Ie,{pushAllBranchStack:uo,updateWorldBoundsByBranchStack:_o}=He,go=Z.get("Layouter");class fo{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(xe.START),this.layoutOnce(),t.emitEvent(new xe(xe.END,this.layoutedBlocks,this.times))}catch(t){go.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?go.warn("layouting"):this.times>3?go.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(fe.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=J.start("PartLayout"),{target:s,__updateList:r}=this,{BEFORE:i,LAYOUT:o,AFTER:n}=xe,a=this.getBlocks(r);a.forEach((t=>{t.setBefore()})),s.emitEvent(new xe(i,a,this.times)),r.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(ro(t),e.push(t),t.isBranch&&oo(t,e),no(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),no(t,e)))}))}(r,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&io(t),t.__updateChange()}))}(r),a.forEach((t=>t.setAfter())),s.emitEvent(new xe(o,a,this.times)),s.emitEvent(new xe(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updateList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:r,AFTER:i}=xe,o=this.getBlocks(new ht(e));e.emitEvent(new xe(s,o,this.times)),fo.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new xe(r,o,this.times)),e.emitEvent(new xe(i,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(co(t),t.isBranch){const e=[t];uo(t,e),_o(e)}else t.__updateWorldBounds();po(t)}createBlock(t){return new lo(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_(xe.REQUEST,this.layout,this),t.on_(xe.AGAIN,this.layoutAgain,this),t.on_(fe.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const xo=Z.get("Renderer");class yo{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(xe.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new V,xo.log(e.innerName,"---\x3e");try{this.emitRender(ve.START),this.renderOnce(t),this.emitRender(ve.END,this.totalBounds)}catch(t){xo.error(t)}xo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?xo.warn("rendering"):this.times>3?xo.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(ve.BEFORE),t()):(this.requestLayout(),this.emitRender(ve.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(ve.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ve.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return xo.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,r=t.getIntersect(s.bounds),i=t.includes(this.target.__world),o=(new V).copy(r);s.save(),i&&!Z.showRepaint?s.clear():(r.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(r,!0),s.clipWorld(r,!0)),this.__render(r,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(s),Z.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.render(),this.running&&this.target.emit(ye.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(xo.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new ve(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ve.REQUEST,this.update,this),t.on_(xe.END,this.__onLayoutEnd,this),t.on_(ve.AGAIN,this.renderAgain,this),t.on_(_e.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:vo}=z;class mo{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const r=s.through||!1,i=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=i?this.getPath(n):this.getHitablePath(n);return this.clear(),r?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:r}=this.point,i={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],Ie.worldHittable(e)&&(this.hitChild(e,i),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,r=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(r.unshift(s),s.__.hitChildren);t--);return r}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let r,i,o;for(let t=0,n=s.length;t<n;t++){r=s[t],i=s[t+1];for(let t=0,s=r.length;t<s&&(o=r.list[t],!i||!i.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,r;const{point:i}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(r=vo(s.__world,i),s.isBranch?(r||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,i)):r&&this.hitChild(s,i))}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 wo{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new mo(t,this),this.__listenEvents()}getByPoint(e,s,r){return t.realtimeLayout&&this.target.emit(xe.CHECK_UPDATE),this.findPath.getByPoint(e,s,r)}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,r=this.innerIdList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,r=this.idList[t];return r||(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 r=0,i=s.length;r<i;r++){if(e(t=s[r]))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_(ce.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(e,{watcher:(t,e)=>new so(t,e),layouter:(t,e)=>new fo(t,e),renderer:(t,e,s)=>new yo(t,e,s),selector:(t,e)=>new wo(t,e)}),t.layout=fo.fullLayout;class Eo extends Tt{get allowBackgroundColor(){return!1}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){this.view=t.origin.createCanvas(this.width,this.height)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s}}class bo{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(exports.MoveEvent.START,this.moveData)}t.path=this.moveData.path,e.emit(exports.MoveEvent.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(exports.ZoomEvent.START,this.zoomData)}t.path=this.zoomData.path,e.emit(exports.ZoomEvent.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(exports.RotateEvent.START,this.rotateData)}t.path=this.rotateData.path,e.emit(exports.RotateEvent.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(exports.MoveEvent.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(exports.ZoomEvent.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(exports.RotateEvent.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Bo={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?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.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:ko.getSwipeDirection(k.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,r=s.length;t<r;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:r}=t;for(let t=0,i=r.length;t<i;t++)r[t].hasEvent(e)&&s.push(r[t]);return s}},ko=Bo,{getDragEventData:To,getDropEventData:Po,getSwipeEventData:Co,filterPathByEventType:Ro}=Bo;class Lo{constructor(t){this.interaction=t}setDragData(t){this.dragData=To(t,t,t)}getDragList(){return this.dragging?exports.DropEvent.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:r}=s;if(this.moving&&!rs.middle(t)&&!rs.left(t))return void s.pointerCancel();const{dragData:i}=this;if(!this.moving){const o=r.target.isLeafer&&s.config.move.dragEmpty;this.moving=(rs.middle(t)||ss.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(exports.MoveEvent.START,i)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=r;this.dragData=To(r,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(exports.MoveEvent.MOVE,this.dragData):this.dragging&&(s.emit(exports.DragEvent.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=rs.left(t)&&e,this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Ro(this.dragData.path,exports.DragEvent.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,r=t.length;s<r;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=>{Ie.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:r}=t;s?r.indexAt(0)!==s.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,s),e.emit(exports.DragEvent.OVER,t,r)):e.emit(exports.DragEvent.OVER,t,r),this.dragOverPath=r}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:r}=t;e.emit(exports.DragEvent.ENTER,t,r,s),e.emit(exports.DragEvent.LEAVE,t,s,r),this.dragEnterPath=r}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:r,throughPath:i}=s,o=To(s,t,t);i&&(o.throughPath=i),o.path=r,this.moving&&e.emit(exports.MoveEvent.END,o),this.dragging&&(e.emit(exports.DragEvent.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:r}=s;if(k.getDistance(r,t)>s.config.pointer.swipeDistance){const t=Co(r,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Po(t,this.getDragList(),exports.DropEvent.dragData);e.path=this.dragEnterPath,this.interaction.emit(exports.DropEvent.DROP,e),this.interaction.emit(exports.DragEvent.LEAVE,t,this.dragEnterPath)}dragReset(){exports.DropEvent.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:r,dragOut:i}=e.config.move;if(!i||!r)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=z.right(o),l=z.bottom(o),d=t.x<n?r:h<t.x?-r:0,c=t.y<a?r:l<t.y?-r:0;let p=0,u=0;this.autoMoveTimer=setInterval((()=>{p+=d,u+=c,k.move(s,d,c),k.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:p,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const So=["move","zoom","rotate"];function Oo(t,e,s,r,i){if(So.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Mo(t,i)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&Do(o,e,s,r,i)}}function Do(t,e,s,r,i){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,r)&&!Mo(t,i)){s.phase=r?1:t===s.target?2:3;const i=ot.get(e,s);if(t.emitEvent(i,r),i.isStop)return!0}return!1}function Mo(t,e){return e&&e.has(t)}const{pathHasEventType:Io}=Bo;class Ao{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new ht(t),this.transformer=new bo(this),this.dragger=new Lo(this),r&&(this.config=ct.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(exports.PointerEvent.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,r=this.selector.getByPoint(t,e,{through:s});r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,this.emit(exports.PointerEvent.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),rs.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(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=k.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:exports.PointerEvent.MOVE});t.path=e.path,this.emit(exports.PointerEvent.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(exports.PointerEvent.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(exports.PointerEvent.UP,t),this.emit(exports.PointerEvent.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(exports.PointerEvent.OUT,t,this.overPath),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.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(exports.PointerEvent.ENTER,t,e,this.enterPath),this.emit(exports.PointerEvent.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.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 r=Date.now()-this.downTime,i=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>Io(t.path,e)));r<e.tapTime+50&&i?(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(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.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(exports.PointerEvent.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),Io(t.path,exports.PointerEvent.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(_e.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,r){this.running&&function(t,e,s,r){if(!s&&!e.path)return;let i;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(i=s.list[o],Do(i,t,e,!0,r))return;i.isApp&&Oo(i,t,e,!0,r)}for(let o=0,n=s.length;o<n;o++)if(i=s.list[o],i.isApp&&Oo(i,t,e,!1,r),Do(i,t,e,!1,r))return}(t,e,s,r)}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)}}function Wo(s,r){if(!t.origin){if("skia"===s){const{Canvas:e,loadImage:s}=r;t.origin={createCanvas:(t,s,r)=>new e(t,s,r),canvasToDataURL:(t,e,s)=>t.toDataURLSync(e,{quality:s}),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>t.saveAs(e,{quality:s}),loadImage:s}}t.canvas=e.canvas()}}Object.assign(e,{canvas:(t,e)=>new Eo(t,e),image:t=>new ns(t),hitCanvas:(t,e)=>new Eo(t,e),interaction:(t,e,s,r)=>new Ao(t,e,s,r)}),t.requestRender=function(t){setTimeout(t)},t.devicePixelRatio=1,t.conicGradientSupport=!0,t.realtimeLayout=!0;const Uo=Z.get("LeaferTypeCreator"),No={list:{},register(t,e){Fo[t]?Uo.repeat(t):Fo[t]=e},run(t,e){const s=No.list[t];s?s(e):Uo.error("no",t)}},{list:Fo}=No;No.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),No.register("design",(function(t){const{MOVE:e}=exports.MoveEvent,{ZOOM:s}=exports.ZoomEvent;t.__eventIds.push(t.on_(e,(e=>{Ie.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:r,max:i}=t.config.zoom;let{scale:o}=e;o*s<r?o=r/s:o*s>i&&(o=i/s),1!==o&&Ie.zoomOfWorld(t.zoomLayer,e,o)})))}));const Ho={},zo={},Yo={},jo={export(t,e,s){return new Promise((r=>{const{leafer:i}=t;i?i.waitViewLoaded((()=>gt(this,void 0,void 0,(function*(){let t,o,n,{canvas:a}=i,{unreal:h}=a;switch(h&&(a=a.getSameCanvas(),a.backgroundColor=i.config.fill,i.__render(a,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(o=!0);break;case"number":t=s;break;case"boolean":o=s}n=e.includes(".")?yield a.saveAs(e,t):o?yield a.toBlob(e,t):a.toDataURL(e,t),r({data:n}),h&&a.recycle()})))):r({data:!1})}))}},{copy:Xo,toOffsetOutBounds:Vo}=z,Go={},qo={};function Ko(e,s,r,i){const{bounds:o,shapeBounds:n}=i;if(t.fullImageShadow){if(Xo(Go,e.bounds),Go.x+=s.x-n.x,Go.y+=s.y-n.y,r){const{matrix:t}=i;Go.x-=(o.x+(t?t.e:0)+o.width/2)*(r-1),Go.y-=(o.y+(t?t.f:0)+o.height/2)*(r-1),Go.width*=r,Go.height*=r}e.copyWorld(i.canvas,e.bounds,Go)}else r&&(Xo(Go,s),Go.x-=s.width/2*(r-1),Go.y-=s.height/2*(r-1),Go.width*=r,Go.height*=r),e.copyWorld(i.canvas,n,r?Go:s)}const{toOffsetOutBounds:Zo}=z,Qo={};var $o=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:r}=t.__;s.setWorldBlur(r*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s){let r,i;const{__world:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:p}=s,u=e.getSameCanvas(),_=a.length-1;Zo(l,Qo),a.forEach(((t,a)=>{u.save(),u.setWorldShadow(Qo.offsetX+t.x*c,Qo.offsetY+t.y*p,t.blur*c),i=t.spread?1-2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,Ko(u,Qo,i,s),u.restore(),h?(u.copyWorld(u,l,o,"copy"),u.copyWorld(h,o,o,"source-out"),r=o):(u.copyWorld(s.canvas,d,l,"source-out"),r=l),u.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(u,r,n.renderBounds,t.blendMode),_&&a<_&&u.clear()})),u.recycle()},shadow:function(t,e,s){let r,i;const{__world:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:p}=s,u=e.getSameCanvas(),_=a.length-1;Vo(l,qo),a.forEach(((t,a)=>{u.setWorldShadow(qo.offsetX+t.x*c,qo.offsetY+t.y*p,t.blur*c,t.color),i=t.spread?1+2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,Ko(u,qo,i,s),r=l,t.box&&(u.restore(),u.save(),h&&(u.copyWorld(u,l,o,"copy"),r=o),h?u.copyWorld(h,o,o,"destination-out"):u.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(u,r,n.renderBounds,t.blendMode),_&&a<_&&u.clear()})),u.recycle()}});function Jo(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[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)})),i&&e.fillRect(s.x,s.y+i,s.width,o)}function tn(t,e,s){const{strokeAlign:r}=t.__;switch(r){case"center":e.setStroke(s,t.__.strokeWidth,t.__),on(t,e);break;case"inside":en(t,e,s,"inside");break;case"outside":en(t,e,s,"outside")}}function en(t,e,s,r){const{strokeWidth:i,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(s,2*i,t.__),n.font=o,on(t,n),n.blendMode="outside"===r?"destination-out":"destination-in",Jo(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}function sn(t,e,s){const{strokeAlign:r}=t.__;switch(r){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),rn(t,s,e);break;case"inside":en(t,e,s,"inside");break;case"outside":!function(t,e,s,r){const{strokeWidth:i,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(void 0,2*i,t.__),n.font=o,rn(t,s,n),n.blendMode="outside"===r?"destination - out":"destination -in ",Jo(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}(t,e,s,"outside")}}function rn(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),on(t,s),s.restoreBlendMode()):on(t,s)}))}function on(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[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)})),i&&e.strokeRect(s.x,s.y+i,s.width,o)}function nn(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:an,getOuterOf:hn,getByMove:ln,getIntersectData:dn}=z;const cn={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}},{get:pn,rotateOfOuter:un,translate:_n,scaleOfOuter:gn,scale:fn,rotate:xn}=f;function yn(e,s,r,i){let{type:o,blendMode:n}=r,a={type:o,blendMode:n,style:"rgba(255,255,255,0)"};const{imageManager:h}=e.leafer,l=h.get(r);if(l.ready){let e,{opacity:s,mode:o,offset:n,scale:h,rotation:d}=r,{width:c,height:p}=l;const u=i.width===c&&i.height===p;switch(o){case"strench":u||(c=i.width,p=i.height),(i.x||i.y)&&(e=pn(),_n(e,i.x,i.y));break;case"clip":(n||h||d)&&(e=function(t,e,s,r){const i=pn();_n(i,t.x,t.y),e&&_n(i,e.x,e.y);s&&("number"==typeof s?fn(i,s):fn(i,s.x,s.y));r&&xn(i,r);return i}(i,n,h,d));break;case"repeat":(!u||h||d)&&(e=function(t,e,s,r,i){const o=pn();if(i)switch(xn(o,i),i){case 90:_n(o,s,0);break;case 180:_n(o,e,s);break;case 270:_n(o,0,e)}_n(o,t.x,t.y),r&&gn(o,t,r);return o}(i,c,p,h,d));break;default:u&&!d||(e=function(t,e,s,r,i){const o=pn(),n=i&&180!==i,a=e.width/(n?r:s),h=e.height/(n?s:r),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-r*l)/2;_n(o,d,c),fn(o,l),i&&un(o,{x:e.x+e.width/2,y:e.y+e.height/2},i);return o}(o,i,c,p,d))}a.style=function(e,s,r){let i=t.canvas.createPattern(e,r?"repeat":"no-repeat");if(s){const{a:t,b:e,c:r,d:o,e:n,f:a}=s;i.setTransform(new DOMMatrix([t,e,r,o,n,a]))}return i}(l.getCanvas(c,p,s),e,"repeat"===o)}else h.load(l,(()=>{e.__.__getInput("width")||(e.width=l.width),e.__.__getInput("height")||(e.height=l.height),e.forceUpdate("width"),e.emitEvent(new ue(ue.LOADED,e,l,s,r))}),(t=>{e.emitEvent(new ue(ue.ERROR,e,l,s,r,t))}));return a}const vn={x:.5,y:0},mn={x:.5,y:1};function wn(t,e,s){let r;for(let i=0,o=e.length;i<o;i++)r=e[i],t.addColorStop(r.offset,cn.string(r.color,s))}const{set:En,getAngle:bn,getDistance:Bn}=k,{get:kn,rotateOfOuter:Tn,scaleOfOuter:Pn}=f,Cn={x:.5,y:.5},Rn={x:.5,y:1},Ln={},Sn={};const{set:On,getAngle:Dn,getDistance:Mn}=k,{get:In,rotateOfOuter:An,scaleOfOuter:Wn}=f,Un={x:.5,y:.5},Nn={x:.5,y:1},Fn={},Hn={};function zn(t,e){let s,r=t.__.__input[e];const i=[];r instanceof Array||(r=[r]);for(let o=0,n=r.length;o<n;o++)s=Yn(t,r[o],e),s&&i.push(s);t.__["_"+e]=i.length?i:void 0}function Yn(e,s,r){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:i}=e.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:cn.string(a,h)};case"image":return yn(e,r,s,i);case"linear":return function(e,s){let{from:r,to:i,type:o,blendMode:n,opacity:a}=e;r||(r=vn),i||(i=mn);const h=t.canvas.createLinearGradient(s.x+r.x*s.width,s.y+r.y*s.height,s.x+i.x*s.width,s.y+i.y*s.height);return wn(h,e.stops,a),{type:o,blendMode:n,style:h}}(s,i);case"radial":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=Cn),i||(i=Rn);const{x:l,y:d,width:c,height:p}=s;let u;En(Ln,l+r.x*c,d+r.y*p),En(Sn,l+i.x*c,d+i.y*p),(c!==p||h)&&(u=kn(),Pn(u,Ln,c/p*(h||1),1),Tn(u,Ln,bn(Ln,Sn)+90));const _=t.canvas.createRadialGradient(Ln.x,Ln.y,0,Ln.x,Ln.y,Bn(Ln,Sn));return wn(_,e.stops,n),{type:o,blendMode:a,style:_,transform:u}}(s,i);case"angular":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=Un),i||(i=Nn);const{x:l,y:d,width:c,height:p}=s;On(Fn,l+r.x*c,d+r.y*p),On(Hn,l+i.x*c,d+i.y*p);const u=In(),_=Dn(Fn,Hn);t.conicGradientRotate90?(Wn(u,Fn,c/p*(h||1),1),An(u,Fn,_+90)):(Wn(u,Fn,1,c/p*(h||1)),An(u,Fn,_));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,Fn.x,Fn.y):t.canvas.createRadialGradient(Fn.x,Fn.y,0,Fn.x,Fn.y,Mn(Fn,Hn));return wn(g,e.stops,n),{type:o,blendMode:a,style:g,transform:u}}(s,i);default:return s.r?{type:"solid",style:cn.string(s)}:void 0}}var jn=Object.freeze({__proto__:null,computeFill:function(t){zn(t,"fill")},computeStroke:function(t){zn(t,"stroke")},drawText:Jo,drawTextStroke:on,fill:function(t,e,s){e.fillStyle=s,t.__.__font?Jo(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let r;const{windingRule:i,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)if(r=s[n],e.fillStyle=r.style,r.transform){e.save();const{a:s,b:n,c:a,d:h,e:l,f:d}=r.transform;e.transform(s,n,a,h,l,d),r.blendMode&&(e.blendMode=r.blendMode),o?Jo(t,e):e.fill(i),e.restore()}else r.blendMode?(e.saveBlendMode(r.blendMode),o?Jo(t,e):e.fill(i),e.restoreBlendMode()):o?Jo(t,e):e.fill(i)},shape:function(t,e,s){const r=e.getSameCanvas();let i,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))i=n=h,a=r;else{const{renderShapeSpread:r}=t.__layout,c=dn(r?an(e.bounds,r*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=hn(h,o),i=ln(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(r,s),{canvas:r,matrix:o,bounds:i,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(n)tn(t,e,s);else switch(o){case"center":e.setStroke(s,i,r),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*i,r),e.clip(r.windingRule),e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);o.setStroke(s,2*i,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(r.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:tn,strokes:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(n)sn(t,e,s);else switch(o){case"center":e.setStroke(void 0,i,r),nn(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*i,r),e.clip(r.windingRule),nn(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*i,t.__),nn(s,n),n.clip(r.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}},strokesText:sn});Object.assign(Ho,$o),Object.assign(zo,jn);class Xn extends ut{setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:zo.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:zo.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Vn={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Gn extends Xn{}class qn extends Gn{get __boxStroke(){return!0}}class Kn extends Xn{get __boxStroke(){return!0}}const{parse:Zn}=Br;const Qn={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class $n extends Kn{}function Jn(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ta(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const ea={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:r,strokeAlign:i,strokeWidth:n}=this.__;if((s||"all"===r)&&n&&"inside"!==i&&(e=t="center"===i?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,r="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,i="none"===s?0:n;t+=Math.max(r,i)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=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)})),r&&(t=Math.max(t,r));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)})),i&&(o=Math.max(o,i)),this.__layout.renderShapeSpread=o,t}},sa={__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:r,windingRule:i}=this.__,o=s&&"path"===r||"all"===r;if(o&&e.hitFill(t,i))return!0;const{stroke:n,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=n&&"path"===a||"all"===a,c=2*t.radiusX;let p=2*(d?"center"===l?h/2:h:0)+c;if(!p)return!1;switch(l){case"inside":if(!o&&e.hitFill(t,i)&&e.hitStroke(t,p))return!0;p=c;break;case"outside":if(!o){if(!e.hitFill(t,i)&&e.hitStroke(t,p))return!0;p=c}}return!!p&&e.hitStroke(t,p)}},ra={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;t.__useEffect=!!(e||s||r||i)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;this.__drawRenderPath(t),s&&zo.fill(this,t,s),i&&this.__drawAfterFill(t,e),r&&zo.stroke(this,t,r)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=zo.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&Ho.shadow(this,t,o),s&&(this.__.__isFills?zo.fills(this,t,s):zo.fill(this,t,s)),i&&this.__drawAfterFill(t,e),a&&Ho.innerShadow(this,t,o),r&&(this.__.__isStrokes?zo.strokes(this,t,r):zo.stroke(this,t,r)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?zo.fills(this,t,s):zo.fill(this,t,s)),i&&this.__drawAfterFill(t,e),r&&(this.__.__isStrokes?zo.strokes(this,t,r):zo.stroke(this,t,r))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:r}=this.__;this.__drawRenderPath(t),s&&zo.fill(this,t,"#000000"),r&&zo.stroke(this,t,"#000000")}},ia={__drawFast(t,e){const{width:s,height:r,fill:i,stroke:o,__drawAfterFill:n}=this.__;if(i&&(t.fillStyle=i,t.fillRect(0,0,s,r)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:i}=this.__;t.setStroke(o,i,this.__);const n=i/2;switch(e){case"center":t.strokeRect(0,0,s,r);break;case"inside":t.strokeRect(n,n,s-i,r-i);break;case"outside":t.strokeRect(-n,-n,s+i,r+i)}}}};exports.UI=class extends exports.Leaf{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Br.toCanvasData(e,!0):e:[]}getPathString(t){return Br.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&zo.computeFill(this),e&&zo.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?$i.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return jo.export(this,t,e)}static one(t,e,s,r,i){return st.get(t.tag||this.prototype.__tag,t,e,s,r,i)}},_t([Vt(Xn)],exports.UI.prototype,"__",void 0),_t([St("")],exports.UI.prototype,"id",void 0),_t([St("")],exports.UI.prototype,"name",void 0),_t([St("")],exports.UI.prototype,"className",void 0),_t([Ft("pass-through")],exports.UI.prototype,"blendMode",void 0),_t([Ht(1)],exports.UI.prototype,"opacity",void 0),_t([Ht(!0)],exports.UI.prototype,"visible",void 0),_t([Yt(!1)],exports.UI.prototype,"isMask",void 0),_t([jt(!1)],exports.UI.prototype,"isEraser",void 0),_t([zt(0)],exports.UI.prototype,"zIndex",void 0),_t([St()],exports.UI.prototype,"locked",void 0),_t([Ot(0)],exports.UI.prototype,"x",void 0),_t([Ot(0)],exports.UI.prototype,"y",void 0),_t([It(100)],exports.UI.prototype,"width",void 0),_t([It(100)],exports.UI.prototype,"height",void 0),_t([Dt(1)],exports.UI.prototype,"scaleX",void 0),_t([Dt(1)],exports.UI.prototype,"scaleY",void 0),_t([Mt(0)],exports.UI.prototype,"rotation",void 0),_t([Mt(0)],exports.UI.prototype,"skewX",void 0),_t([Mt(0)],exports.UI.prototype,"skewY",void 0),_t([St(!1)],exports.UI.prototype,"draggable",void 0),_t([Xt(!0)],exports.UI.prototype,"hittable",void 0),_t([Xt("path")],exports.UI.prototype,"hitFill",void 0),_t([Ut("path")],exports.UI.prototype,"hitStroke",void 0),_t([Xt(!0)],exports.UI.prototype,"hitChildren",void 0),_t([Xt(!0)],exports.UI.prototype,"hitSelf",void 0),_t([Ft()],exports.UI.prototype,"fill",void 0),_t([Ut()],exports.UI.prototype,"stroke",void 0),_t([Ut("inside")],exports.UI.prototype,"strokeAlign",void 0),_t([Ut(1)],exports.UI.prototype,"strokeWidth",void 0),_t([Ut("none")],exports.UI.prototype,"strokeCap",void 0),_t([Ut("miter")],exports.UI.prototype,"strokeJoin",void 0),_t([Ut()],exports.UI.prototype,"dashPattern",void 0),_t([Ut()],exports.UI.prototype,"dashOffset",void 0),_t([Ut(10)],exports.UI.prototype,"miterLimit",void 0),_t([At()],exports.UI.prototype,"cornerRadius",void 0),_t([At()],exports.UI.prototype,"cornerSmoothing",void 0),_t([Jn()],exports.UI.prototype,"shadow",void 0),_t([Jn()],exports.UI.prototype,"innerShadow",void 0),_t([Jn()],exports.UI.prototype,"blur",void 0),_t([Jn()],exports.UI.prototype,"backgroundBlur",void 0),_t([Jn()],exports.UI.prototype,"grayscale",void 0),_t([Jt(vi.drawPathByData)],exports.UI.prototype,"__drawPathByData",null),exports.UI=_t([se(ea),se(sa),se(ra),te()],exports.UI),exports.Group=class extends exports.UI{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){}},_t([Vt(Gn)],exports.Group.prototype,"__",void 0),exports.Group=_t([se(exports.Branch),re()],exports.Group),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:r,cornerRadius:i}=this.__;i?t.roundRect(0,0,s,r,i):t.rect(0,0,s,r)}},_t([Vt(Kn)],exports.Rect.prototype,"__",void 0),exports.Rect=_t([se(ia),re()],exports.Rect);const oa=exports.Rect.prototype,na=exports.Group.prototype,aa={},{copy:ha,add:la}=z;exports.Box=class extends exports.Group{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;ha(aa,t),super.__updateRenderBounds(),la(t,aa)}}__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)}},_t([Vt(qn)],exports.Box.prototype,"__",void 0),_t([Nt("show")],exports.Box.prototype,"overflow",void 0),_t([Jt(oa.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),_t([Jt(oa.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),_t([Jt(oa.__updateBoxBounds)],exports.Box.prototype,"__updateBoxBounds",null),_t([Jt(oa.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),_t([Jt(oa.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),_t([Jt(oa.__updateChange)],exports.Box.prototype,"__updateRectChange",null),_t([Jt(oa.__drawPathByData)],exports.Box.prototype,"__drawPathByData",null),_t([Jt(oa.__render)],exports.Box.prototype,"__renderRect",null),_t([Jt(na.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=_t([te(),re()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}},_t([Vt(class extends qn{})],exports.Frame.prototype,"__",void 0),_t([Nt("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=_t([re()],exports.Frame);const{moveTo:da,closePath:ca,ellipse:pa}=zr;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:r,endAngle:i}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?r||i?(s<1&&pa(a,o,n,o*s,n*s,0,r,i,!1),pa(a,o,n,o,n,0,i,r,!0),s<1&&ca(a)):(s<1&&(pa(a,o,n,o*s,n*s),da(a,t,n)),pa(a,o,n,o,n,0,0,360,!0)):r||i?(da(a,o,n),pa(a,o,n,o,n,0,r,i,!1),ca(a)):pa(a,o,n,o,n)}},_t([Vt(class extends Xn{get __boxStroke(){return!0}})],exports.Ellipse.prototype,"__",void 0),_t([At(0)],exports.Ellipse.prototype,"innerRadius",void 0),_t([At(0)],exports.Ellipse.prototype,"startAngle",void 0),_t([At(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=_t([re()],exports.Ellipse);const{sin:ua,cos:_a,PI:ga}=Math,{moveTo:fa,lineTo:xa,closePath:ya}=zr;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,r=t/2,i=e/2,o=this.__.path=[];fa(o,r,0);for(let t=1;t<s;t++)xa(o,r+r*ua(2*t*ga/s),i-i*_a(2*t*ga/s));ya(o)}},_t([Vt(class extends Xn{})],exports.Polygon.prototype,"__",void 0),_t([At(3)],exports.Polygon.prototype,"sides",void 0),exports.Polygon=_t([re()],exports.Polygon);const{sin:va,cos:ma,PI:wa}=Math,{moveTo:Ea,lineTo:ba,closePath:Ba}=zr;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:r}=this.__,i=t/2,o=e/2,n=this.__.path=[];Ea(n,i,0);for(let t=1;t<2*s;t++)ba(n,i+(t%2==0?i:i*r)*va(t*wa/s),o-(t%2==0?o:o*r)*ma(t*wa/s));Ba(n)}},_t([Vt(class extends Xn{})],exports.Star.prototype,"__",void 0),_t([At(5)],exports.Star.prototype,"points",void 0),_t([At(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=_t([re()],exports.Star);const{moveTo:ka,lineTo:Ta}=zr,{rotate:Pa,getAngle:Ca,getDistance:Ra,defaultPoint:La}=k,{setPoint:Sa,addPoint:Oa,toBounds:Da}=R,Ma={};exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Pa(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Ra(La,t),this.rotation=Ca(La,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];ka(t,0,0);const e=this.toPoint;Ta(t,e.x,e.y)}__updateBoxBounds(){Sa(Ma,0,0),Oa(Ma,this.__toPoint.x,this.__toPoint.y),Da(Ma,this.__layout.boxBounds)}},_t([Vt(class extends Xn{})],exports.Line.prototype,"__",void 0),_t([It()],exports.Line.prototype,"rotation",void 0),_t([Wt("center")],exports.Line.prototype,"strokeAlign",void 0),exports.Line=_t([re()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(ue.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}},_t([Vt($n)],exports.Image.prototype,"__",void 0),_t([It("")],exports.Image.prototype,"url",void 0),exports.Image=_t([re()],exports.Image),exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,r){t.__layout.checkUpdate();const i=new C(t.__world);i.invert();const o=new C;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),r&&o.rotate(r),i.preMultiply(o),t.__render(this.canvas,{matrix:i}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:r,height:i}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}},_t([Vt($n)],exports.Canvas.prototype,"__",void 0),_t([ta(100)],exports.Canvas.prototype,"width",void 0),_t([ta(100)],exports.Canvas.prototype,"height",void 0),_t([ta(t.devicePixelRatio)],exports.Canvas.prototype,"pixelRatio",void 0),_t([ta(!0)],exports.Canvas.prototype,"smooth",void 0),_t([Xt("all")],exports.Canvas.prototype,"hitFill",void 0),exports.Canvas=_t([re()],exports.Canvas);const Ia=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’“!?,、。:;‰",Aa=Ia+"_#~&*+\\=|≮≯≈≠=…";function Wa(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ua=Wa("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Na=Wa("{[(<'\"《(「〈『〖【〔{┌<’“=¥¥$€££¢¢"),Fa=Wa(Ia),Ha=Wa(Aa),za=Wa("- —/~|┆·");var Ya;!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"}(Ya||(Ya={}));const{Letter:ja,Single:Xa,Before:Va,After:Ga,Symbol:qa,Break:Ka}=Ya;function Za(t){return Ua[t]?ja:za[t]?Ka:/[\u3400-\u9FBF]/.test(t)?Xa:Na[t]?Va:Fa[t]?Ga:Ha[t]?qa:ja}const Qa={trimRight(t){const{words:e}=t;let s,r=0,i=e.length;for(let o=i-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)r++,t.width-=s.width;r&&e.splice(i-r,r)}};function $a(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:Ja}=Qa,{Letter:th,Single:eh,Before:sh,After:rh,Symbol:ih,Break:oh}=Ya;let nh,ah,hh,lh,dh,ch,ph,uh,_h,gh,fh,xh,yh,vh,mh=[];function wh(t,e){nh.data.push({char:t,width:e}),hh+=e}function Eh(){lh+=hh,nh.width=hh,ah.words.push(nh),nh={data:[]},hh=0}function bh(){xh&&(yh.paraNumber++,ah.paraStart=!0,xh=!1),ah.width=lh,Ja(ah),mh.push(ah),ah.width>vh.width&&(vh.width=ah.width),ah={words:[]},lh=0}const Bh=0,kh=1,Th=2;const Ph={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let r=0,o=0,{width:n,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=i.fourNumber(h);n&&(r=l,n-=e+l),a&&(o=t,a-=t+s)}const p={bounds:{x:r,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,r){yh=e,mh=e.rows,vh=e.bounds;const{__letterSpacing:i,paraIndent:o,textCase:n}=r,{canvas:a}=t,{width:h,height:l}=vh;if(h||l||i||n){xh=!0,_h=null,hh=lh=0,nh={data:[]},ah={words:[]};for(let t=0,e=s.length;t<e;t++)ch=s[t],"\n"===ch?(hh&&Eh(),ah.paraEnd=!0,bh(),xh=!0):(uh=Za(ch),uh===th&&"none"!==n&&(ch=$a(ch,n,!hh)),ph=a.measureText(ch).width,i&&(ph+=i),gh=uh===eh&&(_h===eh||_h===th)||_h===eh&&uh!==rh,fh=!(uh!==sh&&uh!==eh||_h!==ih&&_h!==rh),dh=xh&&o?h-o:h,h&&lh+hh+ph>dh&&(fh||(fh=uh===th&&_h==rh),gh||fh||uh===oh||uh===sh||uh===eh||hh+ph>dh?(hh&&Eh(),bh()):bh())," "===ch&&lh+hh===0||(uh===oh?(" "===ch&&hh&&Eh(),wh(ch,ph),Eh()):gh||fh?(hh&&Eh(),wh(ch,ph)):wh(ch,ph)),_h=uh);hh&&Eh(),lh&&bh(),mh[mh.length-1].paraEnd=!0}else s.split("\n").forEach((t=>{yh.paraNumber++,mh.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(p,e,s),function(t,e){const{rows:s,bounds:r}=t,{__lineHeight:i,__baseLine:o,textAlign:n,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:p,width:u,height:_}=r,g=i*s.length+(h?h*(t.paraNumber-1):0),f=o;if(_){if("show"!==l&&g>_)g=Math.max(_,i),t.overflow=s.length;else switch(a){case"middle":p+=(_-g)/2;break;case"bottom":p+=_-g}f+=p}for(let e=0,r=s.length;e<r;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(u-d.width)/2;break;case"right":d.x+=u-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=i,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1)}r.y=p,r.height=g}(p,s),function(t,e,s,r){const{rows:i}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,p;i.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?Bh:l>.01?kh:Th,c===Th?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===kh?(p={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,p)," "!==p.char&&t.data.push(p)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(p,s,n),p.overflow&&function(e,s){const{rows:r,overflow:i}=e;if(r.splice(i),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=r[i-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,p=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<p));t--){if(h<p&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(p,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(p,s),p}},{copyAndSpread:Ch,includes:Rh,spread:Lh}=z;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:r}=this.__;t.beginPath(),r.rows.forEach((r=>t.rect(r.x,r.y-s,r.width,e)))}__drawPathByData(t,e){const{x:s,y:r,width:i,height:o}=this.__layout.boxBounds;t.rect(s,r,i,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Ph.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:r,lineHeight:i,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Vn.number(i,a),t.__letterSpacing=Vn.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,p=e.boxBounds;t.__lineHeight<a&&Lh(c,a/2),s&&r?super.__updateBoxBounds():(p.x=s?0:c.x,p.y=r?0:c.y,p.width=s||c.width,p.height=r||c.height);const u=Rh(p,c)?p:c;u!==e.contentBounds&&(e.contentBounds=u,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Ch(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}},_t([Vt(class extends Xn{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=Qn[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],exports.Text.prototype,"__",void 0),_t([It(0)],exports.Text.prototype,"width",void 0),_t([It(0)],exports.Text.prototype,"height",void 0),_t([It(0)],exports.Text.prototype,"padding",void 0),_t([Wt("outside")],exports.Text.prototype,"strokeAlign",void 0),_t([It("")],exports.Text.prototype,"text",void 0),_t([It("L")],exports.Text.prototype,"fontFamily",void 0),_t([It(12)],exports.Text.prototype,"fontSize",void 0),_t([It("normal")],exports.Text.prototype,"fontWeight",void 0),_t([It(!1)],exports.Text.prototype,"italic",void 0),_t([It("none")],exports.Text.prototype,"textCase",void 0),_t([It("none")],exports.Text.prototype,"textDecoration",void 0),_t([It(0)],exports.Text.prototype,"letterSpacing",void 0),_t([It({type:"percent",value:150})],exports.Text.prototype,"lineHeight",void 0),_t([It(0)],exports.Text.prototype,"paraIndent",void 0),_t([It(0)],exports.Text.prototype,"paraSpacing",void 0),_t([It("left")],exports.Text.prototype,"textAlign",void 0),_t([It("top")],exports.Text.prototype,"verticalAlign",void 0),_t([It("show")],exports.Text.prototype,"textOverflow",void 0),exports.Text=_t([re()],exports.Text);const{toBounds:Sh}=Qi;exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){Sh(this.__.path,this.__layout.boxBounds)}},_t([Vt(class extends Xn{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Zn(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],exports.Path.prototype,"__",void 0),_t([At()],exports.Path.prototype,"path",void 0),_t([At()],exports.Path.prototype,"windingRule",void 0),_t([Wt("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=_t([re()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(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,r,i,o){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,i){return this}ellipse(t,e,s,r,i,o,n,a){return this}arc(t,e,s,r,i,o){return this}arcTo(t,e,s,r,i){return this}moveToEllipse(t,e,s,r,i,o,n,a){return this}moveToArc(t,e,s,r,i,o){return this}paint(){this.pathElement.forceUpdate("path")}},_t([Vt(class extends Gn{})],exports.Pen.prototype,"__",void 0),exports.Pen=_t([se(ii,["beginPath"]),re()],exports.Pen);const Oh=Z.get("Leafer");exports.Leafer=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&this.imageManager.tasker.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let r;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:i}=this;No.run(i.type,this),this.canvas=e.canvas(i),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,i),this.watcher=e.watcher(this,i),this.layouter=e.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,s?(this.__bindApp(s),r=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new at,this.hitCanvasManager=new dt,this.imageManager=new ds(this,i),r=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(me.RESTART):this.emitLeafer(me.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(me.STOP))}resize(t){const e=ct.copyAttrs({},t,kt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new _e(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,kt),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const r=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),r(),this.viewLoaded||(s=this.on_("render.after",r))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(kt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&kt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,kt);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(me.BEFORE_READY),this.emitLeafer(me.READY),this.emitLeafer(me.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(me.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new me(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(me.START,(()=>J.end(t))),this.once(xe.END,(()=>this.__onReady())),this.once(ve.END,(()=>this.__onViewReady())),this.on(xe.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new me(me.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){Oh.error(t)}}},_t([Vt(class extends Gn{})],exports.Leafer.prototype,"__",void 0),_t([It()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=_t([re()],exports.Leafer),exports.App=class extends exports.Leafer{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(pe.CHANGE,(()=>{Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new exports.Leafer(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(xe.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(ve.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(ve.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}},exports.App=_t([re()],exports.App);var Dh=Object.freeze({__proto__:null,Animate:Yo,AnimateEvent:ye,get App(){return exports.App},AutoBounds:G,BezierHelper:Ss,Bounds:V,BoundsHelper:z,get Box(){return exports.Box},get Branch(){return exports.Branch},BranchHelper:He,BranchRender:Me,get Canvas(){return exports.Canvas},CanvasManager:at,ChildEvent:ce,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return exports.DragEvent},get DropEvent(){return exports.DropEvent},Effect:Ho,get Ellipse(){return exports.Ellipse},EllipseHelper:Fs,Event:de,EventCreator:ot,Export:jo,get Frame(){return exports.Frame},get Group(){return exports.Group},HitCanvasManager:dt,get Image(){return exports.Image},ImageEvent:ue,ImageManager:ds,IncrementId:s,get KeyEvent(){return exports.KeyEvent},Keyboard:ss,LayoutEvent:xe,Layouter:fo,get Leaf(){return exports.Leaf},LeafBounds:Ce,LeafBoundsHelper:Fe,LeafData:ut,LeafDataProxy:we,LeafEventer:he,LeafHelper:Ie,LeafHit:Se,LeafLevelList:lt,LeafList:ht,LeafMask:De,LeafMatrix:ke,LeafRender:Oe,get Leafer(){return exports.Leafer},LeaferCanvas:Eo,LeaferCanvasBase:Tt,LeaferEvent:me,LeaferImage:ns,LeaferImageBase:ns,LeaferTypeCreator:No,get Line(){return exports.Line},MathHelper:i,Matrix:C,MatrixHelper:f,get MoveEvent(){return exports.MoveEvent},NeedConvertToCanvasCommandMap:gs,OneRadian:o,PI2:n,PI_2:a,Paint:zo,get Path(){return exports.Path},PathBounds:Qi,PathCommandDataHelper:zr,PathCommandMap:us,PathConvert:Br,PathCorner:$i,PathCreator:ii,PathDrawer:vi,PathHelper:cs,PathNumberCommandLengthMap:vs,PathNumberCommandMap:ys,get Pen(){return exports.Pen},Platform:t,PluginManager:to,Point:P,PointHelper:k,PointerButton:rs,get PointerEvent(){return exports.PointerEvent},get Polygon(){return exports.Polygon},PropertyEvent:pe,get Rect(){return exports.Rect},RectHelper:ms,RectRender:ia,RenderEvent:ve,Renderer:yo,ResizeEvent:_e,get RotateEvent(){return exports.RotateEvent},Run:J,Selector:wo,get Star(){return exports.Star},StringNumberMap:K,get SwipeEvent(){return exports.SwipeEvent},TaskItem:as,TaskProcessor:ls,get Text(){return exports.Text},TransformEvent:ge,TwoPointBounds:q,TwoPointBoundsHelper:R,get UI(){return exports.UI},UIBounds:ea,UICreator:st,UIEvent:is,UIHit:sa,UIRender:ra,WaitHelper:je,WatchEvent:fe,Watcher:so,get ZoomEvent(){return exports.ZoomEvent},affectRenderBoundsType:Nt,affectStrokeBoundsType:Wt,aliasType:Rt,boundsType:It,canvasSizeAttrs:kt,dataProcessor:Vt,dataType:St,defineDataProcessor:Kt,defineKey:Pt,defineLeafAttr:Lt,effectType:Jn,eraserType:jt,getDescriptor:Ct,hitType:Xt,layoutProcessor:Gt,maskType:Yt,opacityType:Ht,pathType:At,positionType:Ot,registerUI:re,registerUIEvent:ie,resizeType:ta,rewrite:Jt,rewriteAble:te,rotationType:Mt,scaleType:Dt,setDefaultValue:qt,sortType:zt,strokeType:Ut,surfaceType:Ft,useCanvas:Wo,useModule:se,usePlugin:eo});to.power=Dh,exports.Animate=Yo,exports.AnimateEvent=ye,exports.AutoBounds=G,exports.BezierHelper=Ss,exports.Bounds=V,exports.BoundsHelper=z,exports.BranchHelper=He,exports.BranchRender=Me,exports.CanvasManager=at,exports.ChildEvent=ce,exports.Creator=e,exports.DataHelper=ct,exports.Debug=Z,exports.Effect=Ho,exports.EllipseHelper=Fs,exports.Event=de,exports.EventCreator=ot,exports.Export=jo,exports.HitCanvasManager=dt,exports.ImageEvent=ue,exports.ImageManager=ds,exports.IncrementId=s,exports.Keyboard=ss,exports.LayoutEvent=xe,exports.Layouter=fo,exports.LeafBounds=Ce,exports.LeafBoundsHelper=Fe,exports.LeafData=ut,exports.LeafDataProxy=we,exports.LeafEventer=he,exports.LeafHelper=Ie,exports.LeafHit=Se,exports.LeafLevelList=lt,exports.LeafList=ht,exports.LeafMask=De,exports.LeafMatrix=ke,exports.LeafRender=Oe,exports.LeaferCanvas=Eo,exports.LeaferCanvasBase=Tt,exports.LeaferEvent=me,exports.LeaferImage=ns,exports.LeaferImageBase=ns,exports.LeaferTypeCreator=No,exports.MathHelper=i,exports.Matrix=C,exports.MatrixHelper=f,exports.NeedConvertToCanvasCommandMap=gs,exports.OneRadian=o,exports.PI2=n,exports.PI_2=a,exports.Paint=zo,exports.PathBounds=Qi,exports.PathCommandDataHelper=zr,exports.PathCommandMap=us,exports.PathConvert=Br,exports.PathCorner=$i,exports.PathCreator=ii,exports.PathDrawer=vi,exports.PathHelper=cs,exports.PathNumberCommandLengthMap=vs,exports.PathNumberCommandMap=ys,exports.Platform=t,exports.PluginManager=to,exports.Point=P,exports.PointHelper=k,exports.PointerButton=rs,exports.PropertyEvent=pe,exports.RectHelper=ms,exports.RectRender=ia,exports.RenderEvent=ve,exports.Renderer=yo,exports.ResizeEvent=_e,exports.Run=J,exports.Selector=wo,exports.StringNumberMap=K,exports.TaskItem=as,exports.TaskProcessor=ls,exports.TransformEvent=ge,exports.TwoPointBounds=q,exports.TwoPointBoundsHelper=R,exports.UIBounds=ea,exports.UICreator=st,exports.UIEvent=is,exports.UIHit=sa,exports.UIRender=ra,exports.WaitHelper=je,exports.WatchEvent=fe,exports.Watcher=so,exports.affectRenderBoundsType=Nt,exports.affectStrokeBoundsType=Wt,exports.aliasType=Rt,exports.boundsType=It,exports.canvasSizeAttrs=kt,exports.dataProcessor=Vt,exports.dataType=St,exports.defineDataProcessor=Kt,exports.defineKey=Pt,exports.defineLeafAttr=Lt,exports.effectType=Jn,exports.eraserType=jt,exports.getDescriptor=Ct,exports.hitType=Xt,exports.layoutProcessor=Gt,exports.maskType=Yt,exports.opacityType=Ht,exports.pathType=At,exports.positionType=Ot,exports.registerUI=re,exports.registerUIEvent=ie,exports.resizeType=ta,exports.rewrite=Jt,exports.rewriteAble=te,exports.rotationType=Mt,exports.scaleType=Dt,exports.setDefaultValue=qt,exports.sortType=zt,exports.strokeType=Ut,exports.surfaceType=Ft,exports.useCanvas=Wo,exports.useModule=se,exports.usePlugin=eo;
1
+ "use strict";const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,i={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,r,i;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=r=t[0],s=i=t[1];break;case 3:e=t[0],s=i=t[1],r=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,r,i]}},o=Math.PI/180,n=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:p,PI:u}=Math,_={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s},scaleOfOuter(t,e,s,r=s){x.toInnerPoint(t,e,_),x.scaleOfInner(t,_,s,r)},scaleOfInner(t,e,s,r=s){x.translateInner(t,e.x,e.y),x.scale(t,s,r),x.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=o),r=h(e),{a:i,b:n,c:a,d:d}=t;t.a=i*s-n*r,t.b=i*r+n*s,t.c=a*s-d*r,t.d=a*r+d*s},rotateOfOuter(t,e,s){x.toInnerPoint(t,e,_),x.rotateOfInner(t,_,s)},rotateOfInner(t,e,s){x.translateInner(t,e.x,e.y),x.rotate(t,s),x.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:n,d:a}=t;s&&(s*=o,t.a=r+n*s,t.b=i+a*s),e&&(e*=o,t.c=n+r*e,t.d=a+i*e)},skewOfOuter(t,e,s,r){x.toInnerPoint(t,e,_),x.skewOfInner(t,_,s,r)},skewOfInner(t,e,s,r){x.translateInner(t,e.x,e.y),x.skew(t,s,r),x.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+n,t.f=e.e*r+e.f*o+a},preMultiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+r*e.c,t.b=s*e.b+r*e.d,t.c=i*e.a+o*e.c,t.d=i*e.b+o*e.d),t.e=n*e.a+a*e.c+e.e,t.f=n*e.b+a*e.d+e.f},divide(t,e){x.multiply(t,x.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=x;return x.copy(e,t),x.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t,a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{x:i,y:o}=e,{a:n,b:a,c:h,d:l}=t,d=1/(n*l-a*h);if(s||(s=e),s.x=(i*l-o*h)*d,s.y=(o*n-i*a)*d,!r){const{e:e,f:r}=t;s.x-=(e*l-r*h)*d,s.y-=(r*n-e*a)*d}},decompose(t){const{a:e,b:s,c:r,d:i}=t;let n=e,a=i,h=0,l=0,_=0;if(s||r){const t=e*i-s*r,g=e*r+s*i;if(s){const r=e*e+s*s;n=p(r),a=t/n;const i=e/n;h=s>0?d(i):-d(i),l=c(g/r)/o}else{const e=r*r+i*i;a=p(e),n=t/a;const s=r/a;h=u/2-(i>0?d(-s):-d(s)),_=c(g/e)/o}h/=o}return{x:t.e,y:t.f,scaleX:n,scaleY:a,rotation:h,skewX:l,skewY:_}},reset(t){x.set(t)}},x=f,{toInnerPoint:y,toOuterPoint:v}=f,{sin:m,cos:w,abs:E,sqrt:b,atan2:B}=Math,k={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=T.defaultPoint);const r=w(e*o),i=m(e*o),n=t.x-s.x,a=t.y-s.y;t.x=s.x+n*r-a*i,t.y=s.y+n*i-a*r},tempToInnerOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),y(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=T;return T.copy(s,t),T.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),y(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){y(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=E(e.x-t.x),r=E(e.y-t.y);return b(s*s+r*r)},getAngle:(t,e)=>T.getAtan2(t,e)/o,getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=T.getAtan2(t,e);return{x:t.x+w(r)*s,y:t.y+m(r)*s}},reset(t){T.reset(t)}},T=k;class P{constructor(t,e){"object"==typeof t?k.copy(this,t):k.set(this,t,e)}set(t,e){k.set(this,t,e)}copy(t){return k.copy(this,t),this}clone(){return new P(this)}rotate(t,e){return k.rotate(this,t,e),this}toInnerOf(t,e){return k.toInnerOf(this,t,e),this}toOuterOf(t,e){return k.toOuterOf(this,t,e),this}getCenter(t){return k.getCenter(this,t)}getDistance(t){return k.getDistance(this,t)}getAngle(t){return k.getAngle(this,t)}getAtan2(t){return k.getAtan2(this,t)}reset(){k.reset(this)}}class C{constructor(t,e,s,r,i,o){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,r,i,o)}set(t,e,s,r,i,o){f.set(this,t,e,s,r,i,o)}copy(t){return f.copy(this,t),this}clone(){return new C(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const 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},addBounds(t,e,s,r,i){L(t,e,s),L(t,e+r,s+i)},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:L}=R,{tempPointBounds:S,setPoint:O,addPoint:D,toBounds:M}=R,{toOuterPoint:A}=f;let I,W,U,N;const F={},H={},z={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){j.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),j.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(j.right(s)-t.x),e.offsetY=-(j.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),j.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(j.copy(j.tempBounds,t),j.toOuterOf(j.tempBounds,e),j.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),j.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else F.x=t.x,F.y=t.y,A(e,F,H),O(S,H.x,H.y),F.x=t.x+t.width,A(e,F,H),D(S,H.x,H.y),F.y=t.y+t.height,A(e,F,H),D(S,H.x,H.y),F.x=t.x,A(e,F,H),D(S,H.x,H.y),M(S,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new C(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){I=t.x+t.width,W=t.y+t.height,U=e.x+e.width,N=e.y+e.height,I=I>U?I:U,W=W>N?W:N,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){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,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||X(t,i)):Y(t,i));o&&j.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?O(S,t.x,t.y):D(S,t.x,t.y)})),M(S,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=k.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=k.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=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:r,y:i,width:o,height:n}=e;return I=r+o,W=i+n,U=t.x+t.width,N=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,I=I<U?I:U,W=W<N?W:N,o=I-r,n=W-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){j.copy(t,j.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){j.set(t)}},j=z,{add:Y,copy:X}=j;class V{constructor(t,e,s,r){"object"==typeof t?z.copy(this,t):z.set(this,t,e,s,r)}set(t,e,s,r){z.set(this,t,e,s,r)}copy(t){return z.copy(this,t),this}clone(){return new V(this)}scale(t){return z.scale(this,t),this}toOuterOf(t,e){return z.toOuterOf(this,t,e),this}getFitMatrix(t){return z.getFitMatrix(this,t)}spread(t){return z.spread(this,t),this}ceil(){return z.ceil(this),this}add(t){return z.add(this,t),this}addList(t){return z.setByList(this,t,!0),this}setByList(t,e){return z.setByList(this,t,e),this}addListWithHandle(t,e){return z.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return z.setByListWithHandle(this,t,e,s),this}setByPoints(t){return z.setByPoints(this,t),this}hitPoint(t,e){return z.hitPoint(this,t,e)}hitRadiusPoint(t,e){return z.hitRadiusPoint(this,t,e)}hit(t,e){return z.hit(this,t,e)}includes(t,e){return z.includes(this,t,e)}intersect(t,e){return z.intersect(this,t,e),this}getIntersect(t,e){return new V(z.getIntersectData(this,t,e))}isSame(t){return z.isSame(this,t)}isEmpty(){return z.isEmpty(this)}reset(){z.reset(this)}}class G{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new V(i,e,o||t.width-i-s,n||t.height-e-r)}}class q{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}addBounds(t,e,s,r){R.addBounds(this,t,e,s,r)}add(t){R.add(this,t)}}const K={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const r=s.create(s.RUNTIME);return tt.currentId=tt.idMap[r]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[r]=t,tt.nameToIdMap[t]=r,r}static end(t,e){const s=tt.idMap[t],r=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[r]=void 0,e?$.log(r,performance.now()-s,"µs"):$.log(r,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;rt[e]?et.repeat(e):rt[e]=t},get(t,e,s,r,i,o){const n=new rt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:rt}=st,it=Z.get("EventCreator"),ot={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(nt[e]?it.repeat(e):nt[e]=t)}))},changeName(t,e){const s=nt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,nt[e]=s)}},get:(t,...e)=>new nt[t](...e)},{nameList:nt}=ot;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.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,r=this.list.length;s<r;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 ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(pt(e,t),pt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?pt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:pt}=ct;class ut{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,r;for(let i in this)s=i.substring(1),void 0!==this[s]&&(r=e?e[s]:void 0,t[s]=void 0===r?this[i]:r);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}const _t={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function ft(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((r=r.apply(t,e||[])).next())}))}function xt(t){return(e,s)=>{t||(t=s);const r={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,r)}}const yt=[];function vt(){return(t,e)=>{yt.push(e)}}const mt=[];class wt{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||mt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;yt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,n,a){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}gt([xt("imageSmoothingEnabled")],wt.prototype,"smooth",void 0),gt([xt("imageSmoothingQuality")],wt.prototype,"smoothLevel",void 0),gt([xt("globalAlpha")],wt.prototype,"opacity",void 0),gt([xt()],wt.prototype,"fillStyle",void 0),gt([xt()],wt.prototype,"strokeStyle",void 0),gt([xt("lineWidth")],wt.prototype,"strokeWidth",void 0),gt([xt("lineCap")],wt.prototype,"strokeCap",void 0),gt([xt("lineJoin")],wt.prototype,"strokeJoin",void 0),gt([xt("lineDashOffset")],wt.prototype,"dashOffset",void 0),gt([xt()],wt.prototype,"miterLimit",void 0),gt([xt()],wt.prototype,"shadowBlur",void 0),gt([xt()],wt.prototype,"shadowColor",void 0),gt([xt()],wt.prototype,"shadowOffsetX",void 0),gt([xt()],wt.prototype,"shadowOffsetY",void 0),gt([xt()],wt.prototype,"filter",void 0),gt([xt()],wt.prototype,"font",void 0),gt([xt()],wt.prototype,"fontKerning",void 0),gt([xt()],wt.prototype,"fontStretch",void 0),gt([xt()],wt.prototype,"fontVariantCaps",void 0),gt([xt()],wt.prototype,"textAlign",void 0),gt([xt()],wt.prototype,"textBaseline",void 0),gt([xt()],wt.prototype,"textRendering",void 0),gt([xt()],wt.prototype,"wordSpacing",void 0),gt([xt()],wt.prototype,"letterSpacing",void 0),gt([xt()],wt.prototype,"direction",void 0),gt([vt()],wt.prototype,"setTransform",null),gt([vt()],wt.prototype,"resetTransform",null),gt([vt()],wt.prototype,"getTransform",null),gt([vt()],wt.prototype,"save",null),gt([vt()],wt.prototype,"restore",null),gt([vt()],wt.prototype,"transform",null),gt([vt()],wt.prototype,"translate",null),gt([vt()],wt.prototype,"scale",null),gt([vt()],wt.prototype,"rotate",null),gt([vt()],wt.prototype,"fill",null),gt([vt()],wt.prototype,"stroke",null),gt([vt()],wt.prototype,"clip",null),gt([vt()],wt.prototype,"fillRect",null),gt([vt()],wt.prototype,"strokeRect",null),gt([vt()],wt.prototype,"clearRect",null),gt([vt()],wt.prototype,"beginPath",null),gt([vt()],wt.prototype,"moveTo",null),gt([vt()],wt.prototype,"lineTo",null),gt([vt()],wt.prototype,"bezierCurveTo",null),gt([vt()],wt.prototype,"quadraticCurveTo",null),gt([vt()],wt.prototype,"closePath",null),gt([vt()],wt.prototype,"arc",null),gt([vt()],wt.prototype,"arcTo",null),gt([vt()],wt.prototype,"ellipse",null),gt([vt()],wt.prototype,"rect",null),gt([vt()],wt.prototype,"roundRect",null),gt([vt()],wt.prototype,"createConicGradient",null),gt([vt()],wt.prototype,"createLinearGradient",null),gt([vt()],wt.prototype,"createPattern",null),gt([vt()],wt.prototype,"createRadialGradient",null),gt([vt()],wt.prototype,"fillText",null),gt([vt()],wt.prototype,"measureText",null),gt([vt()],wt.prototype,"strokeText",null);const Et=new V,bt={width:1,height:1,pixelRatio:1},Bt=Z.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Tt extends wt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,r){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.pixelRatio=n,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init(),this.textBaseline="alphabetic"}init(){}toBlob(e,s){return new Promise((r=>{const i=this.getSaveCanvas(e);t.origin.canvasToBolb(i.view,e,s).then((t=>{i.recycle(),r(t)})).catch((t=>{Bt.error(t),r(null)}))}))}toDataURL(e,s){const r=this.getSaveCanvas(e),i=t.origin.canvasToDataURL(r.view,e,s);return r.recycle(),i}saveAs(e,s){return new Promise((r=>{const i=this.getSaveCanvas(_t.fileType(e));t.origin.canvasSaveAs(i.view,e,s).then((()=>{i.recycle(),r(!0)})).catch((t=>{Bt.error(t),r(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,r=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&r.fillWorld(s,"#FFFFFF"),e&&r.fillWorld(s,e),r.copyWorld(this),r}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,kt),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:r}=this,i=this.worldTransform;if(e)if(s)this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=(t.e+e.e)*r,i.f=(t.f+e.f)*r);else{const{a:s,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*s+t.b*n)*r,i.b=(t.a*o+t.b*a)*r,i.c=(t.c*s+t.d*n)*r,i.d=(t.c*o+t.d*a)*r,i.e=(t.e*s+t.f*n+h)*r,i.f=(t.e*o+t.f*a+l)*r)}else this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=t.e*r,i.f=t.f*r)}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,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,z.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Et.copy(t).scale(this.pixelRatio),this.fillRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Et.copy(t).scale(this.pixelRatio),this.strokeRect(Et.x,Et.y,Et.width,Et.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.clearRect(Et.x,Et.y,Et.width,Et.height)}clipWorld(t,e){this.beginPath(),Et.copy(t).scale(this.pixelRatio),e&&Et.ceil(),this.rect(Et.x,Et.y,Et.width,Et.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:r,pixelRatio:i}=this,o={width:s,height:r,pixelRatio:i},n=this.manager?this.manager.get(o):e.canvas(o);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:r,height:i,pixelRatio:o}=this;t&&(r+=t),s&&(i+=s);const n={width:r,height:i,pixelRatio:o},a=this.manager?this.manager.get(n):e.canvas(n);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function Pt(t,e,s){Object.defineProperty(t,e,s)}function Ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Rt(t){return(e,s)=>{Pt(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function Lt(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Pt(t,e,Object.assign(i,r||{})),Kt(t,e,s)}function St(t){return(e,s)=>{Lt(e,s,t)}}function Ot(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function Dt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Mt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function At(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const It=At;function Wt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ut=Wt;function Nt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ft(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Ht(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function zt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function jt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Yt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Xt(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Vt(t){return(e,s)=>{Pt(e,"__DataProcessor",{get:()=>t})}}function Gt(t){return(e,s)=>{Pt(e,"__LayoutProcessor",{get:()=>t})}}function qt(t,e,s){Kt(t.prototype,e,s)}function Kt(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t},configurable:!0,enumerable:!0};void 0===s&&(n.get=function(){return this[i]});const a=Ct(r,e);a&&a.set&&(n.set=a.set),r[o]&&(n.set=r[o],delete r[o]),Object.defineProperty(r,e,n)}const Zt=new Z("rewrite"),Qt=[],$t=["destroy","constructor"];function Jt(t){return(e,s)=>{Qt.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function te(){return t=>{ee()}}function ee(t){Qt.length&&(Qt.forEach((e=>{t&&Zt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Qt.length=0)}function se(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!($t.includes(r)||e&&e.includes(r)))if(t.prototype){Ct(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function re(){return t=>{st.register(t)}}function ie(){return t=>{ot.register(t)}}setTimeout((()=>ee(!0)));const{toOuterOf:oe}=z;class ne{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),oe(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),oe(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),oe(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:r},this.localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:r},this.localRenderBounds={x:t,y:e,width:s,height:r}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const ae={},he={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=le(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))},off(t,e,s){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const n=le(this,r);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,listener:e,options:r}},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 r=le(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this;return void 0===e?!!(r&&r[t]||s&&s[t]):!!(e?r&&r[t]:s&&s[t])}};function le(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ae)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ae)}}class de{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 ce extends de{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ce.ADD="child.add",ce.REMOVE="child.remove";class pe extends de{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}pe.CHANGE="property.change";class ue extends de{constructor(t,e,s,r,i,o){super(t,e),this.image=s,this.attrName=r,this.attrValue=i,o&&(this.error=o)}}ue.LOADED="image.loaded",ue.ERROR="image.error";class _e extends de{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){"object"==typeof t?(super(_e.RESIZE),Object.assign(this,t)):super(t),this.old=e}}_e.RESIZE="resize";class ge extends de{constructor(t,e){super(t),e&&Object.assign(this,e)}}ge.START="transform.start",ge.CHANGE="transform.change",ge.END="transform.end",ge.BEFORE_START="transform.before_start",ge.BEFORE_CHANGE="transform.before_change",ge.BEFORE_END="transform.before_end";class fe extends de{constructor(t,e){super(t),this.data=e}}fe.REQUEST="watch.request",fe.DATA="watch.data";class xe extends de{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}xe.CHECK_UPDATE="layout.check_update",xe.REQUEST="layout.request",xe.START="layout.start",xe.BEFORE="layout.before",xe.LAYOUT="layout.layout",xe.AFTER="layout.after",xe.AGAIN="layout.again",xe.END="layout.end";class ye extends de{}ye.FRAME="animate.frame";class ve extends de{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}ve.REQUEST="render.request",ve.START="render.start",ve.BEFORE="render.before",ve.RENDER="render",ve.AFTER="render.after",ve.AGAIN="render.again",ve.END="render.end";class me extends de{}me.START="leafer.start",me.BEFORE_READY="leafer.before_ready",me.READY="leafer.ready",me.AFTER_READY="leafer.after_ready",me.VIEW_READY="leafer.view_ready",me.STOP="leafer.stop",me.RESTART="leafer.restart",me.END="leafer.end";const we={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=pe,r=new pe(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:Ee}=f,{sin:be,cos:Be}=Math,ke={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Ee,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:r}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:i,skewX:n,skewY:a}=this.__;i||n||a?(i*=o,n&&(n*=o),a&&(a*=o),t.a=s*Be(i+a),t.b=s*be(i+a),t.c=r*-be(i-n),t.d=r*Be(i-n)):(t.a=s,t.b=0,t.c=0,t.d=r,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=r,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:Te,copyAndSpread:Pe}=z,Ce={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,Te(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Te(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Te(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Te(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Te(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(){Pe(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Pe(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Re}=k,Le={},Se={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Re(t,this.__world,Le),this.__hit(Le)},__drawHitPath(t){this.__drawRenderPath(t)}},Oe={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e),t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},De={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,r=e.length;s<r;s++)(t=e[s]).isMask&&(this.__removeMask(t),r--,s--)}}},Me={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity,t.copyWorld(s,this.__world,this.__world,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:r}=this;if(this.__hasMask&&r.length>1){let i,o=t.getSameCanvas(),n=t.getSameCanvas();for(let a=0,h=r.length;a<h;a++)s=r[a],s.isMask?(i?(this.__renderMask(t,n,o),o.clear(),n.clear()):i=!0,s.__render(o,e)):s.__render(n,e);this.__renderMask(t,n,o),o.recycle(),n.recycle()}else{const{bounds:i,hideBounds:o}=e;for(let n=0,a=r.length;n<a;n++)s=r[n],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},Ae={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++)Ue(e[t])}},updateAllChange(t){if(Ue(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ne(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const r={x:e,y:s};t.parent&&f.toInnerPoint(t.parent.__world,r,r,!0),Ie.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,r,i){const o=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,o,s,r,i)},zoomOfLocal(t,e,s,r,i){r||(r=s),i||(i=t);const{x:o,y:n}=i.__,a=(new C).translate(o,n).scaleOfOuter(e,s,r);i.x=a.e,i.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*r},rotateOfWorld(t,e,s,r){const i=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,i,s,r)},rotateOfLocal(t,e,s,r){r||(r=t);const{x:i,y:o}=r.__,n=(new C).translate(i,o).rotateOfOuter(e,s);r.x=n.e,r.y=n.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Ie=Ae,{updateAllWorldMatrix:We,updateAllWorldOpacity:Ue,updateAllChange:Ne}=Ie,Fe={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},He={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 r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.push(t),ze(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:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)je(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:ze,pushAllBranchStack:je}=He,Ye={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Xe,create:Ve}=s;exports.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return ut}get __LayoutProcessor(){return ne}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=Ve(Xe),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.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&Ye.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?f.toInnerPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}localToWorld(t,e,s){this.parent?f.toOuterPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}worldToInner(t,e,s){f.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){f.toOuterPoint(this.worldTransform,t,e,s)}move(t,e){Ae.moveLocal(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),void 0===s&&(s=e),Ae.zoomOfLocal(this,k.tempToOuterOf(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Ae.rotateOfLocal(this,k.tempToOuterOf(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){this.parent&&this.parent.remove(this)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}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))}},exports.Leaf=gt([se(we),se(ke),se(Ce),se(Se),se(he),se(Oe)],exports.Leaf);const{setByListWithHandle:Ge}=z,{sort:qe}=He,{localBoxBounds:Ke,localEventBounds:Ze,localRenderBounds:Qe,maskLocalBoxBounds:$e,maskLocalEventBounds:Je,maskLocalRenderBounds:ts}=Fe;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Ge(this.__layout.boxBounds,this.children,this.__hasMask?$e:Ke)}__updateStrokeBounds(){Ge(this.__layout.strokeBounds,this.children,this.__hasMask?Je:Ze)}__updateRenderBounds(){Ge(this.__layout.renderBounds,this.children,this.__hasMask?ts:Qe)}__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(qe)}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Ye.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(ce.ADD,t))}remove(t){if(t){const e=this.children.indexOf(t);e>-1&&(this.children.splice(e,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t))}else void 0===t&&super.remove()}removeAll(){const{children:t}=this;this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,t.forEach((t=>{this.__realRemoveChild(t)}))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(ce.REMOVE,t))}__emitChildEvent(t,e){const s=new ce(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=gt([se(Me),se(De)],exports.Branch);const es={};class ss{static isHoldSpaceKey(){return ss.hasDownCode("Space")}static setDownCode(t){es[t]||(es[t]=!0)}static setUpCode(t){es[t]=!1}static hasDownCode(t){return es[t]}}class rs{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class is extends de{get spaceKey(){return ss.isHoldSpaceKey()}get left(){return rs.left(this)}get right(){return rs.right(this)}get middle(){return rs.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){ot.changeName(t,e)}}var os;exports.PointerEvent=class extends is{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent=gt([ie()],exports.PointerEvent),exports.DragEvent=class extends exports.PointerEvent{},exports.DragEvent.DRAG="drag",exports.DragEvent.START="drag.start",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=gt([ie()],exports.DragEvent),exports.DropEvent=os=class extends exports.PointerEvent{static setList(t){os.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}},exports.DropEvent.DROP="drop",exports.DropEvent=os=gt([ie()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.MOVE="move",exports.MoveEvent.START="move.start",exports.MoveEvent.END="move.end",exports.MoveEvent=gt([ie()],exports.MoveEvent),exports.RotateEvent=class extends is{},exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.END="rotate.end",exports.RotateEvent=gt([ie()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=gt([ie()],exports.SwipeEvent),exports.ZoomEvent=class extends is{},exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=gt([ie()],exports.ZoomEvent),exports.KeyEvent=class extends is{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.PRESS="key.press",exports.KeyEvent.UP="key.up",exports.KeyEvent=gt([ie()],exports.KeyEvent);class ns{constructor(t){this.options=t}load(e,s){return ft(this,void 0,void 0,(function*(){return t.origin.loadImage(this.options.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,e&&e(this)})).catch((t=>{s&&s(t)}))}))}getCanvas(e,s,r,i){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),o}destory(){this.view=null,this.options=null}}class as{constructor(t){this.taskTime=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(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 hs=Z.get("TaskProcessor");class ls{get isComplete(){return this._isComplete}get running(){return this._running}get percent(){const{total:t}=this;let e=0,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].taskTime,r===this.finishedIndex&&(e=s)):e+=this.list[r].taskTime;return this._isComplete?1:s/e}get total(){return this.list.length}get finishedIndex(){return this._isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this._isComplete?this.total:this.total-this.finishedIndex}constructor(t){this.config={parallel:6},this.list=[],this.index=0,t&&ct.assign(this.config,t),this.init()}init(){this.empty(),this._running=!1,this._isComplete=!0}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){clearTimeout(this._timer),this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){clearTimeout(this._timer),this._running=!1,this._isComplete=!0,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new as(t),e)}addParallel(t,e){const s=new as(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new as(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.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}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.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this._running)return;r<this.total&&(t=this.list[r],t.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}nextTask(){this.total===this.finishedIndex?this.onComplete():this._timer=setTimeout((()=>this.run()),0)}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){hs.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destory(){this.empty(),this.config={}}}class ds{constructor(t,e){this.map={},this.leafer=t,this.tasker=new ls}get(t){let s=this.map[t.url];return s||(s=e.image(t),this.map[t.url]=s),s}load(t,e,s){this.tasker.addParallel((()=>ft(this,void 0,void 0,(function*(){return yield t.load(e,s)})))),this.tasker.running||this.tasker.start()}destory(){this.leafer=null,this.map=null}}const cs={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ps={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},us=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},ps),_s={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},gs={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},fs=Object.assign(Object.assign({},gs),ps),xs=us,ys={};for(let t in xs)ys[xs[t]]=t;const vs={};for(let t in xs)vs[xs[t]]=_s[t];const ms={drawRoundRect(t,e,s,r,o,n){let[a,h,l,d]=i.fourNumber(n);const c=Math.min(r/2,o/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+r,s,e+r,s+o,h):t.lineTo(e+r,s),l?t.arcTo(e+r,s+o,e,s+o,l):t.lineTo(e+r,s+o),d?t.arcTo(e,s+o,e,s,d):t.lineTo(e,s+o),a?t.arcTo(e,s,e+r,s,a):t.lineTo(e,s)}},{sin:ws,cos:Es,atan2:bs,ceil:Bs,abs:ks,PI:Ts}=Math,{setPoint:Ps,addPoint:Cs}=R,{set:Rs}=k,Ls={},Ss={rect(t,e,s,r,i){cs.creator.path=t,cs.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){cs.creator.path=[],ms.drawRoundRect(cs.creator,e,s,r,i,o),t.push(...cs.convertToCanvasData(cs.creator.path,!0))},arcTo(t,e,s,r,i,h,l,d,c,p,u){const _=r-e,g=i-s,f=h-r,x=l-i;let y=bs(g,_),v=bs(x,f),m=v-y;if(m<0&&(m+=n),m===Ts||ks(_+g)<1e-12||ks(f+x)<1e-12)return t&&t.push(us.L,r,i),c&&(Ps(c,e,s),Cs(c,r,i)),u&&Rs(u,e,s),void(p&&Rs(p,r,i));const w=_*x-f*g<0,E=w?-1:1,b=d/Es(m/2),B=r+b*Es(y+m/2+a*E),k=i+b*ws(y+m/2+a*E);return y-=a*E,v-=a*E,Ms(t,B,k,d,d,0,y/o,v/o,w,c,p,u)},arc:(t,e,s,r,i,o,n,a,h,l)=>Ms(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,h,l,d,c,p,u,_){const g=h*o,f=ws(g),x=Es(g);let y=l*o,v=d*o;y>Ts&&(y-=n),v<0&&(v+=n);let m=v-y;m<0?m+=n:m>n&&(m-=n),c&&(m-=n);const w=Bs(ks(m/a)),E=m/w,b=ws(E/4),B=8/3*b*b/ws(E/2);v=y+E;let k,T,P,C,R,L,S,O,D=Es(y),M=ws(y),A=P=x*r*D-f*i*M,I=C=f*r*D+x*i*M,W=e+P,U=s+C;t&&t.push(us.L,W,U),p&&Ps(p,W,U),_&&Rs(_,W,U);for(let o=0;o<w;o++)k=Es(v),T=ws(v),P=x*r*k-f*i*T,C=f*r*k+x*i*T,R=e+A-B*(x*r*M+f*i*D),L=s+I-B*(f*r*M-x*i*D),S=e+P+B*(x*r*T+f*i*k),O=s+C+B*(f*r*T-x*i*k),t&&t.push(us.C,R,L,S,O,e+P,s+C),p&&Ds(e+A,s+I,R,L,S,O,e+P,s+C,p,!0),A=P,I=C,D=k,M=T,y=v,v+=E;u&&Rs(u,e+P,s+C)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(us.C,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Ds(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let c,p,u,_,g,f,x,y,v=t,m=s,w=i,E=n;for(let t=0;t<2;++t)if(1==t&&(v=e,m=r,w=o,E=a),c=-3*v+9*m-9*w+3*E,p=6*v-12*m+6*w,u=3*m-3*v,Math.abs(c)<1e-12){if(Math.abs(p)<1e-12)continue;_=-u/p,0<_&&_<1&&d.push(_)}else x=p*p-4*u*c,y=Math.sqrt(x),x<0||(g=(-p+y)/(2*c),0<g&&g<1&&d.push(g),f=(-p-y)/(2*c),0<f&&f<1&&d.push(f));l?Cs(h,t,e):Ps(h,t,e),Cs(h,n,a);for(let l=0,c=d.length;l<c;l++)Os(d[l],t,e,s,r,i,o,n,a,Ls),Cs(h,Ls.x,Ls.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,c=d*d*d,p=3*d*d*t,u=3*d*t*t,_=t*t*t;l.x=c*e+p*r+u*o+_*a,l.y=c*s+p*i+u*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return Os(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:Os,toTwoPointBounds:Ds,ellipse:Ms}=Ss,{sin:As,cos:Is,sqrt:Ws,atan2:Us}=Math,{ellipse:Ns}=Ss,Fs={ellipticalArc(t,e,s,r,i,a,h,l,d,c,p){const u=(d-e)/2,_=(c-s)/2,g=a*o,f=As(g),x=Is(g),y=-x*u-f*_,v=-x*_+f*u,m=r*r,w=i*i,E=v*v,b=y*y,B=m*w-m*E-w*b;let k=0;if(B<0){const t=Ws(1-B/(m*w));r*=t,i*=t}else k=(h===l?-1:1)*Ws(B/(m*E+w*b));const T=k*r*v/i,P=-k*i*y/r,C=Us((v-P)/i,(y-T)/r),R=Us((-v-P)/i,(-y-T)/r);let L=R-C;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const S=e+u+x*T-f*P,O=s+_+f*T+x*P,D=L<0?1:0;p?Ns(t,S,O,r,i,a,C/o,R/o,D):r!==i||a?t.push(us.G,S,O,r,i,a,C/o,R/o,D):t.push(us.O,S,O,r,C/o,R/o,D)}},{M:Hs,m:zs,L:js,l:Ys,H:Xs,h:Vs,V:Gs,v:qs,C:Ks,c:Zs,S:Qs,s:$s,Q:Js,q:tr,T:er,t:sr,A:rr,a:ir,Z:or,z:nr,N:ar,D:hr,X:lr,G:dr,F:cr,O:pr,P:ur,U:_r}=us,{rect:gr,roundRect:fr,arcTo:xr,arc:yr,ellipse:vr,quadraticCurveTo:mr}=Ss,{ellipticalArc:wr}=Fs,Er=Z.get("PathConvert"),br={},Br={current:{},stringify(t){let e,s,r,i=0,o=t.length,n="";for(;i<o;){s=t[i],e=vs[s],n+=s===r?" ":ys[s];for(let s=1;s<e;s++)n+=t[i+s],s===e-1||(n+=" ");r=s,i+=e}return n},parse(t,e){let s,r,i,o="";const n=[],a=e?fs:gs;for(let e=0,h=t.length;e<h;e++)r=t[e],K[r]?o+=r:us[r]?(o&&(Tr(n,Number(o)),o=""),kr.name=us[r],kr.length=_s[r],kr.index=0,Tr(n,kr.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&Tr(n,Number(o)),o=r):o&&(Tr(n,Number(o)),o=""),i=r;return o&&Tr(n,Number(o)),s?Br.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,c=0,p=t.length;const u=[];for(;c<p;){switch(i=t[c],i){case zs:t[c+1]+=a,t[c+2]+=h;case Hs:a=t[c+1],h=t[c+2],u.push(Hs,a,h),c+=3;break;case Vs:t[c+1]+=a;case Xs:a=t[c+1],u.push(js,a,h),c+=2;break;case qs:t[c+1]+=h;case Gs:h=t[c+1],u.push(js,a,h),c+=2;break;case Ys:t[c+1]+=a,t[c+2]+=h;case js:a=t[c+1],h=t[c+2],u.push(js,a,h),c+=3;break;case $s:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Qs;case Qs:n=o===Ks||o===Qs,l=n?2*a-s:t[c+1],d=n?2*h-r:t[c+2],s=t[c+1],r=t[c+2],a=t[c+3],h=t[c+4],u.push(Ks,l,d,s,r,a,h),c+=5;break;case Zs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,i=Ks;case Ks:s=t[c+3],r=t[c+4],a=t[c+5],h=t[c+6],u.push(Ks,t[c+1],t[c+2],s,r,a,h),c+=7;break;case sr:t[c+1]+=a,t[c+2]+=h,i=er;case er:n=o===Js||o===er,s=n?2*a-s:t[c+1],r=n?2*h-r:t[c+2],e?mr(u,a,h,s,r,t[c+1],t[c+2]):u.push(Js,s,r,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case tr:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,i=Js;case Js:s=t[c+1],r=t[c+2],e?mr(u,a,h,s,r,t[c+3],t[c+4]):u.push(Js,s,r,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ir:t[c+6]+=a,t[c+7]+=h;case rr:wr(u,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 nr:case or:u.push(or),c++;break;case ar:a=t[c+1],h=t[c+2],e?gr(u,a,h,t[c+3],t[c+4]):Pr(u,t,c,5),c+=5;break;case hr:a=t[c+1],h=t[c+2],e?fr(u,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Pr(u,t,c,9),c+=9;break;case lr:a=t[c+1],h=t[c+2],e?fr(u,a,h,t[c+3],t[c+4],t[c+5]):Pr(u,t,c,6),c+=6;break;case dr:vr(e?u:Pr(u,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,br),a=br.x,h=br.y,c+=9;break;case cr:e?vr(u,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Pr(u,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pr:yr(e?u:Pr(u,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,br),a=br.x,h=br.y,c+=7;break;case ur:e?yr(u,t[c+1],t[c+2],t[c+3],0,360,!1):Pr(u,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case _r:xr(e?u:Pr(u,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,br),a=br.x,h=br.y,c+=6;break;default:return Er.error(`command: ${i} [index:${c}]`,t),u}o=i}return u},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){kr.index===kr.length&&(kr.index=1,t.push(kr.name)),t.push(e),kr.index++}},{current:kr,pushData:Tr,copyData:Pr}=Br,{M:Cr,L:Rr,C:Lr,Q:Sr,Z:Or,N:Dr,D:Mr,X:Ar,G:Ir,F:Wr,O:Ur,P:Nr,U:Fr}=us,Hr={},zr={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Cr,e,s)},lineTo(t,e,s){t.push(Rr,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Lr,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Sr,e,s,r,i)},closePath(t){t.push(Or)},rect(t,e,s,r,i){t.push(Dr,e,s,r,i)},roundRect(t,e,s,r,o,n){if("number"==typeof n)t.push(Ar,e,s,r,o,n);else{const a=i.fourNumber(n);a?t.push(Mr,e,s,r,o,...a):t.push(Dr,e,s,r,o)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Wr,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ir,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Nr,e,s,r):(void 0===o&&(o=360),t.push(Ur,e,s,r,i,o,n?1:0))},moveToEllipse(t,e,s,r,i,o,n,a,h){void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=360),Ss.ellipse(null,e,s,r,i,o,n,a,h,null,null,Hr),t.push(Cr,Hr.x,Hr.y),jr(t,e,s,r,i,o,n,a,h)},moveToArc(t,e,s,r,i,o,n){void 0===i&&(i=0),void 0===o&&(o=360),Ss.arc(null,e,s,r,i,o,n,null,null,Hr),t.push(Cr,Hr.x,Hr.y),Yr(t,e,s,r,i,o,n)},arcTo(t,e,s,r,i,o){t.push(Fr,e,s,r,i,o)}},{ellipse:jr,arc:Yr}=zr,{moveTo:Xr,lineTo:Vr,quadraticCurveTo:Gr,bezierCurveTo:qr,closePath:Kr,beginPath:Zr,rect:Qr,roundRect:$r,ellipse:Jr,arc:ti,arcTo:ei,moveToEllipse:si,moveToArc:ri}=zr;class ii{constructor(t){this.path=t?"string"==typeof t?cs.parse(t):t:[]}beginPath(){return Zr(this.path),this}moveTo(t,e){return Xr(this.path,t,e),this}lineTo(t,e){return Vr(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return qr(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Gr(this.path,t,e,s,r),this}closePath(){return Kr(this.path),this}rect(t,e,s,r){return Qr(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return $r(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,n,a){return Jr(this.path,t,e,s,r,i,o,n,a),this}arc(t,e,s,r,i,o){return ti(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return ei(this.path,t,e,s,r,i),this}moveToEllipse(t,e,s,r,i,o,n,a){return si(this.path,t,e,s,r,i,o,n,a),this}moveToArc(t,e,s,r,i,o){return ri(this.path,t,e,s,r,i,o),this}}const{M:oi,L:ni,C:ai,Q:hi,Z:li,N:di,D:ci,X:pi,G:ui,F:_i,O:gi,P:fi,U:xi}=us,yi=Z.get("PathDrawer"),vi={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case oi:t.moveTo(e[r+1],e[r+2]),r+=3;break;case ni:t.lineTo(e[r+1],e[r+2]),r+=3;break;case ai:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case hi:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case li:t.closePath(),r+=1;break;case di:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ci:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case pi:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case ui:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*o,e[r+6]*o,e[r+7]*o,e[r+8]),r+=9;break;case _i:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,n,!1),r+=5;break;case gi:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*o,e[r+5]*o,e[r+6]),r+=7;break;case fi:t.arc(e[r+1],e[r+2],e[r+3],0,n,!1),r+=4;break;case xi:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void yi.error(`command: ${s} [index:${r}]`,e)}}},{M:mi,L:wi,C:Ei,Q:bi,Z:Bi,N:ki,D:Ti,X:Pi,G:Ci,F:Ri,O:Li,P:Si,U:Oi}=us,{toTwoPointBounds:Di,toTwoPointBoundsByQuadraticCurve:Mi,arcTo:Ai,arc:Ii,ellipse:Wi}=Ss,{add:Ui,copy:Ni,addPoint:Fi,setPoint:Hi,addBounds:zi,toBounds:ji}=R,Yi=Z.get("PathBounds");let Xi,Vi,Gi;const qi={},Ki={},Zi={},Qi={toBounds(t,e){Qi.toTwoPointBounds(t,Ki),ji(Ki,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Hi(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Bi||s===Ei||s===bi?Hi(e,h,l):Hi(e,t[a+1],t[a+2])),s){case mi:case wi:h=t[a+1],l=t[a+2],Fi(e,h,l),a+=3;break;case Ei:o=t[a+5],n=t[a+6],Di(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,qi),Ui(e,qi),h=o,l=n,a+=7;break;case bi:r=t[a+1],i=t[a+2],o=t[a+3],n=t[a+4],Mi(h,l,r,i,o,n,qi),Ui(e,qi),h=o,l=n,a+=5;break;case Bi:a+=1;break;case ki:h=t[a+1],l=t[a+2],zi(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ti:case Pi:h=t[a+1],l=t[a+2],zi(e,h,l,t[a+3],t[a+4]),a+=s===Ti?9:6;break;case Ci:Wi(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],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=9;break;case Ri:h=t[a+1],l=t[a+2],Vi=t[a+3],Gi=t[a+4],zi(e,h-Vi,l-Gi,2*Vi,2*Gi),h+=Vi,a+=5;break;case Li:Ii(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=7;break;case Si:h=t[a+1],l=t[a+2],Xi=t[a+3],zi(e,h-Xi,l-Xi,2*Xi,2*Xi),h+=Xi,a+=4;break;case Oi:Ai(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],qi,Zi),0===a?Ni(e,qi):Ui(e,qi),h=Zi.x,l=Zi.y,a+=6;break;default:return void Yi.error(`command: ${s} [index:${a}]`,t)}}},$i={smooth:(t,e,s)=>t};cs.creator=new ii,cs.parse=Br.parse,cs.convertToCanvasData=Br.toCanvasData;const Ji=Z.get("plugin"),to={power:{},list:[]};function eo(t,e){const{power:s}=to;to.list.push(t);const r={};t.import?t.import.forEach((t=>{s[t]?r[t]=s[t]:Ji.error(t+" non-existent")})):Ji.warn("no import");try{t.run(r,e)}catch(t){Ji.error(t)}}class so{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(ve.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===ce.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new fe(fe.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(pe.CHANGE,this.__onAttrChange,this),t.on_([ce.ADD,ce.REMOVE],this.__onChildEvent,this),t.on_(fe.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:ro,updateAllWorldOpacity:io}=Ae,{pushAllChildBranch:oo,pushAllParent:no}=He;const{worldBounds:ao}=Fe,{setByListWithHandle:ho}=z;class lo{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){ho(this.beforeBounds,this.updatedList.list,ao)}setAfter(){ho(this.afterBounds,this.updatedList.list,ao),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:co,updateAllChange:po}=Ae,{pushAllBranchStack:uo,updateWorldBoundsByBranchStack:_o}=He,go=Z.get("Layouter");class fo{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(xe.START),this.layoutOnce(),t.emitEvent(new xe(xe.END,this.layoutedBlocks,this.times))}catch(t){go.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?go.warn("layouting"):this.times>3?go.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(fe.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:r}=this,{BEFORE:i,LAYOUT:o,AFTER:n}=xe,a=this.getBlocks(r);a.forEach((t=>{t.setBefore()})),s.emitEvent(new xe(i,a,this.times)),r.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(ro(t),e.push(t),t.isBranch&&oo(t,e),no(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),no(t,e)))}))}(r,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&io(t),t.__updateChange()}))}(r),a.forEach((t=>t.setAfter())),s.emitEvent(new xe(o,a,this.times)),s.emitEvent(new xe(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:r,AFTER:i}=xe,o=this.getBlocks(new ht(e));e.emitEvent(new xe(s,o,this.times)),fo.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new xe(r,o,this.times)),e.emitEvent(new xe(i,o,this.times)),this.addBlocks(o),J.end(t)}static fullLayout(t){if(co(t),t.isBranch){const e=[t];uo(t,e),_o(e)}else t.__updateWorldBounds();po(t)}createBlock(t){return new lo(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(xe.REQUEST,this.layout,this),t.on_(xe.AGAIN,this.layoutAgain,this),t.on_(fe.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const xo=Z.get("Renderer");class yo{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(xe.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new V,xo.log(e.innerName,"---\x3e");try{this.emitRender(ve.START),this.renderOnce(t),this.emitRender(ve.END,this.totalBounds)}catch(t){xo.error(t)}xo.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?xo.warn("rendering"):this.times>3?xo.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(ve.BEFORE),t()):(this.requestLayout(),this.emitRender(ve.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(ve.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ve.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return xo.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,r=t.getIntersect(s.bounds),i=t.includes(this.target.__world),o=(new V).copy(r);s.save(),i&&!Z.showRepaint?s.clear():(r.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(r,!0),s.clipWorld(r,!0)),this.__render(r,o),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(s),Z.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.render(),this.running&&this.target.emit(ye.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(xo.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new ve(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ve.REQUEST,this.update,this),t.on_(xe.END,this.__onLayoutEnd,this),t.on_(ve.AGAIN,this.renderAgain,this),t.on_(_e.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:vo}=z;class mo{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const r=s.through||!1,i=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,n=this.getBestMatchLeaf(),a=i?this.getPath(n):this.getHitablePath(n);return this.clear(),r?{path:a,leaf:n,throughPath:o.length?this.getThroughPath(o):a}:{path:a,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:r}=this.point,i={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],Ae.worldHittable(e)&&(this.hitChild(e,i),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,r=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(r.unshift(s),s.__.hitChildren);t--);return r}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let r,i,o;for(let t=0,n=s.length;t<n;t++){r=s[t],i=s[t+1];for(let t=0,s=r.length;t<s&&(o=r.list[t],!i||!i.has(o));t++)e.push(o)}return e}eachFind(t,e){let s,r;const{point:i}=this;for(let o=t.length-1;o>-1;o--)s=t[o],e&&!s.isMask||(r=vo(s.__world,i),s.isBranch?(r||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,i)):r&&this.hitChild(s,i))}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 wo{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new mo(t,this),this.__listenEvents()}getByPoint(e,s,r){return t.realtimeLayout&&this.target.emit(xe.CHECK_UPDATE),this.findPath.getByPoint(e,s,r)}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,r=this.innerIdList[t];return r||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,r=this.idList[t];return r||(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 r=0,i=s.length;r<i;r++){if(e(t=s[r]))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_(ce.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(e,{watcher:(t,e)=>new so(t,e),layouter:(t,e)=>new fo(t,e),renderer:(t,e,s)=>new yo(t,e,s),selector:(t,e)=>new wo(t,e)}),t.layout=fo.fullLayout;class Eo extends Tt{get allowBackgroundColor(){return!1}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){this.view=t.origin.createCanvas(this.width,this.height)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s}}class bo{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(exports.MoveEvent.START,this.moveData)}t.path=this.moveData.path,e.emit(exports.MoveEvent.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(exports.ZoomEvent.START,this.zoomData)}t.path=this.zoomData.path,e.emit(exports.ZoomEvent.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(exports.RotateEvent.START,this.rotateData)}t.path=this.rotateData.path,e.emit(exports.RotateEvent.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(exports.MoveEvent.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(exports.ZoomEvent.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(exports.RotateEvent.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Bo={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?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.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:ko.getSwipeDirection(k.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,r=s.length;t<r;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:r}=t;for(let t=0,i=r.length;t<i;t++)r[t].hasEvent(e)&&s.push(r[t]);return s}},ko=Bo,{getDragEventData:To,getDropEventData:Po,getSwipeEventData:Co,filterPathByEventType:Ro}=Bo;class Lo{constructor(t){this.interaction=t}setDragData(t){this.dragData=To(t,t,t)}getDragList(){return this.dragging?exports.DropEvent.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:r}=s;if(this.moving&&!rs.middle(t)&&!rs.left(t))return void s.pointerCancel();const{dragData:i}=this;if(!this.moving){const o=r.target.isLeafer&&s.config.move.dragEmpty;this.moving=(rs.middle(t)||ss.isHoldSpaceKey()||o)&&e,this.moving&&s.emit(exports.MoveEvent.START,i)}this.moving||this.dragStart(t,e);const{path:o,throughPath:n}=r;this.dragData=To(r,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?s.emit(exports.MoveEvent.MOVE,this.dragData):this.dragging&&(s.emit(exports.DragEvent.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=rs.left(t)&&e,this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Ro(this.dragData.path,exports.DragEvent.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,r=t.length;s<r;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=>{Ae.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:r}=t;s?r.indexAt(0)!==s.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,s),e.emit(exports.DragEvent.OVER,t,r)):e.emit(exports.DragEvent.OVER,t,r),this.dragOverPath=r}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:r}=t;e.emit(exports.DragEvent.ENTER,t,r,s),e.emit(exports.DragEvent.LEAVE,t,s,r),this.dragEnterPath=r}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:r,throughPath:i}=s,o=To(s,t,t);i&&(o.throughPath=i),o.path=r,this.moving&&e.emit(exports.MoveEvent.END,o),this.dragging&&(e.emit(exports.DragEvent.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:r}=s;if(k.getDistance(r,t)>s.config.pointer.swipeDistance){const t=Co(r,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Po(t,this.getDragList(),exports.DropEvent.dragData);e.path=this.dragEnterPath,this.interaction.emit(exports.DropEvent.DROP,e),this.interaction.emit(exports.DragEvent.LEAVE,t,this.dragEnterPath)}dragReset(){exports.DropEvent.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:r,dragOut:i}=e.config.move;if(!i||!r)return;const o=e.shrinkCanvasBounds,{x:n,y:a}=o,h=z.right(o),l=z.bottom(o),d=t.x<n?r:h<t.x?-r:0,c=t.y<a?r:l<t.y?-r:0;let p=0,u=0;this.autoMoveTimer=setInterval((()=>{p+=d,u+=c,k.move(s,d,c),k.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:p,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const So=["move","zoom","rotate"];function Oo(t,e,s,r,i){if(So.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Mo(t,i)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!s.path.has(o)&&o.__.hittable&&Do(o,e,s,r,i)}}function Do(t,e,s,r,i){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,r)&&!Mo(t,i)){s.phase=r?1:t===s.target?2:3;const i=ot.get(e,s);if(t.emitEvent(i,r),i.isStop)return!0}return!1}function Mo(t,e){return e&&e.has(t)}const{pathHasEventType:Ao}=Bo;class Io{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,r,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=r,this.defaultPath=new ht(e),this.transformer=new bo(this),this.dragger=new Lo(this),i&&(this.config=ct.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(exports.PointerEvent.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,r=this.selector.getByPoint(t,e,{through:s});r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,this.emit(exports.PointerEvent.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),rs.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(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=k.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:exports.PointerEvent.MOVE});t.path=e.path,this.emit(exports.PointerEvent.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(exports.PointerEvent.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(exports.PointerEvent.UP,t),this.emit(exports.PointerEvent.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(exports.PointerEvent.OUT,t,this.overPath),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.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(exports.PointerEvent.ENTER,t,e,this.enterPath),this.emit(exports.PointerEvent.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.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 r=Date.now()-this.downTime,i=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>Ao(t.path,e)));r<e.tapTime+50&&i?(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(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.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(exports.PointerEvent.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),Ao(t.path,exports.PointerEvent.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(_e.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,r){this.running&&function(t,e,s,r){if(!s&&!e.path)return;let i;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(i=s.list[o],Do(i,t,e,!0,r))return;i.isApp&&Oo(i,t,e,!0,r)}for(let o=0,n=s.length;o<n;o++)if(i=s.list[o],i.isApp&&Oo(i,t,e,!1,r),Do(i,t,e,!1,r))return}(t,e,s,r)}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)}}function Wo(s,r){if(!t.origin){if("skia"===s){const{Canvas:e,loadImage:s}=r;t.origin={createCanvas:(t,s,r)=>new e(t,s,r),canvasToDataURL:(t,e,s)=>t.toDataURLSync(e,{quality:s}),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(t,e,s)=>t.saveAs(e,{quality:s}),loadImage:s}}t.canvas=e.canvas()}}Object.assign(e,{canvas:(t,e)=>new Eo(t,e),image:t=>new ns(t),hitCanvas:(t,e)=>new Eo(t,e),interaction:(t,e,s,r)=>new Io(t,e,s,r)}),t.name="node",t.requestRender=function(t){setTimeout(t)},t.devicePixelRatio=1,t.conicGradientSupport=!0,t.realtimeLayout=!0;const Uo=Z.get("LeaferTypeCreator"),No={list:{},register(t,e){Fo[t]?Uo.repeat(t):Fo[t]=e},run(t,e){const s=No.list[t];s?s(e):Uo.error("no",t)}},{list:Fo}=No;No.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),No.register("design",(function(t){const{MOVE:e}=exports.MoveEvent,{ZOOM:s}=exports.ZoomEvent;t.__eventIds.push(t.on_(e,(e=>{Ae.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:r,max:i}=t.config.zoom;let{scale:o}=e;o*s<r?o=r/s:o*s>i&&(o=i/s),1!==o&&Ae.zoomOfWorld(t.zoomLayer,e,o)})))}));const Ho={},zo={},jo={},Yo={export(t,e,s){return new Promise((r=>{const{leafer:i}=t;i?i.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,o,n,{canvas:a}=i,{unreal:h}=a;switch(h&&(a=a.getSameCanvas(),a.backgroundColor=i.config.fill,i.__render(a,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(o=!0);break;case"number":t=s;break;case"boolean":o=s}n=e.includes(".")?yield a.saveAs(e,t):o?yield a.toBlob(e,t):a.toDataURL(e,t),r({data:n}),h&&a.recycle()})))):r({data:!1})}))}},{copy:Xo,toOffsetOutBounds:Vo}=z,Go={},qo={};function Ko(e,s,r,i){const{bounds:o,shapeBounds:n}=i;if(t.fullImageShadow){if(Xo(Go,e.bounds),Go.x+=s.x-n.x,Go.y+=s.y-n.y,r){const{matrix:t}=i;Go.x-=(o.x+(t?t.e:0)+o.width/2)*(r-1),Go.y-=(o.y+(t?t.f:0)+o.height/2)*(r-1),Go.width*=r,Go.height*=r}e.copyWorld(i.canvas,e.bounds,Go)}else r&&(Xo(Go,s),Go.x-=s.width/2*(r-1),Go.y-=s.height/2*(r-1),Go.width*=r,Go.height*=r),e.copyWorld(i.canvas,n,r?Go:s)}const{toOffsetOutBounds:Zo}=z,Qo={};var $o=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:r}=t.__;s.setWorldBlur(r*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s){let r,i;const{__world:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:p}=s,u=e.getSameCanvas(),_=a.length-1;Zo(l,Qo),a.forEach(((t,a)=>{u.save(),u.setWorldShadow(Qo.offsetX+t.x*c,Qo.offsetY+t.y*p,t.blur*c),i=t.spread?1-2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,Ko(u,Qo,i,s),u.restore(),h?(u.copyWorld(u,l,o,"copy"),u.copyWorld(h,o,o,"source-out"),r=o):(u.copyWorld(s.canvas,d,l,"source-out"),r=l),u.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(u,r,n.renderBounds,t.blendMode),_&&a<_&&u.clear()})),u.recycle()},shadow:function(t,e,s){let r,i;const{__world:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:p}=s,u=e.getSameCanvas(),_=a.length-1;Vo(l,qo),a.forEach(((t,a)=>{u.setWorldShadow(qo.offsetX+t.x*c,qo.offsetY+t.y*p,t.blur*c,t.color),i=t.spread?1+2*t.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,Ko(u,qo,i,s),r=l,t.box&&(u.restore(),u.save(),h&&(u.copyWorld(u,l,o,"copy"),r=o),h?u.copyWorld(h,o,o,"destination-out"):u.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(u,r,n.renderBounds,t.blendMode),_&&a<_&&u.clear()})),u.recycle()}});function Jo(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[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)})),i&&e.fillRect(s.x,s.y+i,s.width,o)}function tn(t,e,s){const{strokeAlign:r}=t.__;switch(r){case"center":e.setStroke(s,t.__.strokeWidth,t.__),on(t,e);break;case"inside":en(t,e,s,"inside");break;case"outside":en(t,e,s,"outside")}}function en(t,e,s,r){const{strokeWidth:i,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(s,2*i,t.__),n.font=o,on(t,n),n.blendMode="outside"===r?"destination-out":"destination-in",Jo(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}function sn(t,e,s){const{strokeAlign:r}=t.__;switch(r){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),rn(t,s,e);break;case"inside":en(t,e,s,"inside");break;case"outside":!function(t,e,s,r){const{strokeWidth:i,__font:o}=t.__,n=e.getSameCanvas(!0);n.setStroke(void 0,2*i,t.__),n.font=o,rn(t,s,n),n.blendMode="outside"===r?"destination - out":"destination -in ",Jo(t,n),n.blendMode="normal",e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}(t,e,s,"outside")}}function rn(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),on(t,s),s.restoreBlendMode()):on(t,s)}))}function on(t,e){let s;const{rows:r,decorationY:i,decorationHeight:o}=t.__.__textDrawData;for(let t=0,n=r.length;t<n;t++)s=r[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)})),i&&e.strokeRect(s.x,s.y+i,s.width,o)}function nn(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:an,getOuterOf:hn,getByMove:ln,getIntersectData:dn}=z;const cn={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}},{get:pn,rotateOfOuter:un,translate:_n,scaleOfOuter:gn,scale:fn,rotate:xn}=f;function yn(e,s,r,i){const{type:o,blendMode:n}=r;let a={type:o,style:"rgba(255,255,255,0)"};n&&(a.blendMode=n);const{imageManager:h}=e.leafer,l=h.get(r);if(l.ready){if(!vn(e,l)){let e,{opacity:s,mode:o,offset:n,scale:h,rotation:d}=r,{width:c,height:p}=l;const u=i.width===c&&i.height===p;switch(o){case"strench":u||(c=i.width,p=i.height),(i.x||i.y)&&(e=pn(),_n(e,i.x,i.y));break;case"clip":(n||h||d)&&(e=function(t,e,s,r){const i=pn();_n(i,t.x,t.y),e&&_n(i,e.x,e.y);s&&("number"==typeof s?fn(i,s):fn(i,s.x,s.y));r&&xn(i,r);return i}(i,n,h,d));break;case"repeat":(!u||h||d)&&(e=function(t,e,s,r,i){const o=pn();if(i)switch(xn(o,i),i){case 90:_n(o,s,0);break;case 180:_n(o,e,s);break;case 270:_n(o,0,e)}_n(o,t.x,t.y),r&&gn(o,t,r);return o}(i,c,p,h,d));break;default:u&&!d||(e=function(t,e,s,r,i){const o=pn(),n=i&&180!==i,a=e.width/(n?r:s),h=e.height/(n?s:r),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-r*l)/2;_n(o,d,c),fn(o,l),i&&un(o,{x:e.x+e.width/2,y:e.y+e.height/2},i);return o}(o,i,c,p,d))}a.style=function(e,s,r){let i=t.canvas.createPattern(e,r?"repeat":"no-repeat");if(s){const{a:t,b:e,c:r,d:o,e:n,f:a}=s;i.setTransform(new DOMMatrix([t,e,r,o,n,a]))}return i}(l.getCanvas(c,p,s),e,"repeat"===o)}}else h.load(l,(()=>{e.leafer&&(vn(e,l)||e.forceUpdate("width"),e.emitEvent(new ue(ue.LOADED,e,l,s,r)))}),(t=>{e.emitEvent(new ue(ue.ERROR,e,l,s,r,t))}));return a}function vn(t,e){let s;const{__:r}=t;return r&&(r.__getInput("width")||(s=!0,t.width=e.width),r.__getInput("height")||(s=!0,t.height=e.height)),s}const mn={x:.5,y:0},wn={x:.5,y:1};function En(t,e,s){let r;for(let i=0,o=e.length;i<o;i++)r=e[i],t.addColorStop(r.offset,cn.string(r.color,s))}const{set:bn,getAngle:Bn,getDistance:kn}=k,{get:Tn,rotateOfOuter:Pn,scaleOfOuter:Cn}=f,Rn={x:.5,y:.5},Ln={x:.5,y:1},Sn={},On={};const{set:Dn,getAngle:Mn,getDistance:An}=k,{get:In,rotateOfOuter:Wn,scaleOfOuter:Un}=f,Nn={x:.5,y:.5},Fn={x:.5,y:1},Hn={},zn={};function jn(t,e){let s,r=t.__.__input[e];const i=[];r instanceof Array||(r=[r]);for(let o=0,n=r.length;o<n;o++)s=Yn(t,r[o],e),s&&i.push(s);t.__["_"+e]=i.length?i:void 0}function Yn(e,s,r){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:i}=e.__layout;switch(s.type){case"solid":let{type:o,blendMode:n,color:a,opacity:h}=s;return{type:o,blendMode:n,style:cn.string(a,h)};case"image":return yn(e,r,s,i);case"linear":return function(e,s){let{from:r,to:i,type:o,blendMode:n,opacity:a}=e;r||(r=mn),i||(i=wn);const h=t.canvas.createLinearGradient(s.x+r.x*s.width,s.y+r.y*s.height,s.x+i.x*s.width,s.y+i.y*s.height);return En(h,e.stops,a),{type:o,blendMode:n,style:h}}(s,i);case"radial":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=Rn),i||(i=Ln);const{x:l,y:d,width:c,height:p}=s;let u;bn(Sn,l+r.x*c,d+r.y*p),bn(On,l+i.x*c,d+i.y*p),(c!==p||h)&&(u=Tn(),Cn(u,Sn,c/p*(h||1),1),Pn(u,Sn,Bn(Sn,On)+90));const _=t.canvas.createRadialGradient(Sn.x,Sn.y,0,Sn.x,Sn.y,kn(Sn,On));return En(_,e.stops,n),{type:o,blendMode:a,style:_,transform:u}}(s,i);case"angular":return function(e,s){let{from:r,to:i,type:o,opacity:n,blendMode:a,stretch:h}=e;r||(r=Nn),i||(i=Fn);const{x:l,y:d,width:c,height:p}=s;Dn(Hn,l+r.x*c,d+r.y*p),Dn(zn,l+i.x*c,d+i.y*p);const u=In(),_=Mn(Hn,zn);t.conicGradientRotate90?(Un(u,Hn,c/p*(h||1),1),Wn(u,Hn,_+90)):(Un(u,Hn,1,c/p*(h||1)),Wn(u,Hn,_));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,Hn.x,Hn.y):t.canvas.createRadialGradient(Hn.x,Hn.y,0,Hn.x,Hn.y,An(Hn,zn));return En(g,e.stops,n),{type:o,blendMode:a,style:g,transform:u}}(s,i);default:return s.r?{type:"solid",style:cn.string(s)}:void 0}}var Xn=Object.freeze({__proto__:null,computeFill:function(t){jn(t,"fill")},computeStroke:function(t){jn(t,"stroke")},drawText:Jo,drawTextStroke:on,fill:function(t,e,s){e.fillStyle=s,t.__.__font?Jo(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let r;const{windingRule:i,__font:o}=t.__;for(let n=0,a=s.length;n<a;n++)if(r=s[n],e.fillStyle=r.style,r.transform){e.save();const{a:s,b:n,c:a,d:h,e:l,f:d}=r.transform;e.transform(s,n,a,h,l,d),r.blendMode&&(e.blendMode=r.blendMode),o?Jo(t,e):e.fill(i),e.restore()}else r.blendMode?(e.saveBlendMode(r.blendMode),o?Jo(t,e):e.fill(i),e.restoreBlendMode()):o?Jo(t,e):e.fill(i)},shape:function(t,e,s){const r=e.getSameCanvas();let i,o,n,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))i=n=h,a=r;else{const{renderShapeSpread:r}=t.__layout,c=dn(r?an(e.bounds,r*l):e.bounds,h,s.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=o.a,d*=o.d),n=hn(h,o),i=ln(n,-o.e,-o.f),s.matrix&&o.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:o})}return t.__renderShape(r,s),{canvas:r,matrix:o,bounds:i,worldCanvas:a,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(n)tn(t,e,s);else switch(o){case"center":e.setStroke(s,i,r),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*i,r),e.clip(r.windingRule),e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);o.setStroke(s,2*i,t.__),t.__drawRenderPath(o),o.stroke(),o.clip(r.windingRule),o.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokeText:tn,strokes:function(t,e,s){const r=t.__,{strokeWidth:i,strokeAlign:o,__font:n}=r;if(n)sn(t,e,s);else switch(o){case"center":e.setStroke(void 0,i,r),nn(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*i,r),e.clip(r.windingRule),nn(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*i,t.__),nn(s,n),n.clip(r.windingRule),n.clearWorld(o),e.copyWorldToInner(n,t.__world,o),n.recycle()}},strokesText:sn});Object.assign(Ho,$o),Object.assign(zo,Xn);class Vn extends ut{setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:zo.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:zo.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Gn={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class qn extends Vn{}class Kn extends qn{get __boxStroke(){return!0}}class Zn extends Vn{get __boxStroke(){return!0}}const{parse:Qn}=Br;const $n={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Jn extends Zn{}function ta(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function ea(t){return(e,s)=>{Lt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const sa={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:r,strokeAlign:i,strokeWidth:n}=this.__;if((s||"all"===r)&&n&&"inside"!==i&&(e=t="center"===i?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,r="Line"!==this.__tag?1/Math.sin(e*o/2)*Math.sqrt(n)-t:0,i="none"===s?0:n;t+=Math.max(r,i)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=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)})),r&&(t=Math.max(t,r));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)})),i&&(o=Math.max(o,i)),this.__layout.renderShapeSpread=o,t}},ra={__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:r,windingRule:i}=this.__,o=s&&"path"===r||"all"===r;if(o&&e.hitFill(t,i))return!0;const{stroke:n,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=n&&"path"===a||"all"===a,c=2*t.radiusX;let p=2*(d?"center"===l?h/2:h:0)+c;if(!p)return!1;switch(l){case"inside":if(!o&&e.hitFill(t,i)&&e.hitStroke(t,p))return!0;p=c;break;case"outside":if(!o){if(!e.hitFill(t,i)&&e.hitStroke(t,p))return!0;p=c}}return!!p&&e.hitStroke(t,p)}},ia={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:r,backgroundBlur:i}=this.__;t.__useEffect=!!(e||s||r||i)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;this.__drawRenderPath(t),s&&zo.fill(this,t,s),i&&this.__drawAfterFill(t,e),r&&zo.stroke(this,t,r)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:r,__drawAfterFill:i}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const o=zo.shape(this,t,e),{shadow:n,innerShadow:a}=this.__;n&&Ho.shadow(this,t,o),s&&(this.__.__isFills?zo.fills(this,t,s):zo.fill(this,t,s)),i&&this.__drawAfterFill(t,e),a&&Ho.innerShadow(this,t,o),r&&(this.__.__isStrokes?zo.strokes(this,t,r):zo.stroke(this,t,r)),o.worldCanvas&&o.worldCanvas.recycle(),o.canvas.recycle()}else s&&(this.__.__isFills?zo.fills(this,t,s):zo.fill(this,t,s)),i&&this.__drawAfterFill(t,e),r&&(this.__.__isStrokes?zo.strokes(this,t,r):zo.stroke(this,t,r))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:r}=this.__;this.__drawRenderPath(t),s&&zo.fill(this,t,"#000000"),r&&zo.stroke(this,t,"#000000")}},oa={__drawFast(t,e){const{width:s,height:r,fill:i,stroke:o,__drawAfterFill:n}=this.__;if(i&&(t.fillStyle=i,t.fillRect(0,0,s,r)),n&&this.__drawAfterFill(t,e),o){const{strokeAlign:e,strokeWidth:i}=this.__;t.setStroke(o,i,this.__);const n=i/2;switch(e){case"center":t.strokeRect(0,0,s,r);break;case"inside":t.strokeRect(n,n,s-i,r-i);break;case"outside":t.strokeRect(-n,-n,s+i,r+i)}}}};exports.UI=class extends exports.Leaf{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Br.toCanvasData(e,!0):e:[]}getPathString(t){return Br.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&zo.computeFill(this),e&&zo.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?$i.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return Yo.export(this,t,e)}static one(t,e,s,r,i){return st.get(t.tag||this.prototype.__tag,t,e,s,r,i)}},gt([Vt(Vn)],exports.UI.prototype,"__",void 0),gt([St("")],exports.UI.prototype,"id",void 0),gt([St("")],exports.UI.prototype,"name",void 0),gt([St("")],exports.UI.prototype,"className",void 0),gt([Ft("pass-through")],exports.UI.prototype,"blendMode",void 0),gt([Ht(1)],exports.UI.prototype,"opacity",void 0),gt([Ht(!0)],exports.UI.prototype,"visible",void 0),gt([jt(!1)],exports.UI.prototype,"isMask",void 0),gt([Yt(!1)],exports.UI.prototype,"isEraser",void 0),gt([zt(0)],exports.UI.prototype,"zIndex",void 0),gt([St()],exports.UI.prototype,"locked",void 0),gt([Ot(0)],exports.UI.prototype,"x",void 0),gt([Ot(0)],exports.UI.prototype,"y",void 0),gt([At(100)],exports.UI.prototype,"width",void 0),gt([At(100)],exports.UI.prototype,"height",void 0),gt([Dt(1)],exports.UI.prototype,"scaleX",void 0),gt([Dt(1)],exports.UI.prototype,"scaleY",void 0),gt([Mt(0)],exports.UI.prototype,"rotation",void 0),gt([Mt(0)],exports.UI.prototype,"skewX",void 0),gt([Mt(0)],exports.UI.prototype,"skewY",void 0),gt([St(!1)],exports.UI.prototype,"draggable",void 0),gt([Xt(!0)],exports.UI.prototype,"hittable",void 0),gt([Xt("path")],exports.UI.prototype,"hitFill",void 0),gt([Ut("path")],exports.UI.prototype,"hitStroke",void 0),gt([Xt(!0)],exports.UI.prototype,"hitChildren",void 0),gt([Xt(!0)],exports.UI.prototype,"hitSelf",void 0),gt([Ft()],exports.UI.prototype,"fill",void 0),gt([Ut()],exports.UI.prototype,"stroke",void 0),gt([Ut("inside")],exports.UI.prototype,"strokeAlign",void 0),gt([Ut(1)],exports.UI.prototype,"strokeWidth",void 0),gt([Ut("none")],exports.UI.prototype,"strokeCap",void 0),gt([Ut("miter")],exports.UI.prototype,"strokeJoin",void 0),gt([Ut()],exports.UI.prototype,"dashPattern",void 0),gt([Ut()],exports.UI.prototype,"dashOffset",void 0),gt([Ut(10)],exports.UI.prototype,"miterLimit",void 0),gt([It()],exports.UI.prototype,"cornerRadius",void 0),gt([It()],exports.UI.prototype,"cornerSmoothing",void 0),gt([ta()],exports.UI.prototype,"shadow",void 0),gt([ta()],exports.UI.prototype,"innerShadow",void 0),gt([ta()],exports.UI.prototype,"blur",void 0),gt([ta()],exports.UI.prototype,"backgroundBlur",void 0),gt([ta()],exports.UI.prototype,"grayscale",void 0),gt([Jt(vi.drawPathByData)],exports.UI.prototype,"__drawPathByData",null),exports.UI=gt([se(sa),se(ra),se(ia),te()],exports.UI),exports.Group=class extends exports.UI{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){}removeAll(){}},gt([Vt(qn)],exports.Group.prototype,"__",void 0),exports.Group=gt([se(exports.Branch),re()],exports.Group),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:r,cornerRadius:i}=this.__;i?t.roundRect(0,0,s,r,i):t.rect(0,0,s,r)}},gt([Vt(Zn)],exports.Rect.prototype,"__",void 0),exports.Rect=gt([se(oa),re()],exports.Rect);const na=exports.Rect.prototype,aa=exports.Group.prototype,ha={},{copy:la,add:da}=z;exports.Box=class extends exports.Group{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;la(ha,t),super.__updateRenderBounds(),da(t,ha)}}__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([Vt(Kn)],exports.Box.prototype,"__",void 0),gt([Nt("show")],exports.Box.prototype,"overflow",void 0),gt([Jt(na.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),gt([Jt(na.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),gt([Jt(na.__updateBoxBounds)],exports.Box.prototype,"__updateBoxBounds",null),gt([Jt(na.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),gt([Jt(na.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),gt([Jt(na.__updateChange)],exports.Box.prototype,"__updateRectChange",null),gt([Jt(na.__drawPathByData)],exports.Box.prototype,"__drawPathByData",null),gt([Jt(na.__render)],exports.Box.prototype,"__renderRect",null),gt([Jt(aa.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=gt([te(),re()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}},gt([Vt(class extends Kn{})],exports.Frame.prototype,"__",void 0),gt([Nt("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=gt([re()],exports.Frame);const{moveTo:ca,closePath:pa,ellipse:ua}=zr;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:r,endAngle:i}=this.__,o=t/2,n=e/2,a=this.__.path=[];s?r||i?(s<1&&ua(a,o,n,o*s,n*s,0,r,i,!1),ua(a,o,n,o,n,0,i,r,!0),s<1&&pa(a)):(s<1&&(ua(a,o,n,o*s,n*s),ca(a,t,n)),ua(a,o,n,o,n,0,0,360,!0)):r||i?(ca(a,o,n),ua(a,o,n,o,n,0,r,i,!1),pa(a)):ua(a,o,n,o,n)}},gt([Vt(class extends Vn{get __boxStroke(){return!0}})],exports.Ellipse.prototype,"__",void 0),gt([It(0)],exports.Ellipse.prototype,"innerRadius",void 0),gt([It(0)],exports.Ellipse.prototype,"startAngle",void 0),gt([It(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=gt([re()],exports.Ellipse);const{sin:_a,cos:ga,PI:fa}=Math,{moveTo:xa,lineTo:ya,closePath:va}=zr;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,r=t/2,i=e/2,o=this.__.path=[];xa(o,r,0);for(let t=1;t<s;t++)ya(o,r+r*_a(2*t*fa/s),i-i*ga(2*t*fa/s));va(o)}},gt([Vt(class extends Vn{})],exports.Polygon.prototype,"__",void 0),gt([It(3)],exports.Polygon.prototype,"sides",void 0),exports.Polygon=gt([re()],exports.Polygon);const{sin:ma,cos:wa,PI:Ea}=Math,{moveTo:ba,lineTo:Ba,closePath:ka}=zr;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:r}=this.__,i=t/2,o=e/2,n=this.__.path=[];ba(n,i,0);for(let t=1;t<2*s;t++)Ba(n,i+(t%2==0?i:i*r)*ma(t*Ea/s),o-(t%2==0?o:o*r)*wa(t*Ea/s));ka(n)}},gt([Vt(class extends Vn{})],exports.Star.prototype,"__",void 0),gt([It(5)],exports.Star.prototype,"points",void 0),gt([It(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=gt([re()],exports.Star);const{moveTo:Ta,lineTo:Pa}=zr,{rotate:Ca,getAngle:Ra,getDistance:La,defaultPoint:Sa}=k,{setPoint:Oa,addPoint:Da,toBounds:Ma}=R,Aa={};exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Ca(s,e),this.__toPoint=s,s}set toPoint(t){this.width=La(Sa,t),this.rotation=Ra(Sa,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];Ta(t,0,0);const e=this.toPoint;Pa(t,e.x,e.y)}__updateBoxBounds(){Oa(Aa,0,0),Da(Aa,this.__toPoint.x,this.__toPoint.y),Ma(Aa,this.__layout.boxBounds)}},gt([Vt(class extends Vn{})],exports.Line.prototype,"__",void 0),gt([At()],exports.Line.prototype,"rotation",void 0),gt([Wt("center")],exports.Line.prototype,"strokeAlign",void 0),exports.Line=gt([re()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(ue.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}},gt([Vt(Jn)],exports.Image.prototype,"__",void 0),gt([At("")],exports.Image.prototype,"url",void 0),exports.Image=gt([re()],exports.Image),exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,r){t.__layout.checkUpdate();const i=new C(t.__world);i.invert();const o=new C;e&&o.translate(e.x,e.y),s&&("number"==typeof s?o.scale(s):o.scale(s.x,s.y)),r&&o.rotate(r),i.preMultiply(o),t.__render(this.canvas,{matrix:i}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:r,height:i}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,r,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}},gt([Vt(Jn)],exports.Canvas.prototype,"__",void 0),gt([ea(100)],exports.Canvas.prototype,"width",void 0),gt([ea(100)],exports.Canvas.prototype,"height",void 0),gt([ea(t.devicePixelRatio)],exports.Canvas.prototype,"pixelRatio",void 0),gt([ea(!0)],exports.Canvas.prototype,"smooth",void 0),gt([Xt("all")],exports.Canvas.prototype,"hitFill",void 0),exports.Canvas=gt([re()],exports.Canvas);const Ia=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Wa=Ia+"_#~&*+\\=|≮≯≈≠=…",Ua=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Na(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Fa=Na("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ha=Na("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),za=Na(Ia),ja=Na(Wa),Ya=Na("- —/~|┆·");var Xa;!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"}(Xa||(Xa={}));const{Letter:Va,Single:Ga,Before:qa,After:Ka,Symbol:Za,Break:Qa}=Xa;function $a(t){return Fa[t]?Va:Ya[t]?Qa:Ha[t]?qa:za[t]?Ka:ja[t]?Za:Ua.test(t)?Ga:Va}const Ja={trimRight(t){const{words:e}=t;let s,r=0,i=e.length;for(let o=i-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)r++,t.width-=s.width;r&&e.splice(i-r,r)}};function th(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:eh}=Ja,{Letter:sh,Single:rh,Before:ih,After:oh,Symbol:nh,Break:ah}=Xa;let hh,lh,dh,ch,ph,uh,_h,gh,fh,xh,yh,vh,mh,wh,Eh=[];function bh(t,e){hh.data.push({char:t,width:e}),dh+=e}function Bh(){ch+=dh,hh.width=dh,lh.words.push(hh),hh={data:[]},dh=0}function kh(){vh&&(mh.paraNumber++,lh.paraStart=!0,vh=!1),lh.width=ch,eh(lh),Eh.push(lh),lh.width>wh.width&&(wh.width=lh.width),lh={words:[]},ch=0}const Th=0,Ph=1,Ch=2;const Rh={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let r=0,o=0,{width:n,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=i.fourNumber(h);n&&(r=l,n-=e+l),a&&(o=t,a-=t+s)}const p={bounds:{x:r,y:o,width:n,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,r){mh=e,Eh=e.rows,wh=e.bounds;const{__letterSpacing:i,paraIndent:o,textCase:n}=r,{canvas:a}=t,{width:h,height:l}=wh;if(h||l||i||n){vh=!0,fh=null,dh=ch=0,hh={data:[]},lh={words:[]};for(let t=0,e=s.length;t<e;t++)uh=s[t],"\n"===uh?(dh&&Bh(),lh.paraEnd=!0,kh(),vh=!0):(gh=$a(uh),gh===sh&&"none"!==n&&(uh=th(uh,n,!dh)),_h=a.measureText(uh).width,i&&(_h+=i),xh=gh===rh&&(fh===rh||fh===sh)||fh===rh&&gh!==oh,yh=!(gh!==ih&&gh!==rh||fh!==nh&&fh!==oh),ph=vh&&o?h-o:h,h&&ch+dh+_h>ph&&(yh||(yh=gh===sh&&fh==oh),xh||yh||gh===ah||gh===ih||gh===rh||dh+_h>ph?(dh&&Bh(),kh()):kh())," "===uh&&ch+dh===0||(gh===ah?(" "===uh&&dh&&Bh(),bh(uh,_h),Bh()):xh||yh?(dh&&Bh(),bh(uh,_h)):bh(uh,_h)),fh=gh);dh&&Bh(),ch&&kh(),Eh.length>0&&(Eh[Eh.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{mh.paraNumber++,Eh.push({x:o||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(p,e,s),function(t,e){const{rows:s,bounds:r}=t,{__lineHeight:i,__baseLine:o,textAlign:n,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:p,width:u,height:_}=r,g=i*s.length+(h?h*(t.paraNumber-1):0),f=o;if(_){if("show"!==l&&g>_)g=Math.max(_,i),t.overflow=s.length;else switch(a){case"middle":p+=(_-g)/2;break;case"bottom":p+=_-g}f+=p}for(let e=0,r=s.length;e<r;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(u-d.width)/2;break;case"right":d.x+=u-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=i,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1)}r.y=p,r.height=g}(p,s),function(t,e,s,r){const{rows:i}=t,{textAlign:o,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,p;i.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===o&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?Th:l>.01?Ph:Ch,c===Ch?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===Ph?(p={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,p)," "!==p.char&&t.data.push(p)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(p,s,n),p.overflow&&function(e,s){const{rows:r,overflow:i}=e;if(r.splice(i),"hide"!==s){"ellipsis"===s&&(s="...");const o=t.canvas.measureText(s).width,n=r[i-1];let a,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,p=d+c-o;for(let t=l;t>-1&&(a=n.data[t],h=a.x+a.width,!(t===l&&h<p));t--){if(h<p&&" "!==a.char){n.data.splice(t+1),n.width-=a.width;break}n.width-=a.width}n.width+=o,n.data.push({char:s,x:h})}}(p,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(p,s),p}},{copyAndSpread:Lh,includes:Sh,spread:Oh}=z;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:r}=this.__;t.beginPath(),r.rows.forEach((r=>t.rect(r.x,r.y-s,r.width,e)))}__drawPathByData(t,e){const{x:s,y:r,width:i,height:o}=this.__layout.boxBounds;t.rect(s,r,i,o)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Rh.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:r,lineHeight:i,letterSpacing:o,fontFamily:n,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Gn.number(i,a),t.__letterSpacing=Gn.number(o,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,p=e.boxBounds;t.__lineHeight<a&&Oh(c,a/2),s&&r?super.__updateBoxBounds():(p.x=s?0:c.x,p.y=r?0:c.y,p.width=s||c.width,p.height=r||c.height);const u=Sh(p,c)?p:c;u!==e.contentBounds&&(e.contentBounds=u,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Lh(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}},gt([Vt(class extends Vn{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=$n[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],exports.Text.prototype,"__",void 0),gt([At(0)],exports.Text.prototype,"width",void 0),gt([At(0)],exports.Text.prototype,"height",void 0),gt([At(0)],exports.Text.prototype,"padding",void 0),gt([Wt("outside")],exports.Text.prototype,"strokeAlign",void 0),gt([At("")],exports.Text.prototype,"text",void 0),gt([At("L")],exports.Text.prototype,"fontFamily",void 0),gt([At(12)],exports.Text.prototype,"fontSize",void 0),gt([At("normal")],exports.Text.prototype,"fontWeight",void 0),gt([At(!1)],exports.Text.prototype,"italic",void 0),gt([At("none")],exports.Text.prototype,"textCase",void 0),gt([At("none")],exports.Text.prototype,"textDecoration",void 0),gt([At(0)],exports.Text.prototype,"letterSpacing",void 0),gt([At({type:"percent",value:150})],exports.Text.prototype,"lineHeight",void 0),gt([At(0)],exports.Text.prototype,"paraIndent",void 0),gt([At(0)],exports.Text.prototype,"paraSpacing",void 0),gt([At("left")],exports.Text.prototype,"textAlign",void 0),gt([At("top")],exports.Text.prototype,"verticalAlign",void 0),gt([At("show")],exports.Text.prototype,"textOverflow",void 0),exports.Text=gt([re()],exports.Text);const{toBounds:Dh}=Qi;exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){Dh(this.__.path,this.__layout.boxBounds)}},gt([Vt(class extends Vn{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Qn(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],exports.Path.prototype,"__",void 0),gt([It()],exports.Path.prototype,"path",void 0),gt([It()],exports.Path.prototype,"windingRule",void 0),gt([Wt("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=gt([re()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(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,r,i,o){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,i){return this}ellipse(t,e,s,r,i,o,n,a){return this}arc(t,e,s,r,i,o){return this}arcTo(t,e,s,r,i){return this}moveToEllipse(t,e,s,r,i,o,n,a){return this}moveToArc(t,e,s,r,i,o){return this}paint(){this.pathElement.forceUpdate("path")}},gt([Vt(class extends qn{})],exports.Pen.prototype,"__",void 0),exports.Pen=gt([se(ii,["beginPath"]),re()],exports.Pen);const Mh=Z.get("Leafer");exports.Leafer=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&this.imageManager.tasker.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let r;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:i}=this;No.run(i.type,this),this.canvas=e.canvas(i),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,i),this.watcher=e.watcher(this,i),this.layouter=e.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=this.canvas.view,s?(this.__bindApp(s),r=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,i)),this.canvasManager=new at,this.hitCanvasManager=new dt,this.imageManager=new ds(this,i),r=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(me.RESTART):this.emitLeafer(me.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(me.STOP))}resize(t){const e=ct.copyAttrs({},t,kt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new _e(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,kt),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const r=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),r(),this.viewLoaded||(s=this.on_("render.after",r))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(kt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&kt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,kt);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(me.BEFORE_READY),this.emitLeafer(me.READY),this.emitLeafer(me.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(me.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new me(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(me.START,(()=>J.end(t))),this.once(xe.END,(()=>this.__onReady())),this.once(ve.END,(()=>this.__onViewReady())),this.on(xe.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new me(me.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){Mh.error(t)}}},gt([Vt(class extends qn{})],exports.Leafer.prototype,"__",void 0),gt([At()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=gt([re()],exports.Leafer),exports.App=class extends exports.Leafer{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(pe.CHANGE,(()=>{Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new exports.Leafer(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(xe.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(ve.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(ve.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}},exports.App=gt([re()],exports.App);var Ah=Object.freeze({__proto__:null,Animate:jo,AnimateEvent:ye,get App(){return exports.App},AutoBounds:G,BezierHelper:Ss,Bounds:V,BoundsHelper:z,get Box(){return exports.Box},get Branch(){return exports.Branch},BranchHelper:He,BranchRender:Me,get Canvas(){return exports.Canvas},CanvasManager:at,ChildEvent:ce,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return exports.DragEvent},get DropEvent(){return exports.DropEvent},Effect:Ho,get Ellipse(){return exports.Ellipse},EllipseHelper:Fs,Event:de,EventCreator:ot,Export:Yo,FileHelper:_t,get Frame(){return exports.Frame},get Group(){return exports.Group},HitCanvasManager:dt,get Image(){return exports.Image},ImageEvent:ue,ImageManager:ds,IncrementId:s,get KeyEvent(){return exports.KeyEvent},Keyboard:ss,LayoutEvent:xe,Layouter:fo,get Leaf(){return exports.Leaf},LeafBounds:Ce,LeafBoundsHelper:Fe,LeafData:ut,LeafDataProxy:we,LeafEventer:he,LeafHelper:Ae,LeafHit:Se,LeafLevelList:lt,LeafList:ht,LeafMask:De,LeafMatrix:ke,LeafRender:Oe,get Leafer(){return exports.Leafer},LeaferCanvas:Eo,LeaferCanvasBase:Tt,LeaferEvent:me,LeaferImage:ns,LeaferImageBase:ns,LeaferTypeCreator:No,get Line(){return exports.Line},MathHelper:i,Matrix:C,MatrixHelper:f,get MoveEvent(){return exports.MoveEvent},NeedConvertToCanvasCommandMap:gs,OneRadian:o,PI2:n,PI_2:a,Paint:zo,get Path(){return exports.Path},PathBounds:Qi,PathCommandDataHelper:zr,PathCommandMap:us,PathConvert:Br,PathCorner:$i,PathCreator:ii,PathDrawer:vi,PathHelper:cs,PathNumberCommandLengthMap:vs,PathNumberCommandMap:ys,get Pen(){return exports.Pen},Platform:t,PluginManager:to,Point:P,PointHelper:k,PointerButton:rs,get PointerEvent(){return exports.PointerEvent},get Polygon(){return exports.Polygon},PropertyEvent:pe,get Rect(){return exports.Rect},RectHelper:ms,RectRender:oa,RenderEvent:ve,Renderer:yo,ResizeEvent:_e,get RotateEvent(){return exports.RotateEvent},Run:J,Selector:wo,get Star(){return exports.Star},StringNumberMap:K,get SwipeEvent(){return exports.SwipeEvent},TaskItem:as,TaskProcessor:ls,get Text(){return exports.Text},TransformEvent:ge,TwoPointBounds:q,TwoPointBoundsHelper:R,get UI(){return exports.UI},UIBounds:sa,UICreator:st,UIEvent:is,UIHit:ra,UIRender:ia,WaitHelper:Ye,WatchEvent:fe,Watcher:so,get ZoomEvent(){return exports.ZoomEvent},affectRenderBoundsType:Nt,affectStrokeBoundsType:Wt,aliasType:Rt,boundsType:At,canvasSizeAttrs:kt,dataProcessor:Vt,dataType:St,defineDataProcessor:Kt,defineKey:Pt,defineLeafAttr:Lt,effectType:ta,eraserType:Yt,getDescriptor:Ct,hitType:Xt,layoutProcessor:Gt,maskType:jt,opacityType:Ht,pathType:It,positionType:Ot,registerUI:re,registerUIEvent:ie,resizeType:ea,rewrite:Jt,rewriteAble:te,rotationType:Mt,scaleType:Dt,setDefaultValue:qt,sortType:zt,strokeType:Ut,surfaceType:Ft,useCanvas:Wo,useModule:se,usePlugin:eo});to.power=Ah,exports.Animate=jo,exports.AnimateEvent=ye,exports.AutoBounds=G,exports.BezierHelper=Ss,exports.Bounds=V,exports.BoundsHelper=z,exports.BranchHelper=He,exports.BranchRender=Me,exports.CanvasManager=at,exports.ChildEvent=ce,exports.Creator=e,exports.DataHelper=ct,exports.Debug=Z,exports.Effect=Ho,exports.EllipseHelper=Fs,exports.Event=de,exports.EventCreator=ot,exports.Export=Yo,exports.FileHelper=_t,exports.HitCanvasManager=dt,exports.ImageEvent=ue,exports.ImageManager=ds,exports.IncrementId=s,exports.Keyboard=ss,exports.LayoutEvent=xe,exports.Layouter=fo,exports.LeafBounds=Ce,exports.LeafBoundsHelper=Fe,exports.LeafData=ut,exports.LeafDataProxy=we,exports.LeafEventer=he,exports.LeafHelper=Ae,exports.LeafHit=Se,exports.LeafLevelList=lt,exports.LeafList=ht,exports.LeafMask=De,exports.LeafMatrix=ke,exports.LeafRender=Oe,exports.LeaferCanvas=Eo,exports.LeaferCanvasBase=Tt,exports.LeaferEvent=me,exports.LeaferImage=ns,exports.LeaferImageBase=ns,exports.LeaferTypeCreator=No,exports.MathHelper=i,exports.Matrix=C,exports.MatrixHelper=f,exports.NeedConvertToCanvasCommandMap=gs,exports.OneRadian=o,exports.PI2=n,exports.PI_2=a,exports.Paint=zo,exports.PathBounds=Qi,exports.PathCommandDataHelper=zr,exports.PathCommandMap=us,exports.PathConvert=Br,exports.PathCorner=$i,exports.PathCreator=ii,exports.PathDrawer=vi,exports.PathHelper=cs,exports.PathNumberCommandLengthMap=vs,exports.PathNumberCommandMap=ys,exports.Platform=t,exports.PluginManager=to,exports.Point=P,exports.PointHelper=k,exports.PointerButton=rs,exports.PropertyEvent=pe,exports.RectHelper=ms,exports.RectRender=oa,exports.RenderEvent=ve,exports.Renderer=yo,exports.ResizeEvent=_e,exports.Run=J,exports.Selector=wo,exports.StringNumberMap=K,exports.TaskItem=as,exports.TaskProcessor=ls,exports.TransformEvent=ge,exports.TwoPointBounds=q,exports.TwoPointBoundsHelper=R,exports.UIBounds=sa,exports.UICreator=st,exports.UIEvent=is,exports.UIHit=ra,exports.UIRender=ia,exports.WaitHelper=Ye,exports.WatchEvent=fe,exports.Watcher=so,exports.affectRenderBoundsType=Nt,exports.affectStrokeBoundsType=Wt,exports.aliasType=Rt,exports.boundsType=At,exports.canvasSizeAttrs=kt,exports.dataProcessor=Vt,exports.dataType=St,exports.defineDataProcessor=Kt,exports.defineKey=Pt,exports.defineLeafAttr=Lt,exports.effectType=ta,exports.eraserType=Yt,exports.getDescriptor=Ct,exports.hitType=Xt,exports.layoutProcessor=Gt,exports.maskType=jt,exports.opacityType=Ht,exports.pathType=It,exports.positionType=Ot,exports.registerUI=re,exports.registerUIEvent=ie,exports.resizeType=ea,exports.rewrite=Jt,exports.rewriteAble=te,exports.rotationType=Mt,exports.scaleType=Dt,exports.setDefaultValue=qt,exports.sortType=zt,exports.strokeType=Ut,exports.surfaceType=Ft,exports.useCanvas=Wo,exports.useModule=se,exports.usePlugin=eo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/node",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "@leafer-ui/node",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -24,9 +24,9 @@
24
24
  "leaferjs"
25
25
  ],
26
26
  "dependencies": {
27
- "@leafer/node": "1.0.0-beta.5",
28
- "@leafer-ui/core": "1.0.0-beta.5",
29
- "@leafer-ui/interface": "1.0.0-beta.5",
30
- "@leafer/interface": "1.0.0-beta.5"
27
+ "@leafer/node": "1.0.0-beta.7",
28
+ "@leafer-ui/core": "1.0.0-beta.7",
29
+ "@leafer-ui/interface": "1.0.0-beta.7",
30
+ "@leafer/interface": "1.0.0-beta.7"
31
31
  }
32
32
  }