@leafer-ui/worker 1.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/global.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +30 -0
- package/src/global.ts +5 -0
- package/src/index.d.ts +4 -0
- package/src/index.ts +5 -0
- package/src/worker.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present, Chao (Leafer) Wan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @leafer-ui/worker
|
package/dist/global.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={imageSuffix:"leaf"},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]}},a=Math.PI/180,n=2*Math.PI,o=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,a=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=a,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=a),i=h(e),{a:r,b:n,c:o,d:d}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=o*s-d*i,t.d=o*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=a,t.a=i+n*s,t.b=r+o*s),e&&(e*=a,t.c=n+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:a,e:n,f:o}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*a,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*a,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*a+o},preMultiply(t,e){const{a:s,b:i,c:r,d:a,e:n,f:o}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+a*e.c,t.d=r*e.b+a*e.d),t.e=n*e.a+o*e.c+e.e,t.f=n*e.b+o*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:a,f:n}=t,o=1/(e*r-s*i);t.a=r*o,t.b=-s*o,t.c=-i*o,t.d=e*o,t.e=-(a*r-n*i)*o,t.f=-(n*e-a*s)*o},toOuterPoint(t,e,s,i){const{x:r,y:a}=e;s||(s=e),s.x=r*t.a+a*t.c,s.y=r*t.b+a*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:a}=e,{a:n,b:o,c:h,d:l}=t,d=1/(n*l-o*h);if(s||(s=e),s.x=(r*l-a*h)*d,s.y=(a*n-r*o)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*n-e*o)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,o=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;n=u(i),o=t/n;const r=e/n;h=s>0?d(r):-d(r),l=c(g/i)/a}else{const e=i*i+r*r;o=u(e),n=t/o;const s=i/o;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/a}h/=a}return{x:t.e,y:t.f,scaleX:n,scaleY:o,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:k}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=C.defaultPoint);const i=x(e*a),r=w(e*a),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=C;return C.copy(s,t),C.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>C.getAtan2(t,e)/a,getAtan2:(t,e)=>k(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=C.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){C.reset(t)}},C=E;class R{constructor(t,e){"object"==typeof t?E.copy(this,t):E.set(this,t,e)}set(t,e){E.set(this,t,e)}copy(t){return E.copy(this,t),this}clone(){return new R(this)}rotate(t,e){return E.rotate(this,t,e),this}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return E.getCenter(this,t)}getDistance(t){return E.getDistance(this,t)}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){E.reset(this)}}class T{constructor(t,e,s,i,r,a){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,a)}set(t,e,s,i,r,a){f.set(this,t,e,s,i,r,a)}copy(t){return f.copy(this,t),this}clone(){return new T(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 O={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){L(t,e,s),L(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:L}=O,{tempPointBounds:P,setPoint:S,addPoint:A,toBounds:D}=O,{toOuterPoint:M}=f;let I,W,N,F;const U={},H={},Y={tempBounds:{},set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){z.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),z.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(z.right(s)-t.x),e.offsetY=-(z.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),z.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(z.copy(z.tempBounds,t),z.toOuterOf(z.tempBounds,e),z.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),z.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else U.x=t.x,U.y=t.y,M(e,U,H),S(P,H.x,H.y),U.x=t.x+t.width,M(e,U,H),A(P,H.x,H.y),U.y=t.y+t.height,M(e,U,H),A(P,H.x,H.y),U.x=t.x,M(e,U,H),A(P,H.x,H.y),D(P,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return z.copyAndSpread(s,t,e),s},spread(t,e){z.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){I=t.x+t.width,W=t.y+t.height,N=e.x+e.width,F=e.y+e.height,I=I>N?I:N,W=W>F?W:F,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){z.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){z.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){z.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,a=!0;for(let n=0,o=e.length;n<o;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(a?(a=!1,i||X(t,r)):j(t,r));a&&z.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?S(P,t.x,t.y):A(P,t.x,t.y)})),D(P,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=E.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=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=z.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=z.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){s&&(e=z.tempToOuterOf(e,s));let{x:i,y:r,width:a,height:n}=e;return I=i+a,W=r+n,N=t.x+t.width,F=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<N?I:N,W=W<F?W:F,a=I-i,n=W-r,{x:i,y:r,width:a,height:n}},intersect(t,e,s){z.copy(t,z.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){z.set(t)}},z=Y,{add:j,copy:X}=z;class V{constructor(t,e,s,i){"object"==typeof t?Y.copy(this,t):Y.set(this,t,e,s,i)}set(t,e,s,i){Y.set(this,t,e,s,i)}copy(t){return Y.copy(this,t),this}clone(){return new V(this)}scale(t){return Y.scale(this,t),this}toOuterOf(t,e){return Y.toOuterOf(this,t,e),this}getFitMatrix(t){return Y.getFitMatrix(this,t)}spread(t){return Y.spread(this,t),this}ceil(){return Y.ceil(this),this}add(t){return Y.add(this,t),this}addList(t){return Y.setByList(this,t,!0),this}setByList(t,e){return Y.setByList(this,t,e),this}addListWithHandle(t,e){return Y.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return Y.setByListWithHandle(this,t,e,s),this}setByPoints(t){return Y.setByPoints(this,t),this}hitPoint(t,e){return Y.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Y.hitRadiusPoint(this,t,e)}hit(t,e){return Y.hit(this,t,e)}includes(t,e){return Y.includes(this,t,e)}intersect(t,e){return Y.intersect(this,t,e),this}getIntersect(t,e){return new V(Y.getIntersectData(this,t,e))}isSame(t){return Y.isSame(this,t)}isEmpty(){return Y.isEmpty(this)}reset(){Y.reset(this)}}class G{constructor(t,e,s,i,r,a){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,a)}set(t=0,e=0,s=0,i=0,r=0,a=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=a}copy(t){const{top:e,right:s,bottom:i,left:r,width:a,height:n}=t;this.set(e,s,i,r,a,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:a,height:n}=this;return new V(r,e,a||t.width-r-s,n||t.height-e-i)}}const q={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1};class K{constructor(t){this.repeatMap={},this.name=t}static get(t){return new K(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){Q.enable&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}K.filterList=[],K.excludeList=[];const Q=K,Z=K.get("RunTime");class ${static start(t,e){const i=s.create(s.RUNTIME);return J.currentId=J.idMap[i]=e?performance.now():Date.now(),J.currentName=J.nameMap[i]=t,J.nameToIdMap[t]=i,i}static end(t,e){const s=J.idMap[t],i=J.nameMap[t];J.idMap[t]=J.nameMap[t]=J.nameToIdMap[i]=void 0,e?Z.log(i,performance.now()-s,"µs"):Z.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=J.nameToIdMap[t];void 0!==s&&J.end(s,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$,tt=K.get("UICreator"),et={list:{},register(t){const{__tag:e}=t.prototype;st[e]?tt.repeat(e):st[e]=t},get(t,e,s,i,r,a){const n=new st[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),a&&(n.height=a)),n}},{list:st}=et,it=K.get("EventCreator"),rt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(at[e]?it.repeat(e):at[e]=t)}))},changeName(t,e){const s=at[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,at[e]=s)}},get:(t,...e)=>new at[t](...e)},{nameList:at}=rt;class nt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ot{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ot;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class ht{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class lt extends nt{constructor(){super(...arguments),this.pathTypeList=new ot,this.imageTypeList=new ot}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.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const dt={default:(t,e)=>(ct(e,t),ct(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ct(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ct}=dt;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,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=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 pt(t,e,s,i){var r,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(n=(a<3?r(n):a>3?r(e,s,n):r(e,s))||n);return a>3&&n&&Object.defineProperty(e,s,n),n}function gt(t,e,s,i){return new(s||(s=Promise))((function(r,a){function n(t){try{h(i.next(t))}catch(t){a(t)}}function o(t){try{h(i.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,o)}h((i=i.apply(t,e||[])).next())}))}function ft(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const yt=[];function mt(){return(t,e)=>{yt.push(e)}}const vt=[];let wt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||vt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;yt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,a){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,a){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,a)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,a,n,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*o;i+=e,e=0,a+=t,o-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,a,n,o,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,a){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,a){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,a,n,o){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,a){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};pt([ft("imageSmoothingEnabled")],wt.prototype,"smooth",void 0),pt([ft("imageSmoothingQuality")],wt.prototype,"smoothLevel",void 0),pt([ft("globalAlpha")],wt.prototype,"opacity",void 0),pt([ft()],wt.prototype,"fillStyle",void 0),pt([ft()],wt.prototype,"strokeStyle",void 0),pt([ft("lineWidth")],wt.prototype,"strokeWidth",void 0),pt([ft("lineCap")],wt.prototype,"strokeCap",void 0),pt([ft("lineJoin")],wt.prototype,"strokeJoin",void 0),pt([ft("lineDashOffset")],wt.prototype,"dashOffset",void 0),pt([ft()],wt.prototype,"miterLimit",void 0),pt([ft()],wt.prototype,"shadowBlur",void 0),pt([ft()],wt.prototype,"shadowColor",void 0),pt([ft()],wt.prototype,"shadowOffsetX",void 0),pt([ft()],wt.prototype,"shadowOffsetY",void 0),pt([ft()],wt.prototype,"filter",void 0),pt([ft()],wt.prototype,"font",void 0),pt([ft()],wt.prototype,"fontKerning",void 0),pt([ft()],wt.prototype,"fontStretch",void 0),pt([ft()],wt.prototype,"fontVariantCaps",void 0),pt([ft()],wt.prototype,"textAlign",void 0),pt([ft()],wt.prototype,"textBaseline",void 0),pt([ft()],wt.prototype,"textRendering",void 0),pt([ft()],wt.prototype,"wordSpacing",void 0),pt([ft()],wt.prototype,"letterSpacing",void 0),pt([ft()],wt.prototype,"direction",void 0),pt([mt()],wt.prototype,"setTransform",null),pt([mt()],wt.prototype,"resetTransform",null),pt([mt()],wt.prototype,"getTransform",null),pt([mt()],wt.prototype,"save",null),pt([mt()],wt.prototype,"restore",null),pt([mt()],wt.prototype,"translate",null),pt([mt()],wt.prototype,"scale",null),pt([mt()],wt.prototype,"rotate",null),pt([mt()],wt.prototype,"fill",null),pt([mt()],wt.prototype,"stroke",null),pt([mt()],wt.prototype,"clip",null),pt([mt()],wt.prototype,"fillRect",null),pt([mt()],wt.prototype,"strokeRect",null),pt([mt()],wt.prototype,"clearRect",null),pt([mt()],wt.prototype,"beginPath",null),pt([mt()],wt.prototype,"moveTo",null),pt([mt()],wt.prototype,"lineTo",null),pt([mt()],wt.prototype,"bezierCurveTo",null),pt([mt()],wt.prototype,"quadraticCurveTo",null),pt([mt()],wt.prototype,"closePath",null),pt([mt()],wt.prototype,"arc",null),pt([mt()],wt.prototype,"arcTo",null),pt([mt()],wt.prototype,"ellipse",null),pt([mt()],wt.prototype,"rect",null),pt([mt()],wt.prototype,"roundRect",null),pt([mt()],wt.prototype,"createConicGradient",null),pt([mt()],wt.prototype,"createLinearGradient",null),pt([mt()],wt.prototype,"createPattern",null),pt([mt()],wt.prototype,"createRadialGradient",null),pt([mt()],wt.prototype,"fillText",null),pt([mt()],wt.prototype,"measureText",null),pt([mt()],wt.prototype,"strokeText",null);const xt=new V,bt={width:1,height:1,pixelRatio:1},Bt=K.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Et extends wt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:a,pixelRatio:n}=e;this.autoLayout=!r||!a,this.pixelRatio=n,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Bt.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(_t.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Bt.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),dt.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.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:a,c:n,d:o,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*a+t.b*o)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*a+t.d*o)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*a+t.f*o+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Y.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,xt.copy(t).scale(this.pixelRatio),this.fillRect(xt.x,xt.y,xt.width,xt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,xt.copy(t).scale(this.pixelRatio),this.strokeRect(xt.x,xt.y,xt.width,xt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){xt.copy(t).scale(this.pixelRatio),e&&xt.ceil(),this.clearRect(xt.x,xt.y,xt.width,xt.height)}clipWorld(t,e){this.beginPath(),xt.copy(t).scale(this.pixelRatio),e&&xt.ceil(),this.rect(xt.x,xt.y,xt.width,xt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,a={width:s,height:i,pixelRatio:r},n=this.manager?this.manager.get(a):e.canvas(a);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:a}=this;t&&(i+=t),s&&(r+=s);const n={width:i,height:r,pixelRatio:a},o=this.manager?this.manager.get(n):e.canvas(n);return o.save(),o}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ct={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Rt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Tt=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Rt),Ot={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Lt={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},Pt=Object.assign(Object.assign({},Lt),Rt),St=Tt,At={};for(let t in St)At[St[t]]=t;const Dt={};for(let t in St)Dt[St[t]]=Ot[t];const Mt={drawRoundRect(t,e,s,i,a,n){let[o,h,l,d]=r.fourNumber(n);const c=Math.min(i/2,a/2);o>c&&(o=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),o?t.moveTo(e+o,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+a,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+a,e,s+a,l):t.lineTo(e+i,s+a),d?t.arcTo(e,s+a,e,s,d):t.lineTo(e,s+a),o?t.arcTo(e,s,e+i,s,o):t.lineTo(e,s)}},{sin:It,cos:Wt,atan2:Nt,ceil:Ft,abs:Ut,PI:Ht}=Math,{setPoint:Yt,addPoint:zt}=O,{set:jt}=E,Xt={},Vt={rect(t,e,s,i,r){Ct.creator.path=t,Ct.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,a){Ct.creator.path=[],Mt.drawRoundRect(Ct.creator,e,s,i,r,a),t.push(...Ct.convertToCanvasData(Ct.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Nt(g,p),v=Nt(y,f),w=v-m;if(w<0&&(w+=n),w===Ht||Ut(p+g)<1e-12||Ut(f+y)<1e-12)return t&&t.push(Tt.L,i,r),c&&(Yt(c,e,s),zt(c,i,r)),_&&jt(_,e,s),void(u&&jt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Wt(w/2),k=i+B*Wt(m+w/2+o*b),E=r+B*It(m+w/2+o*b);return m-=o*b,v-=o*b,Kt(t,k,E,d,d,0,m/a,v/a,x,c,u,_)},arc:(t,e,s,i,r,a,n,o,h,l)=>Kt(t,e,s,i,i,0,r,a,n,o,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*a,f=It(g),y=Wt(g);let m=l*a,v=d*a;m>Ht&&(m-=n),v<0&&(v+=n);let w=v-m;w<0?w+=n:w>n&&(w-=n),c&&(w-=n);const x=Ft(Ut(w/o)),b=w/x,B=It(b/4),k=8/3*B*B/It(b/2);v=m+b;let E,C,R,T,O,L,P,S,A=Wt(m),D=It(m),M=R=y*i*A-f*r*D,I=T=f*i*A+y*r*D,W=e+R,N=s+T;t&&t.push(Tt.L,W,N),u&&Yt(u,W,N),p&&jt(p,W,N);for(let a=0;a<x;a++)E=Wt(v),C=It(v),R=y*i*E-f*r*C,T=f*i*E+y*r*C,O=e+M-k*(y*i*D+f*r*A),L=s+I-k*(f*i*D-y*r*A),P=e+R+k*(y*i*C+f*r*E),S=s+T+k*(f*i*C-y*r*E),t&&t.push(Tt.C,O,L,P,S,e+R,s+T),u&&qt(e+M,s+I,O,L,P,S,e+R,s+T,u,!0),M=R,I=T,A=E,D=C,m=v,v+=b;_&&jt(_,e+R,s+T)},quadraticCurveTo(t,e,s,i,r,a,n){t.push(Tt.C,(e+2*i)/3,(s+2*r)/3,(a+2*i)/3,(n+2*r)/3,a,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,a,n,o){qt(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(a+2*i)/3,r,a,n,o)},toTwoPointBounds(t,e,s,i,r,a,n,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=a,b=o),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?zt(h,t,e):Yt(h,t,e),zt(h,n,o);for(let l=0,c=d.length;l<c;l++)Gt(d[l],t,e,s,i,r,a,n,o,Xt),zt(h,Xt.x,Xt.y)},getPointAndSet(t,e,s,i,r,a,n,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*a+p*o,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,a,n,o,h){const l={};return Gt(t,e,s,i,r,a,n,o,h,l),l}},{getPointAndSet:Gt,toTwoPointBounds:qt,ellipse:Kt}=Vt,{sin:Qt,cos:Zt,sqrt:$t,atan2:Jt}=Math,{ellipse:te}=Vt,ee={ellipticalArc(t,e,s,i,r,o,h,l,d,c,u){const _=(d-e)/2,p=(c-s)/2,g=o*a,f=Qt(g),y=Zt(g),m=-y*_-f*p,v=-y*p+f*_,w=i*i,x=r*r,b=v*v,B=m*m,k=w*x-w*b-x*B;let E=0;if(k<0){const t=$t(1-k/(w*x));i*=t,r*=t}else E=(h===l?-1:1)*$t(k/(w*b+x*B));const C=E*i*v/r,R=-E*r*m/i,T=Jt((v-R)/r,(m-C)/i),O=Jt((-v-R)/r,(-m-C)/i);let L=O-T;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const P=e+_+y*C-f*R,S=s+p+f*C+y*R,A=L<0?1:0;u?te(t,P,S,i,r,o,T/a,O/a,A):i!==r||o?t.push(Tt.G,P,S,i,r,o,T/a,O/a,A):t.push(Tt.O,P,S,i,T/a,O/a,A)}},{M:se,m:ie,L:re,l:ae,H:ne,h:oe,V:he,v:le,C:de,c:ce,S:ue,s:_e,Q:pe,q:ge,T:fe,t:ye,A:me,a:ve,Z:we,z:xe,N:be,D:Be,X:ke,G:Ee,F:Ce,O:Re,P:Te,U:Oe}=Tt,{rect:Le,roundRect:Pe,arcTo:Se,arc:Ae,ellipse:De,quadraticCurveTo:Me}=Vt,{ellipticalArc:Ie}=ee,We=K.get("PathConvert"),Ne={},Fe={current:{dot:0},stringify(t){let e,s,i,r=0,a=t.length,n="";for(;r<a;){s=t[r],e=Dt[s],n+=s===i?" ":At[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,a="";const n=[],o=e?Pt:Lt;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?("."===i&&(Ue.dot++,Ue.dot>1&&(He(n,a),a="")),a+=i):Tt[i]?(a&&(He(n,a),a=""),Ue.name=Tt[i],Ue.length=Ot[i],Ue.index=0,He(n,Ue.name),!s&&o[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?a+=i:(a&&He(n,a),a=i):a&&(He(n,a),a=""),r=i;return a&&He(n,a),s?Fe.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,a,n,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ie:t[c+1]+=o,t[c+2]+=h;case se:o=t[c+1],h=t[c+2],_.push(se,o,h),c+=3;break;case oe:t[c+1]+=o;case ne:o=t[c+1],_.push(re,o,h),c+=2;break;case le:t[c+1]+=h;case he:h=t[c+1],_.push(re,o,h),c+=2;break;case ae:t[c+1]+=o,t[c+2]+=h;case re:o=t[c+1],h=t[c+2],_.push(re,o,h),c+=3;break;case _e:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=ue;case ue:n=a===de||a===ue,l=n?2*o-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],o=t[c+3],h=t[c+4],_.push(de,l,d,s,i,o,h),c+=5;break;case ce:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=de;case de:s=t[c+3],i=t[c+4],o=t[c+5],h=t[c+6],_.push(de,t[c+1],t[c+2],s,i,o,h),c+=7;break;case ye:t[c+1]+=o,t[c+2]+=h,r=fe;case fe:n=a===pe||a===fe,s=n?2*o-s:t[c+1],i=n?2*h-i:t[c+2],e?Me(_,o,h,s,i,t[c+1],t[c+2]):_.push(pe,s,i,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case ge:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=pe;case pe:s=t[c+1],i=t[c+2],e?Me(_,o,h,s,i,t[c+3],t[c+4]):_.push(pe,s,i,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case ve:t[c+6]+=o,t[c+7]+=h;case me:Ie(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case xe:case we:_.push(we),c++;break;case be:o=t[c+1],h=t[c+2],e?Le(_,o,h,t[c+3],t[c+4]):Ye(_,t,c,5),c+=5;break;case Be:o=t[c+1],h=t[c+2],e?Pe(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ye(_,t,c,9),c+=9;break;case ke:o=t[c+1],h=t[c+2],e?Pe(_,o,h,t[c+3],t[c+4],t[c+5]):Ye(_,t,c,6),c+=6;break;case Ee:De(e?_:Ye(_,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,Ne),o=Ne.x,h=Ne.y,c+=9;break;case Ce:e?De(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ye(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Re:Ae(e?_:Ye(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ne),o=Ne.x,h=Ne.y,c+=7;break;case Te:e?Ae(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ye(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Oe:Se(e?_:Ye(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ne),o=Ne.x,h=Ne.y,c+=6;break;default:return We.error(`command: ${r} [index:${c}]`,t),_}a=r}return _},copyData(t,e,s,i){for(let r=s,a=s+i;r<a;r++)t.push(e[r])},pushData(t,e){Ue.index===Ue.length&&(Ue.index=1,t.push(Ue.name)),t.push(Number(e)),Ue.index++,Ue.dot=0}},{current:Ue,pushData:He,copyData:Ye}=Fe,{M:ze,L:je,C:Xe,Q:Ve,Z:Ge,N:qe,D:Ke,X:Qe,G:Ze,F:$e,O:Je,P:ts,U:es}=Tt,ss={},is={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ze,e,s)},lineTo(t,e,s){t.push(je,e,s)},bezierCurveTo(t,e,s,i,r,a,n){t.push(Xe,e,s,i,r,a,n)},quadraticCurveTo(t,e,s,i,r){t.push(Ve,e,s,i,r)},closePath(t){t.push(Ge)},rect(t,e,s,i,r){t.push(qe,e,s,i,r)},roundRect(t,e,s,i,a,n){if("number"==typeof n)t.push(Qe,e,s,i,a,n);else{const o=r.fourNumber(n);o?t.push(Ke,e,s,i,a,...o):t.push(qe,e,s,i,a)}},ellipse(t,e,s,i,r,a,n,o,h){void 0===a?t.push($e,e,s,i,r):(void 0===n&&(n=0),void 0===o&&(o=360),t.push(Ze,e,s,i,r,a,n,o,h?1:0))},arc(t,e,s,i,r,a,n){void 0===r?t.push(ts,e,s,i):(void 0===a&&(a=360),t.push(Je,e,s,i,r,a,n?1:0))},moveToEllipse(t,e,s,i,r,a,n,o,h){void 0===a&&(a=0),void 0===n&&(n=0),void 0===o&&(o=360),Vt.ellipse(null,e,s,i,r,a,n,o,h,null,null,ss),t.push(ze,ss.x,ss.y),rs(t,e,s,i,r,a,n,o,h)},moveToArc(t,e,s,i,r,a,n){void 0===r&&(r=0),void 0===a&&(a=360),Vt.arc(null,e,s,i,r,a,n,null,null,ss),t.push(ze,ss.x,ss.y),as(t,e,s,i,r,a,n)},arcTo(t,e,s,i,r,a){t.push(es,e,s,i,r,a)}},{ellipse:rs,arc:as}=is,{moveTo:ns,lineTo:os,quadraticCurveTo:hs,bezierCurveTo:ls,closePath:ds,beginPath:cs,rect:us,roundRect:_s,ellipse:ps,arc:gs,arcTo:fs,moveToEllipse:ys,moveToArc:ms}=is;class vs{constructor(t){this.path=t?"string"==typeof t?Ct.parse(t):t:[]}beginPath(){return cs(this.path),this}moveTo(t,e){return ns(this.path,t,e),this}lineTo(t,e){return os(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,a){return ls(this.path,t,e,s,i,r,a),this}quadraticCurveTo(t,e,s,i){return hs(this.path,t,e,s,i),this}closePath(){return ds(this.path),this}rect(t,e,s,i){return us(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return _s(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,a,n,o){return ps(this.path,t,e,s,i,r,a,n,o),this}arc(t,e,s,i,r,a){return gs(this.path,t,e,s,i,r,a),this}arcTo(t,e,s,i,r){return fs(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,a,n,o){return ys(this.path,t,e,s,i,r,a,n,o),this}moveToArc(t,e,s,i,r,a){return ms(this.path,t,e,s,i,r,a),this}}const{M:ws,L:xs,C:bs,Q:Bs,Z:ks,N:Es,D:Cs,X:Rs,G:Ts,F:Os,O:Ls,P:Ps,U:Ss}=Tt,As=K.get("PathDrawer"),Ds={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case ws:t.moveTo(e[i+1],e[i+2]),i+=3;break;case xs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case bs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Bs:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ks:t.closePath(),i+=1;break;case Es:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Cs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Rs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ts:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*a,e[i+6]*a,e[i+7]*a,e[i+8]),i+=9;break;case Os:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,n,!1),i+=5;break;case Ls:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*a,e[i+5]*a,e[i+6]),i+=7;break;case Ps:t.arc(e[i+1],e[i+2],e[i+3],0,n,!1),i+=4;break;case Ss:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void As.error(`command: ${s} [index:${i}]`,e)}}},{M:Ms,L:Is,C:Ws,Q:Ns,Z:Fs,N:Us,D:Hs,X:Ys,G:zs,F:js,O:Xs,P:Vs,U:Gs}=Tt,{toTwoPointBounds:qs,toTwoPointBoundsByQuadraticCurve:Ks,arcTo:Qs,arc:Zs,ellipse:$s}=Vt,{add:Js,copy:ti,addPoint:ei,setPoint:si,addBounds:ii,toBounds:ri}=O,ai=K.get("PathBounds");let ni,oi,hi;const li={},di={},ci={},ui={toBounds(t,e){ui.toTwoPointBounds(t,di),ri(di,e)},toTwoPointBounds(t,e){if(!t||!t.length)return si(e,0,0);let s,i,r,a,n,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(s=t[o],0===o&&(s===Fs||s===Ws||s===Ns?si(e,h,l):si(e,t[o+1],t[o+2])),s){case Ms:case Is:h=t[o+1],l=t[o+2],ei(e,h,l),o+=3;break;case Ws:a=t[o+5],n=t[o+6],qs(h,l,t[o+1],t[o+2],t[o+3],t[o+4],a,n,li),Js(e,li),h=a,l=n,o+=7;break;case Ns:i=t[o+1],r=t[o+2],a=t[o+3],n=t[o+4],Ks(h,l,i,r,a,n,li),Js(e,li),h=a,l=n,o+=5;break;case Fs:o+=1;break;case Us:h=t[o+1],l=t[o+2],ii(e,h,l,t[o+3],t[o+4]),o+=5;break;case Hs:case Ys:h=t[o+1],l=t[o+2],ii(e,h,l,t[o+3],t[o+4]),o+=s===Hs?9:6;break;case zs:$s(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=9;break;case js:h=t[o+1],l=t[o+2],oi=t[o+3],hi=t[o+4],ii(e,h-oi,l-hi,2*oi,2*hi),h+=oi,o+=5;break;case Xs:Zs(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=7;break;case Vs:h=t[o+1],l=t[o+2],ni=t[o+3],ii(e,h-ni,l-ni,2*ni,2*ni),h+=ni,o+=4;break;case Gs:Qs(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=6;break;default:return void ai.error(`command: ${s} [index:${o}]`,t)}}},_i={smooth:(t,e,s)=>t};Ct.creator=new vs,Ct.parse=Fe.parse,Ct.convertToCanvasData=Fe.toCanvasData;const{drawRoundRect:pi}=Mt;function gi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){pi(this,t,e,s,i,r)})}(t)}function fi(t,e,s){Object.defineProperty(t,e,s)}function yi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function mi(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};fi(t,e,Object.assign(r,i||{})),Mi(t,e,s)}function vi(t){return(e,s)=>{mi(e,s,t)}}function wi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function xi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function bi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Bi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const ki=Bi;function Ei(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ci=Ei;function Ri(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ti(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Oi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Li(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Pi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Si(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ai(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),K.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Di(t){return(e,s)=>{fi(e,"__DataProcessor",{get:()=>t})}}function Mi(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[r]}:"width"===e?n.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});const o=yi(i,e);o&&o.set&&(n.set=o.set),i[a]&&(n.set=i[a],delete i[a]),Object.defineProperty(i,e,n)}const Ii=new K("rewrite"),Wi=[],Ni=["destroy","constructor"];function Fi(t){return(e,s)=>{Wi.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Ui(){return t=>{Hi()}}function Hi(t){Wi.length&&(Wi.forEach((e=>{t&&Ii.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Wi.length=0)}function Yi(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Ni.includes(i)||e&&e.includes(i)))if(t.prototype){yi(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function zi(){return t=>{et.register(t)}}function ji(){return t=>{rt.register(t)}}setTimeout((()=>Hi(!0)));const{toOuterOf:Xi}=Y;class Vi{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Xi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Xi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Xi(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const Gi={},qi={on(t,e,s){let i,r,a;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Ki(this,i,!0),o="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};o.forEach((t=>{t&&(a=n[t],a?-1===a.findIndex((t=>t.listener===e))&&a.push(h):n[t]=[h])}))},off(t,e,s){let i,r,a;s&&(i="boolean"==typeof s?s:s.capture);const n=Ki(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(a=r.findIndex((t=>t.listener===e)),a>-1&&r.splice(a,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=Ki(this,s)[t];if(i){let r;for(let a=0,n=i.length;a<n&&(r=i[a],r.listener(e),r.once&&(this.off(t,r.listener,s),a--,n--),!e||!e.isStopNow);a++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Ki(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Gi)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Gi)}}class Qi{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 Zi extends Qi{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Zi.ADD="child.add",Zi.REMOVE="child.remove";class $i extends Qi{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}$i.CHANGE="property.change";class Ji extends Qi{constructor(t,e){super(t),Object.assign(this,e)}}Ji.LOAD="image.load",Ji.LOADED="image.loaded",Ji.ERROR="image.error";class tr extends Qi{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(tr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}tr.RESIZE="resize";class er extends Qi{constructor(t,e){super(t),e&&Object.assign(this,e)}}er.START="transform.start",er.CHANGE="transform.change",er.END="transform.end",er.BEFORE_START="transform.before_start",er.BEFORE_CHANGE="transform.before_change",er.BEFORE_END="transform.before_end";class sr extends Qi{constructor(t,e){super(t),this.data=e}}sr.REQUEST="watch.request",sr.DATA="watch.data";class ir extends Qi{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ir.CHECK_UPDATE="layout.check_update",ir.REQUEST="layout.request",ir.START="layout.start",ir.BEFORE="layout.before",ir.LAYOUT="layout.layout",ir.AFTER="layout.after",ir.AGAIN="layout.again",ir.END="layout.end";class rr extends Qi{}rr.FRAME="animate.frame";class ar extends Qi{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}ar.REQUEST="render.request",ar.START="render.start",ar.BEFORE="render.before",ar.RENDER="render",ar.AFTER="render.after",ar.AGAIN="render.again",ar.END="render.end";class nr extends Qi{}nr.START="leafer.start",nr.BEFORE_READY="leafer.before_ready",nr.READY="leafer.ready",nr.AFTER_READY="leafer.after_ready",nr.VIEW_READY="leafer.view_ready",nr.STOP="leafer.stop",nr.RESTART="leafer.restart",nr.END="leafer.end";const or={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=$i,i=new $i(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:hr,cos:lr}=Math,dr=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1}),cr={__updateWorldMatrix(){const t=this.parent?this.parent.__world:dr,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX*this.__.scaleX,s.scaleY=t.scaleY*this.__.scaleY):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:n,skewY:o}=this.__;r||n||o?(r*=a,n&&(n*=a),o&&(o*=a),t.a=s*lr(r+o),t.b=s*hr(r+o),t.c=i*-hr(r-n),t.d=i*lr(r-n)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:ur,copyAndSpread:_r}=Y,pr={__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,ur(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else ur(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){ur(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ur(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ur(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(){_r(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){_r(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:gr}=E,fr={},yr={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),gr(t,this.__world,fr),this.__hit(fr)},__drawHitPath(t){this.__drawRenderPath(t)}},mr={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,i)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},vr={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},wr={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,a=t.getSameCanvas(),n=t.getSameCanvas();for(let o=0,h=i.length;o<h;o++)s=i[o],s.isMask?(r?(this.__renderMask(t,n,a),a.clear(),n.clear()):r=!0,s.__render(a,e)):s.__render(n,e);this.__renderMask(t,n,a),a.recycle(),n.recycle()}else{const{bounds:r,hideBounds:a}=e;for(let n=0,o=i.length;n<o;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||a&&a.includes(s.__world,e.matrix)||s.__render(t,e)}}},{copy:xr,translate:br,toInnerPoint:Br,scaleOfOuter:kr,rotateOfOuter:Er}=f,Cr={},Rr={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Or(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Lr(e[t])}},updateAllChange(t){if(Lr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Pr(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){t.__layout.checkUpdate();const i={x:e,y:s};t.parent&&Br(t.parent.__world,i,i,!0),Tr.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i,r){t.__layout.checkUpdate();const a=t.parent?E.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,a,s,i,r)},zoomOfLocal(t,e,s,i=s,r){xr(Cr,t.__local),r&&br(Cr,r.x,r.y),kr(Cr,e,s,i),r||(r=t),r.x+=Cr.e-t.__local.e,r.y+=Cr.f-t.__local.f,t.scaleX*=s,t.scaleY*=i},rotateOfWorld(t,e,s,i){t.__layout.checkUpdate();const r=t.parent?E.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){xr(Cr,t.__local),i&&br(Cr,i.x,i.y),Er(Cr,e,s),i||(i=t),i.x+=Cr.e-t.__local.e,i.y+=Cr.f-t.__local.f,t.rotation+=s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Tr=Rr,{updateAllWorldMatrix:Or,updateAllWorldOpacity:Lr,updateAllChange:Pr}=Tr,Sr={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},Ar={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.push(t),Dr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Mr(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:Dr,pushAllBranchStack:Mr}=Ar,Ir={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Wr,create:Nr}=s,{toInnerPoint:Fr,toOuterPoint:Ur}=f,{tempToOuterOf:Hr,copy:Yr}=E,{moveLocal:zr,zoomOfLocal:jr,rotateOfLocal:Xr}=Rr;let Vr=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 Vi}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=Nr(Wr),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer=t,t&&(this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&Ir.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){void 0===t?t="x":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?Fr(this.parent.worldTransform,t,e,s):e&&Yr(e,t)}localToWorld(t,e,s){this.parent?Ur(this.parent.worldTransform,t,e,s):e&&Yr(e,t)}worldToInner(t,e,s){Fr(this.worldTransform,t,e,s)}innerToWorld(t,e,s){Ur(this.worldTransform,t,e,s)}move(t,e){zr(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),jr(this,Hr(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Xr(this,Hr(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};Vr=pt([Yi(or),Yi(cr),Yi(pr),Yi(yr),Yi(qi),Yi(mr)],Vr);const{setByListWithHandle:Gr}=Y,{sort:qr}=Ar,{localBoxBounds:Kr,localEventBounds:Qr,localRenderBounds:Zr,maskLocalBoxBounds:$r,maskLocalEventBounds:Jr,maskLocalRenderBounds:ta}=Sr;let ea=class extends Vr{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(){Gr(this.__layout.boxBounds,this.children,this.__hasMask?$r:Kr)}__updateStrokeBounds(){Gr(this.__layout.strokeBounds,this.children,this.__hasMask?Jr:Qr)}__updateRenderBounds(){Gr(this.__layout.renderBounds,this.children,this.__hasMask?ta:Zr)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(qr),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Ir.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(Zi.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(Zi.REMOVE,t),this.leafer.hitCanvasManager.clear())}__emitChildEvent(t,e){const s=new Zi(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ea=pt([Yi(wr),Yi(vr)],ea);const sa={};class ia{static isHoldSpaceKey(){return ia.hasDownCode("Space")}static setDownCode(t){sa[t]||(sa[t]=!0)}static setUpCode(t){sa[t]=!1}static hasDownCode(t){return sa[t]}}class ra{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const aa={};class na extends Qi{get spaceKey(){return ia.isHoldSpaceKey()}get left(){return ra.left(this)}get right(){return ra.right(this)}get middle(){return ra.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,aa),Object.assign({},aa)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,aa),Object.assign({},aa)}static changeName(t,e){rt.changeName(t,e)}}let oa=class extends na{};oa.POINTER="pointer",oa.BEFORE_DOWN="pointer.before_down",oa.BEFORE_MOVE="pointer.before_move",oa.BEFORE_UP="pointer.before_up",oa.DOWN="pointer.down",oa.MOVE="pointer.move",oa.UP="pointer.up",oa.OVER="pointer.over",oa.OUT="pointer.out",oa.ENTER="pointer.enter",oa.LEAVE="pointer.leave",oa.TAP="tap",oa.DOUBLE_TAP="double_tap",oa.CLICK="click",oa.DOUBLE_CLICK="double_click",oa.LONG_PRESS="long_press",oa.LONG_TAP="long_tap",oa=pt([ji()],oa);const ha={},la={};let da=class extends oa{getInnerMove(t){return t||(t=this.current),ha.x=this.moveX,ha.y=this.moveY,t.worldToInner(ha,la,!0),Object.assign({},la)}getLocalMove(t){return t||(t=this.current),ha.x=this.moveX,ha.y=this.moveY,t.worldToLocal(ha,la,!0),Object.assign({},la)}};var ca;da.DRAG="drag",da.START="drag.start",da.END="drag.end",da.OVER="drag.over",da.OUT="drag.out",da.ENTER="drag.enter",da.LEAVE="drag.leave",da=pt([ji()],da);let ua=ca=class extends oa{static setList(t){ca.dragList=t instanceof ot?t:new ot(t)}static setData(t){this.dragData=t}};ua.DROP="drop",ua=ca=pt([ji()],ua);let _a=class extends da{};_a.MOVE="move",_a.START="move.start",_a.END="move.end",_a=pt([ji()],_a);let pa=class extends na{};pa.ROTATE="rotate",pa.START="rotate.start",pa.END="rotate.end",pa=pt([ji()],pa);let ga=class extends da{};ga.SWIPE="swipe",ga.LEFT="swipe.left",ga.RIGHT="swipe.right",ga.UP="swipe.up",ga.DOWN="swipe.down",ga=pt([ji()],ga);let fa=class extends na{};fa.ZOOM="zoom",fa.START="zoom.start",fa.END="zoom.end",fa=pt([ji()],fa);let ya=class extends na{};ya.DOWN="key.down",ya.PRESS="key.press",ya.UP="key.up",ya=pt([ji()],ya);const ma=K.get("TaskProcessor");class va{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return gt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ma.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wa{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&dt.assign(this.config,t),this.empty()}add(t,e){let s,i,r,a;const n=new va(t);return n.parent=this,"number"==typeof e?a=e:e&&(i=e.parallel,s=e.start,r=e.time,a=e.delay),r&&(n.time=r),!1===i&&(n.parallel=!1),void 0===a?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber--,this.push(n,s)}),a)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const xa={map:{},recycledList:[],tasker:new wa,patternTasker:new wa,get isComplete(){return ba.tasker.isComplete&&ba.patternTasker.isComplete},get(t){let s=ba.map[t.url];return s||(s=e.image(t),ba.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ba.recycledList.push(t)}))},clearRecycled(){const t=ba.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete ba.map[t.url],t.destroy())})),t.length=0)},destroy(){ba.map={}}},ba=xa,{IMAGE:Ba,create:ka}=s;class Ea{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=ka(Ba),this.config=t||{url:""};const{url:e}=t;e.startsWith("data:")?e.startsWith("data:image/svg")&&(this.isSVG=!0):e.includes(".svg")&&(this.isSVG=!0)}load(e,s){return this.loading||(this.loading=!0,xa.tasker.add((()=>gt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const a=t.origin.createCanvas(e,s),n=a.getContext("2d");return i&&(n.globalAlpha=i),n.drawImage(this.view,0,0,e,s),a}destroy(){this.config={url:""},this.waitComplete.length=0}}const Ca=K.get("plugin"),Ra={power:{},list:[],onLeafer(t){Ra.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};class Ta{get updatedList(){if(this.hasRemoved){const t=new ot;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 ot,this.target=t,e&&(this.config=dt.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(ar.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===Zi.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 sr(sr.DATA,{updatedList:this.updatedList})),this.__updatedList=new ot,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($i.CHANGE,this.__onAttrChange,this),t.on_([Zi.ADD,Zi.REMOVE],this.__onChildEvent,this),t.on_(sr.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:Oa,updateAllWorldOpacity:La}=Rr,{pushAllChildBranch:Pa,pushAllParent:Sa}=Ar;const{worldBounds:Aa}=Sr,{setByListWithHandle:Da}=Y;class Ma{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ot(t)),this.updatedList=t}setBefore(){Da(this.beforeBounds,this.updatedList.list,Aa)}setAfter(){Da(this.afterBounds,this.updatedList.list,Aa),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:Ia,updateAllChange:Wa}=Rr,{pushAllBranchStack:Na,updateWorldBoundsByBranchStack:Fa}=Ar,Ua=K.get("Layouter");class Ha{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ht,this.target=t,e&&(this.config=dt.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(ir.START),this.layoutOnce(),t.emitEvent(new ir(ir.END,this.layoutedBlocks,this.times))}catch(t){Ua.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ua.warn("layouting"):this.times>3?Ua.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(sr.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=$.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:a,AFTER:n}=ir,o=this.getBlocks(i);o.forEach((t=>{t.setBefore()})),s.emitEvent(new ir(r,o,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(Oa(t),e.push(t),t.isBranch&&Pa(t,e),Sa(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Sa(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&La(t),t.__updateChange()}))}(i),o.forEach((t=>t.setAfter())),s.emitEvent(new ir(a,o,this.times)),s.emitEvent(new ir(n,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,$.end(e)}fullLayout(){const t=$.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=ir,a=this.getBlocks(new ot(e));e.emitEvent(new ir(s,a,this.times)),Ha.fullLayout(e),a.forEach((t=>{t.setAfter()})),e.emitEvent(new ir(i,a,this.times)),e.emitEvent(new ir(r,a,this.times)),this.addBlocks(a),$.end(t)}static fullLayout(t){if(Ia(t),t.isBranch){const e=[t];Na(t,e),Fa(e)}else t.__updateWorldBounds();Wa(t)}createBlock(t){return new Ma(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_(ir.REQUEST,this.layout,this),t.on_(ir.AGAIN,this.layoutAgain,this),t.on_(sr.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Ya=K.get("Renderer");class za{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=dt.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ir.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Ya.log(e.innerName,"---\x3e");try{this.emitRender(ar.START),this.renderOnce(t),this.emitRender(ar.END,this.totalBounds),xa.clearRecycled()}catch(t){Ya.error(t)}Ya.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Ya.warn("rendering"):this.times>3?Ya.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(ar.BEFORE),t()):(this.requestLayout(),this.emitRender(ar.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(ar.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ar.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 Ya.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=$.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),a=(new V).copy(i);s.save(),r&&!K.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,a),s.restore(),$.end(e)}fullRender(){const t=$.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),$.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),K.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),K.showHitView&&this.renderHitView(s),K.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(rr.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ya.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new ar(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ar.REQUEST,this.update,this),t.on_(ir.END,this.__onLayoutEnd,this),t.on_(ar.AGAIN,this.renderAgain,this),t.on_(tr.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:ja}=Y;class Xa{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,n=this.getBestMatchLeaf(),o=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:o,leaf:n,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Rr.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ot;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ot;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ot,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,a;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(a=i.list[t],!r||!r.has(a));t++)e.push(a)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let a=t.length-1;a>-1;a--)s=t[a],e&&!s.isMask||(i=ja(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Va{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=dt.default(e,this.config)),this.findPath=new Xa(t,this),this.__listenEvents()}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(ir.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(Zi.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.findPath.destroy(),this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={})}}Object.assign(e,{watcher:(t,e)=>new Ta(t,e),layouter:(t,e)=>new Ha(t,e),renderer:(t,e,s)=>new za(t,e,s),selector:(t,e)=>new Va(t,e)}),t.layout=Ha.fullLayout;class Ga extends Et{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s,this.clientBounds=this.bounds}}gi(OffscreenCanvasRenderingContext2D.prototype),gi(Path2D.prototype);class qa{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(_a.START,this.moveData)}t.path=this.moveData.path,e.emit(_a.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(fa.START,this.zoomData)}t.path=this.zoomData.path,e.emit(fa.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(pa.START,this.rotateData)}t.path=this.rotateData.path,e.emit(pa.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(_a.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(fa.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(pa.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const Ka={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?ga.UP:t>45&&t<135?ga.DOWN:t<=45&&t>=-45?ga.RIGHT:ga.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:Qa.getSwipeDirection(E.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ot,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Qa=Ka,{getDragEventData:Za,getDropEventData:$a,getSwipeEventData:Ja,filterPathByEventType:tn}=Ka;class en{constructor(t){this.interaction=t}setDragData(t){this.dragData=Za(t,t,t)}getDragList(){return this.dragging?ua.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ra.middle(t)&&!ra.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const a=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ra.middle(t)||ia.isHoldSpaceKey()||a)&&e,this.moving&&s.emit(_a.START,r)}this.moving||this.dragStart(t,e);const{path:a,throughPath:n}=i;this.dragData=Za(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=a,this.moving?s.emit(_a.MOVE,this.dragData):this.dragging&&(s.emit(da.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ra.left(t)&&e,this.dragging&&(this.interaction.emit(da.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=tn(this.dragData.path,da.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Rr.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(da.OUT,t,s),e.emit(da.OVER,t,i)):e.emit(da.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(da.LEAVE,t,s,i),e.emit(da.ENTER,t,i,s),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,a=Za(s,t,t);r&&(a.throughPath=r),a.path=i,this.moving&&e.emit(_a.END,a),this.dragging&&(e.emit(da.END,a),this.swipe(t,a),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(E.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Ja(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=$a(t,this.getDragList(),ua.dragData);e.path=this.dragEnterPath,this.interaction.emit(ua.DROP,e),this.interaction.emit(da.LEAVE,t,this.dragEnterPath)}dragReset(){ua.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const a=e.shrinkCanvasBounds,{x:n,y:o}=a,h=Y.right(a),l=Y.bottom(a),d=t.x<n?i:h<t.x?-i:0,c=t.y<o?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,E.move(s,d,c),E.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const sn=["move","zoom","rotate"];function rn(t,e,s,i,r){if(sn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!nn(t,r)){let a;for(let n=0,o=t.children.length;n<o;n++)a=t.children[n],!s.path.has(a)&&a.__.hittable&&an(a,e,s,i,r)}}function an(t,e,s,i,r){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!nn(t,r)){s.phase=i?1:t===s.target?2:3;const r=rt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function nn(t,e){return e&&e.has(t)}const on={getData(t){const e=t[0],s=t[1],i=E.getCenter(e.from,s.from),r=E.getCenter(e.to,s.to),a={x:r.x-i.x,y:r.y-i.y},n=E.getDistance(e.from,s.from),o=E.getDistance(e.to,s.to)/n,h=E.getAngle(e.from,s.from),l=E.getAngle(e.to,s.to);return{move:a,scale:o,angle:this.getChangedAngle(h,l),center:r}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:hn,getMoveEventData:ln,getZoomEventData:dn,getRotateEventData:cn}=Ka;class un{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ot(e),this.transformer=new qa(this),this.dragger=new en(this),r&&(this.config=dt.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){this.emit(oa.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,{through:i});r.throughPath&&(t.throughPath=r.throughPath),t.path=e?this.defaultPath:r.path,this.emit(oa.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ra.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&ra.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(oa.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=E.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:oa.MOVE});t.path=e.path,this.emit(oa.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(oa.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(oa.UP,t),this.emit(oa.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:a}=on.getData(e);this.rotate(cn(a,i,t)),this.zoom(dn(a,r,t)),this.move(ln(a,s,t))}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(oa.OUT,t,this.overPath),this.emit(oa.OVER,t,e)):this.emit(oa.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(oa.LEAVE,t,this.enterPath,e),this.emit(oa.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(oa.LEAVE,t),this.dragger.dragging&&this.emit(ua.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[oa.DOUBLE_TAP,oa.DOUBLE_CLICK].some((e=>hn(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit(oa.TAP,t),this.emit(oa.CLICK,t)}emitDoubleTap(t){this.emit(oa.DOUBLE_TAP,t),this.emit(oa.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(oa.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(oa.LONG_TAP,t),hn(t.path,oa.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_(tr.RESIZE,this.__onResize,this)],t.once(nr.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let a=s.length-1;a>-1;a--){if(r=s.list[a],an(r,t,e,!0,i))return;r.isApp&&rn(r,t,e,!0,i)}for(let a=0,n=s.length;a<n;a++)if(r=s.list[a],r.isApp&&rn(r,t,e,!1,i),an(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}const{mineType:_n}=_t;function pn(s,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,s)=>new Promise(((i,r)=>{t.convertToBlob({type:_n(e),quality:s}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,s)=>t.convertToBlob({type:_n(e),quality:s}),canvasSaveAs:(t,e,s)=>new Promise((t=>t())),loadImage:e=>new Promise(((s,i)=>{!e.startsWith("data:")&&t.imageSuffix&&(e+=(e.includes("?")?"&":"?")+t.imageSuffix);let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then((t=>{s(t)})).catch((t=>{i(t)}))},r.onerror=t=>i(t),r.send()}))},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Ga(t,e),image:t=>new Ea(t),hitCanvas:(t,e)=>new Ga(t,e),interaction:(t,e,s,i)=>new un(t,e,s,i)}),t.name="web",t.isWorker=!0,t.requestRender=function(t){requestAnimationFrame(t)},t.devicePixelRatio=1,t.realtimeLayout=!0;const{userAgent:gn}=navigator;gn.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):gn.indexOf("Safari")>-1&&-1===gn.indexOf("Chrome")&&(t.fullImageShadow=!0),gn.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):gn.indexOf("Mac")>-1?t.os="Mac":gn.indexOf("Linux")>-1&&(t.os="Linux");const fn=K.get("LeaferTypeCreator"),yn={list:{},register(t,e){mn[t]?fn.repeat(t):mn[t]=e},run(t,e){const s=yn.list[t];s?s(e):fn.error("no",t)}},{list:mn}=yn;yn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),yn.register("design",(function(t){const{MOVE:e}=_a,{ZOOM:s}=fa;t.__eventIds.push(t.on_(e,(e=>{Rr.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:a}=e;a*s<i?a=i/s:a*s>r&&(a=r/s),1!==a&&Rr.zoomOfWorld(t.zoomLayer,e,a)})))}));const vn={},wn={},xn={export(t,e,s){return function(t){bn||(bn=new wa);return new Promise((e=>{bn.add((()=>gt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((r=>{const{leafer:a}=t;a?a.waitViewLoaded((()=>gt(this,void 0,void 0,(function*(){let t,n,o,{canvas:h}=a,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=a.config.fill,a.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}o=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):yield h.toDataURL(e,t),i({data:o}),r(),l&&h.recycle()})))):(i({data:!1}),r())}))))}};let bn;const{copy:Bn,toOffsetOutBounds:kn}=Y,En={},Cn={};function Rn(e,s,i,r){const{bounds:a,shapeBounds:n}=r;if(t.fullImageShadow){if(Bn(En,e.bounds),En.x+=s.x-n.x,En.y+=s.y-n.y,i){const{matrix:t}=r;En.x-=(a.x+(t?t.e:0)+a.width/2)*(i-1),En.y-=(a.y+(t?t.f:0)+a.height/2)*(i-1),En.width*=i,En.height*=i}e.copyWorld(r.canvas,e.bounds,En)}else i&&(Bn(En,s),En.x-=s.width/2*(i-1),En.y-=s.height/2*(i-1),En.width*=i,En.height*=i),e.copyWorld(r.canvas,n,i?En:s)}const{toOffsetOutBounds:Tn}=Y,On={};var Ln=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,a;const{__world:n,__layout:o}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;Tn(d,On),h.forEach(((t,i)=>{p.save(),p.setWorldShadow(On.offsetX+t.x*u,On.offsetY+t.y*_,t.blur*u),a=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Rn(p,On,a,s),p.restore(),l?(p.copyWorld(p,d,n,"copy"),p.copyWorld(l,n,n,"source-out"),r=n):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(p,r,o.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,a;const{__world:n,__layout:o}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;kn(d,Cn),h.forEach(((t,i)=>{p.setWorldShadow(Cn.offsetX+t.x*u,Cn.offsetY+t.y*_,t.blur*u,t.color),a=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Rn(p,Cn,a,s),r=d,t.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,n,"copy"),r=n),l?p.copyWorld(l,n,n,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(p,r,o.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()}});const{get:Pn,rotateOfOuter:Sn,translate:An,scaleOfOuter:Dn,scale:Mn,rotate:In}=f;const{get:Wn,translate:Nn}=f;function Fn(t,e,s,i){let{width:r,height:a}=e;const{opacity:n,mode:o,offset:h,scale:l,rotation:d,blendMode:c}=s,u=i.width===r&&i.height===a;c&&(t.blendMode=c);const _=t.data={mode:o};switch(o){case"strench":u||(r=i.width,a=i.height),(i.x||i.y)&&(_.transform=Wn(),Nn(_.transform,i.x,i.y));break;case"clip":(h||l||d)&&function(t,e,s,i,r){const a=Pn();An(a,e.x,e.y),s&&An(a,s.x,s.y),i&&("number"==typeof i?Mn(a,i):Mn(a,i.x,i.y),t.scaleX=a.a,t.scaleY=a.d),r&&In(a,r),t.transform=a}(_,i,h,l,d);break;case"repeat":(!u||l||d)&&function(t,e,s,i,r,a){const n=Pn();if(a)switch(In(n,a),a){case 90:An(n,i,0);break;case 180:An(n,s,i);break;case 270:An(n,0,s)}An(n,e.x,e.y),r&&(Dn(n,e,r),t.scaleX=t.scaleY=r),t.transform=n}(_,i,r,a,l,d);break;default:u&&!d||function(t,e,s,i,r,a){const n=Pn(),o=a&&180!==a,h=s.width/(o?r:i),l=s.height/(o?i:r),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-i*d)/2,u=s.y+(s.height-r*d)/2;An(n,c,u),Mn(n,d),a&&Sn(n,{x:s.x+s.width/2,y:s.y+s.height/2},a),t.scaleX=t.scaleY=d,t.transform=n}(_,o,i,r,a,d)}_.width=r,_.height=a,n&&(_.opacity=n)}function Un(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function Hn(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new Ji(t,e))}const{get:Yn,scale:zn,copy:jn}=f;function Xn(e,s,i){let{scaleX:r,scaleY:a}=e.__world;const n=r+a;if(s.patternId===n||e.destroyed)return!1;{s.patternId=n;const{image:e,data:o}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:u,height:_,scaleX:p,scaleY:g,opacity:f,transform:y,mode:m}=o;p&&(c=Yn(),jn(c,y),zn(c,1/p,1/g),r*=p,a*=g),r*=i,a*=i,u*=r,_*=a,u>h||_>l?d=Math.max(u/h,_/l):(u<32||_<32)&&(d=Math.min(u/32,_/32)),d&&(r/=d,a/=d,u/=d,_/=d),p&&(r/=p,a/=g),(y||1!==r||1!==a)&&(c||(c=Yn(),y&&jn(c,y)),zn(c,1/r,1/a));const v=t.canvas.createPattern(e.getCanvas(u,_,f),"repeat"===m?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform&&(s.transform=null),c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}}function Vn(t,e,s,i){const{scaleX:r,scaleY:a}=t.__world;if(s.data&&s.patternId!==r+a){if(i)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=r*e.pixelRatio,n*=a*e.pixelRatio,i=t>4096||n>4096}else i=!1;if(i){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?xa.patternTasker.add((()=>gt(this,void 0,void 0,(function*(){e.bounds.hit(t.__world)&&Xn(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300):Xn(t,s,e.pixelRatio),!1}return!1}function Gn(t,e){const s="fill"===e?t._fill:t._stroke;if(s instanceof Array){let i,r,a,n;for(let o=0,h=s.length;o<h;o++)i=s[o].image,n=i&&i.url,n&&(r||(r={}),r[n]=!0,xa.recycle(i),i.loading&&(a||(a=t.__input&&t.__input[e]||[],a instanceof Array||(a=[a])),i.unload(s[o].loadId,!a.some((t=>t.url===n)))));return r}return null}function qn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:a}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,a)}function Kn(t,e,s){const{strokeAlign:i}=t.__,r="string"!=typeof s;switch(i){case"center":e.setStroke(r?void 0:s,t.__.strokeWidth,t.__),r?$n(t,s,e,!0):Zn(t,e);break;case"inside":Qn(t,e,s,"inside",r);break;case"outside":Qn(t,e,s,"outside",r)}}function Qn(t,e,s,i,r){const{strokeWidth:a,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(r?void 0:s,2*a,t.__),o.font=n,r?$n(t,s,o,!0):Zn(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",qn(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function Zn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:a}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),r&&e.strokeRect(s.x,s.y+r,s.width,a)}function $n(t,e,s,i){let r;for(let a=0,n=e.length;a<n;a++)r=e[a],r.image&&Vn(t,s,r,!1)||r.style&&(s.strokeStyle=r.style,r.blendMode?(s.saveBlendMode(r.blendMode),i?Zn(t,s):s.stroke(),s.restoreBlendMode()):i?Zn(t,s):s.stroke())}const{getSpread:Jn,getOuterOf:to,getByMove:eo,getIntersectData:so}=Y;const io={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},ro={x:.5,y:0},ao={x:.5,y:1};function no(t,e,s){let i;for(let r=0,a=e.length;r<a;r++)i=e[r],t.addColorStop(i.offset,io.string(i.color,s))}const{set:oo,getAngle:ho,getDistance:lo}=E,{get:co,rotateOfOuter:uo,scaleOfOuter:_o}=f,po={x:.5,y:.5},go={x:.5,y:1},fo={},yo={};const{set:mo,getAngle:vo,getDistance:wo}=E,{get:xo,rotateOfOuter:bo,scaleOfOuter:Bo}=f,ko={x:.5,y:.5},Eo={x:.5,y:1},Co={},Ro={};let To;function Oo(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=e.__layout;switch(s.type){case"solid":let{type:a,blendMode:n,color:o,opacity:h}=s;return{type:a,blendMode:n,style:io.string(o,h)};case"image":return function(t,e,s,i,r){const a={type:s.type},n=a.image=xa.get(s),o=(r||n.loading)&&{target:t,image:n,attrName:e,attrValue:s};return n.ready?(Un(t,e,n)&&Fn(a,n,s,i),r&&(Hn(Ji.LOAD,o),Hn(Ji.LOADED,o))):n.error?r&&(t.forceUpdate("surface"),o.error=n.error,Hn(Ji.ERROR,o)):(r&&Hn(Ji.LOAD,o),a.loadId=n.load((()=>{t.destroyed||(Un(t,e,n)&&(Fn(a,n,s,i),t.forceUpdate("surface")),Hn(Ji.LOADED,o))}),(e=>{t.forceUpdate("surface"),o.error=e,Hn(Ji.ERROR,o)}))),a}(e,i,s,r,!To||!To[s.url]);case"linear":return function(e,s){let{from:i,to:r,type:a,blendMode:n,opacity:o}=e;i||(i=ro),r||(r=ao);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);no(h,e.stops,o);const l={type:a,style:h};return n&&(l.blendMode=n),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:a,opacity:n,blendMode:o,stretch:h}=e;i||(i=po),r||(r=go);const{x:l,y:d,width:c,height:u}=s;let _;oo(fo,l+i.x*c,d+i.y*u),oo(yo,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=co(),_o(_,fo,c/u*(h||1),1),uo(_,fo,ho(fo,yo)+90));const p=t.canvas.createRadialGradient(fo.x,fo.y,0,fo.x,fo.y,lo(fo,yo));no(p,e.stops,n);const g={type:a,style:p,transform:_};return o&&(g.blendMode=o),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:a,opacity:n,blendMode:o,stretch:h}=e;i||(i=ko),r||(r=Eo);const{x:l,y:d,width:c,height:u}=s;mo(Co,l+i.x*c,d+i.y*u),mo(Ro,l+r.x*c,d+r.y*u);const _=xo(),p=vo(Co,Ro);t.conicGradientRotate90?(Bo(_,Co,c/u*(h||1),1),bo(_,Co,p+90)):(Bo(_,Co,1,c/u*(h||1)),bo(_,Co,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,Co.x,Co.y):t.canvas.createRadialGradient(Co.x,Co.y,0,Co.x,Co.y,wo(Co,Ro));no(g,e.stops,n);const f={type:a,style:g,transform:_};return o&&(f.blendMode=o),f}(s,r);default:return s.r?{type:"solid",style:io.string(s)}:void 0}}var Lo=Object.freeze({__proto__:null,compute:function(t,e){const s=[];let i,r=t.__.__input[e];r instanceof Array||(r=[r]),To=Gn(t.__,e);for(let a=0,n=r.length;a<n;a++)i=Oo(t,r[a],e),i&&s.push(i);t.__["_"+e]=s.length?s:void 0},drawTextStroke:Zn,fill:function(t,e,s){e.fillStyle=s,t.__.__font?qn(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fillText:qn,fills:function(t,e,s){let i;const{windingRule:r,__font:a}=t.__;for(let n=0,o=s.length;n<o;n++)i=s[n],i.image&&Vn(t,e,i,!a)||i.style&&(e.fillStyle=i.style,i.transform?(e.save(),e.transform(i.transform),i.blendMode&&(e.blendMode=i.blendMode),a?qn(t,e):r?e.fill(r):e.fill(),e.restore()):i.blendMode?(e.saveBlendMode(i.blendMode),a?qn(t,e):r?e.fill(r):e.fill(),e.restoreBlendMode()):a?qn(t,e):r?e.fill(r):e.fill())},recycleImage:Gn,shape:function(t,e,s){const i=e.getSameCanvas();let r,a,n,o;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=n=to(h,s.matrix)):r=n=h,o=i;else{const{renderShapeSpread:i}=t.__layout,c=so(i?Jn(e.bounds,i*l):e.bounds,h,s.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,s),l*=a.a,d*=a.d),n=to(h,a),r=eo(n,-a.e,-a.f),s.matrix&&a.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:a})}return t.__renderShape(i,s),{canvas:i,matrix:a,bounds:r,worldCanvas:o,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:a,__font:n}=i;if(r)if(n)Kn(t,e,s);else switch(a){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const a=e.getSameCanvas(!0);a.setStroke(s,2*r,t.__),t.__drawRenderPath(a),a.stroke(),a.clip(i.windingRule),a.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(a,t.__world,t.__layout.renderBounds),a.recycle()}},strokeText:Kn,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:a,__font:n}=i;if(r)if(n)Kn(t,e,s);else switch(a){case"center":e.setStroke(void 0,r,i),$n(t,s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),$n(t,s,e),e.restore();break;case"outside":const{renderBounds:a}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*r,t.__),$n(t,s,n),n.clip(i.windingRule),n.clearWorld(a),e.copyWorldToInner(n,t.__world,a),n.recycle()}}});Object.assign(vn,Ln),Object.assign(wn,Lo);const Po={};class So extends ut{setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Po)):(this.__isFills&&(this.__removeInput("fill"),wn.recycleImage(this,"fill"),this.__isFills=!1),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Po)):(this.__isStrokes&&(this.__removeInput("stroke"),wn.recycleImage(this,"stroke"),this.__isStrokes=!1),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Ao={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Do extends So{}class Mo extends Do{get __boxStroke(){return!0}}class Io extends So{get __boxStroke(){return!0}}const{parse:Wo}=Fe;const No={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Fo extends Io{}function Uo(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ho(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Yo={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:n}=this.__;if((s||"all"===i)&&n&&"inside"!==r&&(e=t="center"===r?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*a/2)*Math.sqrt(n)-t:0,r="none"===s?0:n;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let a=t=Math.ceil(t);return s&&s.forEach((t=>{a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t}},zo={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:a}=this.__,n=i&&"path"===r||"all"===r,o=s.hitFill(e,a);if(n&&o)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!n&&o&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!n){if(!o&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},jo={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&wn.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&wn.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const a=wn.shape(this,t,e),{shadow:n,innerShadow:o}=this.__;n&&vn.shadow(this,t,a,e),s&&(this.__.__isFills?wn.fills(this,t,s):wn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),o&&vn.innerShadow(this,t,a,e),i&&(this.__.__isStrokes?wn.strokes(this,t,i):wn.stroke(this,t,i)),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else s&&(this.__.__isFills?wn.fills(this,t,s):wn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?wn.strokes(this,t,i):wn.stroke(this,t,i))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&wn.fill(this,t,"#000000"),i&&wn.stroke(this,t,"#000000")}},Xo={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:a,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),a){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(a,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};let Vo=class extends Vr{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Fe.toCanvasData(e,!0):e:[]}getPathString(t){return Fe.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&wn.compute(this,"fill"),e&&wn.compute(this,"stroke")}}__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 xn.export(this,t,e)}static one(t,e,s,i,r){return et.get(t.tag||this.prototype.__tag,t,e,s,i,r)}destroy(){this.fill=this.stroke=null,super.destroy()}};pt([Di(So)],Vo.prototype,"__",void 0),pt([vi("")],Vo.prototype,"id",void 0),pt([vi("")],Vo.prototype,"name",void 0),pt([vi("")],Vo.prototype,"className",void 0),pt([Ti("pass-through")],Vo.prototype,"blendMode",void 0),pt([Oi(1)],Vo.prototype,"opacity",void 0),pt([Oi(!0)],Vo.prototype,"visible",void 0),pt([Pi(!1)],Vo.prototype,"isMask",void 0),pt([Si(!1)],Vo.prototype,"isEraser",void 0),pt([Li(0)],Vo.prototype,"zIndex",void 0),pt([vi()],Vo.prototype,"locked",void 0),pt([wi(0)],Vo.prototype,"x",void 0),pt([wi(0)],Vo.prototype,"y",void 0),pt([Bi(100)],Vo.prototype,"width",void 0),pt([Bi(100)],Vo.prototype,"height",void 0),pt([xi(1)],Vo.prototype,"scaleX",void 0),pt([xi(1)],Vo.prototype,"scaleY",void 0),pt([bi(0)],Vo.prototype,"rotation",void 0),pt([bi(0)],Vo.prototype,"skewX",void 0),pt([bi(0)],Vo.prototype,"skewY",void 0),pt([vi(!1)],Vo.prototype,"draggable",void 0),pt([Ai(!0)],Vo.prototype,"hittable",void 0),pt([Ai("path")],Vo.prototype,"hitFill",void 0),pt([Ci("path")],Vo.prototype,"hitStroke",void 0),pt([Ai(!0)],Vo.prototype,"hitChildren",void 0),pt([Ai(!0)],Vo.prototype,"hitSelf",void 0),pt([Ti()],Vo.prototype,"fill",void 0),pt([Ci()],Vo.prototype,"stroke",void 0),pt([Ci("inside")],Vo.prototype,"strokeAlign",void 0),pt([Ci(1)],Vo.prototype,"strokeWidth",void 0),pt([Ci("none")],Vo.prototype,"strokeCap",void 0),pt([Ci("miter")],Vo.prototype,"strokeJoin",void 0),pt([Ci()],Vo.prototype,"dashPattern",void 0),pt([Ci()],Vo.prototype,"dashOffset",void 0),pt([Ci(10)],Vo.prototype,"miterLimit",void 0),pt([ki()],Vo.prototype,"cornerRadius",void 0),pt([ki()],Vo.prototype,"cornerSmoothing",void 0),pt([Uo()],Vo.prototype,"shadow",void 0),pt([Uo()],Vo.prototype,"innerShadow",void 0),pt([Uo()],Vo.prototype,"blur",void 0),pt([Uo()],Vo.prototype,"backgroundBlur",void 0),pt([Uo()],Vo.prototype,"grayscale",void 0),pt([Fi(Ds.drawPathByData)],Vo.prototype,"__drawPathByData",null),Vo=pt([Yi(Yo),Yi(zo),Yi(jo),Ui()],Vo);let Go=class extends Vo{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}remove(t,e){}removeAll(t){}};pt([Di(Do)],Go.prototype,"__",void 0),Go=pt([Yi(ea),zi()],Go);let qo=class extends Vo{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};pt([Di(Io)],qo.prototype,"__",void 0),qo=pt([Yi(Xo),zi()],qo);const Ko=qo.prototype,Qo=Go.prototype,Zo={},{copy:$o,add:Jo}=Y;let th=class extends Go{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;$o(Zo,t),super.__updateRenderBounds(),Jo(t,Zo)}}__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)}};pt([Di(Mo)],th.prototype,"__",void 0),pt([Ri("show")],th.prototype,"overflow",void 0),pt([Fi(Ko.__updateStrokeSpread)],th.prototype,"__updateStrokeSpread",null),pt([Fi(Ko.__updateRenderSpread)],th.prototype,"__updateRectRenderSpread",null),pt([Fi(Ko.__updateBoxBounds)],th.prototype,"__updateBoxBounds",null),pt([Fi(Ko.__updateStrokeBounds)],th.prototype,"__updateStrokeBounds",null),pt([Fi(Ko.__updateRenderBounds)],th.prototype,"__updateRectRenderBounds",null),pt([Fi(Ko.__updateChange)],th.prototype,"__updateRectChange",null),pt([Fi(Ko.__drawPathByData)],th.prototype,"__drawPathByData",null),pt([Fi(Ko.__render)],th.prototype,"__renderRect",null),pt([Fi(Qo.__render)],th.prototype,"__renderGroup",null),th=pt([Ui(),zi()],th);let eh=class extends th{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};pt([Di(class extends Mo{})],eh.prototype,"__",void 0),pt([Ri("hide")],eh.prototype,"overflow",void 0),eh=pt([zi()],eh);const{moveTo:sh,closePath:ih,ellipse:rh}=is;let ah=class extends Vo{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,a=t/2,n=e/2,o=this.__.path=[];s?i||r?(s<1&&rh(o,a,n,a*s,n*s,0,i,r,!1),rh(o,a,n,a,n,0,r,i,!0),s<1&&ih(o)):(s<1&&(rh(o,a,n,a*s,n*s),sh(o,t,n)),rh(o,a,n,a,n,0,0,360,!0)):i||r?(sh(o,a,n),rh(o,a,n,a,n,0,i,r,!1),ih(o)):rh(o,a,n,a,n)}};pt([Di(class extends So{get __boxStroke(){return!0}})],ah.prototype,"__",void 0),pt([ki(0)],ah.prototype,"innerRadius",void 0),pt([ki(0)],ah.prototype,"startAngle",void 0),pt([ki(0)],ah.prototype,"endAngle",void 0),ah=pt([zi()],ah);const{sin:nh,cos:oh,PI:hh}=Math,{moveTo:lh,lineTo:dh,closePath:ch}=is;let uh=class extends Vo{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,a=this.__.path=[];lh(a,i,0);for(let t=1;t<s;t++)dh(a,i+i*nh(2*t*hh/s),r-r*oh(2*t*hh/s));ch(a)}};pt([Di(class extends So{})],uh.prototype,"__",void 0),pt([ki(3)],uh.prototype,"sides",void 0),uh=pt([zi()],uh);const{sin:_h,cos:ph,PI:gh}=Math,{moveTo:fh,lineTo:yh,closePath:mh}=is;let vh=class extends Vo{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,a=e/2,n=this.__.path=[];fh(n,r,0);for(let t=1;t<2*s;t++)yh(n,r+(t%2==0?r:r*i)*_h(t*gh/s),a-(t%2==0?a:a*i)*ph(t*gh/s));mh(n)}};pt([Di(class extends So{})],vh.prototype,"__",void 0),pt([ki(5)],vh.prototype,"points",void 0),pt([ki(.382)],vh.prototype,"innerRadius",void 0),vh=pt([zi()],vh);const{moveTo:wh,lineTo:xh}=is,{rotate:bh,getAngle:Bh,getDistance:kh,defaultPoint:Eh}=E,{setPoint:Ch,addPoint:Rh,toBounds:Th}=O,Oh={};let Lh=class extends Vo{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&&bh(s,e),this.__toPoint=s,s}set toPoint(t){this.width=kh(Eh,t),this.rotation=Bh(Eh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];wh(t,0,0);const e=this.toPoint;xh(t,e.x,e.y)}__updateBoxBounds(){Ch(Oh,0,0),Rh(Oh,this.__toPoint.x,this.__toPoint.y),Th(Oh,this.__layout.boxBounds)}};pt([Di(class extends So{})],Lh.prototype,"__",void 0),pt([Bi()],Lh.prototype,"rotation",void 0),pt([Ei("center")],Lh.prototype,"strokeAlign",void 0),Lh=pt([zi()],Lh);let Ph=class extends qo{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(Ji.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};pt([Di(Fo)],Ph.prototype,"__",void 0),pt([Bi("")],Ph.prototype,"url",void 0),Ph=pt([zi()],Ph);let Sh=class extends qo{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new T(t.__world);r.invert();const a=new T;e&&a.translate(e.x,e.y),s&&("number"==typeof s?a.scale(s):a.scale(s.x,s.y)),i&&a.rotate(i),r.preMultiply(a),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};pt([Di(Fo)],Sh.prototype,"__",void 0),pt([Ho(100)],Sh.prototype,"width",void 0),pt([Ho(100)],Sh.prototype,"height",void 0),pt([Ho(t.devicePixelRatio)],Sh.prototype,"pixelRatio",void 0),pt([Ho(!0)],Sh.prototype,"smooth",void 0),pt([Ai("all")],Sh.prototype,"hitFill",void 0),Sh=pt([zi()],Sh);const Ah=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Dh=Ah+"_#~&*+\\=|≮≯≈≠=…",Mh=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 Ih(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Wh=Ih("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Nh=Ih("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Fh=Ih(Ah),Uh=Ih(Dh),Hh=Ih("- —/~|┆·");var Yh;!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"}(Yh||(Yh={}));const{Letter:zh,Single:jh,Before:Xh,After:Vh,Symbol:Gh,Break:qh}=Yh;function Kh(t){return Wh[t]?zh:Hh[t]?qh:Nh[t]?Xh:Fh[t]?Vh:Uh[t]?Gh:Mh.test(t)?jh:zh}const Qh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let a=r-1;a>-1&&(s=e[a].data[0]," "===s.char);a--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Zh(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:$h}=Qh,{Letter:Jh,Single:tl,Before:el,After:sl,Symbol:il,Break:rl}=Yh;let al,nl,ol,hl,ll,dl,cl,ul,_l,pl,gl,fl,yl,ml,vl=[];function wl(t,e){al.data.push({char:t,width:e}),ol+=e}function xl(){hl+=ol,al.width=ol,nl.words.push(al),al={data:[]},ol=0}function bl(){fl&&(yl.paraNumber++,nl.paraStart=!0,fl=!1),nl.width=hl,ml.width&&$h(nl),vl.push(nl),nl={words:[]},hl=0}const Bl=0,kl=1,El=2;const Cl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,a=0,{width:n,height:o,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=r.fourNumber(h);n&&(i=l,n-=e+l),o&&(a=t,o-=t+s)}const u={bounds:{x:i,y:a,width:n,height:o},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,i){yl=e,vl=e.rows,ml=e.bounds;const{__letterSpacing:r,paraIndent:a,textCase:n}=i,{canvas:o}=t,{width:h,height:l}=ml;if(h||l||r||"none"!==n){fl=!0,_l=null,ol=hl=0,al={data:[]},nl={words:[]};for(let t=0,e=s.length;t<e;t++)dl=s[t],"\n"===dl?(ol&&xl(),nl.paraEnd=!0,bl(),fl=!0):(ul=Kh(dl),ul===Jh&&"none"!==n&&(dl=Zh(dl,n,!ol)),cl=o.measureText(dl).width,r&&(cl+=r),pl=ul===tl&&(_l===tl||_l===Jh)||_l===tl&&ul!==sl,gl=!(ul!==el&&ul!==tl||_l!==il&&_l!==sl),ll=fl&&a?h-a:h,h&&hl+ol+cl>ll&&(gl||(gl=ul===Jh&&_l==sl),pl||gl||ul===rl||ul===el||ul===tl||ol+cl>ll?(ol&&xl(),bl()):bl())," "===dl&&!0!==fl&&hl+ol===0||(ul===rl?(" "===dl&&ol&&xl(),wl(dl,cl),xl()):pl||gl?(ol&&xl(),wl(dl,cl)):wl(dl,cl)),_l=ul);ol&&xl(),hl&&bl(),vl.length>0&&(vl[vl.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{yl.paraNumber++,vl.push({x:a||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:a,textAlign:n,verticalAlign:o,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=a;if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(o){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u;for(let e=0,a=s.length;e<a;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1),d.x<i.x&&(i.x=d.x),d.width>i.width&&(i.width=d.width)}i.y=u,i.height=g}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:a,paraIndent:n,letterSpacing:o}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===a&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=o||t.isOverflow?Bl:l>.01?kl:El,c===El?(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===kl?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,n),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const a=t.canvas.measureText(s).width,n=i[r-1];let o,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-a;for(let t=l;t>-1&&(o=n.data[t],h=o.x+o.width,!(t===l&&h<u));t--){if(h<u&&" "!==o.char){n.data.splice(t+1),n.width-=o.width;break}n.width-=o.width}n.width+=a,n.data.push({char:s,x:h})}}(u,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},{copyAndSpread:Rl,includes:Tl,spread:Ol}=Y;let Ll=class extends Vo{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:a}=this.__layout.boxBounds;t.rect(s,i,r,a)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Cl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:a,fontFamily:n,fontSize:o,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Ao.number(r,o),t.__letterSpacing=Ao.number(a,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${o}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<o&&Ol(c,o/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=Tl(u,c)?u:c;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Rl(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};pt([Di(class extends So{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=No[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Ll.prototype,"__",void 0),pt([Bi(0)],Ll.prototype,"width",void 0),pt([Bi(0)],Ll.prototype,"height",void 0),pt([Bi(0)],Ll.prototype,"padding",void 0),pt([Ei("outside")],Ll.prototype,"strokeAlign",void 0),pt([Bi("")],Ll.prototype,"text",void 0),pt([Bi("L")],Ll.prototype,"fontFamily",void 0),pt([Bi(12)],Ll.prototype,"fontSize",void 0),pt([Bi("normal")],Ll.prototype,"fontWeight",void 0),pt([Bi(!1)],Ll.prototype,"italic",void 0),pt([Bi("none")],Ll.prototype,"textCase",void 0),pt([Bi("none")],Ll.prototype,"textDecoration",void 0),pt([Bi(0)],Ll.prototype,"letterSpacing",void 0),pt([Bi({type:"percent",value:150})],Ll.prototype,"lineHeight",void 0),pt([Bi(0)],Ll.prototype,"paraIndent",void 0),pt([Bi(0)],Ll.prototype,"paraSpacing",void 0),pt([Bi("left")],Ll.prototype,"textAlign",void 0),pt([Bi("top")],Ll.prototype,"verticalAlign",void 0),pt([Bi("show")],Ll.prototype,"textOverflow",void 0),Ll=pt([zi()],Ll);const{toBounds:Pl}=ui;let Sl=class extends Vo{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){Pl(this.__.path,this.__layout.boxBounds)}};pt([Di(class extends So{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Wo(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],Sl.prototype,"__",void 0),pt([ki()],Sl.prototype,"path",void 0),pt([ki()],Sl.prototype,"windingRule",void 0),pt([Ei("center")],Sl.prototype,"strokeAlign",void 0),Sl=pt([zi()],Sl);let Al=class extends Go{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Sl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,a){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,a,n,o){return this}arc(t,e,s,i,r,a){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,a,n,o){return this}moveToArc(t,e,s,i,r,a){return this}paint(){this.pathElement.forceUpdate("path")}};pt([Di(class extends Do{})],Al.prototype,"__",void 0),Al=pt([Yi(vs,["beginPath"]),zi()],Al);const Dl=K.get("Leafer");let Ml=class extends Go{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&xa.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&dt.assign(this.config,t);const{config:r}=this;yn.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new nt,this.hitCanvasManager=new lt,i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Ra.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(nr.RESTART):this.emitLeafer(nr.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(nr.STOP))}resize(t){const e=dt.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=dt.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new tr(t,e))}__onResize(t){this.emitEvent(t),dt.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}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const i=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),i(),this.viewLoaded||(s=this.on_(rr.FRAME,i))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(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=dt.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(nr.BEFORE_READY),this.emitLeafer(nr.READY),this.emitLeafer(nr.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(nr.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new nr(t,this))}__listenEvents(){const t=$.start("FirstCreate "+this.innerName);this.once(nr.START,(()=>$.end(t))),this.once(ir.END,(()=>this.__onReady())),this.once(ar.END,(()=>this.__onViewReady())),this.on(ir.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){setTimeout((()=>{if(!this.destroyed)try{this.stop(),this.emitEvent(new nr(nr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config.view=this.userConfig.view=this.view=null,super.destroy(),setTimeout((()=>{xa.clearRecycled()}),100)}catch(t){Dl.error(t)}}),0)}};pt([Di(class extends Do{})],Ml.prototype,"__",void 0),pt([Bi()],Ml.prototype,"pixelRatio",void 0),Ml=pt([zi()],Ml);let Il=class extends Ml{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_($i.CHANGE,(()=>{K.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 Ml(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ir.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(ar.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(ar.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&&dt.assign(e,t),this.autoLayout&&dt.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}};Il=pt([zi()],Il);var Wl=Object.freeze({__proto__:null,Animate:{},AnimateEvent:rr,get App(){return Il},AutoBounds:G,BezierHelper:Vt,Bounds:V,BoundsHelper:Y,get Box(){return th},get Branch(){return ea},BranchHelper:Ar,BranchRender:wr,get Canvas(){return Sh},CanvasManager:nt,ChildEvent:Zi,Creator:e,DataHelper:dt,Debug:K,get DragEvent(){return da},get DropEvent(){return ua},Effect:vn,get Ellipse(){return ah},EllipseHelper:ee,Event:Qi,EventCreator:rt,Export:xn,FileHelper:_t,get Frame(){return eh},get Group(){return Go},HitCanvasManager:lt,get Image(){return Ph},ImageEvent:Ji,ImageManager:xa,IncrementId:s,get KeyEvent(){return ya},Keyboard:ia,LayoutEvent:ir,Layouter:Ha,get Leaf(){return Vr},LeafBounds:pr,LeafBoundsHelper:Sr,LeafData:ut,LeafDataProxy:or,LeafEventer:qi,LeafHelper:Rr,LeafHit:yr,LeafLevelList:ht,LeafList:ot,LeafMask:vr,LeafMatrix:cr,LeafRender:mr,get Leafer(){return Ml},LeaferCanvas:Ga,LeaferCanvasBase:Et,LeaferEvent:nr,LeaferImage:Ea,LeaferImageBase:Ea,LeaferTypeCreator:yn,get Line(){return Lh},MathHelper:r,Matrix:T,MatrixHelper:f,get MoveEvent(){return _a},NeedConvertToCanvasCommandMap:Lt,OneRadian:a,PI2:n,PI_2:o,Paint:wn,get Path(){return Sl},PathBounds:ui,PathCommandDataHelper:is,PathCommandMap:Tt,PathConvert:Fe,PathCorner:_i,PathCreator:vs,PathDrawer:Ds,PathHelper:Ct,PathNumberCommandLengthMap:Dt,PathNumberCommandMap:At,get Pen(){return Al},Platform:t,PluginManager:Ra,Point:R,PointHelper:E,PointerButton:ra,get PointerEvent(){return oa},get Polygon(){return uh},PropertyEvent:$i,get Rect(){return qo},RectHelper:Mt,RectRender:Xo,RenderEvent:ar,Renderer:za,ResizeEvent:tr,get RotateEvent(){return pa},Run:$,Selector:Va,get Star(){return vh},StringNumberMap:q,get SwipeEvent(){return ga},TaskItem:va,TaskProcessor:wa,get Text(){return Ll},TransformEvent:er,TwoPointBounds:class{constructor(t,e){O.setPoint(this,t,e)}addPoint(t,e){O.addPoint(this,t,e)}addBounds(t,e,s,i){O.addBounds(this,t,e,s,i)}add(t){O.add(this,t)}},TwoPointBoundsHelper:O,get UI(){return Vo},UIBounds:Yo,UICreator:et,UIEvent:na,UIHit:zo,UIRender:jo,WaitHelper:Ir,WatchEvent:sr,Watcher:Ta,get ZoomEvent(){return fa},affectRenderBoundsType:Ri,affectStrokeBoundsType:Ei,aliasType:function(t){return(e,s)=>{fi(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}},boundsType:Bi,canvasPatch:gi,canvasSizeAttrs:kt,dataProcessor:Di,dataType:vi,defineDataProcessor:Mi,defineKey:fi,defineLeafAttr:mi,effectType:Uo,eraserType:Si,getDescriptor:yi,hitType:Ai,layoutProcessor:function(t){return(e,s)=>{fi(e,"__LayoutProcessor",{get:()=>t})}},maskType:Pi,opacityType:Oi,pathType:ki,positionType:wi,registerUI:zi,registerUIEvent:ji,resizeType:Ho,rewrite:Fi,rewriteAble:Ui,rotationType:bi,scaleType:xi,setDefaultValue:function(t,e,s){Mi(t.prototype,e,s)},sortType:Li,strokeType:Ci,surfaceType:Ti,useCanvas:pn,useModule:Yi,usePlugin:function(t,e){const s={},{power:i,list:r}=Ra;if(r.includes(t))Ca.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:Ca.error(t+" non-existent")})):Ca.warn("no import");try{t.run(s,e)}catch(t){Ca.error(t)}}}});LeaferUI=Ra.power=Wl,pn();
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={imageSuffix:"leaf"},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]}},a=Math.PI/180,n=2*Math.PI,o=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,a=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=a,t.f=n},get:g,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=a),i=h(e),{a:r,b:n,c:o,d:d}=t;t.a=r*s-n*i,t.b=r*i+n*s,t.c=o*s-d*i,t.d=o*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=a,t.a=i+n*s,t.b=r+o*s),e&&(e*=a,t.c=n+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:a,e:n,f:o}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*a,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*a,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*a+o},preMultiply(t,e){const{a:s,b:i,c:r,d:a,e:n,f:o}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+a*e.c,t.d=r*e.b+a*e.d),t.e=n*e.a+o*e.c+e.e,t.f=n*e.b+o*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:a,f:n}=t,o=1/(e*r-s*i);t.a=r*o,t.b=-s*o,t.c=-i*o,t.d=e*o,t.e=-(a*r-n*i)*o,t.f=-(n*e-a*s)*o},toOuterPoint(t,e,s,i){const{x:r,y:a}=e;s||(s=e),s.x=r*t.a+a*t.c,s.y=r*t.b+a*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:a}=e,{a:n,b:o,c:h,d:l}=t,d=1/(n*l-o*h);if(s||(s=e),s.x=(r*l-a*h)*d,s.y=(a*n-r*o)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*n-e*o)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let n=e,o=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;n=u(i),o=t/n;const r=e/n;h=s>0?d(r):-d(r),l=c(g/i)/a}else{const e=i*i+r*r;o=u(e),n=t/o;const s=i/o;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/a}h/=a}return{x:t.e,y:t.f,scaleX:n,scaleY:o,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:k}=Math,E={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=C.defaultPoint);const i=x(e*a),r=w(e*a),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=C;return C.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=C;return C.copy(s,t),C.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>C.getAtan2(t,e)/a,getAtan2:(t,e)=>k(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=C.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){C.reset(t)}},C=E;class R{constructor(t,e){"object"==typeof t?E.copy(this,t):E.set(this,t,e)}set(t,e){E.set(this,t,e)}copy(t){return E.copy(this,t),this}clone(){return new R(this)}rotate(t,e){return E.rotate(this,t,e),this}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return E.getCenter(this,t)}getDistance(t){return E.getDistance(this,t)}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){E.reset(this)}}class T{constructor(t,e,s,i,r,a){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,a)}set(t,e,s,i,r,a){f.set(this,t,e,s,i,r,a)}copy(t){return f.copy(this,t),this}clone(){return new T(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 O={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){L(t,e,s),L(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:L}=O,{tempPointBounds:P,setPoint:S,addPoint:A,toBounds:D}=O,{toOuterPoint:M}=f;let I,W,N,F;const H={},U={},Y={tempBounds:{},set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){z.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),z.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(z.right(s)-t.x),e.offsetY=-(z.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),z.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(z.copy(z.tempBounds,t),z.toOuterOf(z.tempBounds,e),z.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),z.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else H.x=t.x,H.y=t.y,M(e,H,U),S(P,U.x,U.y),H.x=t.x+t.width,M(e,H,U),A(P,U.x,U.y),H.y=t.y+t.height,M(e,H,U),A(P,U.x,U.y),H.x=t.x,M(e,H,U),A(P,U.x,U.y),D(P,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return z.copyAndSpread(s,t,e),s},spread(t,e){z.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){I=t.x+t.width,W=t.y+t.height,N=e.x+e.width,F=e.y+e.height,I=I>N?I:N,W=W>F?W:F,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){z.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){z.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){z.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,a=!0;for(let n=0,o=e.length;n<o;n++)r=s?s(e[n]):e[n],r&&(r.width||r.height)&&(a?(a=!1,i||X(t,r)):j(t,r));a&&z.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?S(P,t.x,t.y):A(P,t.x,t.y)})),D(P,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=E.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=E.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=z.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=z.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){s&&(e=z.tempToOuterOf(e,s));let{x:i,y:r,width:a,height:n}=e;return I=i+a,W=r+n,N=t.x+t.width,F=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<N?I:N,W=W<F?W:F,a=I-i,n=W-r,{x:i,y:r,width:a,height:n}},intersect(t,e,s){z.copy(t,z.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){z.set(t)}},z=Y,{add:j,copy:X}=z;class V{constructor(t,e,s,i){"object"==typeof t?Y.copy(this,t):Y.set(this,t,e,s,i)}set(t,e,s,i){Y.set(this,t,e,s,i)}copy(t){return Y.copy(this,t),this}clone(){return new V(this)}scale(t){return Y.scale(this,t),this}toOuterOf(t,e){return Y.toOuterOf(this,t,e),this}getFitMatrix(t){return Y.getFitMatrix(this,t)}spread(t){return Y.spread(this,t),this}ceil(){return Y.ceil(this),this}add(t){return Y.add(this,t),this}addList(t){return Y.setByList(this,t,!0),this}setByList(t,e){return Y.setByList(this,t,e),this}addListWithHandle(t,e){return Y.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return Y.setByListWithHandle(this,t,e,s),this}setByPoints(t){return Y.setByPoints(this,t),this}hitPoint(t,e){return Y.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Y.hitRadiusPoint(this,t,e)}hit(t,e){return Y.hit(this,t,e)}includes(t,e){return Y.includes(this,t,e)}intersect(t,e){return Y.intersect(this,t,e),this}getIntersect(t,e){return new V(Y.getIntersectData(this,t,e))}isSame(t){return Y.isSame(this,t)}isEmpty(){return Y.isEmpty(this)}reset(){Y.reset(this)}}class G{constructor(t,e,s,i,r,a){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,a)}set(t=0,e=0,s=0,i=0,r=0,a=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=a}copy(t){const{top:e,right:s,bottom:i,left:r,width:a,height:n}=t;this.set(e,s,i,r,a,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:a,height:n}=this;return new V(r,e,a||t.width-r-s,n||t.height-e-i)}}const q={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1};class K{constructor(t){this.repeatMap={},this.name=t}static get(t){return new K(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){Q.enable&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}K.filterList=[],K.excludeList=[];const Q=K,Z=K.get("RunTime");class ${static start(t,e){const i=s.create(s.RUNTIME);return J.currentId=J.idMap[i]=e?performance.now():Date.now(),J.currentName=J.nameMap[i]=t,J.nameToIdMap[t]=i,i}static end(t,e){const s=J.idMap[t],i=J.nameMap[t];J.idMap[t]=J.nameMap[t]=J.nameToIdMap[i]=void 0,e?Z.log(i,performance.now()-s,"µs"):Z.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=J.nameToIdMap[t];void 0!==s&&J.end(s,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$,tt=K.get("UICreator"),et={list:{},register(t){const{__tag:e}=t.prototype;st[e]?tt.repeat(e):st[e]=t},get(t,e,s,i,r,a){const n=new st[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),r&&(n.width=r),a&&(n.height=a)),n}},{list:st}=et,it=K.get("EventCreator"),rt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(at[e]?it.repeat(e):at[e]=t)}))},changeName(t,e){const s=at[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,at[e]=s)}},get:(t,...e)=>new at[t](...e)},{nameList:at}=rt;class nt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ot{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ot;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class ht{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class lt extends nt{constructor(){super(...arguments),this.pathTypeList=new ot,this.imageTypeList=new ot}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.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const dt={default:(t,e)=>(ct(e,t),ct(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ct(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ct}=dt;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,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=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 pt(t,e,s,i){var r,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(n=(a<3?r(n):a>3?r(e,s,n):r(e,s))||n);return a>3&&n&&Object.defineProperty(e,s,n),n}function gt(t,e,s,i){return new(s||(s=Promise))((function(r,a){function n(t){try{h(i.next(t))}catch(t){a(t)}}function o(t){try{h(i.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,o)}h((i=i.apply(t,e||[])).next())}))}function ft(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const yt=[];function mt(){return(t,e)=>{yt.push(e)}}const vt=[];let wt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||vt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;yt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,a){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,a){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,a)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,a,n,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*o;i+=e,e=0,a+=t,o-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,a,n,o,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,a){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,a){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,a,n,o){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,a){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};pt([ft("imageSmoothingEnabled")],wt.prototype,"smooth",void 0),pt([ft("imageSmoothingQuality")],wt.prototype,"smoothLevel",void 0),pt([ft("globalAlpha")],wt.prototype,"opacity",void 0),pt([ft()],wt.prototype,"fillStyle",void 0),pt([ft()],wt.prototype,"strokeStyle",void 0),pt([ft("lineWidth")],wt.prototype,"strokeWidth",void 0),pt([ft("lineCap")],wt.prototype,"strokeCap",void 0),pt([ft("lineJoin")],wt.prototype,"strokeJoin",void 0),pt([ft("lineDashOffset")],wt.prototype,"dashOffset",void 0),pt([ft()],wt.prototype,"miterLimit",void 0),pt([ft()],wt.prototype,"shadowBlur",void 0),pt([ft()],wt.prototype,"shadowColor",void 0),pt([ft()],wt.prototype,"shadowOffsetX",void 0),pt([ft()],wt.prototype,"shadowOffsetY",void 0),pt([ft()],wt.prototype,"filter",void 0),pt([ft()],wt.prototype,"font",void 0),pt([ft()],wt.prototype,"fontKerning",void 0),pt([ft()],wt.prototype,"fontStretch",void 0),pt([ft()],wt.prototype,"fontVariantCaps",void 0),pt([ft()],wt.prototype,"textAlign",void 0),pt([ft()],wt.prototype,"textBaseline",void 0),pt([ft()],wt.prototype,"textRendering",void 0),pt([ft()],wt.prototype,"wordSpacing",void 0),pt([ft()],wt.prototype,"letterSpacing",void 0),pt([ft()],wt.prototype,"direction",void 0),pt([mt()],wt.prototype,"setTransform",null),pt([mt()],wt.prototype,"resetTransform",null),pt([mt()],wt.prototype,"getTransform",null),pt([mt()],wt.prototype,"save",null),pt([mt()],wt.prototype,"restore",null),pt([mt()],wt.prototype,"translate",null),pt([mt()],wt.prototype,"scale",null),pt([mt()],wt.prototype,"rotate",null),pt([mt()],wt.prototype,"fill",null),pt([mt()],wt.prototype,"stroke",null),pt([mt()],wt.prototype,"clip",null),pt([mt()],wt.prototype,"fillRect",null),pt([mt()],wt.prototype,"strokeRect",null),pt([mt()],wt.prototype,"clearRect",null),pt([mt()],wt.prototype,"beginPath",null),pt([mt()],wt.prototype,"moveTo",null),pt([mt()],wt.prototype,"lineTo",null),pt([mt()],wt.prototype,"bezierCurveTo",null),pt([mt()],wt.prototype,"quadraticCurveTo",null),pt([mt()],wt.prototype,"closePath",null),pt([mt()],wt.prototype,"arc",null),pt([mt()],wt.prototype,"arcTo",null),pt([mt()],wt.prototype,"ellipse",null),pt([mt()],wt.prototype,"rect",null),pt([mt()],wt.prototype,"roundRect",null),pt([mt()],wt.prototype,"createConicGradient",null),pt([mt()],wt.prototype,"createLinearGradient",null),pt([mt()],wt.prototype,"createPattern",null),pt([mt()],wt.prototype,"createRadialGradient",null),pt([mt()],wt.prototype,"fillText",null),pt([mt()],wt.prototype,"measureText",null),pt([mt()],wt.prototype,"strokeText",null);const xt=new V,bt={width:1,height:1,pixelRatio:1},Bt=K.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Et extends wt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.worldTransform={},e||(e=bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:a,pixelRatio:n}=e;this.autoLayout=!r||!a,this.pixelRatio=n,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Bt.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(_t.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Bt.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),dt.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.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:a,c:n,d:o,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*n)*i,r.b=(t.a*a+t.b*o)*i,r.c=(t.c*s+t.d*n)*i,r.d=(t.c*a+t.d*o)*i,r.e=(t.e*s+t.f*n+h)*i,r.f=(t.e*a+t.f*o+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Y.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,xt.copy(t).scale(this.pixelRatio),this.fillRect(xt.x,xt.y,xt.width,xt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,xt.copy(t).scale(this.pixelRatio),this.strokeRect(xt.x,xt.y,xt.width,xt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){xt.copy(t).scale(this.pixelRatio),e&&xt.ceil(),this.clearRect(xt.x,xt.y,xt.width,xt.height)}clipWorld(t,e){this.beginPath(),xt.copy(t).scale(this.pixelRatio),e&&xt.ceil(),this.rect(xt.x,xt.y,xt.width,xt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,a={width:s,height:i,pixelRatio:r},n=this.manager?this.manager.get(a):e.canvas(a);if(n.save(),t){const t=this.worldTransform;n.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return n}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:a}=this;t&&(i+=t),s&&(r+=s);const n={width:i,height:r,pixelRatio:a},o=this.manager?this.manager.get(n):e.canvas(n);return o.save(),o}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ct={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Rt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Tt=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Rt),Ot={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Lt={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},Pt=Object.assign(Object.assign({},Lt),Rt),St=Tt,At={};for(let t in St)At[St[t]]=t;const Dt={};for(let t in St)Dt[St[t]]=Ot[t];const Mt={drawRoundRect(t,e,s,i,a,n){let[o,h,l,d]=r.fourNumber(n);const c=Math.min(i/2,a/2);o>c&&(o=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),o?t.moveTo(e+o,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+a,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+a,e,s+a,l):t.lineTo(e+i,s+a),d?t.arcTo(e,s+a,e,s,d):t.lineTo(e,s+a),o?t.arcTo(e,s,e+i,s,o):t.lineTo(e,s)}},{sin:It,cos:Wt,atan2:Nt,ceil:Ft,abs:Ht,PI:Ut}=Math,{setPoint:Yt,addPoint:zt}=O,{set:jt}=E,Xt={},Vt={rect(t,e,s,i,r){Ct.creator.path=t,Ct.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,a){Ct.creator.path=[],Mt.drawRoundRect(Ct.creator,e,s,i,r,a),t.push(...Ct.convertToCanvasData(Ct.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Nt(g,p),v=Nt(y,f),w=v-m;if(w<0&&(w+=n),w===Ut||Ht(p+g)<1e-12||Ht(f+y)<1e-12)return t&&t.push(Tt.L,i,r),c&&(Yt(c,e,s),zt(c,i,r)),_&&jt(_,e,s),void(u&&jt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Wt(w/2),k=i+B*Wt(m+w/2+o*b),E=r+B*It(m+w/2+o*b);return m-=o*b,v-=o*b,Kt(t,k,E,d,d,0,m/a,v/a,x,c,u,_)},arc:(t,e,s,i,r,a,n,o,h,l)=>Kt(t,e,s,i,i,0,r,a,n,o,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*a,f=It(g),y=Wt(g);let m=l*a,v=d*a;m>Ut&&(m-=n),v<0&&(v+=n);let w=v-m;w<0?w+=n:w>n&&(w-=n),c&&(w-=n);const x=Ft(Ht(w/o)),b=w/x,B=It(b/4),k=8/3*B*B/It(b/2);v=m+b;let E,C,R,T,O,L,P,S,A=Wt(m),D=It(m),M=R=y*i*A-f*r*D,I=T=f*i*A+y*r*D,W=e+R,N=s+T;t&&t.push(Tt.L,W,N),u&&Yt(u,W,N),p&&jt(p,W,N);for(let a=0;a<x;a++)E=Wt(v),C=It(v),R=y*i*E-f*r*C,T=f*i*E+y*r*C,O=e+M-k*(y*i*D+f*r*A),L=s+I-k*(f*i*D-y*r*A),P=e+R+k*(y*i*C+f*r*E),S=s+T+k*(f*i*C-y*r*E),t&&t.push(Tt.C,O,L,P,S,e+R,s+T),u&&qt(e+M,s+I,O,L,P,S,e+R,s+T,u,!0),M=R,I=T,A=E,D=C,m=v,v+=b;_&&jt(_,e+R,s+T)},quadraticCurveTo(t,e,s,i,r,a,n){t.push(Tt.C,(e+2*i)/3,(s+2*r)/3,(a+2*i)/3,(n+2*r)/3,a,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,a,n,o){qt(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(a+2*i)/3,r,a,n,o)},toTwoPointBounds(t,e,s,i,r,a,n,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=n;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=a,b=o),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?zt(h,t,e):Yt(h,t,e),zt(h,n,o);for(let l=0,c=d.length;l<c;l++)Gt(d[l],t,e,s,i,r,a,n,o,Xt),zt(h,Xt.x,Xt.y)},getPointAndSet(t,e,s,i,r,a,n,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*a+p*o,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,a,n,o,h){const l={};return Gt(t,e,s,i,r,a,n,o,h,l),l}},{getPointAndSet:Gt,toTwoPointBounds:qt,ellipse:Kt}=Vt,{sin:Qt,cos:Zt,sqrt:$t,atan2:Jt}=Math,{ellipse:te}=Vt,ee={ellipticalArc(t,e,s,i,r,o,h,l,d,c,u){const _=(d-e)/2,p=(c-s)/2,g=o*a,f=Qt(g),y=Zt(g),m=-y*_-f*p,v=-y*p+f*_,w=i*i,x=r*r,b=v*v,B=m*m,k=w*x-w*b-x*B;let E=0;if(k<0){const t=$t(1-k/(w*x));i*=t,r*=t}else E=(h===l?-1:1)*$t(k/(w*b+x*B));const C=E*i*v/r,R=-E*r*m/i,T=Jt((v-R)/r,(m-C)/i),O=Jt((-v-R)/r,(-m-C)/i);let L=O-T;0===l&&L>0?L-=n:1===l&&L<0&&(L+=n);const P=e+_+y*C-f*R,S=s+p+f*C+y*R,A=L<0?1:0;u?te(t,P,S,i,r,o,T/a,O/a,A):i!==r||o?t.push(Tt.G,P,S,i,r,o,T/a,O/a,A):t.push(Tt.O,P,S,i,T/a,O/a,A)}},{M:se,m:ie,L:re,l:ae,H:ne,h:oe,V:he,v:le,C:de,c:ce,S:ue,s:_e,Q:pe,q:ge,T:fe,t:ye,A:me,a:ve,Z:we,z:xe,N:be,D:Be,X:ke,G:Ee,F:Ce,O:Re,P:Te,U:Oe}=Tt,{rect:Le,roundRect:Pe,arcTo:Se,arc:Ae,ellipse:De,quadraticCurveTo:Me}=Vt,{ellipticalArc:Ie}=ee,We=K.get("PathConvert"),Ne={},Fe={current:{dot:0},stringify(t){let e,s,i,r=0,a=t.length,n="";for(;r<a;){s=t[r],e=Dt[s],n+=s===i?" ":At[s];for(let s=1;s<e;s++)n+=t[r+s],s===e-1||(n+=" ");i=s,r+=e}return n},parse(t,e){let s,i,r,a="";const n=[],o=e?Pt:Lt;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?("."===i&&(He.dot++,He.dot>1&&(Ue(n,a),a="")),a+=i):Tt[i]?(a&&(Ue(n,a),a=""),He.name=Tt[i],He.length=Ot[i],He.index=0,Ue(n,He.name),!s&&o[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?a+=i:(a&&Ue(n,a),a=i):a&&(Ue(n,a),a=""),r=i;return a&&Ue(n,a),s?Fe.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,a,n,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ie:t[c+1]+=o,t[c+2]+=h;case se:o=t[c+1],h=t[c+2],_.push(se,o,h),c+=3;break;case oe:t[c+1]+=o;case ne:o=t[c+1],_.push(re,o,h),c+=2;break;case le:t[c+1]+=h;case he:h=t[c+1],_.push(re,o,h),c+=2;break;case ae:t[c+1]+=o,t[c+2]+=h;case re:o=t[c+1],h=t[c+2],_.push(re,o,h),c+=3;break;case _e:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=ue;case ue:n=a===de||a===ue,l=n?2*o-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],o=t[c+3],h=t[c+4],_.push(de,l,d,s,i,o,h),c+=5;break;case ce:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=de;case de:s=t[c+3],i=t[c+4],o=t[c+5],h=t[c+6],_.push(de,t[c+1],t[c+2],s,i,o,h),c+=7;break;case ye:t[c+1]+=o,t[c+2]+=h,r=fe;case fe:n=a===pe||a===fe,s=n?2*o-s:t[c+1],i=n?2*h-i:t[c+2],e?Me(_,o,h,s,i,t[c+1],t[c+2]):_.push(pe,s,i,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case ge:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=pe;case pe:s=t[c+1],i=t[c+2],e?Me(_,o,h,s,i,t[c+3],t[c+4]):_.push(pe,s,i,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case ve:t[c+6]+=o,t[c+7]+=h;case me:Ie(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case xe:case we:_.push(we),c++;break;case be:o=t[c+1],h=t[c+2],e?Le(_,o,h,t[c+3],t[c+4]):Ye(_,t,c,5),c+=5;break;case Be:o=t[c+1],h=t[c+2],e?Pe(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ye(_,t,c,9),c+=9;break;case ke:o=t[c+1],h=t[c+2],e?Pe(_,o,h,t[c+3],t[c+4],t[c+5]):Ye(_,t,c,6),c+=6;break;case Ee:De(e?_:Ye(_,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,Ne),o=Ne.x,h=Ne.y,c+=9;break;case Ce:e?De(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ye(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Re:Ae(e?_:Ye(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ne),o=Ne.x,h=Ne.y,c+=7;break;case Te:e?Ae(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ye(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Oe:Se(e?_:Ye(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ne),o=Ne.x,h=Ne.y,c+=6;break;default:return We.error(`command: ${r} [index:${c}]`,t),_}a=r}return _},copyData(t,e,s,i){for(let r=s,a=s+i;r<a;r++)t.push(e[r])},pushData(t,e){He.index===He.length&&(He.index=1,t.push(He.name)),t.push(Number(e)),He.index++,He.dot=0}},{current:He,pushData:Ue,copyData:Ye}=Fe,{M:ze,L:je,C:Xe,Q:Ve,Z:Ge,N:qe,D:Ke,X:Qe,G:Ze,F:$e,O:Je,P:ts,U:es}=Tt,ss={},is={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ze,e,s)},lineTo(t,e,s){t.push(je,e,s)},bezierCurveTo(t,e,s,i,r,a,n){t.push(Xe,e,s,i,r,a,n)},quadraticCurveTo(t,e,s,i,r){t.push(Ve,e,s,i,r)},closePath(t){t.push(Ge)},rect(t,e,s,i,r){t.push(qe,e,s,i,r)},roundRect(t,e,s,i,a,n){if("number"==typeof n)t.push(Qe,e,s,i,a,n);else{const o=r.fourNumber(n);o?t.push(Ke,e,s,i,a,...o):t.push(qe,e,s,i,a)}},ellipse(t,e,s,i,r,a,n,o,h){void 0===a?t.push($e,e,s,i,r):(void 0===n&&(n=0),void 0===o&&(o=360),t.push(Ze,e,s,i,r,a,n,o,h?1:0))},arc(t,e,s,i,r,a,n){void 0===r?t.push(ts,e,s,i):(void 0===a&&(a=360),t.push(Je,e,s,i,r,a,n?1:0))},moveToEllipse(t,e,s,i,r,a,n,o,h){void 0===a&&(a=0),void 0===n&&(n=0),void 0===o&&(o=360),Vt.ellipse(null,e,s,i,r,a,n,o,h,null,null,ss),t.push(ze,ss.x,ss.y),rs(t,e,s,i,r,a,n,o,h)},moveToArc(t,e,s,i,r,a,n){void 0===r&&(r=0),void 0===a&&(a=360),Vt.arc(null,e,s,i,r,a,n,null,null,ss),t.push(ze,ss.x,ss.y),as(t,e,s,i,r,a,n)},arcTo(t,e,s,i,r,a){t.push(es,e,s,i,r,a)}},{ellipse:rs,arc:as}=is,{moveTo:ns,lineTo:os,quadraticCurveTo:hs,bezierCurveTo:ls,closePath:ds,beginPath:cs,rect:us,roundRect:_s,ellipse:ps,arc:gs,arcTo:fs,moveToEllipse:ys,moveToArc:ms}=is;class vs{constructor(t){this.path=t?"string"==typeof t?Ct.parse(t):t:[]}beginPath(){return cs(this.path),this}moveTo(t,e){return ns(this.path,t,e),this}lineTo(t,e){return os(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,a){return ls(this.path,t,e,s,i,r,a),this}quadraticCurveTo(t,e,s,i){return hs(this.path,t,e,s,i),this}closePath(){return ds(this.path),this}rect(t,e,s,i){return us(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return _s(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,a,n,o){return ps(this.path,t,e,s,i,r,a,n,o),this}arc(t,e,s,i,r,a){return gs(this.path,t,e,s,i,r,a),this}arcTo(t,e,s,i,r){return fs(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,a,n,o){return ys(this.path,t,e,s,i,r,a,n,o),this}moveToArc(t,e,s,i,r,a){return ms(this.path,t,e,s,i,r,a),this}}const{M:ws,L:xs,C:bs,Q:Bs,Z:ks,N:Es,D:Cs,X:Rs,G:Ts,F:Os,O:Ls,P:Ps,U:Ss}=Tt,As=K.get("PathDrawer"),Ds={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case ws:t.moveTo(e[i+1],e[i+2]),i+=3;break;case xs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case bs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Bs:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ks:t.closePath(),i+=1;break;case Es:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Cs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Rs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ts:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*a,e[i+6]*a,e[i+7]*a,e[i+8]),i+=9;break;case Os:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,n,!1),i+=5;break;case Ls:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*a,e[i+5]*a,e[i+6]),i+=7;break;case Ps:t.arc(e[i+1],e[i+2],e[i+3],0,n,!1),i+=4;break;case Ss:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void As.error(`command: ${s} [index:${i}]`,e)}}},{M:Ms,L:Is,C:Ws,Q:Ns,Z:Fs,N:Hs,D:Us,X:Ys,G:zs,F:js,O:Xs,P:Vs,U:Gs}=Tt,{toTwoPointBounds:qs,toTwoPointBoundsByQuadraticCurve:Ks,arcTo:Qs,arc:Zs,ellipse:$s}=Vt,{add:Js,copy:ti,addPoint:ei,setPoint:si,addBounds:ii,toBounds:ri}=O,ai=K.get("PathBounds");let ni,oi,hi;const li={},di={},ci={},ui={toBounds(t,e){ui.toTwoPointBounds(t,di),ri(di,e)},toTwoPointBounds(t,e){if(!t||!t.length)return si(e,0,0);let s,i,r,a,n,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(s=t[o],0===o&&(s===Fs||s===Ws||s===Ns?si(e,h,l):si(e,t[o+1],t[o+2])),s){case Ms:case Is:h=t[o+1],l=t[o+2],ei(e,h,l),o+=3;break;case Ws:a=t[o+5],n=t[o+6],qs(h,l,t[o+1],t[o+2],t[o+3],t[o+4],a,n,li),Js(e,li),h=a,l=n,o+=7;break;case Ns:i=t[o+1],r=t[o+2],a=t[o+3],n=t[o+4],Ks(h,l,i,r,a,n,li),Js(e,li),h=a,l=n,o+=5;break;case Fs:o+=1;break;case Hs:h=t[o+1],l=t[o+2],ii(e,h,l,t[o+3],t[o+4]),o+=5;break;case Us:case Ys:h=t[o+1],l=t[o+2],ii(e,h,l,t[o+3],t[o+4]),o+=s===Us?9:6;break;case zs:$s(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=9;break;case js:h=t[o+1],l=t[o+2],oi=t[o+3],hi=t[o+4],ii(e,h-oi,l-hi,2*oi,2*hi),h+=oi,o+=5;break;case Xs:Zs(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=7;break;case Vs:h=t[o+1],l=t[o+2],ni=t[o+3],ii(e,h-ni,l-ni,2*ni,2*ni),h+=ni,o+=4;break;case Gs:Qs(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],li,ci),0===o?ti(e,li):Js(e,li),h=ci.x,l=ci.y,o+=6;break;default:return void ai.error(`command: ${s} [index:${o}]`,t)}}},_i={smooth:(t,e,s)=>t};Ct.creator=new vs,Ct.parse=Fe.parse,Ct.convertToCanvasData=Fe.toCanvasData;const{drawRoundRect:pi}=Mt;function gi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){pi(this,t,e,s,i,r)})}(t)}function fi(t,e,s){Object.defineProperty(t,e,s)}function yi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function mi(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};fi(t,e,Object.assign(r,i||{})),Mi(t,e,s)}function vi(t){return(e,s)=>{mi(e,s,t)}}function wi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function xi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function bi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Bi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const ki=Bi;function Ei(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ci=Ei;function Ri(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ti(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Oi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Li(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Pi(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Si(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ai(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),K.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Di(t){return(e,s)=>{fi(e,"__DataProcessor",{get:()=>t})}}function Mi(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[r]}:"width"===e?n.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});const o=yi(i,e);o&&o.set&&(n.set=o.set),i[a]&&(n.set=i[a],delete i[a]),Object.defineProperty(i,e,n)}const Ii=new K("rewrite"),Wi=[],Ni=["destroy","constructor"];function Fi(t){return(e,s)=>{Wi.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Hi(){return t=>{Ui()}}function Ui(t){Wi.length&&(Wi.forEach((e=>{t&&Ii.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Wi.length=0)}function Yi(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Ni.includes(i)||e&&e.includes(i)))if(t.prototype){yi(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function zi(){return t=>{et.register(t)}}function ji(){return t=>{rt.register(t)}}setTimeout((()=>Ui(!0)));const{toOuterOf:Xi}=Y;class Vi{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Xi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Xi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Xi(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const Gi={},qi={on(t,e,s){let i,r,a;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Ki(this,i,!0),o="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};o.forEach((t=>{t&&(a=n[t],a?-1===a.findIndex((t=>t.listener===e))&&a.push(h):n[t]=[h])}))},off(t,e,s){let i,r,a;s&&(i="boolean"==typeof s?s:s.capture);const n=Ki(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=n[t],r&&(a=r.findIndex((t=>t.listener===e)),a>-1&&r.splice(a,1),r.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=Ki(this,s)[t];if(i){let r;for(let a=0,n=i.length;a<n&&(r=i[a],r.listener(e),r.once&&(this.off(t,r.listener,s),a--,n--),!e||!e.isStopNow);a++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Ki(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Gi)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Gi)}}class Qi{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 Zi extends Qi{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Zi.ADD="child.add",Zi.REMOVE="child.remove";class $i extends Qi{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}$i.CHANGE="property.change";class Ji extends Qi{constructor(t,e){super(t),Object.assign(this,e)}}Ji.LOAD="image.load",Ji.LOADED="image.loaded",Ji.ERROR="image.error";class tr extends Qi{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(tr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}tr.RESIZE="resize";class er extends Qi{constructor(t,e){super(t),e&&Object.assign(this,e)}}er.START="transform.start",er.CHANGE="transform.change",er.END="transform.end",er.BEFORE_START="transform.before_start",er.BEFORE_CHANGE="transform.before_change",er.BEFORE_END="transform.before_end";class sr extends Qi{constructor(t,e){super(t),this.data=e}}sr.REQUEST="watch.request",sr.DATA="watch.data";class ir extends Qi{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ir.CHECK_UPDATE="layout.check_update",ir.REQUEST="layout.request",ir.START="layout.start",ir.BEFORE="layout.before",ir.LAYOUT="layout.layout",ir.AFTER="layout.after",ir.AGAIN="layout.again",ir.END="layout.end";class rr extends Qi{}rr.FRAME="animate.frame";class ar extends Qi{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}ar.REQUEST="render.request",ar.START="render.start",ar.BEFORE="render.before",ar.RENDER="render",ar.AFTER="render.after",ar.AGAIN="render.again",ar.END="render.end";class nr extends Qi{}nr.START="leafer.start",nr.BEFORE_READY="leafer.before_ready",nr.READY="leafer.ready",nr.AFTER_READY="leafer.after_ready",nr.VIEW_READY="leafer.view_ready",nr.STOP="leafer.stop",nr.RESTART="leafer.restart",nr.END="leafer.end";const or={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=$i,i=new $i(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{sin:hr,cos:lr}=Math,dr=Object.assign(Object.assign({},f.defaultMatrix),{scaleX:1,scaleY:1}),cr={__updateWorldMatrix(){const t=this.parent?this.parent.__world:dr,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX*this.__.scaleX,s.scaleY=t.scaleY*this.__.scaleY):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f,s.scaleX=t.scaleX,s.scaleY=t.scaleY)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:n,skewY:o}=this.__;r||n||o?(r*=a,n&&(n*=a),o&&(o*=a),t.a=s*lr(r+o),t.b=s*hr(r+o),t.c=i*-hr(r-n),t.d=i*lr(r-n)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:ur,copyAndSpread:_r}=Y,pr={__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,ur(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else ur(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){ur(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ur(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ur(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(){_r(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){_r(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:gr}=E,fr={},yr={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),gr(t,this.__world,fr),this.__hit(fr)},__drawHitPath(t){this.__drawRenderPath(t)}},mr={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,i)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},vr={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},wr={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,a=t.getSameCanvas(),n=t.getSameCanvas();for(let o=0,h=i.length;o<h;o++)s=i[o],s.isMask?(r?(this.__renderMask(t,n,a),a.clear(),n.clear()):r=!0,s.__render(a,e)):s.__render(n,e);this.__renderMask(t,n,a),a.recycle(),n.recycle()}else{const{bounds:r,hideBounds:a}=e;for(let n=0,o=i.length;n<o;n++)s=i[n],r&&!r.hit(s.__world,e.matrix)||a&&a.includes(s.__world,e.matrix)||s.__render(t,e)}}},{copy:xr,translate:br,toInnerPoint:Br,scaleOfOuter:kr,rotateOfOuter:Er}=f,Cr={},Rr={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Or(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Lr(e[t])}},updateAllChange(t){if(Lr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Pr(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){t.__layout.checkUpdate();const i={x:e,y:s};t.parent&&Br(t.parent.__world,i,i,!0),Tr.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i,r){t.__layout.checkUpdate();const a=t.parent?E.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,a,s,i,r)},zoomOfLocal(t,e,s,i=s,r){xr(Cr,t.__local),r&&br(Cr,r.x,r.y),kr(Cr,e,s,i),r||(r=t),r.x+=Cr.e-t.__local.e,r.y+=Cr.f-t.__local.f,t.scaleX*=s,t.scaleY*=i},rotateOfWorld(t,e,s,i){t.__layout.checkUpdate();const r=t.parent?E.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){xr(Cr,t.__local),i&&br(Cr,i.x,i.y),Er(Cr,e,s),i||(i=t),i.x+=Cr.e-t.__local.e,i.y+=Cr.f-t.__local.f,t.rotation+=s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Tr=Rr,{updateAllWorldMatrix:Or,updateAllWorldOpacity:Lr,updateAllChange:Pr}=Tr,Sr={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},Ar={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.push(t),Dr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Mr(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:Dr,pushAllBranchStack:Mr}=Ar,Ir={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Wr,create:Nr}=s,{toInnerPoint:Fr,toOuterPoint:Hr}=f,{tempToOuterOf:Ur,copy:Yr}=E,{moveLocal:zr,zoomOfLocal:jr,rotateOfLocal:Xr}=Rr;let Vr=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 Vi}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=Nr(Wr),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer=t,t&&(this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&Ir.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){void 0===t?t="x":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?Fr(this.parent.worldTransform,t,e,s):e&&Yr(e,t)}localToWorld(t,e,s){this.parent?Hr(this.parent.worldTransform,t,e,s):e&&Yr(e,t)}worldToInner(t,e,s){Fr(this.worldTransform,t,e,s)}innerToWorld(t,e,s){Hr(this.worldTransform,t,e,s)}move(t,e){zr(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),jr(this,Ur(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Xr(this,Ur(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};Vr=pt([Yi(or),Yi(cr),Yi(pr),Yi(yr),Yi(qi),Yi(mr)],Vr);const{setByListWithHandle:Gr}=Y,{sort:qr}=Ar,{localBoxBounds:Kr,localEventBounds:Qr,localRenderBounds:Zr,maskLocalBoxBounds:$r,maskLocalEventBounds:Jr,maskLocalRenderBounds:ta}=Sr;let ea=class extends Vr{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(){Gr(this.__layout.boxBounds,this.children,this.__hasMask?$r:Kr)}__updateStrokeBounds(){Gr(this.__layout.strokeBounds,this.children,this.__hasMask?Jr:Qr)}__updateRenderBounds(){Gr(this.__layout.renderBounds,this.children,this.__hasMask?ta:Zr)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(qr),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Ir.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(Zi.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(Zi.REMOVE,t),this.leafer.hitCanvasManager.clear())}__emitChildEvent(t,e){const s=new Zi(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ea=pt([Yi(wr),Yi(vr)],ea);const sa={};class ia{static isHoldSpaceKey(){return ia.hasDownCode("Space")}static setDownCode(t){sa[t]||(sa[t]=!0)}static setUpCode(t){sa[t]=!1}static hasDownCode(t){return sa[t]}}class ra{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const aa={};class na extends Qi{get spaceKey(){return ia.isHoldSpaceKey()}get left(){return ra.left(this)}get right(){return ra.right(this)}get middle(){return ra.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,aa),Object.assign({},aa)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,aa),Object.assign({},aa)}static changeName(t,e){rt.changeName(t,e)}}let oa=class extends na{};oa.POINTER="pointer",oa.BEFORE_DOWN="pointer.before_down",oa.BEFORE_MOVE="pointer.before_move",oa.BEFORE_UP="pointer.before_up",oa.DOWN="pointer.down",oa.MOVE="pointer.move",oa.UP="pointer.up",oa.OVER="pointer.over",oa.OUT="pointer.out",oa.ENTER="pointer.enter",oa.LEAVE="pointer.leave",oa.TAP="tap",oa.DOUBLE_TAP="double_tap",oa.CLICK="click",oa.DOUBLE_CLICK="double_click",oa.LONG_PRESS="long_press",oa.LONG_TAP="long_tap",oa=pt([ji()],oa);const ha={},la={};let da=class extends oa{getInnerMove(t){return t||(t=this.current),ha.x=this.moveX,ha.y=this.moveY,t.worldToInner(ha,la,!0),Object.assign({},la)}getLocalMove(t){return t||(t=this.current),ha.x=this.moveX,ha.y=this.moveY,t.worldToLocal(ha,la,!0),Object.assign({},la)}};var ca;da.DRAG="drag",da.START="drag.start",da.END="drag.end",da.OVER="drag.over",da.OUT="drag.out",da.ENTER="drag.enter",da.LEAVE="drag.leave",da=pt([ji()],da);let ua=ca=class extends oa{static setList(t){ca.dragList=t instanceof ot?t:new ot(t)}static setData(t){this.dragData=t}};ua.DROP="drop",ua=ca=pt([ji()],ua);let _a=class extends da{};_a.MOVE="move",_a.START="move.start",_a.END="move.end",_a=pt([ji()],_a);let pa=class extends na{};pa.ROTATE="rotate",pa.START="rotate.start",pa.END="rotate.end",pa=pt([ji()],pa);let ga=class extends da{};ga.SWIPE="swipe",ga.LEFT="swipe.left",ga.RIGHT="swipe.right",ga.UP="swipe.up",ga.DOWN="swipe.down",ga=pt([ji()],ga);let fa=class extends na{};fa.ZOOM="zoom",fa.START="zoom.start",fa.END="zoom.end",fa=pt([ji()],fa);let ya=class extends na{};ya.DOWN="key.down",ya.PRESS="key.press",ya.UP="key.up",ya=pt([ji()],ya);const ma=K.get("TaskProcessor");class va{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return gt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){ma.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wa{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&dt.assign(this.config,t),this.empty()}add(t,e){let s,i,r,a;const n=new va(t);return n.parent=this,"number"==typeof e?a=e:e&&(i=e.parallel,s=e.start,r=e.time,a=e.delay),r&&(n.time=r),!1===i&&(n.parallel=!1),void 0===a?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber--,this.push(n,s)}),a)),this.isComplete=!1,n}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const xa={map:{},recycledList:[],tasker:new wa,patternTasker:new wa,get isComplete(){return ba.tasker.isComplete&&ba.patternTasker.isComplete},get(t){let s=ba.map[t.url];return s||(s=e.image(t),ba.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ba.recycledList.push(t)}))},clearRecycled(){const t=ba.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete ba.map[t.url],t.destroy())})),t.length=0)},destroy(){ba.map={}}},ba=xa,{IMAGE:Ba,create:ka}=s;class Ea{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=ka(Ba),this.config=t||{url:""};const{url:e}=t;e.startsWith("data:")?e.startsWith("data:image/svg")&&(this.isSVG=!0):e.includes(".svg")&&(this.isSVG=!0)}load(e,s){return this.loading||(this.loading=!0,xa.tasker.add((()=>gt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const a=t.origin.createCanvas(e,s),n=a.getContext("2d");return i&&(n.globalAlpha=i),n.drawImage(this.view,0,0,e,s),a}destroy(){this.config={url:""},this.waitComplete.length=0}}const Ca=K.get("plugin"),Ra={power:{},list:[],onLeafer(t){Ra.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};class Ta{get updatedList(){if(this.hasRemoved){const t=new ot;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 ot,this.target=t,e&&(this.config=dt.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(ar.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===Zi.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 sr(sr.DATA,{updatedList:this.updatedList})),this.__updatedList=new ot,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($i.CHANGE,this.__onAttrChange,this),t.on_([Zi.ADD,Zi.REMOVE],this.__onChildEvent,this),t.on_(sr.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:Oa,updateAllWorldOpacity:La}=Rr,{pushAllChildBranch:Pa,pushAllParent:Sa}=Ar;const{worldBounds:Aa}=Sr,{setByListWithHandle:Da}=Y;class Ma{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ot(t)),this.updatedList=t}setBefore(){Da(this.beforeBounds,this.updatedList.list,Aa)}setAfter(){Da(this.afterBounds,this.updatedList.list,Aa),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:Ia,updateAllChange:Wa}=Rr,{pushAllBranchStack:Na,updateWorldBoundsByBranchStack:Fa}=Ar,Ha=K.get("Layouter");class Ua{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ht,this.target=t,e&&(this.config=dt.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(ir.START),this.layoutOnce(),t.emitEvent(new ir(ir.END,this.layoutedBlocks,this.times))}catch(t){Ha.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ha.warn("layouting"):this.times>3?Ha.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(sr.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=$.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:a,AFTER:n}=ir,o=this.getBlocks(i);o.forEach((t=>{t.setBefore()})),s.emitEvent(new ir(r,o,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(Oa(t),e.push(t),t.isBranch&&Pa(t,e),Sa(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),Sa(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&La(t),t.__updateChange()}))}(i),o.forEach((t=>t.setAfter())),s.emitEvent(new ir(a,o,this.times)),s.emitEvent(new ir(n,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,$.end(e)}fullLayout(){const t=$.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=ir,a=this.getBlocks(new ot(e));e.emitEvent(new ir(s,a,this.times)),Ua.fullLayout(e),a.forEach((t=>{t.setAfter()})),e.emitEvent(new ir(i,a,this.times)),e.emitEvent(new ir(r,a,this.times)),this.addBlocks(a),$.end(t)}static fullLayout(t){if(Ia(t),t.isBranch){const e=[t];Na(t,e),Fa(e)}else t.__updateWorldBounds();Wa(t)}createBlock(t){return new Ma(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_(ir.REQUEST,this.layout,this),t.on_(ir.AGAIN,this.layoutAgain,this),t.on_(sr.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Ya=K.get("Renderer");class za{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=dt.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ir.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Ya.log(e.innerName,"---\x3e");try{this.emitRender(ar.START),this.renderOnce(t),this.emitRender(ar.END,this.totalBounds),xa.clearRecycled()}catch(t){Ya.error(t)}Ya.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Ya.warn("rendering"):this.times>3?Ya.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(ar.BEFORE),t()):(this.requestLayout(),this.emitRender(ar.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(ar.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ar.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 Ya.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=$.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),a=(new V).copy(i);s.save(),r&&!K.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,a),s.restore(),$.end(e)}fullRender(){const t=$.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),$.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),K.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),K.showHitView&&this.renderHitView(s),K.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(rr.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ya.warn(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new ar(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ar.REQUEST,this.update,this),t.on_(ir.END,this.__onLayoutEnd,this),t.on_(ar.AGAIN,this.renderAgain,this),t.on_(tr.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:ja}=Y;class Xa{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const a=this.findList,n=this.getBestMatchLeaf(),o=r?this.getPath(n):this.getHitablePath(n);return this.clear(),i?{path:o,leaf:n,throughPath:a.length?this.getThroughPath(a):o}:{path:o,leaf:n}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Rr.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ot;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ot;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ot,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,a;for(let t=0,n=s.length;t<n;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(a=i.list[t],!r||!r.has(a));t++)e.push(a)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let a=t.length-1;a>-1;a--)s=t[a],e&&!s.isMask||(i=ja(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Va{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=dt.default(e,this.config)),this.findPath=new Xa(t,this),this.__listenEvents()}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(ir.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(Zi.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.findPath.destroy(),this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={})}}Object.assign(e,{watcher:(t,e)=>new Ta(t,e),layouter:(t,e)=>new Ua(t,e),renderer:(t,e,s)=>new za(t,e,s),selector:(t,e)=>new Va(t,e)}),t.layout=Ua.fullLayout;class Ga extends Et{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;this.view.width=t*s,this.view.height=e*s,this.clientBounds=this.bounds}}gi(OffscreenCanvasRenderingContext2D.prototype),gi(Path2D.prototype);class qa{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(_a.START,this.moveData)}t.path=this.moveData.path,e.emit(_a.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(fa.START,this.zoomData)}t.path=this.zoomData.path,e.emit(fa.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(pa.START,this.rotateData)}t.path=this.rotateData.path,e.emit(pa.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(_a.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(fa.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(pa.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const Ka={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?ga.UP:t>45&&t<135?ga.DOWN:t<=45&&t>=-45?ga.RIGHT:ga.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:Qa.getSwipeDirection(E.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ot,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Qa=Ka,{getDragEventData:Za,getDropEventData:$a,getSwipeEventData:Ja,filterPathByEventType:tn}=Ka;class en{constructor(t){this.interaction=t}setDragData(t){this.dragData=Za(t,t,t)}getDragList(){return this.dragging?ua.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ra.middle(t)&&!ra.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const a=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ra.middle(t)||ia.isHoldSpaceKey()||a)&&e,this.moving&&s.emit(_a.START,r)}this.moving||this.dragStart(t,e);const{path:a,throughPath:n}=i;this.dragData=Za(i,r,t),n&&(this.dragData.throughPath=n),this.dragData.path=a,this.moving?s.emit(_a.MOVE,this.dragData):this.dragging&&(s.emit(da.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ra.left(t)&&e,this.dragging&&(this.interaction.emit(da.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=tn(this.dragData.path,da.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Rr.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(da.OUT,t,s),e.emit(da.OVER,t,i)):e.emit(da.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(da.LEAVE,t,s,i),e.emit(da.ENTER,t,i,s),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,a=Za(s,t,t);r&&(a.throughPath=r),a.path=i,this.moving&&e.emit(_a.END,a),this.dragging&&(e.emit(da.END,a),this.swipe(t,a),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(E.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Ja(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=$a(t,this.getDragList(),ua.dragData);e.path=this.dragEnterPath,this.interaction.emit(ua.DROP,e),this.interaction.emit(da.LEAVE,t,this.dragEnterPath)}dragReset(){ua.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const a=e.shrinkCanvasBounds,{x:n,y:o}=a,h=Y.right(a),l=Y.bottom(a),d=t.x<n?i:h<t.x?-i:0,c=t.y<o?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,E.move(s,d,c),E.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const sn=["move","zoom","rotate"];function rn(t,e,s,i,r){if(sn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!nn(t,r)){let a;for(let n=0,o=t.children.length;n<o;n++)a=t.children[n],!s.path.has(a)&&a.__.hittable&&an(a,e,s,i,r)}}function an(t,e,s,i,r){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!nn(t,r)){s.phase=i?1:t===s.target?2:3;const r=rt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function nn(t,e){return e&&e.has(t)}const on={getData(t){const e=t[0],s=t[1],i=E.getCenter(e.from,s.from),r=E.getCenter(e.to,s.to),a={x:r.x-i.x,y:r.y-i.y},n=E.getDistance(e.from,s.from),o=E.getDistance(e.to,s.to)/n,h=E.getAngle(e.from,s.from),l=E.getAngle(e.to,s.to);return{move:a,scale:o,angle:this.getChangedAngle(h,l),center:r}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:hn,getMoveEventData:ln,getZoomEventData:dn,getRotateEventData:cn}=Ka;class un{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ot(e),this.transformer=new qa(this),this.dragger=new en(this),r&&(this.config=dt.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){this.emit(oa.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,{through:i});r.throughPath&&(t.throughPath=r.throughPath),t.path=e?this.defaultPath:r.path,this.emit(oa.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ra.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&ra.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(oa.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=E.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:oa.MOVE});t.path=e.path,this.emit(oa.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(oa.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(oa.UP,t),this.emit(oa.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:a}=on.getData(e);this.rotate(cn(a,i,t)),this.zoom(dn(a,r,t)),this.move(ln(a,s,t))}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(oa.OUT,t,this.overPath),this.emit(oa.OVER,t,e)):this.emit(oa.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(oa.LEAVE,t,this.enterPath,e),this.emit(oa.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(oa.LEAVE,t),this.dragger.dragging&&this.emit(ua.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[oa.DOUBLE_TAP,oa.DOUBLE_CLICK].some((e=>hn(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit(oa.TAP,t),this.emit(oa.CLICK,t)}emitDoubleTap(t){this.emit(oa.DOUBLE_TAP,t),this.emit(oa.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(oa.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(oa.LONG_TAP,t),hn(t.path,oa.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_(tr.RESIZE,this.__onResize,this)],t.once(nr.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let a=s.length-1;a>-1;a--){if(r=s.list[a],an(r,t,e,!0,i))return;r.isApp&&rn(r,t,e,!0,i)}for(let a=0,n=s.length;a<n;a++)if(r=s.list[a],r.isApp&&rn(r,t,e,!1,i),an(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}const{mineType:_n}=_t;function pn(s,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,s)=>new Promise(((i,r)=>{t.convertToBlob({type:_n(e),quality:s}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,s)=>t.convertToBlob({type:_n(e),quality:s}),canvasSaveAs:(t,e,s)=>new Promise((t=>t())),loadImage:e=>new Promise(((s,i)=>{!e.startsWith("data:")&&t.imageSuffix&&(e+=(e.includes("?")?"&":"?")+t.imageSuffix);let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then((t=>{s(t)})).catch((t=>{i(t)}))},r.onerror=t=>i(t),r.send()}))},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Ga(t,e),image:t=>new Ea(t),hitCanvas:(t,e)=>new Ga(t,e),interaction:(t,e,s,i)=>new un(t,e,s,i)}),t.name="web",t.isWorker=!0,t.requestRender=function(t){requestAnimationFrame(t)},t.devicePixelRatio=1,t.realtimeLayout=!0;const{userAgent:gn}=navigator;gn.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):gn.indexOf("Safari")>-1&&-1===gn.indexOf("Chrome")&&(t.fullImageShadow=!0),gn.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):gn.indexOf("Mac")>-1?t.os="Mac":gn.indexOf("Linux")>-1&&(t.os="Linux");const fn=K.get("LeaferTypeCreator"),yn={list:{},register(t,e){mn[t]?fn.repeat(t):mn[t]=e},run(t,e){const s=yn.list[t];s?s(e):fn.error("no",t)}},{list:mn}=yn;yn.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),yn.register("design",(function(t){const{MOVE:e}=_a,{ZOOM:s}=fa;t.__eventIds.push(t.on_(e,(e=>{Rr.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:a}=e;a*s<i?a=i/s:a*s>r&&(a=r/s),1!==a&&Rr.zoomOfWorld(t.zoomLayer,e,a)})))}));const vn={},wn={},xn={export(t,e,s){return function(t){bn||(bn=new wa);return new Promise((e=>{bn.add((()=>gt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((r=>{const{leafer:a}=t;a?a.waitViewLoaded((()=>gt(this,void 0,void 0,(function*(){let t,n,o,{canvas:h}=a,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=a.config.fill,a.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}o=e.includes(".")?yield h.saveAs(e,t):n?yield h.toBlob(e,t):yield h.toDataURL(e,t),i({data:o}),r(),l&&h.recycle()})))):(i({data:!1}),r())}))))}};let bn;const{copy:Bn,toOffsetOutBounds:kn}=Y,En={},Cn={};function Rn(e,s,i,r){const{bounds:a,shapeBounds:n}=r;if(t.fullImageShadow){if(Bn(En,e.bounds),En.x+=s.x-n.x,En.y+=s.y-n.y,i){const{matrix:t}=r;En.x-=(a.x+(t?t.e:0)+a.width/2)*(i-1),En.y-=(a.y+(t?t.f:0)+a.height/2)*(i-1),En.width*=i,En.height*=i}e.copyWorld(r.canvas,e.bounds,En)}else i&&(Bn(En,s),En.x-=s.width/2*(i-1),En.y-=s.height/2*(i-1),En.width*=i,En.height*=i),e.copyWorld(r.canvas,n,i?En:s)}const{toOffsetOutBounds:Tn}=Y,On={};var Ln=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,a;const{__world:n,__layout:o}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;Tn(d,On),h.forEach(((t,i)=>{p.save(),p.setWorldShadow(On.offsetX+t.x*u,On.offsetY+t.y*_,t.blur*u),a=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Rn(p,On,a,s),p.restore(),l?(p.copyWorld(p,d,n,"copy"),p.copyWorld(l,n,n,"source-out"),r=n):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(p,r,o.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,a;const{__world:n,__layout:o}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;kn(d,Cn),h.forEach(((t,i)=>{p.setWorldShadow(Cn.offsetX+t.x*u,Cn.offsetY+t.y*_,t.blur*u,t.color),a=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Rn(p,Cn,a,s),r=d,t.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,n,"copy"),r=n),l?p.copyWorld(l,n,n,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(p,r,o.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()}});const{get:Pn,rotateOfOuter:Sn,translate:An,scaleOfOuter:Dn,scale:Mn,rotate:In}=f;const{get:Wn,translate:Nn}=f;function Fn(t,e,s,i){let{width:r,height:a}=e;const{opacity:n,mode:o,offset:h,scale:l,rotation:d,blendMode:c}=s,u=i.width===r&&i.height===a;c&&(t.blendMode=c);const _=t.data={mode:o};switch(o){case"strench":u||(r=i.width,a=i.height),(i.x||i.y)&&(_.transform=Wn(),Nn(_.transform,i.x,i.y));break;case"clip":(h||l||d)&&function(t,e,s,i,r){const a=Pn();An(a,e.x,e.y),s&&An(a,s.x,s.y),i&&("number"==typeof i?Mn(a,i):Mn(a,i.x,i.y),t.scaleX=a.a,t.scaleY=a.d),r&&In(a,r),t.transform=a}(_,i,h,l,d);break;case"repeat":(!u||l||d)&&function(t,e,s,i,r,a){const n=Pn();if(a)switch(In(n,a),a){case 90:An(n,i,0);break;case 180:An(n,s,i);break;case 270:An(n,0,s)}An(n,e.x,e.y),r&&(Dn(n,e,r),t.scaleX=t.scaleY=r),t.transform=n}(_,i,r,a,l,d);break;default:u&&!d||function(t,e,s,i,r,a){const n=Pn(),o=a&&180!==a,h=s.width/(o?r:i),l=s.height/(o?i:r),d="fit"===e?Math.min(h,l):Math.max(h,l),c=s.x+(s.width-i*d)/2,u=s.y+(s.height-r*d)/2;An(n,c,u),Mn(n,d),a&&Sn(n,{x:s.x+s.width/2,y:s.y+s.height/2},a),t.scaleX=t.scaleY=d,t.transform=n}(_,o,i,r,a,d)}_.width=r,_.height=a,n&&(_.opacity=n)}function Hn(t,e,s){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=s.width,e.__naturalHeight=s.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),!1}return!0}function Un(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new Ji(t,e))}const{get:Yn,scale:zn,copy:jn}=f;function Xn(e,s,i){let{scaleX:r,scaleY:a}=e.__world;const n=r+a;if(s.patternId===n||e.destroyed)return!1;{s.patternId=n;const{image:e,data:o}=s,h=e.isSVG?4096:Math.min(e.width,4096),l=e.isSVG?4096:Math.min(e.height,4096);let d,c,{width:u,height:_,scaleX:p,scaleY:g,opacity:f,transform:y,mode:m}=o;p&&(c=Yn(),jn(c,y),zn(c,1/p,1/g),r*=p,a*=g),r*=i,a*=i,u*=r,_*=a,u>h||_>l?d=Math.max(u/h,_/l):(u<32||_<32)&&(d=Math.min(u/32,_/32)),d&&(r/=d,a/=d,u/=d,_/=d),p&&(r/=p,a/=g),(y||1!==r||1!==a)&&(c||(c=Yn(),y&&jn(c,y)),zn(c,1/r,1/a));const v=t.canvas.createPattern(e.getCanvas(u,_,f),"repeat"===m?"repeat":t.origin.noRepeat||"no-repeat");try{s.transform&&(s.transform=null),c&&(v.setTransform?v.setTransform(c):s.transform=c)}catch(t){s.transform=c}return s.style=v,!0}}function Vn(t,e,s,i){const{scaleX:r,scaleY:a}=t.__world;if(s.data&&s.patternId!==r+a){if(i)if(s.image.isSVG&&"repeat"!==s.data.mode){let{width:t,height:n}=s.data;t*=r*e.pixelRatio,n*=a*e.pixelRatio,i=t>4096||n>4096}else i=!1;if(i){e.save(),e.clip();const{data:t}=s;return s.blendMode&&(e.blendMode=s.blendMode),t.opacity&&(e.opacity*=t.opacity),t.transform&&e.transform(t.transform),e.drawImage(s.image.view,0,0,t.width,t.height),e.restore(),!0}return s.style?xa.patternTasker.add((()=>gt(this,void 0,void 0,(function*(){e.bounds.hit(t.__world)&&Xn(t,s,e.pixelRatio)&&t.forceUpdate("surface")}))),300):Xn(t,s,e.pixelRatio),!1}return!1}function Gn(t,e){const s="fill"===e?t._fill:t._stroke;if(s instanceof Array){let i,r,a,n;for(let o=0,h=s.length;o<h;o++)i=s[o].image,n=i&&i.url,n&&(r||(r={}),r[n]=!0,xa.recycle(i),i.loading&&(a||(a=t.__input&&t.__input[e]||[],a instanceof Array||(a=[a])),i.unload(s[o].loadId,!a.some((t=>t.url===n)))));return r}return null}function qn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:a}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,a)}function Kn(t,e,s){const{strokeAlign:i}=t.__,r="string"!=typeof s;switch(i){case"center":e.setStroke(r?void 0:s,t.__.strokeWidth,t.__),r?$n(t,s,e,!0):Zn(t,e);break;case"inside":Qn(t,e,s,"inside",r);break;case"outside":Qn(t,e,s,"outside",r)}}function Qn(t,e,s,i,r){const{strokeWidth:a,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(r?void 0:s,2*a,t.__),o.font=n,r?$n(t,s,o,!0):Zn(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",qn(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function Zn(t,e){let s;const{rows:i,decorationY:r,decorationHeight:a}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),r&&e.strokeRect(s.x,s.y+r,s.width,a)}function $n(t,e,s,i){let r;for(let a=0,n=e.length;a<n;a++)r=e[a],r.image&&Vn(t,s,r,!1)||r.style&&(s.strokeStyle=r.style,r.blendMode?(s.saveBlendMode(r.blendMode),i?Zn(t,s):s.stroke(),s.restoreBlendMode()):i?Zn(t,s):s.stroke())}const{getSpread:Jn,getOuterOf:to,getByMove:eo,getIntersectData:so}=Y;const io={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},ro={x:.5,y:0},ao={x:.5,y:1};function no(t,e,s){let i;for(let r=0,a=e.length;r<a;r++)i=e[r],t.addColorStop(i.offset,io.string(i.color,s))}const{set:oo,getAngle:ho,getDistance:lo}=E,{get:co,rotateOfOuter:uo,scaleOfOuter:_o}=f,po={x:.5,y:.5},go={x:.5,y:1},fo={},yo={};const{set:mo,getAngle:vo,getDistance:wo}=E,{get:xo,rotateOfOuter:bo,scaleOfOuter:Bo}=f,ko={x:.5,y:.5},Eo={x:.5,y:1},Co={},Ro={};let To;function Oo(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=e.__layout;switch(s.type){case"solid":let{type:a,blendMode:n,color:o,opacity:h}=s;return{type:a,blendMode:n,style:io.string(o,h)};case"image":return function(t,e,s,i,r){const a={type:s.type},n=a.image=xa.get(s),o=(r||n.loading)&&{target:t,image:n,attrName:e,attrValue:s};return n.ready?(Hn(t,e,n)&&Fn(a,n,s,i),r&&(Un(Ji.LOAD,o),Un(Ji.LOADED,o))):n.error?r&&(t.forceUpdate("surface"),o.error=n.error,Un(Ji.ERROR,o)):(r&&Un(Ji.LOAD,o),a.loadId=n.load((()=>{t.destroyed||(Hn(t,e,n)&&(Fn(a,n,s,i),t.forceUpdate("surface")),Un(Ji.LOADED,o))}),(e=>{t.forceUpdate("surface"),o.error=e,Un(Ji.ERROR,o)}))),a}(e,i,s,r,!To||!To[s.url]);case"linear":return function(e,s){let{from:i,to:r,type:a,blendMode:n,opacity:o}=e;i||(i=ro),r||(r=ao);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);no(h,e.stops,o);const l={type:a,style:h};return n&&(l.blendMode=n),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:a,opacity:n,blendMode:o,stretch:h}=e;i||(i=po),r||(r=go);const{x:l,y:d,width:c,height:u}=s;let _;oo(fo,l+i.x*c,d+i.y*u),oo(yo,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=co(),_o(_,fo,c/u*(h||1),1),uo(_,fo,ho(fo,yo)+90));const p=t.canvas.createRadialGradient(fo.x,fo.y,0,fo.x,fo.y,lo(fo,yo));no(p,e.stops,n);const g={type:a,style:p,transform:_};return o&&(g.blendMode=o),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:a,opacity:n,blendMode:o,stretch:h}=e;i||(i=ko),r||(r=Eo);const{x:l,y:d,width:c,height:u}=s;mo(Co,l+i.x*c,d+i.y*u),mo(Ro,l+r.x*c,d+r.y*u);const _=xo(),p=vo(Co,Ro);t.conicGradientRotate90?(Bo(_,Co,c/u*(h||1),1),bo(_,Co,p+90)):(Bo(_,Co,1,c/u*(h||1)),bo(_,Co,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,Co.x,Co.y):t.canvas.createRadialGradient(Co.x,Co.y,0,Co.x,Co.y,wo(Co,Ro));no(g,e.stops,n);const f={type:a,style:g,transform:_};return o&&(f.blendMode=o),f}(s,r);default:return s.r?{type:"solid",style:io.string(s)}:void 0}}var Lo=Object.freeze({__proto__:null,compute:function(t,e){const s=[];let i,r=t.__.__input[e];r instanceof Array||(r=[r]),To=Gn(t.__,e);for(let a=0,n=r.length;a<n;a++)i=Oo(t,r[a],e),i&&s.push(i);t.__["_"+e]=s.length?s:void 0},drawTextStroke:Zn,fill:function(t,e,s){e.fillStyle=s,t.__.__font?qn(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fillText:qn,fills:function(t,e,s){let i;const{windingRule:r,__font:a}=t.__;for(let n=0,o=s.length;n<o;n++)i=s[n],i.image&&Vn(t,e,i,!a)||i.style&&(e.fillStyle=i.style,i.transform?(e.save(),e.transform(i.transform),i.blendMode&&(e.blendMode=i.blendMode),a?qn(t,e):r?e.fill(r):e.fill(),e.restore()):i.blendMode?(e.saveBlendMode(i.blendMode),a?qn(t,e):r?e.fill(r):e.fill(),e.restoreBlendMode()):a?qn(t,e):r?e.fill(r):e.fill())},recycleImage:Gn,shape:function(t,e,s){const i=e.getSameCanvas();let r,a,n,o;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=n=to(h,s.matrix)):r=n=h,o=i;else{const{renderShapeSpread:i}=t.__layout,c=so(i?Jn(e.bounds,i*l):e.bounds,h,s.matrix);a=e.bounds.getFitMatrix(c),a.a<1&&(o=e.getSameCanvas(),t.__renderShape(o,s),l*=a.a,d*=a.d),n=to(h,a),r=eo(n,-a.e,-a.f),s.matrix&&a.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:a})}return t.__renderShape(i,s),{canvas:i,matrix:a,bounds:r,worldCanvas:o,shapeBounds:n,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:a,__font:n}=i;if(r)if(n)Kn(t,e,s);else switch(a){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const a=e.getSameCanvas(!0);a.setStroke(s,2*r,t.__),t.__drawRenderPath(a),a.stroke(),a.clip(i.windingRule),a.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(a,t.__world,t.__layout.renderBounds),a.recycle()}},strokeText:Kn,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:a,__font:n}=i;if(r)if(n)Kn(t,e,s);else switch(a){case"center":e.setStroke(void 0,r,i),$n(t,s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),$n(t,s,e),e.restore();break;case"outside":const{renderBounds:a}=t.__layout,n=e.getSameCanvas(!0);t.__drawRenderPath(n),n.setStroke(void 0,2*r,t.__),$n(t,s,n),n.clip(i.windingRule),n.clearWorld(a),e.copyWorldToInner(n,t.__world,a),n.recycle()}}});Object.assign(vn,Ln),Object.assign(wn,Lo);const Po={};class So extends ut{setFill(t){this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Po)):(this.__isFills&&(this.__removeInput("fill"),wn.recycleImage(this,"fill"),this.__isFills=!1),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Po)):(this.__isStrokes&&(this.__removeInput("stroke"),wn.recycleImage(this,"stroke"),this.__isStrokes=!1),this._stroke=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Ao={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Do extends So{}class Mo extends Do{get __boxStroke(){return!0}}class Io extends So{get __boxStroke(){return!0}}const{parse:Wo}=Fe;const No={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Fo extends Io{}function Ho(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Uo(t){return(e,s)=>{mi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Yo={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:n}=this.__;if((s||"all"===i)&&n&&"inside"!==r&&(e=t="center"===r?n/2:n,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*a/2)*Math.sqrt(n)-t:0,r="none"===s?0:n;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let a=t=Math.ceil(t);return s&&s.forEach((t=>{a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t}},zo={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:a}=this.__,n=i&&"path"===r||"all"===r,o=s.hitFill(e,a);if(n&&o)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!n&&o&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!n){if(!o&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},jo={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&wn.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&wn.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const a=wn.shape(this,t,e),{shadow:n,innerShadow:o}=this.__;n&&vn.shadow(this,t,a,e),s&&(this.__.__isFills?wn.fills(this,t,s):wn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),o&&vn.innerShadow(this,t,a,e),i&&(this.__.__isStrokes?wn.strokes(this,t,i):wn.stroke(this,t,i)),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else s&&(this.__.__isFills?wn.fills(this,t,s):wn.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?wn.strokes(this,t,i):wn.stroke(this,t,i))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&wn.fill(this,t,"#000000"),i&&wn.stroke(this,t,"#000000")}},Xo={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:a,__drawAfterFill:n}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),a){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(a,r,this.__);const n=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-r,i-r);break;case"outside":t.strokeRect(-n,-n,s+r,i+r)}}}};let Vo=class extends Vr{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Fe.toCanvasData(e,!0):e:[]}getPathString(t){return Fe.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&wn.compute(this,"fill"),e&&wn.compute(this,"stroke")}}__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 xn.export(this,t,e)}static one(t,e,s,i,r){return et.get(t.tag||this.prototype.__tag,t,e,s,i,r)}destroy(){this.fill=this.stroke=null,super.destroy()}};pt([Di(So)],Vo.prototype,"__",void 0),pt([vi("")],Vo.prototype,"id",void 0),pt([vi("")],Vo.prototype,"name",void 0),pt([vi("")],Vo.prototype,"className",void 0),pt([Ti("pass-through")],Vo.prototype,"blendMode",void 0),pt([Oi(1)],Vo.prototype,"opacity",void 0),pt([Oi(!0)],Vo.prototype,"visible",void 0),pt([Pi(!1)],Vo.prototype,"isMask",void 0),pt([Si(!1)],Vo.prototype,"isEraser",void 0),pt([Li(0)],Vo.prototype,"zIndex",void 0),pt([vi()],Vo.prototype,"locked",void 0),pt([wi(0)],Vo.prototype,"x",void 0),pt([wi(0)],Vo.prototype,"y",void 0),pt([Bi(100)],Vo.prototype,"width",void 0),pt([Bi(100)],Vo.prototype,"height",void 0),pt([xi(1)],Vo.prototype,"scaleX",void 0),pt([xi(1)],Vo.prototype,"scaleY",void 0),pt([bi(0)],Vo.prototype,"rotation",void 0),pt([bi(0)],Vo.prototype,"skewX",void 0),pt([bi(0)],Vo.prototype,"skewY",void 0),pt([vi(!1)],Vo.prototype,"draggable",void 0),pt([Ai(!0)],Vo.prototype,"hittable",void 0),pt([Ai("path")],Vo.prototype,"hitFill",void 0),pt([Ci("path")],Vo.prototype,"hitStroke",void 0),pt([Ai(!0)],Vo.prototype,"hitChildren",void 0),pt([Ai(!0)],Vo.prototype,"hitSelf",void 0),pt([Ti()],Vo.prototype,"fill",void 0),pt([Ci()],Vo.prototype,"stroke",void 0),pt([Ci("inside")],Vo.prototype,"strokeAlign",void 0),pt([Ci(1)],Vo.prototype,"strokeWidth",void 0),pt([Ci("none")],Vo.prototype,"strokeCap",void 0),pt([Ci("miter")],Vo.prototype,"strokeJoin",void 0),pt([Ci()],Vo.prototype,"dashPattern",void 0),pt([Ci()],Vo.prototype,"dashOffset",void 0),pt([Ci(10)],Vo.prototype,"miterLimit",void 0),pt([ki()],Vo.prototype,"cornerRadius",void 0),pt([ki()],Vo.prototype,"cornerSmoothing",void 0),pt([Ho()],Vo.prototype,"shadow",void 0),pt([Ho()],Vo.prototype,"innerShadow",void 0),pt([Ho()],Vo.prototype,"blur",void 0),pt([Ho()],Vo.prototype,"backgroundBlur",void 0),pt([Ho()],Vo.prototype,"grayscale",void 0),pt([Fi(Ds.drawPathByData)],Vo.prototype,"__drawPathByData",null),Vo=pt([Yi(Yo),Yi(zo),Yi(jo),Hi()],Vo);let Go=class extends Vo{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}remove(t,e){}removeAll(t){}};pt([Di(Do)],Go.prototype,"__",void 0),Go=pt([Yi(ea),zi()],Go);let qo=class extends Vo{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};pt([Di(Io)],qo.prototype,"__",void 0),qo=pt([Yi(Xo),zi()],qo);const Ko=qo.prototype,Qo=Go.prototype,Zo={},{copy:$o,add:Jo}=Y;let th=class extends Go{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;$o(Zo,t),super.__updateRenderBounds(),Jo(t,Zo)}}__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)}};pt([Di(Mo)],th.prototype,"__",void 0),pt([Ri("show")],th.prototype,"overflow",void 0),pt([Fi(Ko.__updateStrokeSpread)],th.prototype,"__updateStrokeSpread",null),pt([Fi(Ko.__updateRenderSpread)],th.prototype,"__updateRectRenderSpread",null),pt([Fi(Ko.__updateBoxBounds)],th.prototype,"__updateBoxBounds",null),pt([Fi(Ko.__updateStrokeBounds)],th.prototype,"__updateStrokeBounds",null),pt([Fi(Ko.__updateRenderBounds)],th.prototype,"__updateRectRenderBounds",null),pt([Fi(Ko.__updateChange)],th.prototype,"__updateRectChange",null),pt([Fi(Ko.__drawPathByData)],th.prototype,"__drawPathByData",null),pt([Fi(Ko.__render)],th.prototype,"__renderRect",null),pt([Fi(Qo.__render)],th.prototype,"__renderGroup",null),th=pt([Hi(),zi()],th);let eh=class extends th{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};pt([Di(class extends Mo{})],eh.prototype,"__",void 0),pt([Ri("hide")],eh.prototype,"overflow",void 0),eh=pt([zi()],eh);const{moveTo:sh,closePath:ih,ellipse:rh}=is;let ah=class extends Vo{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,a=t/2,n=e/2,o=this.__.path=[];s?i||r?(s<1&&rh(o,a,n,a*s,n*s,0,i,r,!1),rh(o,a,n,a,n,0,r,i,!0),s<1&&ih(o)):(s<1&&(rh(o,a,n,a*s,n*s),sh(o,t,n)),rh(o,a,n,a,n,0,0,360,!0)):i||r?(sh(o,a,n),rh(o,a,n,a,n,0,i,r,!1),ih(o)):rh(o,a,n,a,n)}};pt([Di(class extends So{get __boxStroke(){return!0}})],ah.prototype,"__",void 0),pt([ki(0)],ah.prototype,"innerRadius",void 0),pt([ki(0)],ah.prototype,"startAngle",void 0),pt([ki(0)],ah.prototype,"endAngle",void 0),ah=pt([zi()],ah);const{sin:nh,cos:oh,PI:hh}=Math,{moveTo:lh,lineTo:dh,closePath:ch}=is;let uh=class extends Vo{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,a=this.__.path=[];lh(a,i,0);for(let t=1;t<s;t++)dh(a,i+i*nh(2*t*hh/s),r-r*oh(2*t*hh/s));ch(a)}};pt([Di(class extends So{})],uh.prototype,"__",void 0),pt([ki(3)],uh.prototype,"sides",void 0),uh=pt([zi()],uh);const{sin:_h,cos:ph,PI:gh}=Math,{moveTo:fh,lineTo:yh,closePath:mh}=is;let vh=class extends Vo{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,a=e/2,n=this.__.path=[];fh(n,r,0);for(let t=1;t<2*s;t++)yh(n,r+(t%2==0?r:r*i)*_h(t*gh/s),a-(t%2==0?a:a*i)*ph(t*gh/s));mh(n)}};pt([Di(class extends So{})],vh.prototype,"__",void 0),pt([ki(5)],vh.prototype,"points",void 0),pt([ki(.382)],vh.prototype,"innerRadius",void 0),vh=pt([zi()],vh);const{moveTo:wh,lineTo:xh}=is,{rotate:bh,getAngle:Bh,getDistance:kh,defaultPoint:Eh}=E,{setPoint:Ch,addPoint:Rh,toBounds:Th}=O,Oh={};let Lh=class extends Vo{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&&bh(s,e),this.__toPoint=s,s}set toPoint(t){this.width=kh(Eh,t),this.rotation=Bh(Eh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];wh(t,0,0);const e=this.toPoint;xh(t,e.x,e.y)}__updateBoxBounds(){Ch(Oh,0,0),Rh(Oh,this.__toPoint.x,this.__toPoint.y),Th(Oh,this.__layout.boxBounds)}};pt([Di(class extends So{})],Lh.prototype,"__",void 0),pt([Bi()],Lh.prototype,"rotation",void 0),pt([Ei("center")],Lh.prototype,"strokeAlign",void 0),Lh=pt([zi()],Lh);let Ph=class extends qo{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill=e?{type:"image",mode:"strench",url:e}:void 0,this.once(Ji.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};pt([Di(Fo)],Ph.prototype,"__",void 0),pt([Bi("")],Ph.prototype,"url",void 0),Ph=pt([zi()],Ph);let Sh=class extends qo{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new T(t.__world);r.invert();const a=new T;e&&a.translate(e.x,e.y),s&&("number"==typeof s?a.scale(s):a.scale(s.x,s.y)),i&&a.rotate(i),r.preMultiply(a),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};pt([Di(Fo)],Sh.prototype,"__",void 0),pt([Uo(100)],Sh.prototype,"width",void 0),pt([Uo(100)],Sh.prototype,"height",void 0),pt([Uo(t.devicePixelRatio)],Sh.prototype,"pixelRatio",void 0),pt([Uo(!0)],Sh.prototype,"smooth",void 0),pt([Ai("all")],Sh.prototype,"hitFill",void 0),Sh=pt([zi()],Sh);const Ah=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Dh=Ah+"_#~&*+\\=|≮≯≈≠=…",Mh=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 Ih(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Wh=Ih("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Nh=Ih("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Fh=Ih(Ah),Hh=Ih(Dh),Uh=Ih("- —/~|┆·");var Yh;!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"}(Yh||(Yh={}));const{Letter:zh,Single:jh,Before:Xh,After:Vh,Symbol:Gh,Break:qh}=Yh;function Kh(t){return Wh[t]?zh:Uh[t]?qh:Nh[t]?Xh:Fh[t]?Vh:Hh[t]?Gh:Mh.test(t)?jh:zh}const Qh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let a=r-1;a>-1&&(s=e[a].data[0]," "===s.char);a--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Zh(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:$h}=Qh,{Letter:Jh,Single:tl,Before:el,After:sl,Symbol:il,Break:rl}=Yh;let al,nl,ol,hl,ll,dl,cl,ul,_l,pl,gl,fl,yl,ml,vl=[];function wl(t,e){al.data.push({char:t,width:e}),ol+=e}function xl(){hl+=ol,al.width=ol,nl.words.push(al),al={data:[]},ol=0}function bl(){fl&&(yl.paraNumber++,nl.paraStart=!0,fl=!1),nl.width=hl,ml.width&&$h(nl),vl.push(nl),nl={words:[]},hl=0}const Bl=0,kl=1,El=2;const Cl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,a=0,{width:n,height:o,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(n||(n=0),h){const[t,e,s,l]=r.fourNumber(h);n&&(i=l,n-=e+l),o&&(a=t,o-=t+s)}const u={bounds:{x:i,y:a,width:n,height:o},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,i){yl=e,vl=e.rows,ml=e.bounds;const{__letterSpacing:r,paraIndent:a,textCase:n}=i,{canvas:o}=t,{width:h,height:l}=ml;if(h||l||r||"none"!==n){fl=!0,_l=null,ol=hl=0,al={data:[]},nl={words:[]};for(let t=0,e=s.length;t<e;t++)dl=s[t],"\n"===dl?(ol&&xl(),nl.paraEnd=!0,bl(),fl=!0):(ul=Kh(dl),ul===Jh&&"none"!==n&&(dl=Zh(dl,n,!ol)),cl=o.measureText(dl).width,r&&(cl+=r),pl=ul===tl&&(_l===tl||_l===Jh)||_l===tl&&ul!==sl,gl=!(ul!==el&&ul!==tl||_l!==il&&_l!==sl),ll=fl&&a?h-a:h,h&&hl+ol+cl>ll&&(gl||(gl=ul===Jh&&_l==sl),pl||gl||ul===rl||ul===el||ul===tl||ol+cl>ll?(ol&&xl(),bl()):bl())," "===dl&&!0!==fl&&hl+ol===0||(ul===rl?(" "===dl&&ol&&xl(),wl(dl,cl),xl()):pl||gl?(ol&&xl(),wl(dl,cl)):wl(dl,cl)),_l=ul);ol&&xl(),hl&&bl(),vl.length>0&&(vl[vl.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{yl.paraNumber++,vl.push({x:a||0,text:t,width:o.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:a,textAlign:n,verticalAlign:o,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=a;if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(o){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u;for(let e=0,a=s.length;e<a;e++){switch(d=s[e],d.x=c,n){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1),d.x<i.x&&(i.x=d.x),d.width>i.width&&(i.width=d.width)}i.y=u,i.height=g}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:a,paraIndent:n,letterSpacing:o}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===a&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=o||t.isOverflow?Bl:l>.01?kl:El,c===El?(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===kl?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,n),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const a=t.canvas.measureText(s).width,n=i[r-1];let o,h,l=n.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-a;for(let t=l;t>-1&&(o=n.data[t],h=o.x+o.width,!(t===l&&h<u));t--){if(h<u&&" "!==o.char){n.data.splice(t+1),n.width-=o.width;break}n.width-=o.width}n.width+=a,n.data.push({char:s,x:h})}}(u,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},{copyAndSpread:Rl,includes:Tl,spread:Ol}=Y;let Ll=class extends Vo{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:a}=this.__layout.boxBounds;t.rect(s,i,r,a)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Cl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:a,fontFamily:n,fontSize:o,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Ao.number(r,o),t.__letterSpacing=Ao.number(a,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${o}px ${n}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<o&&Ol(c,o/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=Tl(u,c)?u:c;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){Rl(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};pt([Di(class extends So{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=No[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],Ll.prototype,"__",void 0),pt([Bi(0)],Ll.prototype,"width",void 0),pt([Bi(0)],Ll.prototype,"height",void 0),pt([Bi(0)],Ll.prototype,"padding",void 0),pt([Ei("outside")],Ll.prototype,"strokeAlign",void 0),pt([Bi("")],Ll.prototype,"text",void 0),pt([Bi("L")],Ll.prototype,"fontFamily",void 0),pt([Bi(12)],Ll.prototype,"fontSize",void 0),pt([Bi("normal")],Ll.prototype,"fontWeight",void 0),pt([Bi(!1)],Ll.prototype,"italic",void 0),pt([Bi("none")],Ll.prototype,"textCase",void 0),pt([Bi("none")],Ll.prototype,"textDecoration",void 0),pt([Bi(0)],Ll.prototype,"letterSpacing",void 0),pt([Bi({type:"percent",value:150})],Ll.prototype,"lineHeight",void 0),pt([Bi(0)],Ll.prototype,"paraIndent",void 0),pt([Bi(0)],Ll.prototype,"paraSpacing",void 0),pt([Bi("left")],Ll.prototype,"textAlign",void 0),pt([Bi("top")],Ll.prototype,"verticalAlign",void 0),pt([Bi("show")],Ll.prototype,"textOverflow",void 0),Ll=pt([zi()],Ll);const{toBounds:Pl}=ui;let Sl=class extends Vo{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){Pl(this.__.path,this.__layout.boxBounds)}};pt([Di(class extends So{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Wo(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],Sl.prototype,"__",void 0),pt([ki()],Sl.prototype,"path",void 0),pt([ki()],Sl.prototype,"windingRule",void 0),pt([Ei("center")],Sl.prototype,"strokeAlign",void 0),Sl=pt([zi()],Sl);let Al=class extends Go{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Sl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,a){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,a,n,o){return this}arc(t,e,s,i,r,a){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,a,n,o){return this}moveToArc(t,e,s,i,r,a){return this}paint(){this.pathElement.forceUpdate("path")}};pt([Di(class extends Do{})],Al.prototype,"__",void 0),Al=pt([Yi(vs,["beginPath"]),zi()],Al);const Dl=K.get("Leafer");let Ml=class extends Go{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&xa.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&dt.assign(this.config,t);const{config:r}=this;yn.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new nt,this.hitCanvasManager=new lt,i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Ra.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(nr.RESTART):this.emitLeafer(nr.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(nr.STOP))}resize(t){const e=dt.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=dt.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new tr(t,e))}__onResize(t){this.emitEvent(t),dt.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}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const i=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),i(),this.viewLoaded||(s=this.on_(rr.FRAME,i))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(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=dt.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(nr.BEFORE_READY),this.emitLeafer(nr.READY),this.emitLeafer(nr.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(nr.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new nr(t,this))}__listenEvents(){const t=$.start("FirstCreate "+this.innerName);this.once(nr.START,(()=>$.end(t))),this.once(ir.END,(()=>this.__onReady())),this.once(ar.END,(()=>this.__onViewReady())),this.on(ir.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){setTimeout((()=>{if(!this.destroyed)try{this.stop(),this.emitEvent(new nr(nr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy()),this.canvas.destroy(),this.config.view=this.userConfig.view=this.view=null,super.destroy(),setTimeout((()=>{xa.clearRecycled()}),100)}catch(t){Dl.error(t)}}),0)}};pt([Di(class extends Do{})],Ml.prototype,"__",void 0),pt([Bi()],Ml.prototype,"pixelRatio",void 0),Ml=pt([zi()],Ml);let Il=class extends Ml{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_($i.CHANGE,(()=>{K.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 Ml(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ir.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(ar.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(ar.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&&dt.assign(e,t),this.autoLayout&&dt.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}};Il=pt([zi()],Il);var Wl=Object.freeze({__proto__:null,Animate:{},AnimateEvent:rr,get App(){return Il},AutoBounds:G,BezierHelper:Vt,Bounds:V,BoundsHelper:Y,get Box(){return th},get Branch(){return ea},BranchHelper:Ar,BranchRender:wr,get Canvas(){return Sh},CanvasManager:nt,ChildEvent:Zi,Creator:e,DataHelper:dt,Debug:K,get DragEvent(){return da},get DropEvent(){return ua},Effect:vn,get Ellipse(){return ah},EllipseHelper:ee,Event:Qi,EventCreator:rt,Export:xn,FileHelper:_t,get Frame(){return eh},get Group(){return Go},HitCanvasManager:lt,get Image(){return Ph},ImageEvent:Ji,ImageManager:xa,IncrementId:s,get KeyEvent(){return ya},Keyboard:ia,LayoutEvent:ir,Layouter:Ua,get Leaf(){return Vr},LeafBounds:pr,LeafBoundsHelper:Sr,LeafData:ut,LeafDataProxy:or,LeafEventer:qi,LeafHelper:Rr,LeafHit:yr,LeafLevelList:ht,LeafList:ot,LeafMask:vr,LeafMatrix:cr,LeafRender:mr,get Leafer(){return Ml},LeaferCanvas:Ga,LeaferCanvasBase:Et,LeaferEvent:nr,LeaferImage:Ea,LeaferImageBase:Ea,LeaferTypeCreator:yn,get Line(){return Lh},MathHelper:r,Matrix:T,MatrixHelper:f,get MoveEvent(){return _a},NeedConvertToCanvasCommandMap:Lt,OneRadian:a,PI2:n,PI_2:o,Paint:wn,get Path(){return Sl},PathBounds:ui,PathCommandDataHelper:is,PathCommandMap:Tt,PathConvert:Fe,PathCorner:_i,PathCreator:vs,PathDrawer:Ds,PathHelper:Ct,PathNumberCommandLengthMap:Dt,PathNumberCommandMap:At,get Pen(){return Al},Platform:t,PluginManager:Ra,Point:R,PointHelper:E,PointerButton:ra,get PointerEvent(){return oa},get Polygon(){return uh},PropertyEvent:$i,get Rect(){return qo},RectHelper:Mt,RectRender:Xo,RenderEvent:ar,Renderer:za,ResizeEvent:tr,get RotateEvent(){return pa},Run:$,Selector:Va,get Star(){return vh},StringNumberMap:q,get SwipeEvent(){return ga},TaskItem:va,TaskProcessor:wa,get Text(){return Ll},TransformEvent:er,TwoPointBounds:class{constructor(t,e){O.setPoint(this,t,e)}addPoint(t,e){O.addPoint(this,t,e)}addBounds(t,e,s,i){O.addBounds(this,t,e,s,i)}add(t){O.add(this,t)}},TwoPointBoundsHelper:O,get UI(){return Vo},UIBounds:Yo,UICreator:et,UIEvent:na,UIHit:zo,UIRender:jo,WaitHelper:Ir,WatchEvent:sr,Watcher:Ta,get ZoomEvent(){return fa},affectRenderBoundsType:Ri,affectStrokeBoundsType:Ei,aliasType:function(t){return(e,s)=>{fi(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}},boundsType:Bi,canvasPatch:gi,canvasSizeAttrs:kt,dataProcessor:Di,dataType:vi,defineDataProcessor:Mi,defineKey:fi,defineLeafAttr:mi,effectType:Ho,eraserType:Si,getDescriptor:yi,hitType:Ai,layoutProcessor:function(t){return(e,s)=>{fi(e,"__LayoutProcessor",{get:()=>t})}},maskType:Pi,opacityType:Oi,pathType:ki,positionType:wi,registerUI:zi,registerUIEvent:ji,resizeType:Uo,rewrite:Fi,rewriteAble:Hi,rotationType:bi,scaleType:xi,setDefaultValue:function(t,e,s){Mi(t.prototype,e,s)},sortType:Li,strokeType:Ci,surfaceType:Ti,useCanvas:pn,useModule:Yi,usePlugin:function(t,e){const s={},{power:i,list:r}=Ra;if(r.includes(t))Ca.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:Ca.error(t+" non-existent")})):Ca.warn("no import");try{t.run(s,e)}catch(t){Ca.error(t)}}}});Ra.power=Wl,pn();
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leafer-ui/worker",
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
4
|
+
"description": "@leafer-ui/worker",
|
|
5
|
+
"author": "Chao (Leafer) Wan",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "src/index.d.ts",
|
|
9
|
+
"unpkg": "dist/global.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/leaferjs/ui.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/leaferjs/ui/tree/main/packages/platform/worker",
|
|
19
|
+
"bugs": "https://github.com/leaferjs/ui/issues",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"leafer-ui",
|
|
22
|
+
"leaferjs"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@leafer/worker": "1.0.0-beta.12",
|
|
26
|
+
"@leafer-ui/core": "1.0.0-beta.12",
|
|
27
|
+
"@leafer/interface": "1.0.0-beta.12",
|
|
28
|
+
"@leafer-ui/interface": "1.0.0-beta.12"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/global.ts
ADDED
package/src/index.d.ts
ADDED
package/src/index.ts
ADDED
package/src/worker.ts
ADDED